/* =========================================================
   Typonyms — Complete Stylesheet
   Layout strategy:
     .app-container  flex-col  height: 100dvh
       header        shrink: 0
       main          flex: 1, flex-col
         .subtitle          shrink: 0
         .board             flex-shrink: 0, margin-bottom: auto
         .keyboard          shrink: 0
   ========================================================= */

/* ----- Design Tokens ----- */
:root {
    --bg-base: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --tile-bg: #1e293b;
    --tile-border: #334155;
    --tile-active-border: #6366f1;
    --tile-corrupted: #ec4899;
    --tile-corrupted-text: #ffffff;
    --tile-solved: #10b981;
    --tile-solved-modified: #047857;
    --primary-color: #8b5cf6;
    --primary-hover: #7c3aed;
    --key-bg: rgba(30, 41, 59, 0.7);
    --key-border: rgba(51, 65, 85, 0.8);
    --modal-overlay: rgba(15, 23, 42, 0.7);
    --rule-card-bg: rgba(15, 23, 42, 0.3);

    /* Fluid sizes — scale with viewport height, clamped to min/max */
    --tile-size: clamp(42px, 7.8vh, 65px);
    --tile-font: clamp(1.35rem, 2.8vh, 2.3rem);
    --tile-radius: clamp(0.45rem, 0.9vh, 0.75rem);
    --key-height: clamp(34px, 5.8vh, 46px);
    --key-font: clamp(0.85rem, 1.5vh, 1.15rem);
    --card-width: clamp(180px, 40vw, 300px);
    --card-height: clamp(36px, 6vh, 52px);
    --card-font: clamp(0.85rem, 1.6vh, 1.25rem);
    --h1-size: clamp(1.5rem, 3.4vh, 2.4rem);
    --gap: clamp(8px, 2.2vh, 20px);
}

[data-theme="light"] {
    --bg-base: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --tile-bg: #ffffff;
    --tile-border: #cbd5e1;
    --tile-active-border: #6366f1;
    --tile-corrupted: #db2777;
    --tile-corrupted-text: #ffffff;
    --tile-solved: #059669;
    --tile-solved-modified: #065f46;
    --primary-color: #7c3aed;
    --primary-hover: #6d28d9;
    --key-bg: rgba(226, 232, 240, 0.8);
    --key-border: rgba(203, 213, 225, 0.9);
    --modal-overlay: rgba(241, 245, 249, 0.85);
    --rule-card-bg: rgba(226, 232, 240, 0.4);
}

/* ----- Reset ----- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ----- App Shell ----- */
.app-container {
    width: 100%;
    max-width: 450px;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5vh 1rem 1.2vh;
    overflow: hidden;
}

/* ----- Header ----- */
header {
    width: 100%;
    flex-shrink: 0;
    text-align: center;
}

.header-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
}

.header-row>*:first-child {
    justify-self: start;
}

.header-row>h1 {
    justify-self: center;
}

.header-row>.header-actions {
    justify-self: end;
}

h1 {
    font-size: var(--h1-size);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--tile-corrupted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

h1 .corrupted-o {
    display: inline-block;
    position: relative;
    color: var(--tile-corrupted);
    -webkit-text-fill-color: var(--tile-corrupted);
    letter-spacing: normal;
}

h1 .corrupted-o::after {
    content: "";
    position: absolute;
    bottom: -0.02em;
    left: 50%;
    transform: translateX(-50%);
    width: 0.32em;
    height: 0.2em;
    background-color: var(--tile-corrupted);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 14' fill='none' stroke='black' stroke-width='6.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12L12 2L22 12'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 14' fill='none' stroke='black' stroke-width='6.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12L12 2L22 12'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover {
    color: var(--primary-color);
    background-color: rgba(139, 92, 246, 0.1);
    transform: scale(1.15);
}

.icon-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4);
}

.gear-icon,
.info-icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

.gear-icon {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover .gear-icon {
    transform: rotate(45deg);
}

/* ----- Main Area ----- */
main {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--gap);
    min-height: 0;
}

.subtitle {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 290px;
    line-height: 1.3;
    text-align: center;
}

/* ----- Game Board ----- */
.board {
    display: flex;
    flex-direction: column;
    gap: clamp(3px, 0.6vh, 6px);
    width: 100%;
    flex-shrink: 0;
    margin-top: 0;
    margin-bottom: auto;
    /* pushes keyboard to the bottom */
    transition: all 0.3s ease;
}

