/* Styles for the Wordle game screen of Dictionary Duel. */
:root {
    --font-stack: system-ui, Inter, sans-serif;

    /* Layout sizing tokens — used for tile/key dvh calculations */
    --title-row-h: 32px;       /* game title row above the icon bar */
    --topbar-h: 76px;          /* title row + icon bar combined */
    --header-extra-h: 160px;   /* full header height incl. margin-bottom — overwritten at runtime by JS */
    --key-h: clamp(44px, 7.5dvh, 58px);
    --keyboard-h: calc(3 * var(--key-h) + 20px);   /* 3 key rows + gaps + padding */
    --grid-gap: 5px;
    /* Tile size: smallest of width-fit, height-fit, and 62px ceiling */
    --tile-by-w: calc(
        (min(100vw - 20px, 350px) - (var(--word-length, 5) - 1) * var(--grid-gap))
        / var(--word-length, 5)
    );
    --tile-by-h: calc(
        (100dvh - var(--header-extra-h) - var(--keyboard-h) - 16px - 5 * var(--grid-gap))
        / 6
    );
    --tile-size: min(var(--tile-by-w), var(--tile-by-h), 62px);

    /* Dark Theme (Default) */
    --bg-color: #121213;
    --text-color: #e2e2e2;
    --modal-bg: #1f1f1f;
    --modal-border: #3a3a3c;
    --header-border: #3a3a3c;
    --button-bg: #818384;
    --button-text: #ffffff;
    --toast-bg: #333;
    --toast-text: #fff;

    --tile-bg-empty: #121213;
    --tile-border-empty: #3a3a3c;
    --tile-border-typed: #565758;
    --tile-text-color: #e2e2e2;
    --tile-text-revealed: #ffffff;

    --key-bg: #818384;
    --key-text: #ffffff;
    --key-bg-action: #505254;

    /* State Colors */
    --color-correct: #6aaa64;
    --color-present: #c9b458;
    --color-absent: #58585a;   /* lightened from #3a3a3c — was too close to bg #121213 */
    --key-color-absent: #3a3a3c;   /* darker than unused key #818384 — eliminated keys sink back */
    --text-muted: #a0a0a0;
}

[data-theme="light"] {
    --bg-color: #ffffff;
    --text-color: #1a1a1b;
    --modal-bg: #f0f0f0;
    --modal-border: #d3d6da;
    --header-border: #d3d6da;
    --button-bg: #d3d6da;
    --button-text: #1a1a1b;
    --toast-bg: #eee;
    --toast-text: #333;

    --tile-bg-empty: #ffffff;
    --tile-border-empty: #d3d6da;
    --tile-border-typed: #878a8c;
    --tile-text-color: #1a1a1b;
    --tile-text-revealed: #ffffff;
    
    --key-bg: #d3d6da;
    --key-text: #1a1a1b;
    --key-bg-action: #c0c3c6;

    --color-correct: #6aaa64;
    --color-present: #c9b458;
    --color-absent: #787c7e;
    --key-color-absent: #999ca0;
    --text-muted: #6b6b6b;
}

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

html {
    font-family: var(--font-stack);
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    overflow: hidden;
    height: 100%;
    overscroll-behavior: none;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
    overscroll-behavior: none;
    position: fixed;
    width: 100%;
}

.container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    padding: 8px 10px 0;
    overflow: hidden;
}

header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--header-border);
    margin-bottom: 4px;
    position: relative;
    flex-shrink: 0;
}

/* game-title: standalone row above the icon bar */
.puzzle-number {
    font-size: 0.75em;
    font-weight: normal;
    opacity: 0.75;
    margin-left: 0.35em;
    color: #c8a800;
}

.game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    text-align: center;
    color: #f5c518;
    line-height: 1;
    padding: 4px 0 2px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: var(--title-row-h);
    display: flex;
    align-items: center;
    justify-content: center;
}

#definition {
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 2px;
    min-height: 2.5em;
}

