body {
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: radial-gradient(120% 140% at 25% 20%, rgba(79, 70, 229, 0.25), transparent),
        radial-gradient(100% 120% at 80% 0%, rgba(56, 189, 248, 0.2), transparent), #f1f5f9;
    color: #0f172a;

    /* Safari iOS fixes */
    -webkit-text-size-adjust: 100%;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

:root {
    --bank-height: 156px;
}

body.dark-mode {
    background: radial-gradient(120% 140% at 20% 15%, rgba(99, 102, 241, 0.2), transparent),
        radial-gradient(110% 120% at 80% 10%, rgba(12, 74, 110, 0.25), transparent), #020617;
    color: #e2e8f0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#top-pane {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1.2rem 2.6rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    z-index: 120;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

body.dark-mode #top-pane {
    background: rgba(15, 23, 42, 0.72);
    border-bottom: 1px solid rgba(30, 41, 59, 0.6);
    box-shadow: 0 15px 35px rgba(2, 6, 23, 0.45);
    color: #e2e8f0;
}

#scorecard {
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: none;
    color: #0f172a;
    padding: 0.45rem 1.8rem;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(223, 233, 255, 0.96), rgba(209, 228, 255, 0.92));
    border: 2px solid rgba(37, 99, 235, 0.4);
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.85);
    pointer-events: none;
    min-width: 12rem;
    text-align: left;
}

#scorecard .scorecard-subtext {
    display: block;
    font-size: clamp(1.2rem, 3.2vw, 1.8rem);
    font-weight: 700;
    color: #1e3a8a;
    line-height: 1.25;
}

#scorecard .scorecard-error {
    color: #b91c1c;
}

body.dark-mode #scorecard {
    color: #f8fafc;
    background: linear-gradient(135deg, rgba(32, 54, 104, 0.92), rgba(71, 103, 173, 0.95));
    border-color: rgba(148, 163, 184, 0.6);
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.45), inset 0 1px 0 rgba(148, 163, 184, 0.35);
}

body.dark-mode #scorecard .scorecard-subtext {
    color: #dbeafe;
}

body.dark-mode #scorecard .scorecard-error {
    color: #fecaca;
}

#submit-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

#submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6em;
    padding: 0.85rem 2.9rem;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #f8fafc;
    background: linear-gradient(135deg, #6366f1, #2563eb);
    border: 2px solid rgba(37, 99, 235, 0.55);
    border-radius: 999px;
    box-shadow: 0 16px 28px rgba(79, 70, 229, 0.34);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

@keyframes submitButtonActivate {
    0% {
        transform: scale(1);
        box-shadow: 0 16px 28px rgba(79, 70, 229, 0.34);
    }
    55% {
        transform: scale(1.08);
        box-shadow: 0 22px 38px rgba(79, 70, 229, 0.45);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 16px 28px rgba(79, 70, 229, 0.34);
    }
}

#submit.submit-button-activate {
    animation: submitButtonActivate 0.32s ease-out;
}

#submit.submit-state-leaderboard {
    background: linear-gradient(135deg, #f1f5f9, #cbd5f5);
    color: #1e293b;
    box-shadow: none;
    text-transform: none;
    letter-spacing: 0.08em;
    border-color: rgba(148, 163, 184, 0.6);
}

body.dark-mode #submit.submit-state-leaderboard {
    background: linear-gradient(135deg, #1f2937, #334155);
    color: #e2e8f0;
    box-shadow: none;
    border-color: rgba(71, 85, 105, 0.6);
}

#submit.submit-state-leaderboard:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 20px rgba(15, 23, 42, 0.2);
}

#submit.submit-state-leaderboard:active {
    transform: translateY(0);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.18);
}

#submit.is-busy {
    cursor: wait;
}

#submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 32px rgba(79, 70, 229, 0.4);
    border-color: rgba(37, 99, 235, 0.75);
}

#submit:active {
    transform: translateY(0);
    box-shadow: 0 12px 20px rgba(79, 70, 229, 0.36);
    border-color: rgba(37, 99, 235, 0.8);
}

.floating-button {
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 18px;
    border: 3px solid rgba(30, 64, 175, 0.38);
    background: rgba(223, 233, 255, 0.96);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.2);
    font-size: 0;
    line-height: 0;
    color: #0f172a;
    display: grid;
    place-items: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
    cursor: pointer;
    position: relative;
}

