/* ============================================
   MYLONAS CROSSWORDS APP
   Colors: #011935 navy, #3b88eb blue, #3c4b5a slate
   Font: Trebuchet MS
   ============================================ */

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

:root {
    --navy: #011935;
    --blue: #3b88eb;
    --slate: #3c4b5a;
    --bg: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --border: #dddddd;
    --card-bg: #f8f9fa;
    --success-bg: #d4edda;
    --success-text: #155724;
    --error-bg: #f8d7da;
    --error-text: #721c24;
    --tab-bar-height: 60px;
    --safe-top: env(safe-area-inset-top, 28px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
    height: 100%;
    font-family: 'Trebuchet MS', sans-serif;
    color: var(--text);
    background: var(--bg);
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
}


/* ── AUTH SCREEN ─────────────────────────── */

#auth-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 200;
    overflow-y: auto;
    padding: 16px;
}

#auth-screen.auth-modal {
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

#auth-screen.auth-modal .auth-container {
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 12px;
    margin: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    background: var(--bg);
}

.auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: calc(20px + var(--safe-top)) 16px 24px;
}

.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo img { width: 80px; height: 80px; }
.auth-logo h1 { font-size: 1.4em; color: var(--navy); margin-top: 8px; }
.auth-logo p { font-size: 0.9em; color: var(--text-light); }

.auth-input {
    width: 100%; padding: 9px 10px; border: 2px solid var(--border);
    border-radius: 6px; font-size: 0.92em; font-family: 'Trebuchet MS', sans-serif; margin-bottom: 8px;
}
.auth-input:focus { border-color: var(--blue); outline: none; }

.auth-btn {
    width: 100%; padding: 12px; background: var(--navy); color: white;
    border: none; border-radius: 6px; font-size: 0.95em; font-weight: bold;
    font-family: 'Trebuchet MS', sans-serif; cursor: pointer; margin-top: 4px;
}
.auth-btn:active { opacity: 0.8; }

.auth-toggle { text-align: center; margin-top: 14px; font-size: 0.88em; color: var(--text-light); }
.auth-toggle a { color: var(--blue); text-decoration: none; }

.auth-forgot { text-align: center; margin-top: 12px; }
.auth-forgot a { color: var(--blue); text-decoration: none; font-size: 0.88em; }

.auth-msg { display: none; padding: 10px; border-radius: 6px; margin-bottom: 10px; font-size: 0.88em; text-align: center; }
.auth-msg.success { display: block; background: var(--success-bg); color: var(--success-text); }
.auth-msg.error { display: block; background: var(--error-bg); color: var(--error-text); }

.auth-back {
    position: absolute; top: calc(8px + var(--safe-top)); left: 12px;
    border: none; background: none; color: var(--blue);
    font-size: 0.95em; font-weight: bold; font-family: 'Trebuchet MS', sans-serif;
    cursor: pointer; padding: 6px 8px;
}
.auth-back-icon {
    position: absolute; top: calc(8px + var(--safe-top)); left: 12px; z-index: 5;
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid #cdd6e0; border-radius: 8px;
    background: #fff; color: var(--blue); cursor: pointer; padding: 0;
}
.auth-back-icon:active { background: #eef3fb; }

/* Password field with show/hide eye */
.auth-pw-wrap { position: relative; }
.auth-pw-input { padding-right: 42px !important; }
.auth-pw-eye {
    position: absolute; top: 0; right: 0; height: calc(100% - 8px);
    display: flex; align-items: center; justify-content: center;
    width: 40px; background: none; border: none; cursor: pointer;
    color: var(--text-light); padding: 0;
}
.auth-pw-eye:active { color: var(--blue); }

/* Sign-up welcome header + benefits (matches website Join Us) */
.auth-welcome-head h1 { font-size: 1.35em; color: var(--navy); margin: 0 0 4px; }
.auth-subtitle { font-size: 0.95em; color: var(--text-light); margin: 0; }
.auth-toplink { font-size: 0.88em; color: var(--text-light); margin: 8px 0 0; }
.auth-toplink a { color: var(--blue); text-decoration: none; }
.auth-toplink-cta {
    display: inline-block; margin-top: 4px;
    font-size: 1.05em; font-weight: bold; color: var(--blue) !important;
    text-decoration: underline !important;
}

.auth-benefits {
    background: var(--card-bg); border-radius: 8px;
    padding: 14px 16px; margin-bottom: 16px;
}
.auth-benefits > p { font-size: 0.86em; font-weight: bold; color: var(--navy); margin: 0 0 8px; }
.auth-benefits-list { display: flex; flex-direction: column; gap: 6px; font-size: 0.86em; color: var(--text); }
.auth-benefits-list > div { display: flex; align-items: center; gap: 10px; }

.auth-welcome-head { text-align: center; margin-bottom: 14px; }


/* ── MAIN APP ────────────────────────────── */

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#content-area {
    flex: 1;
    overflow-y: auto;
    padding-top: var(--safe-top);
    padding-bottom: calc(var(--tab-bar-height) + var(--safe-bottom));
    -webkit-overflow-scrolling: touch;
}

.tab-content {
    display: none;
    padding: 16px;
    min-height: 100%;
}
.tab-content.active { display: block; }


/* ── TAB BAR ─────────────────────────────── */

#tab-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: calc(var(--tab-bar-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--navy);
    display: flex; justify-content: space-around; align-items: center;
    z-index: 50;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.tab-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 0; background: none; border: none;
    color: rgba(255,255,255,0.5); font-family: 'Trebuchet MS', sans-serif;
    font-size: 0.68em; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.tab-btn.active { color: var(--blue); }