.board.typotype-board {
    border: 2px solid var(--primary-color);
    border-radius: var(--tile-radius);
    padding: 8px;
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.25), inset 0 0 10px rgba(139, 92, 246, 0.1);
    background-color: rgba(139, 92, 246, 0.03);
}

[data-theme="light"] .board.typotype-board {
    background-color: rgba(124, 58, 237, 0.02);
    box-shadow: 0 0 12px rgba(219, 39, 119, 0.2), inset 0 0 8px rgba(124, 58, 237, 0.05);
}

.word-row {
    display: flex;
    justify-content: center;
    gap: clamp(3px, 0.5vw, 5px);
}

.tile {
    width: var(--tile-size);
    height: var(--tile-size);
    background-color: var(--tile-bg);
    border: 2px solid var(--tile-border);
    border-radius: var(--tile-radius);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: var(--tile-font);
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.tile:hover {
    transform: translateY(-2px);
    border-color: var(--text-muted);
}

.tile.active {
    border-color: var(--tile-active-border);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
    transform: scale(1.05);
}

.tile.corrupted {
    background-color: var(--tile-corrupted);
    color: var(--tile-corrupted-text);
    border-color: var(--tile-corrupted);
    animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tile.error {
    background-color: #ef4444;
    border-color: #ef4444;
    color: white;
}

.tile.shake {
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

.word-row.solved .tile {
    background-color: var(--tile-solved);
    border-color: var(--tile-solved);
    color: white;
    animation: flipIn 0.6s ease forwards;
    animation-delay: calc(var(--char-index, 0) * 0.1s);
    cursor: default;
    pointer-events: none;
}

.word-row.solved .tile.corrupted {
    background-color: var(--tile-solved-modified);
    border-color: var(--tile-solved-modified);
    pointer-events: auto;
    cursor: pointer;
}

.word-row.solved .tile.corrupted-original {
    background-color: var(--tile-corrupted);
    border-color: var(--tile-corrupted);
    color: var(--tile-corrupted-text);
    pointer-events: auto;
    cursor: pointer;
}

/* ----- Category Reveal Card ----- */
.category-reveal-container {
    perspective: 1000px;
    display: flex;
    justify-content: center;
    width: 100%;
    flex-shrink: 0;
    margin-top: 0;
}

.category-card {
    display: grid;
    /* grid lets both faces stack without position:absolute */
    background: none;
    border: 0;
    padding: 0;
    font-family: inherit;
    width: var(--card-width);
    height: var(--card-height);
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    outline: 0;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}

.category-card.flipped {
    transform: rotateY(180deg);
}

.card-face {
    grid-area: 1 / 1;
    /* both faces occupy the same cell */
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2rem;
    overflow: hidden;
    font-weight: 600;
    font-size: var(--card-font);
    padding: 0 1.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
}

.card-front {
    background-color: var(--tile-bg);
    border: 2px solid var(--tile-border);
    color: var(--text-muted);
    transform: translateZ(1px);
    opacity: 1;
}

.category-card.flipped .card-front {
    opacity: 0;
    pointer-events: none;
}

.category-card:hover .card-front {
    color: var(--text-main);
    border-color: var(--primary-color);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.2);
    transform: translateY(-1px) translateZ(1px);
}

.category-card.flipped:hover .card-back {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
    transform: rotateY(180deg) translateY(-1px) translateZ(1px);
}

.category-card:focus-visible .card-front {
    border-color: var(--tile-active-border);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4);
}

.category-card.flipped:focus-visible .card-back {
    border-color: var(--tile-active-border);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4);
}

.card-back {
    background: linear-gradient(135deg, var(--primary-color), var(--tile-corrupted));
    -webkit-background-clip: padding-box;
    background-clip: padding-box;
    color: white;
    transform: rotateY(180deg) translateZ(1px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    pointer-events: none;
}

.category-card.flipped .card-back {
    opacity: 1;
    pointer-events: auto;
}

/* ----- Virtual Keyboard ----- */
.keyboard {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(3px, 0.5vh, 5px);
    width: 100%;
    max-width: 500px;
    padding-top: var(--gap);
}

@media (min-width: 600px) and (min-height: 700px) {
    .keyboard {
        margin-bottom: 2rem;
    }
}


.keyboard-row {
    display: flex;
    justify-content: center;
    gap: clamp(3px, 0.5vw, 5px);
    width: 100%;
}

.key {
    background-color: var(--key-bg);
    border: 1px solid var(--key-border);
    color: var(--text-main);
    font-family: inherit;
    font-size: var(--key-font);
    font-weight: 600;
    text-transform: uppercase;
    height: var(--key-height);
    border-radius: 0.375rem;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    max-width: 44px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.15s ease;
}

.key:hover {
    background-color: rgba(51, 65, 85, 0.9);
    border-color: var(--text-muted);
    transform: translateY(-1px);
}

.key:active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(0.95);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.key.large {
    max-width: 65px;
    flex: 1.5;
    font-size: clamp(0.75rem, 1.3vh, 0.95rem);
}

/* ----- Credits Section (in Info Modal) ----- */
.credits-section {
    margin-top: 1.5rem;
}

.credits-section h3 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--tile-border);
    padding-bottom: 0.35rem;
    color: var(--text-main);
}