.floating-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

body.dark-mode .floating-button {
    background: rgba(32, 54, 104, 0.92);
    color: #e0f2fe;
    border-color: rgba(165, 180, 252, 0.55);
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.5);
}

body.dark-mode .floating-button:disabled {
    color: rgba(226, 232, 240, 0.55);
    background: rgba(15, 23, 42, 0.55);
}

.floating-button:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.26);
    border-color: rgba(30, 64, 175, 0.6);
    background: rgba(214, 226, 255, 0.98);
}

.floating-button:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
    border-color: rgba(30, 64, 175, 0.68);
}

.floating-button svg {
    width: 1.6rem;
    height: 1.6rem;
}

.floating-button svg path,
.floating-button svg circle,
.floating-button svg line,
.floating-button svg polyline {
    stroke-width: 2;
}

body.dark-mode .floating-button:hover:not(:disabled) {
    background: rgba(42, 68, 128, 0.96);
    border-color: rgba(191, 219, 254, 0.7);
}

#vertical-buttons {
    position: fixed;
    right: 1.8rem;
    top: 8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    z-index: 110;
}

#history-buttons {
    position: fixed;
    right: 1.8rem;
    bottom: calc(var(--bank-height) + 1.6rem + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    z-index: 110;
    transition: bottom 0.25s ease;
}

@media (max-height: 700px) {
    #history-buttons {
        bottom: calc(var(--bank-height) + 1rem + env(safe-area-inset-bottom));
    }
}

@media (max-width: 640px) {
    #vertical-buttons,
    #history-buttons {
        right: 1.2rem;
    }
}

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;

    /* iPhone Safari fixes */
    -webkit-overflow-scrolling: touch;
    overflow: hidden;
}

/* iPhone specific adjustments */
@media screen and (max-width: 428px) and (-webkit-min-device-pixel-ratio: 2) {
    #game-container {
        /* Slightly smaller on iPhone to account for Safari's quirks */
        width: 98vw;
        height: 98vh;
        margin: 1vh 1vw;
    }
}

#play-area {
    flex: 1;
    position: relative;
    margin-top: 80px;
    /* Account for top pane */
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

#zoom-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    display: none;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
    z-index: 100;
}

body.dark-mode #zoom-indicator {
    background: rgba(15, 23, 42, 0.9);
    color: #e2e8f0;
}

#letter-bank {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bank-height) + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.95);
    border-top: 2px solid #447799;
    z-index: 105;
    backdrop-filter: blur(10px);
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    transition: height 0.25s ease, padding 0.25s ease;
}

body.dark-mode #letter-bank {
    background: rgba(15, 23, 42, 0.95);
    border-top-color: #4488aa;
}

:root.letter-bank-collapsed {
    --bank-height: 72px;
}

#letter-bank.bank-collapsed {
    padding-top: 8px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

#bank-tiles {
    position: relative;
    width: 100%;
    height: 100%;
}

.bank-tile {
    border-radius: 4px;
    transition: transform 0.1s ease;
}

.bank-tile:hover {
    transform: scale(1.05);
}

.bank-tile:active {
    transform: scale(0.95);
}

#offscreen-indicators {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 99;
}

.offscreen-indicator {
    position: absolute;
    background: rgba(153, 204, 255, 0.9);
    border: 2px solid #3399ff;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 600;
    color: #000;
    white-space: nowrap;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    --indicator-arrow-color: #3399ff;
}

.offscreen-indicator:hover {
    background: rgba(153, 204, 255, 1);
    transform: scale(1.05);
}

body.dark-mode .offscreen-indicator {
    background: rgba(68, 136, 170, 0.9);
    border-color: #4488aa;
    color: #fff;
    --indicator-arrow-color: #4488aa;
}

body.dark-mode .offscreen-indicator:hover {
    background: rgba(68, 136, 170, 1);
}

/* Arrow indicators using clip-path triangles */
.offscreen-indicator::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--indicator-arrow-color);
    clip-path: polygon(50% 0, 0 100%, 100% 100%);
    transform-origin: 50% 50%;
    pointer-events: none;
}

.offscreen-indicator.arrow-left::after {
    left: -20px;
    top: calc(50% - 8px);
    transform: rotate(-90deg);
}