#lengthHint {
    font-size: 1.1rem;
    letter-spacing: 0.2em;
    margin-bottom: 3px;
    min-height: 1.3em;
}

/* #themeToggle is now a standard .topbar-btn — no separate rule needed */

#playAudio {
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    margin-top: 2px;
}

#playAudio:hover {
    opacity: 0.8;
}

main {
    flex: 1;
    min-height: 0;   /* allows flex children to shrink below content size */
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#grid {
    display: grid;
    grid-template-columns: repeat(var(--word-length, 5), 1fr);
    gap: var(--grid-gap);
    width: 100%;
    max-width: 350px;
    margin: 8px auto 0;
    justify-items: center;
    /* Establish a 3D rendering context so Safari correctly composites
       the rotateY flip animations on child .tile elements. */
    -webkit-perspective: 1000px;
            perspective: 1000px;
}

.tile {
    width: var(--tile-size);
    height: var(--tile-size);
    border: 2px solid var(--tile-border-empty);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: calc(var(--tile-size) * 0.5);
    font-weight: bold;
    text-transform: uppercase;
    color: var(--tile-text-color);
    background-color: var(--tile-bg-empty);
    /* No `transform` in the transition — every transform effect (flip, shake,
       bounce, pop) uses a @keyframes animation, not a transition.  Having
       `transition: transform` here causes Safari to race the fill-mode value
       left by flip-out against the flip-in animation start in the same
       synchronous style recalculation, breaking the flip. */
    transition: background-color 0.3s, border-color 0.3s;
    /* Safari: required for correct 3D face culling during flip */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.tile.typed {
    border-color: var(--tile-border-typed);
    animation: tile-pop 0.1s ease;
}

@keyframes tile-pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.tile.correct, .tile.present, .tile.absent {
    color: var(--tile-text-revealed);
    border-width: 0;
}

.tile.correct { background-color: var(--color-correct); border-color: var(--color-correct); }
.tile.present { background-color: var(--color-present); border-color: var(--color-present); }
.tile.absent { background-color: var(--color-absent); border-color: var(--color-absent); }

.tile.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* --- Tile flip (guess reveal) --- */
@-webkit-keyframes tile-flip-out {
    from { -webkit-transform: rotateY(0deg);   transform: rotateY(0deg); }
    to   { -webkit-transform: rotateY(-90deg); transform: rotateY(-90deg); }
}
@keyframes tile-flip-out {
    from { transform: rotateY(0deg); }
    to   { transform: rotateY(-90deg); }
}
@-webkit-keyframes tile-flip-in {
    from { -webkit-transform: rotateY(90deg); transform: rotateY(90deg); }
    to   { -webkit-transform: rotateY(0deg);  transform: rotateY(0deg); }
}
@keyframes tile-flip-in {
    from { transform: rotateY(90deg); }
    to   { transform: rotateY(0deg); }
}

/* --- Win-row bounce --- */
@keyframes tile-bounce-win {
    0%   { transform: translateY(0); }
    30%  { transform: translateY(-14px); }
    60%  { transform: translateY(0); }
    80%  { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

.tile.flip-out  {
    -webkit-animation: tile-flip-out  250ms ease-in  forwards;
            animation: tile-flip-out  250ms ease-in  forwards;
}
.tile.flip-in   {
    -webkit-animation: tile-flip-in   250ms ease-out forwards;
            animation: tile-flip-in   250ms ease-out forwards;
}
.tile.bounce-win { animation: tile-bounce-win 400ms ease-in-out both; }

/* Explicitly state the intended transitions during a flip — only bg/border,
   never transform (all transform effects use @keyframes, not transitions).
   will-change: transform hints the GPU to allocate a compositing layer for
   these tiles before the keyframe animation begins. */
.tile.flip-out,
.tile.flip-in {
    transition: background-color 0.3s, border-color 0.3s;
    will-change: transform;
}

/* --- keyboard layout --- */
.keyboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    flex-shrink: 0;
    margin-top: auto;
    width: 100%;
    padding: 0 8px;
    padding-bottom: max(env(safe-area-inset-bottom), 6px);
}
.krow { display: flex; justify-content: center; width: 100%; flex-wrap: nowrap; }
.key {
    background: var(--key-bg, #818384);
    color: var(--key-text, #fff);
    border: none;
    margin: 2px;
    width: calc((100vw - 20px) / 10 - 4px);
    max-width: 43px;
    height: var(--key-h);
    border-radius: 4px;
    font-size: clamp(0.75rem, 2vw, 1rem);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.key.wide { flex: 1 1 auto; max-width: 65px; min-width: 0; }

/* restrict icon-only styling to the real topbar */
.topbar>button{
  background:none;border:none;color:var(--text-color);font-size:24px;cursor:pointer;
}

footer {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--header-border);
    margin-top: auto;
    width: 100%;
    padding-bottom: 10px;
}

footer button {
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

footer button:hover { opacity: 0.8; }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal.is-open {
    display: flex;
}

.modal-container {
    background-color: var(--modal-bg);
    color: var(--text-color);
    margin: auto;
    padding: 20px;
    border: 1px solid var(--modal-border);
    border-radius: 8px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--modal-border);
    margin-bottom: 15px;
}

.modal-title {
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

.modal-content p { margin-bottom: 10px; }
.modal-content .word-reveal { font-weight: bold; font-size: 1.2em; color: var(--color-correct); }
.modal-content .example-sentence { font-style: italic; margin-top: 10px; }

/* Result modal action buttons (Endless Expansions) */
.modal-play-again {
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: 13px;
    background: var(--color-correct);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.02em;
}
.modal-play-again:hover { opacity: 0.88; }

.modal-audio-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 14px;
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    cursor: pointer;
}
.modal-audio-btn:hover { opacity: 0.8; }

#statsChart {
    max-height: 200px;
    margin-top: 15px;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.toast {
    background-color: var(--toast-bg);
    color: var(--toast-text);
    padding: 10px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-size: 0.9rem;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Confetti */
@keyframes confetti-fall {
    /* Start at the viewport top edge (not above it) so overflow:hidden on
       html/body doesn't clip the initial position on iOS Safari */
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti {
    position: fixed;
    top: 0;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    /* animation is set entirely via inline JS (see animateConfetti).
       Putting it in the CSS shorthand here resolves animation-duration to 0s
       by default; Safari fires and completes that 0s animation on DOM
       insertion before the JS inline duration override is applied. */
    pointer-events: none;
    z-index: 9999;
}

/* Confetti container */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: var(--color-correct);
    opacity: 0;
}

@media (max-width: 380px) {
    /* key height now uses clamp(44px, 7.5dvh, 58px) — no override needed */
}

@media (min-width: 768px) {
    :root {
        --tile-by-w: calc(
            (min(100vw - 20px, 500px) - (var(--word-length, 5) - 1) * var(--grid-gap))
            / var(--word-length, 5)
        );
    }
    #grid {
        max-width: 500px;
    }
}

/* Icon bar: all buttons spread evenly across the full container width */
.topbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 44px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--header-border);
    margin-bottom: 6px;
}

.topbar-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    padding: 0;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.topbar-btn:focus {
    outline: 2px solid var(--color-present);
    border-radius: 4px;
}

.topbar-icon {
    width: 36px;
    height: 36px;
    display: block;
    image-rendering: pixelated;
    object-fit: contain;
}

.topbar button:focus {
    outline: 2px solid var(--color-present);
}

.example-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.example-row .tile {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    margin: 0 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    border: 2px solid var(--tile-border-empty);
    background: var(--tile-bg-empty);
    color: var(--tile-text-color);
    font-weight: bold;
    text-transform: uppercase;
}
.example-row .tile.correct { background: var(--color-correct); color: var(--tile-text-revealed); border: none; }
.example-row .tile.present { background: var(--color-present); color: var(--tile-text-revealed); border: none; }
.example-row .tile.absent { background: var(--color-absent); color: var(--tile-text-revealed); border: none; }
.example-row span {
    margin-left: 10px;
    font-size: 0.95rem;
    color: var(--text-color);
} 

.key:active,
.key.key-press {
    transform: scale(0.92);
    filter: brightness(0.85);
    transition: transform 0.08s, filter 0.08s;
}

/* Keyboard feedback styles */
.key.correct {
    background-color: var(--color-correct);
    color: var(--tile-text-revealed);
}

.key.present {
    background-color: var(--color-present);
    color: var(--tile-text-revealed);
}
  
  .key.absent {
    background-color: var(--key-color-absent);
    color: var(--tile-text-revealed);
  }
  
/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background: var(--modal-bg);
    border: 1px solid var(--modal-border);
    border-radius: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-correct);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
}