.tab-btn svg { width: 22px; height: 22px; }


/* ── PUZZLE OVERLAY ──────────────────────── */

.overlay {
    position: fixed; inset: 0; background: var(--bg);
    z-index: 60;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}
.overlay.visible { transform: translateX(0); }

/* Hide the tab bar while a puzzle is open so the keyboard isn't covered */
body.puzzle-open #tab-bar { display: none; }

.overlay-header {
    display: flex; align-items: center; gap: 12px;
    padding: calc(12px + var(--safe-top)) 16px 12px 16px;
    background: var(--navy); color: white;
    min-height: calc(48px + var(--safe-top));
}

.back-btn {
    background: none; border: none; color: white;
    font-size: 1em; font-family: 'Trebuchet MS', sans-serif;
    cursor: pointer; padding: 4px 8px;
}

.overlay-title { font-size: 0.95em; font-weight: bold; }

.overlay-body {
    flex: 1; overflow-y: auto; padding: 16px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(170px + var(--safe-bottom)); /* clear the keyboard */
}

/* Bare mode — full-height fixed layout for Exolve puzzles.
   Must fill the overlay edge-to-edge and top-to-top like Stu's Clues. */
.overlay-bare .overlay-header { display: none; }
.overlay-bare,
.overlay-bare .overlay-body {
    padding: 0 !important;
    margin: 0 !important;
}
.overlay-bare .overlay-body {
    flex: 1; height: auto; overflow: hidden;
    width: 100%;
}
/* Stu's Clues and guide pages use bare mode (no navy header) but still need
   the body to scroll and the content (not the full-width header/banner) to
   have side padding. */
.overlay-bare.overlay-sc .overlay-body,
.overlay-bare.overlay-learn .overlay-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* Stu's needs extra bottom space to clear the fixed keyboard; guides don't. */
.overlay-bare.overlay-sc .overlay-body { padding-bottom: calc(160px + var(--safe-bottom)) !important; }
.overlay-bare.overlay-learn .overlay-body { padding-bottom: calc(24px + var(--safe-bottom)) !important; }
.overlay-bare.overlay-sc .sc-clue-box,
.overlay-bare.overlay-sc .sc-grid-wrap,
.overlay-bare.overlay-sc .sc-guide-link-wrap,
.overlay-bare.overlay-sc #sc-result,
.overlay-bare.overlay-sc #sc-attempt,
.overlay-bare.overlay-learn .reader-content { margin: 16px; }
.overlay-bare.overlay-learn .sc-topbar-title { font-size: 1.4em; }

/* ── Unified sub-page app bar (navy) ─────────────────────────────────
   A tabbed sub-page looks like a main tab: a navy bar with a back
   button + the page's own title, and the bottom tab bar stays visible.
   The overlay is shortened so it sits ABOVE the tab bar instead of
   covering it. */