.offscreen-indicator.arrow-right::after {
    right: -20px;
    top: calc(50% - 8px);
    transform: rotate(90deg);
}

.offscreen-indicator.arrow-up::after {
    top: -20px;
    left: calc(50% - 8px);
}

.offscreen-indicator.arrow-down::after {
    bottom: -20px;
    left: calc(50% - 8px);
    transform: rotate(180deg);
}

.offscreen-indicator.arrow-top-left::after {
    left: -18px;
    top: -18px;
    transform: rotate(-45deg);
}

.offscreen-indicator.arrow-top-right::after {
    right: -18px;
    top: -18px;
    transform: rotate(45deg);
}

.offscreen-indicator.arrow-bottom-left::after {
    left: -18px;
    bottom: -18px;
    transform: rotate(-135deg);
}

.offscreen-indicator.arrow-bottom-right::after {
    right: -18px;
    bottom: -18px;
    transform: rotate(135deg);
}

/* Modal styles */
.first-timer-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.7);
    z-index: 400;
    transition: opacity 0.25s ease;
    padding: min(6vw, 3rem);
}

.first-timer-overlay.transparent {
    opacity: 0;
    pointer-events: none;
}

.first-timer-modal {
    position: relative;
    background: #f8fafc;
    color: #0f172a;
    border-radius: 20px;
    padding: clamp(2rem, 4vw, 3rem);
    width: min(90vw, 640px);
    box-shadow: 0 40px 80px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    gap: 1.2em;
    text-align: center;
}

.first-timer-modal h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.01em;
}

.first-timer-lede {
    margin: 0;
    font-size: 1.05em;
    font-weight: 600;
    color: #1e293b;
}

.first-timer-modal p {
    margin: 0;
    line-height: 1.55;
}

.first-timer-graphic {
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.12), rgba(56, 189, 248, 0.12));
    border-radius: 16px;
    padding: 1.2em;
    display: flex;
    justify-content: center;
}

.first-timer-graphic svg {
    max-width: 100%;
    height: auto;
}

.first-timer-tip {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #1d4ed8;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: none;
    background: transparent;
    font-size: 1.8rem;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
}

.primary-button {
    background: linear-gradient(135deg, #4338ca, #6366f1);
    color: #fff;
    border: none;
    padding: 0.85em 2em;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.primary-button:hover {
    background: linear-gradient(135deg, #3730a3, #4f46e5);
}

body.dark-mode .first-timer-modal {
    background: rgba(15, 23, 42, 0.95);
    color: #e2e8f0;
}

body.dark-mode .first-timer-lede {
    color: #bae6fd;
}

body.dark-mode .first-timer-tip {
    color: #c4b5fd;
}

button {
    font-family: inherit;
}

button:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.55);
    outline-offset: 3px;
}

.submission-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    transition: opacity 0.2s ease;
    --overlay-block-padding: clamp(1.5rem, 6vh, 3rem);
    --overlay-inline-padding: clamp(1.2rem, 5vw, 2.8rem);
    padding: var(--overlay-block-padding) var(--overlay-inline-padding);
    padding-top: calc(var(--overlay-block-padding) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--overlay-block-padding) + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    min-height: 100vh;
    min-height: 100dvh;
}

.submission-overlay.transparent {
    opacity: 0;
    pointer-events: none;
}

.submission-overlay .modal-content {
    background: #ffffff;
    color: #1f2933;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
    padding: 3.5em 2.8em;
    padding-top: calc(3.5em + env(safe-area-inset-top, 0px));
    padding-bottom: calc(3.5em + env(safe-area-inset-bottom, 0px));
    scroll-padding-top: calc(3.5em + env(safe-area-inset-top, 0px));
    scroll-padding-bottom: calc(3.5em + env(safe-area-inset-bottom, 0px));
    width: min(90vw, 760px);
    max-height: calc(100vh - 6rem);
    max-height: calc(
        100dvh - (var(--overlay-block-padding) * 2) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
    );
    overflow-y: auto;
    position: relative;
    margin: 0 auto;
    z-index: 5;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: none;
    background: transparent;
    font-size: 1.8rem;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
}

.modal-close:hover {
    color: #111827;
}

.modal-headline {
    font-size: clamp(2.4rem, 4vw, 3.4rem);
    line-height: 1.05;
    margin: 0 0 0.35em;
    color: #111827;
    font-weight: 800;
    letter-spacing: -0.02em;
    /* text-transform: uppercase; */
}