/* --- Length filter pills (Endless Expansions topbar) --- */
:root {
    --accent: var(--color-correct);
    --border-color: var(--tile-border-empty);
}

#lengthFilters {
    display: flex;
    align-items: center;
    gap: 3px;
}

.length-pill {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 5px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    line-height: 1;
    height: 22px;
    min-width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.length-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

/* --- Length filter dropdown (Endless Expansions) --- */
.filter-btn-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.length-filter-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 10px 8px;
    z-index: 500;
    flex-direction: row;
    gap: 4px;
}

.length-filter-dropdown.open {
    display: flex;
}

.filter-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}

/* Hide the native checkbox — still in the DOM for JS to read data-length */
.filter-option input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* No circle pseudo-element in icon mode */
.filter-option::before {
    display: none;
}

/* --- SVG icon via CSS mask — mask-image set inline per-icon, URL resolves relative to HTML --- */
.filter-icon {
    display: block;
    width: 34px;
    height: 34px;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    background-color: var(--text-color);
    opacity: 0.35;
    transition: opacity 0.15s, background-color 0.15s;
}

.filter-option:has(input:checked) .filter-icon {
    background-color: var(--accent);
    opacity: 1;
}

.filter-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-color);
    opacity: 0.4;
    transition: opacity 0.15s, color 0.15s;
    line-height: 1;
}