.credits-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.credits-text a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed rgba(148, 163, 184, 0.4);
    transition: all 0.2s ease;
}

.credits-text a:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* =========================================================
   Modals
   ========================================================= */
.modal {
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal:not(.hidden) {
    animation: fadeInModal 0.3s ease forwards;
}

.modal:not(.hidden) .modal-content {
    animation: slideUpModal 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.modal-content {
    background: var(--tile-bg);
    padding: 2rem 1.5rem;
    border-radius: 1.5rem;
    border: 1px solid var(--tile-border);
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 480px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.modal-content .close-btn {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    line-height: 1;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.modal-content .close-btn:hover {
    color: var(--primary-color);
    background-color: rgba(139, 92, 246, 0.1);
    transform: scale(1.1);
}

.modal-content .close-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4);
}

.modal h2 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
    padding: 0 2.2rem;
}

.settings-modal-content h2,
.archive-modal-content h2,
.info-modal-content h2 {
    padding-left: 0;
}

.modal p {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.category-text {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--tile-corrupted);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: inherit;
    line-height: 1;
}

.btn:hover {
    background-color: var(--primary-hover);
}

.btn.secondary {
    background-color: var(--tile-bg);
    border: 2px solid var(--tile-border);
    color: var(--text-main);
    transition: all 0.2s ease;
}

.btn.secondary:hover {
    border-color: var(--primary-color);
    background-color: rgba(139, 92, 246, 0.1);
}



/* -- Info Modal -- */
.info-modal-content {
    text-align: left;
    padding: 2rem 1.25rem 1.5rem;
}

.info-body {
    margin-bottom: 1.5rem;
}

.intro {
    font-size: 1rem;
    line-height: 1.55;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.intro strong {
    color: var(--tile-corrupted);
}

.rules-section h3 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--tile-border);
    padding-bottom: 0.35rem;
    color: var(--text-main);
}

.rules-explanation {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rule-card {
    background: var(--rule-card-bg);
    border: 1px solid var(--tile-border);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    transition: transform 0.2s, border-color 0.2s, background-color 0.3s ease;
}

.rule-card:hover {
    transform: translateX(3px);
    border-color: rgba(99, 102, 241, 0.4);
}

.rule-card p {
    font-size: 0.85rem;
    line-height: 1.45;
    margin-bottom: 0;
    text-align: left;
    color: var(--text-muted);
}

.rule-card p strong {
    color: var(--tile-corrupted);
}

#close-info-modal-btn {
    width: 100%;
    padding: 0.85rem;
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* -- Settings Modal -- */
.settings-modal-content {
    max-width: 460px;
    text-align: left;
    padding: 2.5rem 2rem 2rem;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--tile-border);
}

.settings-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-section-title {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    margin-top: 1.5rem;
    margin-bottom: 0.25rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--tile-border);
    opacity: 0.8;
}

.settings-item .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.25rem;
    font-size: 0.95rem;
    border-radius: 0.5rem;
    min-width: 80px;
    text-align: center;
    line-height: 1;
}

.settings-item .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.settings-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.settings-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
}

.settings-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* -- Toggle Switch -- */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--tile-bg);
    border: 2px solid var(--tile-border);
    transition: 0.3s;
}

.slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: 0.3s;
}