.score-display {
    font-size: clamp(3.2rem, 6vw, 4.4rem);
    margin: 0;
    color: #651273;
    font-weight: 800;
    text-shadow: 0 8px 24px rgba(30, 64, 175, 0.35);
}

.score-subline {
    margin: 0.65em 0 1.8em;
    font-size: 1.1em;
    color: #1e293b;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

body.dark-mode .submission-overlay {
    background: rgba(2, 6, 23, 0.55);
}

body.dark-mode .submission-overlay .modal-content {
    background: rgba(15, 23, 42, 0.96);
    color: #e2e8f0;
    box-shadow: 0 24px 55px rgba(2, 6, 23, 0.75);
}

body.dark-mode .modal-close {
    color: #94a3b8;
}

body.dark-mode .modal-close:hover {
    color: #f8fafc;
}

body.dark-mode .modal-headline {
    color: #f8fafc;
}

body.dark-mode .score-display {
    color: #f8fafc;
    text-shadow: 0 10px 30px rgba(2, 6, 23, 0.65);
}

body.dark-mode .score-subline {
    color: #cbd5f5;
}

.modal-content-initial-entry .modal-headline,
.modal-content-initial-entry .score-display,
.modal-content-initial-entry .score-subline {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.modal-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.4em;
    margin-bottom: 2em;
}

.modal-column {
    display: flex;
    flex-direction: column;
    gap: 1.2em;
}

.cta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
    background: #e0e7ff;
    border-radius: 12px;
    padding: 0.9em 1.2em;
}

.cta-message {
    font-size: 1em;
    color: #1e293b;
    font-weight: 600;
}

.modal-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.4em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    display: flex;
    flex-direction: column;
    gap: 0.8em;
}

.modal-section.nickname-section {
    align-items: center;
    text-align: center;
}

.modal-section.share-grid-section {
    align-items: center;
    text-align: center;
}

.emoji-grid-button {
    width: 100%;
    margin-top: 0.2em;
    padding: 1.1em;
    border-radius: 14px;
    border: 2px solid rgba(99, 102, 241, 0.25);
    background: rgba(99, 102, 241, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    cursor: pointer;
    font-size: 1.65rem;
    line-height: 1.1;
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.emoji-grid-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(59, 130, 246, 0.18);
    border-color: rgba(99, 102, 241, 0.45);
}

.emoji-grid-button:active {
    transform: translateY(0);
}

.emoji-grid-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.65);
}

.emoji-grid-row {
    display: block;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    letter-spacing: 0;
    white-space: nowrap;
    line-height: 1;
}

.modal-column .modal-section:last-child {
    flex: 1;
}

.modal-section h2 {
    margin-top: 0;
    font-size: 1.15em;
    color: #1e293b;
}

.modal-section .section-subtitle {
    margin: 0 0 0.9em;
    font-size: 0.9em;
    color: #64748b;
}

.modal-section input {
    width: 100%;
    font-size: 2.1em;
    text-align: center;
    padding: 0.45em 0.3em;
    border: 2px solid #cbd5f5;
    border-radius: 12px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #1e293b;
    background: #fff;
    font-weight: 700;
}

.modal-section input:focus {
    outline: none;
    border-color: #4c1d95;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.primary-button,
.secondary-button {
    width: 100%;
    margin-top: 0.85em;
    padding: 0.85em 1.2em;
    font-size: 0.95em;
    letter-spacing: 0.12em;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 600;
}

.primary-button {
    background: linear-gradient(135deg, #4338ca, #6366f1);
    color: #fff;
}

.primary-button:disabled {
    background: #9aa5ff;
    cursor: wait;
}

.primary-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #3730a3, #4f46e5);
}

.secondary-button {
    background: #dbeafe;
    color: #1d4ed8;
}

.cta-row .secondary-button {
    width: auto;
    min-width: 160px;
    margin-top: 0;
}

.secondary-button:hover {
    background: #bfdbfe;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.55em 0.8em;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.leaderboard-table th {
    background: #eef2ff;
    font-weight: 600;
    color: #475569;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.75em;
}

.leaderboard-table tr.is-you {
    background: rgba(99, 102, 241, 0.18);
    font-weight: 600;
}

.leaderboard-table tr:last-child td {
    border-bottom: none;
}

.leaderboard-empty {
    font-size: 0.9em;
    color: #64748b;
    margin: 1em 0 0;
    text-align: left;
}

.player-rank {
    margin-top: 0.9em;
    font-size: 0.85em;
    color: #475569;
}

.streak-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.streak-section li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45em 0;
    border-bottom: 1px solid #e2e8f0;
}