.filter-option:has(input:checked) .filter-label {
    color: var(--accent);
    opacity: 1;
}

/* =====================================================
   Profile page
   profile.html uses game.css but needs scroll, not the
   fixed/overflow-hidden layout the game pages use.
   Opt out via data-page="profile" on <html>.
   ===================================================== */
html[data-page="profile"],
html[data-page="profile"] body {
    overflow: auto;
    position: static;
    height: auto;
    overscroll-behavior: auto;
}

.profile-page {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px 40px;
    min-height: 100dvh;
}

/* Topbar row */
.profile-topbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 44px;
    border-bottom: 1px solid var(--header-border);
    margin-bottom: 28px;
    flex-shrink: 0;
}

.profile-topbar-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-color);
    text-align: center;
    flex: 1;
}

/* Auth (logged-out) */
.auth-heading {
    font-size: 1.4rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 6px;
}

.auth-subtext {
    font-size: 0.875rem;
    text-align: center;
    opacity: 0.65;
    margin-bottom: 24px;
    line-height: 1.4;
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--header-border);
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 10px 0;
    cursor: pointer;
    opacity: 0.45;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s, border-color 0.15s;
}

.auth-tab.active {
    opacity: 1;
    border-bottom-color: var(--color-correct);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.auth-form.active {
    display: flex;
}

.auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-label {
    font-size: 0.78rem;
    font-weight: 700;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.auth-input {
    background: var(--tile-bg-empty);
    border: 2px solid var(--tile-border-empty);
    color: var(--text-color);
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 1rem;
    font-family: var(--font-stack);
    width: 100%;
    transition: border-color 0.15s;
    -webkit-appearance: none;
}

.auth-input:focus {
    outline: none;
    border-color: var(--color-present);
}

.auth-input::placeholder {
    opacity: 0.35;
}

.auth-submit-btn {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 14px;
    background: var(--color-correct);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.02em;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s;
}

.auth-submit-btn:active { opacity: 0.82; }

/* Logged-in profile view */
.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--color-correct);
    color: #ffffff;
    font-size: 2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 8px auto 12px;
    user-select: none;
}