.overlay-tabbed { bottom: calc(var(--tab-bar-height) + var(--safe-bottom)); }
.overlay-tabbed .overlay-header { display: none; }
.overlay-tabbed .overlay-body {
    padding: 0;
    padding-bottom: calc(16px + var(--safe-bottom));
    overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.overlay-tabbed .reader-content { padding: 16px; }
.overlay-tabbed .archive-page-list { margin: 8px 16px 24px; }
/* Keep the tab bar on screen for tabbed sub-pages (overrides the hide) */
body.puzzle-open.tabbed-sub #tab-bar { display: flex; }

.app-bar {
    position: sticky; top: 0; z-index: 3;
    display: flex; align-items: center;
    padding: calc(12px + var(--safe-top)) 8px 12px 8px;
    background: var(--navy); color: #fff;
    min-height: calc(48px + var(--safe-top));
}
.app-bar-back {
    background: none; border: none; color: #fff; cursor: pointer;
    width: 40px; height: 40px; flex: 0 0 auto; padding: 0; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}
.app-bar-back:active { background: rgba(255,255,255,0.14); }
.app-bar-title {
    flex: 1 1 auto; text-align: center; padding: 0 4px;
    font-size: 1.4em; font-weight: bold; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-bar-spacer { width: 40px; flex: 0 0 auto; }
.app-bar-badge {
    flex: 0 0 auto; min-width: 44px; background: none; border: none; cursor: pointer;
    padding: 0 2px; display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: #fff; font-family: inherit;
}
.app-bar-badge-avatar {
    width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: bold; line-height: 1;
}
.app-bar-badge-name { font-size: 0.62rem; line-height: 1; max-width: 60px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
.app-bar-badge:active { opacity: 0.7; }

/* Subtitle strip that sits directly under the navy app bar on sub-pages */
.page-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 1.05em; font-weight: 600;
    padding: 11px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}
.page-subtitle-lg { font-size: 1.35em; color: var(--navy); padding: 14px 16px 12px; }
.forum-body { padding: 16px; }
.forum-card-lock {
    display: inline-block; font-size: 0.7em; font-weight: normal;
    background: #e7f3fb; color: #2b7bbd;
    padding: 2px 8px; border-radius: 10px; margin: 2px 0 4px;
}
.learn-loading { text-align: center; color: var(--text-light); padding: 30px 0; }


/* ── PLAY TAB: PRE-SOLVE ─────────────────── */

.clue-landing {
    text-align: center;
    margin: -16px -16px 16px -16px;
}
.clue-brand {
    font-size: 1.8em; font-weight: bold; color: var(--navy);
    padding: 16px 20px 8px;
}
.clue-day-bar {
    background: var(--navy); color: white;
    font-weight: bold; font-size: 1.15em; padding: 12px 0;
}
.clue-date {
    font-size: 0.9em; color: var(--text-light); padding: 10px 0 4px;
}
.clue-box { padding: 20px; }
.clue-text {
    font-size: 1.15em; color: var(--navy);
    font-weight: bold; line-height: 1.5;
}
.clue-action { padding: 0 20px 12px; }
.clue-play-btn {
    display: block; width: 100%; padding: 14px;
    background: var(--slate); color: white; border: none; border-radius: 6px;
    font-size: 1.05em; font-weight: bold; font-family: 'Trebuchet MS', sans-serif; cursor: pointer;
}
.clue-play-btn:active { background: #2c3a47; }

.guest-note {
    padding: 8px 20px 16px; font-size: 0.88em; color: var(--text-light);
}
.guest-note a { color: var(--blue); text-decoration: none; }

/* Yesterday's solution video thumbnail */
.clue-video-label {
    text-align: center; color: var(--text-light);
    font-size: 0.9em; padding: 16px 20px 8px;
}
.clue-video {
    position: relative; margin: 0 auto 8px; cursor: pointer;
    max-width: 280px; width: 100%;
    aspect-ratio: 16/9; overflow: hidden; background: #000; border-radius: 6px;
}
.clue-video img {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.clue-video-play {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 48px; height: 48px; background: rgba(255,0,0,0.85);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.clue-video-tri {
    width: 0; height: 0; border-style: solid;
    border-width: 10px 0 10px 20px;
    border-color: transparent transparent transparent white;
    margin-left: 4px;
}


/* ── PLAY TAB: POST-SOLVE HUB (matches website mhub) ── */

.mhub-result { padding: 16px; border-radius: 6px; margin-bottom: 16px; }
.mhub-success { background: var(--success-bg); }
.mhub-error   { background: var(--error-bg); }
.mhub-result-title { font-size: 1.2em; font-weight: bold; margin-bottom: 4px; }
.mhub-success .mhub-result-title { color: var(--success-text); }
.mhub-error   .mhub-result-title { color: var(--error-text); }
.mhub-result-sub { font-size: 0.95em; }
.mhub-success .mhub-result-sub { color: #1e7e34; }
.mhub-error   .mhub-result-sub { color: #a94442; }

.mhub-action-row { display: flex; gap: 10px; margin-bottom: 12px; }
.mhub-lb-btn, .mhub-comment-btn {
    flex: 1; padding: 12px; color: white; border: none; border-radius: 6px;
    font-size: 0.92em; font-weight: bold; font-family: 'Trebuchet MS', sans-serif;
    cursor: pointer; text-align: center;
}
.mhub-lb-btn { background: var(--blue); }
.mhub-lb-btn:active { background: #2a6fcc; }
.mhub-comment-btn { background: var(--slate); }
.mhub-comment-btn:active { background: #2c3a47; }

.mhub-notify {
    display: flex; align-items: center; gap: 12px; width: 100%;
    margin-bottom: 20px; padding: 12px 14px;
    background: #e7f3fb; border: 1px solid #b8ddf5; border-radius: 8px;
    cursor: pointer; text-align: left; font-family: 'Trebuchet MS', sans-serif;
}
.mhub-notify:active { background: #d8ebf8; }
.mhub-notify-icon { font-size: 1.5em; flex-shrink: 0; }
.mhub-notify-text { display: flex; flex-direction: column; flex: 1; }
.mhub-notify-title { font-size: 0.95em; font-weight: bold; color: #1c5d8c; }
.mhub-notify-sub { font-size: 0.78em; color: #3a7aaa; margin-top: 1px; line-height: 1.25; }
.mhub-notify-arrow { font-size: 1.5em; color: #2b7bbd; flex-shrink: 0; }

.mhub-section { margin-bottom: 24px; }
.mhub-section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #eee;
}
.mhub-section-title { font-size: 1em; font-weight: bold; color: var(--navy); }
.mhub-see-all { font-size: 0.85em; color: var(--blue); text-decoration: none; }

/* Clue tiles row (7 across) */
.mhub-clue-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.mhub-clue-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.mhub-tile-box {
    width: 100%; aspect-ratio: 1; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9em; font-weight: bold;
}
.mhub-today .mhub-tile-box { background: var(--navy); color: white; }
.mhub-past .mhub-tile-box { background: #f5f5f5; border: 1px solid #ddd; }
.mhub-past .mhub-tile-box .q { color: var(--blue); font-size: 1.1em; font-weight: bold; }
.mhub-past:active .mhub-tile-box { background: #ececec; }
.mhub-more .mhub-more-box { background: #f5f5f5; border: 1px solid #ddd; }
.mhub-tile-label { font-size: 11px; color: var(--text-light); }

/* Featured puzzle card */
.mhub-featured {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    border: 1px solid #eee; border-radius: 6px; margin-bottom: 10px;
    background: #f9f9f9; cursor: pointer;
}
.mhub-featured:active { background: #f0f0f0; }
.mhub-featured-info { flex: 1; }
.mhub-featured-title { font-size: 0.95em; font-weight: bold; color: var(--navy); }
.mhub-new-badge {
    font-size: 10px; background: var(--navy); color: white;
    padding: 2px 6px; border-radius: 10px; margin-left: 6px; vertical-align: middle;
}

/* Archive tiles row (6 across) */
.mhub-puzzle-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.mhub-puzzle-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.mhub-puzzle-tile-box {
    width: 100%; aspect-ratio: 1; border-radius: 6px;
    background: #f5f5f5; border: 1px solid #ddd;
    display: flex; align-items: center; justify-content: center;
}
.mhub-puzzle-tile-box:active { background: #ececec; }
.mhub-puzzle-tile-box.mhub-more { font-size: 1.4em; color: #999; }

/* Blue "Sample" tile — stands out from the greyscale puzzle tiles */
.mhub-sample-box {
    background: #eaf3fc !important;
    border: 1px solid #3b88eb !important;
    padding: 4px;
}
.mhub-sample .mhub-tile-label { color: #3b88eb; font-weight: bold; }

.hub-action-btn {
    display: block; width: 100%; padding: 12px;
    background: var(--blue); color: white; border: none; border-radius: 6px;
    font-size: 0.95em; font-weight: bold; font-family: 'Trebuchet MS', sans-serif;
    cursor: pointer; text-align: center;
}
.hub-action-btn:active { opacity: 0.8; }


/* ── STU'S CLUES PUZZLE ──────────────────── */

/* New Stu's Clues header: white topbar + navy banner + date/byline */
.sc-topbar {
    display: flex; align-items: center;
    padding: calc(10px + var(--safe-top)) 12px 10px;
    background: #fff;
}
.sc-back {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; flex: 0 0 auto;
    background: none; border: 1px solid #cdd6e0; border-radius: 8px;
    color: var(--blue); cursor: pointer; padding: 0;
}
.sc-back:active { background: #eef3fb; }
.sc-topbar-title { flex: 1 1 auto; text-align: center; font-size: 1.8em; font-weight: bold; color: var(--navy); }
.sc-topbar-spacer { width: 36px; flex: 0 0 auto; }

.sc-banner {
    background: var(--navy); color: #fff; text-align: center;
    font-size: 1.15em; font-weight: bold; padding: 12px 16px;
}
.sc-banner-sub { text-align: center; padding: 12px 16px 4px; }
.sc-banner-date { font-size: 1em; color: #333; }
.sc-setter { text-align: center; color: #4caf6e; font-size: 0.95em; margin-top: 3px; }

.sc-attempt { text-align: center; margin-bottom: 8px; font-weight: bold; }

/* Guest band at top of puzzle page */
/* Guest choice — full-screen modal overlay with a centred popup */
.sc-guest-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(1, 25, 53, 0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 500; padding: 24px;
}
.sc-guest-popup {
    background: #fff; border-radius: 12px;
    padding: 24px 22px; text-align: center; max-width: 340px; width: 100%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.sc-guest-popup-text { color: var(--navy); font-size: 1.3em; font-weight: bold; margin-bottom: 8px; }
.sc-guest-popup-sub { color: #5d4037; font-size: 0.92em; margin-bottom: 18px; line-height: 1.45; }
.sc-guest-popup-btns { display: flex; flex-direction: column; gap: 10px; }
.sc-guest-popup-login, .sc-guest-popup-signup {
    background: var(--navy); color: white; border: none;
    padding: 13px 16px; border-radius: 6px; font-weight: bold;
    font-family: 'Trebuchet MS', sans-serif; cursor: pointer; font-size: 1em;
}
.sc-guest-popup-signup { background: var(--blue); }
.sc-guest-popup-guest {
    background: none; border: 1px solid #999; color: var(--text-light);
    padding: 13px 16px; border-radius: 6px; cursor: pointer;
    font-family: 'Trebuchet MS', sans-serif; font-size: 1em;
}

/* Stu's Cryptic Guide link in puzzle */
.sc-guide-link-wrap { text-align: center; margin: 10px 0 20px; }
.sc-copyright {
    text-align: center; font-size: 0.72em; color: var(--text-light);
    padding: 4px 0 6px;
}
.sc-guide-link {
    display: inline-block; padding: 9px 20px;
    background: var(--slate); color: white; border: none; border-radius: 4px;
    font-size: 0.9em; font-family: 'Trebuchet MS', sans-serif; cursor: pointer;
}
.sc-guide-link:active { background: #2c3a47; }

.sc-clue-box {
    background: #d1e4ff; padding: 12px; margin-bottom: 16px; border-radius: 4px;
}
.sc-clue-text { font-size: 1em; line-height: 1.4; font-weight: bold; }
.sc-hint { margin: 5px 0; color: red; font-size: 0.9em; }

.sc-grid-wrap { display: flex; justify-content: center; margin: 16px 0; overflow-x: auto; }
.sc-grid { display: inline-flex; gap: 2px; }
.sc-grid-long .sc-cell { width: 34px; height: 34px; font-size: 18px; }

.sc-cell {
    width: 42px; height: 42px; border: 2px solid #000;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; text-transform: uppercase; cursor: pointer;
    background: white; user-select: none; flex-shrink: 0;
    font-family: 'Trebuchet MS', sans-serif; font-weight: bold;
}
.sc-cell-active { background: var(--blue); color: white; }
.sc-word-gap { margin-left: 8px; }

.sc-result {
    padding: 16px; border-radius: 6px; text-align: center; margin: 16px 0;
}
.sc-result-ok { background: var(--success-bg); color: var(--success-text); }
.sc-result-fail { background: var(--error-bg); color: var(--error-text); }
.sc-result-title { font-weight: bold; font-size: 1.1em; margin-bottom: 6px; }
.sc-result-answer { margin-bottom: 4px; }
.sc-result-points { font-size: 1.1em; font-weight: bold; color: var(--blue); margin-top: 8px; }

/* Stu's Clues keyboard */
.sc-keyboard {
    background: #f0f0f0; padding: 6px 4px;
    padding-bottom: calc(6px + var(--safe-bottom));
    position: absolute; bottom: 0; left: 0; right: 0;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}
.sc-kb-row {
    display: flex; gap: 3px; margin-bottom: 4px;
    justify-content: center; padding: 0 4px;
}
.sc-kb-row:last-child { margin-bottom: 0; }
.sc-kb-btn {
    flex: 1 1 0; min-width: 0; max-width: 38px; height: 40px;
    background: white; border: 1px solid var(--blue); border-radius: 4px;
    color: var(--blue); font-weight: bold; font-size: 16px;
    font-family: 'Trebuchet MS', sans-serif; cursor: pointer; padding: 0;
}
.sc-kb-btn:active { background: var(--blue); color: white; }
.sc-kb-special { max-width: 48px; font-size: 18px; }


/* ── ARCHIVE TAB ─────────────────────────── */

.archive-title-band {
    background: var(--navy); color: white;
    font-size: 1.2em; font-weight: bold; text-align: center;
    padding: 14px 0; margin: -16px -16px 0 -16px;
}
.archive-members-note {
    text-align: center; color: var(--text-light);
    font-size: 0.85em; padding: 10px 16px 14px;
}
.archive-loading {
    text-align: center; padding: 30px 20px;
    color: var(--text-light); font-size: 0.9em;
}

.archive-cards { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; }
.archive-card { margin-bottom: 0; }

/* Shared "Members content" tag (under card titles) */
.members-tag {
    display: table; font-size: 0.7em; font-weight: normal;
    background: #e7f3fb; color: #2b7bbd;
    padding: 2px 8px; border-radius: 10px; margin: 2px 0;
}

/* Coming-soon badge */
.score-card-soon {
    display: table; font-size: 0.7em; font-weight: normal;
    background: #fdf0e3; color: #b5701f;
    padding: 2px 8px; border-radius: 10px; margin: 2px 0 4px;
}

/* Unified popup (members gate + coming soon): contained box, logo, auto-dismiss */
.mg-overlay {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center; padding: 32px;
    opacity: 1; transition: opacity 0.35s ease;
}
.mg-overlay.mg-fade { opacity: 0; }
.mg-box {
    background: #fff; border-radius: 16px; padding: 28px 24px;
    max-width: 320px; width: 100%; text-align: center;
    box-shadow: 0 12px 44px rgba(0,0,0,0.28);
}
.mg-logo { width: 76px; height: 76px; border-radius: 18px; margin: 0 auto 10px; display: block; }
.mg-brand { font-size: 1.35em; font-weight: bold; color: var(--navy); margin-bottom: 12px; }
.mg-title { font-size: 1.05em; font-weight: bold; color: var(--navy); margin-bottom: 8px; }
.mg-text { font-size: 0.95em; color: var(--text-light); line-height: 1.5; }
.mg-play-btn {
    margin-top: 18px; background: var(--blue); color: #fff; border: none;
    border-radius: 8px; padding: 11px 32px; font-size: 1em; font-weight: bold;
    font-family: 'Trebuchet MS', sans-serif; cursor: pointer;
}
.mg-play-btn:active { background: #2a6fcc; }


/* Leaderboard page block label */
.lb-block-label { text-align: center; font-size: 0.85em; color: var(--text-light); margin-bottom: 14px; }

/* Per-type archive page (opens in bare overlay) */
.overlay-bare.overlay-learn .archive-page-list { margin: 8px 16px 24px; }
.archive-page-list .archive-item:first-child { border-top: 1px solid var(--border); }

.archive-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.archive-item-title { font-weight: bold; font-size: 0.92em; color: var(--navy); }
.archive-item-date { font-size: 0.82em; color: var(--text-light); }

.archive-play-btn {
    background: var(--slate); color: white; padding: 6px 14px;
    border: none; border-radius: 4px; font-size: 0.85em; font-weight: bold;
    font-family: 'Trebuchet MS', sans-serif; cursor: pointer; flex-shrink: 0;
}
.archive-item-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.archive-video-btn {
    background: #e8312a; color: white; width: 30px; height: 30px;
    border: none; border-radius: 50%; font-size: 0.7em; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding-left: 2px; flex-shrink: 0;
}
.archive-video-btn:active { background: #c81e18; }


/* ── LEADERBOARD (Score tab) ─────────────── */

.lb-header { text-align: center; margin-bottom: 16px; }
.lb-header h2 { font-size: 1.1em; color: var(--navy); }
.lb-header p { font-size: 0.85em; color: var(--text-light); }

.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th { text-align: left; padding: 8px; border-bottom: 2px solid var(--navy); font-size: 0.85em; }
.lb-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 0.9em; }
.lb-table td:nth-child(3), .lb-table th:nth-child(3) { text-align: right; font-weight: bold; color: var(--blue); }
.lb-table td:nth-child(4), .lb-table th:nth-child(4) { text-align: right; color: var(--text-light); }
.lb-rank-1 { font-weight: bold; }

.signin-prompt {
    text-align: center; padding: 20px;
    background: #f0f6ff; border: 1px solid #d0e2f7; border-radius: 12px;
}

/* Coming soon popup */
.signin-prompt p {
    margin-bottom: 14px; color: var(--slate);
    font-size: 0.95em; line-height: 1.4;
}


/* ── LEARN TAB ───────────────────────────── */

/* Learn landing reuses the SAME .app-bar as the sub-pages, so the bar
   fills the top and sides identically — no separate band, no break-out
   seam. #tab-learn drops its own padding so the bar is genuinely
   full-width (like the guide's zero-padding container); the content
   below sits in .learn-body, which restores the side padding. */
#tab-learn, #tab-archive, #tab-score, #tab-play, #tab-about { padding: 0; margin-top: calc(-1 * var(--safe-top)); }
#tab-learn .app-bar, #tab-archive .app-bar, #tab-score .app-bar, #tab-play .app-bar, #tab-about .app-bar { position: sticky; top: calc(-1 * var(--safe-top)); }
.learn-body, .archive-body, .score-body, .play-body { padding: 0 16px 16px; }
.learn-intro {
    text-align: center; color: var(--text-light);
    font-size: 0.9em; padding: 12px 16px 16px; line-height: 1.4;
}

.learn-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px; background: var(--card-bg); border-radius: 8px;
    margin-bottom: 10px; cursor: pointer;
}
.learn-card:active { background: #eef0f2; }
.learn-card-icon { font-size: 1.5em; flex-shrink: 0; }
.learn-card-body { flex: 1; }
.learn-card-title { font-weight: bold; font-size: 1.05em; color: var(--navy); margin-bottom: 4px; }
.learn-card-desc { font-size: 0.82em; color: var(--text-light); line-height: 1.3; }
.learn-card-arrow { font-size: 1.5em; color: var(--text-light); flex-shrink: 0; }
.gi-card-thumb { width: 44px; height: 44px; flex-shrink: 0; border-radius: 8px; overflow: hidden; }
.gi-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gi-card-grid { width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.gi-card-grid svg { width: 36px; height: 36px; }

/* ── IN-APP CONTENT READER (glossary pages) ── */

.reader-content {
    font-size: 0.92em; line-height: 1.5; color: var(--text); padding-bottom: 40px;
}
.reader-content h1, .reader-content h2, .reader-content h3, .reader-content h4 {
    color: var(--navy); margin: 18px 0 10px; line-height: 1.3;
}
.reader-content h1 { font-size: 1.3em; }
.reader-content h2 { font-size: 1.2em; }
.reader-content h3 { font-size: 1.1em; }
.reader-content h4 { font-size: 1em; }
.reader-content p { margin-bottom: 12px; }
.reader-content ul, .reader-content ol { margin: 0 0 12px 20px; }
.reader-content li { margin-bottom: 6px; }
.reader-content a { color: var(--blue); text-decoration: none; }
.reader-content strong { color: var(--navy); }
.reader-content figure, .reader-content .wp-block-table { margin: 0 0 16px; overflow-x: auto; }
.reader-content table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.reader-content th, .reader-content td {
    border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top;
}
.reader-content th { background: var(--navy); color: white; }
.reader-content tr:nth-child(even) td { background: #f8f9fa; }


/* ── ABOUT TAB ───────────────────────────── */

.about-title-band {
    background: var(--navy); color: white;
    font-size: 1.2em; font-weight: bold; text-align: center;
    padding: 14px 0; margin: -16px -16px 16px -16px;
}
.about-subpage-body { padding: 16px; }

.about-photo { margin-bottom: 16px; }
.about-photo img { width: 100%; border-radius: 8px; display: block; }

.about-text { margin-bottom: 20px; }
.about-text p { font-size: 0.92em; line-height: 1.5; margin-bottom: 12px; color: var(--text); }
.about-sign { font-style: italic; }

.about-contact {
    background: var(--card-bg); border-radius: 8px;
    padding: 16px; margin-bottom: 20px; text-align: center;
}
.about-contact-title { font-weight: bold; color: var(--navy); margin-bottom: 8px; }
.gi-contact { margin-top: 20px; text-align: center; }
#tab-about .learn-body { display: flex; flex-direction: column; min-height: calc(100vh - var(--tab-bar-height) - var(--safe-top) - var(--safe-bottom) - 64px); }
.gi-footer { margin-top: auto; padding-top: 24px; }
.about-contact p { font-size: 0.88em; color: var(--text-light); margin-bottom: 10px; }
.about-email {
    display: inline-block; color: var(--blue); text-decoration: none;
    font-weight: bold; font-size: 0.95em;
}

.about-account { margin-bottom: 20px; }
.about-logout-btn {
    width: 100%; padding: 12px; background: none;
    border: 2px solid var(--error-bg); border-radius: 6px;
    color: var(--error-text); font-size: 0.9em; font-weight: bold;
    font-family: 'Trebuchet MS', sans-serif; cursor: pointer;
}
.about-login-btn {
    width: 100%; padding: 12px; background: var(--navy); color: white;
    border: none; border-radius: 6px; font-size: 0.9em; font-weight: bold;
    font-family: 'Trebuchet MS', sans-serif; cursor: pointer;
}

.about-footer { text-align: center; padding: 16px 0; border-top: 1px solid var(--border); }
.about-footer-link {
    display: inline-block; margin: 0 8px 8px;
    color: var(--blue); text-decoration: none; font-size: 0.82em;
}
.about-copyright { font-size: 0.78em; color: var(--text-light); margin-top: 8px; }


/* ── LOADING / EMPTY ─────────────────────── */

.loading { text-align: center; padding: 40px 20px; color: var(--text-light); font-size: 0.9em; }
.loading::before {
    content: ''; display: block; width: 30px; height: 30px;
    border: 3px solid var(--border); border-top-color: var(--blue);
    border-radius: 50%; margin: 0 auto 12px; animation: spin 0.8s linear infinite;
}

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-light); font-size: 0.9em; }

.puzzle-loading {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 60px 20px; color: var(--slate);
}
.puzzle-loading p { margin: 16px 0 0; font-size: 15px; }
.spinner {
    width: 36px; height: 36px; border: 3px solid #e0e0e0;
    border-top-color: var(--blue); border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }


/* ── UTILITIES ───────────────────────────── */

.hidden { display: none !important; }


/* ── ABOUT/PROFILE TAB BUTTON (bright when logged in) ── */
.tabbtn-avatar {
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--blue); color: #fff;
    font-size: 13px; font-weight: bold; font-family: 'Trebuchet MS', sans-serif;
    box-shadow: 0 0 8px rgba(59,136,235,0.85);
}
.tab-btn.tabbtn-member { color: #fff; }
.tab-btn.tabbtn-member span:last-child { color: #fff; }


/* ── PROFILE VIEW (logged-in About tab) ── */
.profile-header {
    background: var(--navy); color: #fff; text-align: center;
    padding: 22px 16px 18px; margin: -16px -16px 0 -16px;
}
.profile-avatar {
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--blue); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: bold; margin: 0 auto 10px;
    box-shadow: 0 0 14px rgba(59,136,235,0.7);
}
.profile-name { font-size: 1.25em; font-weight: bold; }
.profile-username { font-size: 0.88em; color: #b0c4de; margin-top: 2px; }
.profile-level { font-size: 0.85em; color: #9db4cf; margin-top: 2px; }

.profile-details-card {
    background: var(--card-bg); border-radius: 8px;
    padding: 4px 14px; margin-bottom: 16px;
    border: 1px solid var(--border);
}
.profile-detail-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 11px 0; border-bottom: 1px solid var(--border);
}
.profile-detail-row:last-child { border-bottom: none; }
.profile-detail-label { font-size: 0.85em; color: var(--text-light); }
.profile-detail-value { font-size: 0.9em; font-weight: 600; color: var(--navy); text-align: right; }

.profile-changepw-toggle {
    width: 100%; padding: 11px 0; background: none; border: none;
    color: var(--blue); font-size: 0.9em; font-weight: bold;
    font-family: 'Trebuchet MS', sans-serif; cursor: pointer; text-align: left;
}

.profile-stats {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
    margin: 16px 0;
}
.profile-stat {
    background: var(--card-bg); border-radius: 8px; padding: 14px 8px; text-align: center;
}
.profile-stat-value { font-size: 1.5em; font-weight: bold; color: var(--navy); }
.profile-stat-label { font-size: 0.78em; color: var(--text-light); margin-top: 2px; }

.profile-lb-wrap { margin-bottom: 22px; }
.profile-lb-btn {
    width: 100%; padding: 13px; background: var(--blue); color: #fff;
    border: none; border-radius: 6px; font-size: 0.95em; font-weight: bold;
    font-family: 'Trebuchet MS', sans-serif; cursor: pointer;
}
.profile-lb-btn:active { background: #2a6fcc; }

.profile-section-title {
    font-size: 0.9em; font-weight: bold; color: var(--navy);
    margin-bottom: 8px;
}
.profile-about {
    background: #fff; border: 1px solid var(--border); border-radius: 8px;
    padding: 12px; margin-bottom: 16px; font-size: 0.9em; line-height: 1.5; color: var(--text-light);
}
.profile-about-photo {
    width: 100%; border-radius: 6px; margin-bottom: 10px; display: block;
}
.profile-about-more { color: var(--blue); text-decoration: none; font-weight: bold; }

.profile-actions { display: flex; gap: 10px; margin-bottom: 8px; }
.profile-contact-btn {
    flex: 1; padding: 12px; background: #fff; border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-light); font-size: 0.9em;
    font-family: 'Trebuchet MS', sans-serif; cursor: pointer;
}
.profile-logout-btn {
    flex: 1; padding: 12px; background: #fff; border: 1px solid #f0c8c8;
    border-radius: 6px; color: var(--error-text); font-size: 0.9em; font-weight: bold;
    font-family: 'Trebuchet MS', sans-serif; cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════════
   PLAY TAB REDESIGN — hero box, yesterday card, visitor boxes
   ══════════════════════════════════════════════════════════════════ */

/* Hero box (three states) */
.play-hero-box { border-radius: 14px; padding: 18px 16px 20px; text-align: center; margin: 12px 0; }
.play-hero-box.phb-play { background: #d1e4ff; }
.play-hero-box.phb-win  { background: var(--success-bg); }
.play-hero-box.phb-miss { background: var(--error-bg); }
.phb-welcome { font-size: 0.95rem; font-weight: bold; color: var(--navy); margin-bottom: 10px; }
.phb-date { font-size: 0.82rem; color: var(--slate); margin-bottom: 6px; }
.phb-brand { font-size: 1.5rem; font-weight: bold; color: var(--navy); line-height: 1.1; }
.phb-sub { font-size: 1.05rem; color: var(--navy); margin: 1px 0 14px; }
.phb-play-btn { display: block; width: 100%; background: var(--blue); color: #fff; border: none;
    padding: 14px; border-radius: 10px; font-size: 1.05rem; font-weight: bold; font-family: inherit;
    box-shadow: 0 3px 0 #2b6fc4; cursor: pointer; }
.phb-play-btn:active { transform: translateY(1px); box-shadow: 0 2px 0 #2b6fc4; }
.phb-clue { margin-top: 14px; font-weight: bold; color: #0a2a4a; font-size: 1rem; line-height: 1.4; }
/* result states */
.phb-badge { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 8px; }
.phb-win .phb-badge { background: #3f9d5a; }
.phb-miss .phb-badge { background: #c65b66; }
.phb-badge svg { width: 24px; height: 24px; }
.phb-title { font-size: 1.35rem; font-weight: bold; line-height: 1.1; }
.phb-win .phb-title { color: var(--success-text); }
.phb-miss .phb-title { color: var(--error-text); }
.phb-answer { font-size: 0.88rem; margin: 5px 0 12px; }
.phb-win .phb-answer { color: #1f6b3a; }
.phb-miss .phb-answer { color: #8a3a42; }
.phb-stats { font-size: 1rem; font-weight: bold; color: var(--navy); margin-bottom: 12px; }
.phb-another { display: inline-block; background: var(--navy); color: #fff; border: none;
    padding: 11px 22px; border-radius: 9px; font-size: 0.95rem; font-weight: bold; font-family: inherit;
    margin-bottom: 12px; cursor: pointer; }
.phb-another:active { transform: translateY(1px); }
.phb-already { font-size: 0.8rem; color: var(--slate); margin-bottom: 10px; }
.phb-win .phb-already { color: #2f7048; }
.phb-miss .phb-already { color: #8a5359; }
.phb-nudge { display: inline-block; background: none; border: none; font-family: inherit;
    font-size: 0.84rem; color: var(--blue); font-weight: bold; margin-bottom: 8px;
    text-decoration: underline; cursor: pointer; padding: 0; }
.phb-nudge:active { opacity: 0.7; }
.phb-tomorrow { font-size: 0.85rem; color: var(--slate); }
.phb-win .phb-tomorrow { color: #2f7048; }
.phb-miss .phb-tomorrow { color: #8a5359; }

/* Yesterday's solution card */
.yt-card { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid #e5e7ec;
    border-radius: 12px; padding: 10px; margin-bottom: 12px; cursor: pointer; }
.yt-card:active { background: #f5f7fa; }
.yt-thumb { position: relative; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.yt-play svg { width: 26px; height: 26px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }
.yt-text { flex: 1; font-size: 0.9rem; font-weight: bold; color: var(--navy); line-height: 1.3; }

/* Visitor: three play boxes + sign-up band */
.play-more-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-light); font-weight: bold; margin: 16px 0 10px; }
.play-three { display: flex; gap: 8px; margin-bottom: 12px; }
.play-tbox { flex: 1; background: var(--card-bg); border: 1px solid #e7e9ee; border-radius: 11px;
    padding: 12px 5px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
.play-tbox:active { background: #eef0f2; }
.play-thumb { width: 44px; height: 44px; background: #fff; border: 1px solid #e0e2e8; border-radius: 6px;
    display: flex; align-items: center; justify-content: center; }
.play-thumb svg { width: 34px; height: 34px; }
.play-thumb .q { color: var(--blue); font-size: 1.7rem; font-weight: bold; line-height: 1; }
.play-tlbl { font-size: 0.68rem; font-weight: bold; color: var(--navy); line-height: 1.2; }
.play-signup { background: var(--card-bg); border: 1px dashed var(--slate); border-radius: 12px;
    padding: 15px; text-align: center; margin-top: 6px; }
.play-signup-t { font-weight: bold; color: var(--navy); font-size: 0.98rem; }
.play-signup-d { font-size: 0.79rem; color: var(--text-light); margin: 5px 0 12px; line-height: 1.4; }
.play-signup-btn { display: block; width: 100%; background: var(--navy); color: #fff; border: none;
    padding: 12px; border-radius: 9px; font-weight: bold; font-family: inherit; cursor: pointer; }
.play-login { text-align: center; font-size: 0.82rem; color: var(--text-light); padding: 8px 0 0; }
.play-login a { color: var(--blue); font-weight: bold; cursor: pointer; }

/* Guest: "See what members get" box */
.play-members { background: #eef4fb; border: 1px solid #cfe0f5; border-radius: 12px;
    padding: 15px; margin-top: 6px; }
.play-members-t { font-weight: bold; color: var(--navy); font-size: 0.98rem; margin-bottom: 10px; }
.play-members-list { list-style: none; margin: 0 0 14px; padding: 0; }
.play-members-list li strong { color: var(--navy); font-weight: bold; }
.play-members-list li { position: relative; padding: 4px 0 4px 22px; font-size: 0.82rem;
    color: var(--slate); line-height: 1.35; }
.play-members-list li::before { content: '\2713'; position: absolute; left: 0; top: 4px;
    color: var(--blue); font-weight: bold; }

/* Guest: three tappable info boxes */
.play-info { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.play-info-box { display: flex; align-items: center; gap: 11px; background: var(--card-bg);
    border: 1px solid #e7e9ee; border-radius: 11px; padding: 13px 14px; cursor: pointer; }
.play-info-box:active { background: #eef0f2; }
.play-info-icon { font-size: 1.25rem; line-height: 1; width: 40px; text-align: center; flex-shrink: 0; }
.play-info-thumb { width: 40px; height: 40px; flex-shrink: 0; border-radius: 8px; overflow: hidden; }
.play-info-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play-info-grid { width: 40px; height: 40px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.play-info-grid svg { width: 34px; height: 34px; }
.play-info-label { flex: 1; font-size: 0.9rem; font-weight: bold; color: var(--navy); }
.play-info-arrow { color: var(--slate); font-size: 1.2rem; }

/* Member footer spacing */
.play-body .mhub-notify { margin-top: 18px; }

/* "More" tile (member puzzle rows) — centres the archive-link icon */
.mhub-more-box { display: flex; align-items: center; justify-content: center; }