.streak-section li:last-child {
    border-bottom: none;
}

.streak-section li span {
    color: #33363d;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.streak-section li strong {
    font-size: 1.15em;
    color: #1e293b;
}

.feedback {
    min-height: 1.3em;
    font-size: 0.85em;
    color: #16a34a;
    margin-top: 0.5em;
    text-align: center;
}

.feedback.error {
    color: #dc2626;
}

body.dark-mode .modal-section {
    background: rgba(15, 23, 42, 0.8);
    box-shadow: inset 0 1px 0 rgba(30, 41, 59, 0.5);
}

body.dark-mode .emoji-grid-button {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(129, 140, 248, 0.45);
    color: #e0f2fe;
    box-shadow: 0 12px 20px rgba(2, 6, 23, 0.35);
}

body.dark-mode .emoji-grid-button:hover {
    box-shadow: 0 14px 24px rgba(2, 6, 23, 0.45);
    border-color: rgba(129, 140, 248, 0.65);
}

body.dark-mode .modal-section .section-subtitle {
    color: #94a3b8;
}

body.dark-mode .modal-section h2 {
    color: #e2e8f0;
}

body.dark-mode .modal-section input {
    background: rgba(15, 23, 42, 0.9);
    color: #f8fafc;
    border-color: rgba(94, 234, 212, 0.35);
}

body.dark-mode .leaderboard-table {
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 1px 2px rgba(2, 6, 23, 0.6);
}

body.dark-mode .leaderboard-table th {
    background: rgba(30, 41, 59, 0.9);
    color: #cbd5f5;
}

body.dark-mode .leaderboard-table td {
    border-bottom: 1px solid rgba(30, 41, 59, 0.85);
    color: #e2e8f0;
}

body.dark-mode .leaderboard-table tr.is-you {
    background: rgba(129, 140, 248, 0.22);
}

body.dark-mode .leaderboard-empty,
body.dark-mode .player-rank {
    color: #cbd5f5;
}

body.dark-mode .streak-section li span {
    color: #94a3b8;
}

body.dark-mode .streak-section li strong {
    color: #f8fafc;
}

body.dark-mode .cta-row {
    background: rgba(30, 41, 59, 0.9);
    color: #f1f5f9;
}

body.dark-mode .cta-message {
    color: #e2e8f0;
}

body.dark-mode .cta-row .secondary-button {
    background: rgba(30, 41, 59, 0.95);
    color: #e0f2fe;
}

body.dark-mode .cta-row .secondary-button:hover {
    background: rgba(59, 130, 246, 0.28);
}

/* Inline SVG styles extracted from template */
.first-timer-graphic .cls-1 {
    fill: #b8c3e4;
}

.first-timer-graphic .cls-2 {
    letter-spacing: -0.02em;
}

.first-timer-graphic .cls-2,
.first-timer-graphic .cls-3,
.first-timer-graphic .cls-4,
.first-timer-graphic .cls-5,
.first-timer-graphic .cls-6 {
    font-size: 12px;
}

.first-timer-graphic .cls-2,
.first-timer-graphic .cls-5,
.first-timer-graphic .cls-6 {
    fill: #231f20;
    font-family: ArialMT, Arial;
}

.first-timer-graphic .cls-3 {
    fill: #a91e22;
}

.first-timer-graphic .cls-3,
.first-timer-graphic .cls-4,
.first-timer-graphic .cls-7 {
    font-family: Arial-BoldMT, Arial;
    font-weight: 700;
}

.first-timer-graphic .cls-4 {
    fill: #0c8f45;
}

.first-timer-graphic .cls-8 {
    fill: #cfdcf1;
    stroke: #479;
    stroke-miterlimit: 10;
}

.first-timer-graphic .cls-7 {
    fill: #6d6e71;
    font-size: 8px;
    letter-spacing: 0.08em;
}

.first-timer-graphic .cls-6 {
    letter-spacing: -0.06em;
}