.profile-name {
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 4px;
}

.profile-email {
    font-size: 0.875rem;
    opacity: 0.55;
    text-align: center;
    margin-bottom: 32px;
}

.profile-stats-section {
    margin-bottom: 24px;
}

.profile-stats-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    opacity: 0.5;
    margin-bottom: 10px;
}

.profile-logout-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 14px;
    background: none;
    color: var(--text-color);
    border: 2px solid var(--header-border);
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s;
}

.profile-logout-btn:active { opacity: 0.65; }

/* State visibility — only the matching view shows */
.profile-view {
    display: none;
}

#profileContent.state-logged-out .view-logged-out,
#profileContent.state-logged-in  .view-logged-in {
    display: block;
}

/* Save-your-stats CTA strip inside the Daily Duel result modal */
.stats-cta {
    border-top: 1px solid var(--header-border);
    margin-top: 16px;
    padding-top: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-cta p {
    font-size: 0.9rem;
    opacity: 0.85;
    margin: 0;
}

.stats-cta-btn {
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    border: 2px solid var(--color-correct);
    background: transparent;
    color: var(--color-correct);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, color 0.15s;
}

.stats-cta-btn:hover,
.stats-cta-btn:active {
    background: var(--color-correct);
    color: #ffffff;
}

/* Word report button */
.word-report {
    text-align: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--header-border);
}

.word-report-btn {
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.5;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: opacity 0.15s;
}

.word-report-btn:hover { opacity: 1; }
.word-report-btn:disabled { cursor: default; opacity: 0.4; }

/* Hint bar */
.hint-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 0;
}

.hint-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 62px;
    padding: 14px 10px;
    border-radius: 10px;
    border: 1.5px solid #3a3a3a;
    background: #141414;
    color: #c8c8c8;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.hint-btn:hover:not(:disabled) {
    border-color: #f5c518;
    color: #f5c518;
    background: #1e1b0e;
}

.hint-btn:disabled {
    opacity: 0.38;
    pointer-events: none;
    cursor: default;
}

.hint-btn-icon {
    display: block;
    width: 18px;
    height: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.hint-icon-swatch {
    border-radius: 3px;
}

.hint-icon-yellow { background-color: var(--color-present); }
.hint-icon-green  { background-color: var(--color-correct); }

.hint-btn-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #e0e0e0;
}

.hint-btn-cost {
    font-size: 0.75rem;
    font-weight: 700;
    color: #f5c518;
    line-height: 1;
}

.hint-coin-pouch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    flex-shrink: 0;
}

.hint-coin-pouch-images {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0px;
}

.hint-pouch-img {
    width: 56px;
    height: 56px;
    image-rendering: pixelated;
    object-fit: contain;
}

#hintCoinDisplay {
    font-size: 0.9rem;
    font-weight: 700;
    color: #f5c518;
    line-height: 1;
    text-align: center;
}

.hint-example-display {
    text-align: center;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-muted);
    padding: 6px 16px;
    margin-bottom: 4px;
}

/* Profile coins display */
.profile-coins {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #f5c518;
}

/* Auth inline field errors */
.auth-field-error {
    color: #e05252;
    font-size: 0.8rem;
    margin-top: 5px;
    line-height: 1.3;
}

.auth-input.auth-input-error {
    border-color: #e05252;
}

/* Profile nav button: logged-in initial circle */
.profile-nav-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-correct);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
}