input:checked+.slider {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

input:checked+.slider::before {
    transform: translateX(22px);
    background-color: white;
}

.slider.round {
    border-radius: 34px;
}

.slider.round::before {
    border-radius: 50%;
}

/* =========================================================
   Keyframe Animations
   ========================================================= */
@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes flipIn {
    0% {
        transform: rotateX(0deg);
    }

    50% {
        transform: rotateX(90deg);
    }

    100% {
        transform: rotateX(0deg);
    }
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-2px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(4px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-6px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(6px, 0, 0);
    }
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUpModal {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ----- Header Actions ----- */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.archive-icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

/* ----- Puzzle Label ----- */
.puzzle-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: auto;
    margin-bottom: 0;
    background: var(--rule-card-bg);
    border: 1px solid var(--tile-border);
    padding: 0.35rem 0.9rem;
    border-radius: 1rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.puzzle-label:hover {
    color: var(--text-main);
    border-color: var(--tile-active-border);
    background: rgba(99, 102, 241, 0.08);
}

.puzzle-label:focus-visible {
    border-color: var(--tile-active-border);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.puzzle-label:active {
    transform: scale(0.98);
}

.puzzle-label .archive-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    flex-shrink: 0;
}

/* ----- Victory Stats & Layout ----- */
.victory-modal-content {
    max-width: 420px;
}

.victory-stats {
    background: var(--rule-card-bg);
    border: 1px solid var(--tile-border);
    border-radius: 1rem;
    padding: 1rem;
    margin: 1.25rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    text-align: left;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: var(--text-main);
}

.stat-row span {
    color: var(--text-muted);
}

.stat-row strong {
    font-weight: 600;
}

.stat-divider {
    border: none;
    border-top: 1px solid var(--tile-border);
    margin: 0.4rem 0;
}

.victory-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.victory-actions .btn {
    width: 100%;
    padding: 0.8rem;
    font-size: 1.05rem;
}

.victory-actions .btn.secondary {
    background-color: var(--tile-bg);
    border: 2px solid var(--tile-border);
    color: var(--text-main);
    transition: all 0.2s ease;
}

.victory-actions .btn.secondary:hover {
    border-color: var(--primary-color);
    background-color: rgba(139, 92, 246, 0.1);
}

/* ----- Archive Modal ----- */
.archive-modal-content {
    max-width: 460px;
    padding: 2.5rem 1.5rem 2rem;
}

.archive-header-actions {
    margin: 1.25rem 0;
    display: flex;
    justify-content: center;
}

.archive-header-actions .btn {
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
}

.archive-all-solved-msg {
    text-align: center;
    margin: 1rem 0;
    color: #10b981;
    font-weight: bold;
}

.archive-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
    max-height: 50vh;
    overflow-y: auto;
    padding: 4px 4px 4px 4px;
}

.archive-item {
    background: var(--rule-card-bg);
    border: 1px solid var(--tile-border);
    border-radius: 0.8rem;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.archive-item:hover:not(.disabled) {
    border-color: var(--primary-color);
    background: rgba(139, 92, 246, 0.05);
    transform: translateY(-1px);
}

.archive-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.archive-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.archive-item-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
}

.archive-item-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.archive-item-stats {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.archive-badge {
    background-color: var(--tile-bg);
    border: 1px solid var(--tile-border);
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.archive-badge.solved-badge {
    background-color: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
}

.archive-badge.revealed-badge {
    background-color: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: #f59e0b;
}

.archive-badge.hard-badge {
    background-color: rgba(236, 72, 153, 0.15);
    border-color: rgba(236, 72, 153, 0.4);
    color: #ec4899;
}

.archive-item-category {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 0.1rem;
}

/* ----- Reset Progress Styling ----- */
.danger-text {
    color: #ef4444 !important;
}

.btn.danger {
    background-color: #ef4444;
    color: white;
    border: none;
    transition: background-color 0.2s ease;
}

.btn.danger:hover {
    background-color: #dc2626;
}

.reset-item {
    margin-top: 1rem;
    padding-top: 1.25rem !important;
}

.reset-confirm-content {
    max-width: 400px;
    padding: 2.25rem 1.75rem;
}

.reset-warning-text {
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 1.25rem 0;
    color: var(--text-main) !important;
}

.reset-warning-subtext {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ef4444;
    margin-bottom: 2.25rem;
}

.confirm-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2.25rem;
}

.confirm-actions .btn {
    flex: 1;
    padding: 0.75rem;
    font-size: 1rem;
}

.confirm-actions .btn.secondary {
    background-color: var(--tile-bg);
    border: 2px solid var(--tile-border);
    color: var(--text-main);
}

/* =========================================================
   Responsive — only one breakpoint for very short screens
   Everything else is handled by clamp() in custom properties
   ========================================================= */
@media (max-height: 660px) {
    .subtitle {
        display: none;
    }

    .app-container {
        padding-top: 0.5vh;
        padding-bottom: 0.5vh;
    }
}