/* Archive page only. Loaded after style.css and subpage.css (in place of the
   page's old inline <style>), so the cascade order is unchanged. */
/* The home game's content sits 10px above the column's bottom; page-main's 20px
   bottom padding is for the calendar, so pull the game view up to match (keeps the
   fit-zoom, and so every card/label size, identical to home). */
#sa-game-view { margin-bottom: -10px; }
/* Desktop split (>= 1000px). page-main keeps its natural 14px/26px inset —
   the same padding the home page's game content uses inside .game-col — so
   the "Archive" label + divider line up with "Today's Word" on the home
   page. */
@media (min-width: 1000px) {
    /* Keep the whole archive within one screen: the page itself never
       scrolls. The left half shows a single month (chosen with the
       month/year dropdowns) and the right half stays fixed beside it. If a
       month is ever taller than its half, only that half scrolls — the
       header, footer and right column stay put. */
    html, body { height: 100%; }
    body { overflow: hidden; }
    .container { height: 100vh; }
    .game-body { min-height: 0; }
    /* Only the game row may give when height is tight — the header (with
       the "Today's Game" link), the backdrop bar and the footer keep their
       size, so a tall month can never squeeze into the sub-header. */
    .game-header,
    .container > .bd-panel,
    .container > .footer { flex-shrink: 0; }
    /* The right column (comments + leaderboard) is capped to the game
       row: when its content is taller — a short window, or a full real
       leaderboard — it scrolls inside itself instead of spilling down
       over the Editor's Note. */
    .game-aside { min-height: 0; overflow-y: auto; scrollbar-width: thin; }
    /* Fill the left half's full width with normal, square day tiles (the
       base repeat(7, 1fr) grid, just a touch more gap). When a month is
       taller than the half, the LEFT column scrolls on its own — the
       header, footer and right column stay fixed — rather than shrinking
       the tiles into an odd spread-out grid. */
    .sa-cal-card,
    .cal-legend { max-width: none; }
    /* Set by archive.js (fitCalendarTiles) only when a square-tiled month
       would overflow the half: slightly shorter tiles so it fits. */
    #sa-calendar.cal-fit .cal-day {
        aspect-ratio: auto;
        height: var(--tile-h);
    }
    #sa-calendar .cal-grid {
        column-gap: clamp(8px, 0.9vw, 14px);
        row-gap: clamp(8px, 0.9vw, 14px);
    }
    /* Tighten the margins around the calendar on laptop. */
    .archive-controls { margin-bottom: 10px; }
    .cal-legend { margin-top: 10px; }
}
/* Month / year pickers — at the top of the calendar card. The buttons take
   the cards' stone rim on a paper fill; the open menus match the ☰ menu
   (light teal, teal edge, teal-tinted lift). */
.archive-controls { display: flex; gap: 10px; margin: 0 0 14px; }
.dd { position: relative; }
.dd-btn {
    display: flex; align-items: center; gap: 10px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem; font-weight: 500; letter-spacing: 0.04em;
    color: #1A1A1A; background: #FCFBF7;
    border: var(--frame-w) solid var(--card-edge); border-radius: 4px;
    padding: 7px 12px 7px 14px; cursor: pointer; transition: border-color 0.15s;
}
.dd-btn:hover, .dd.open .dd-btn { border-color: #0F4C5C; }
.dd-caret { font-size: 0.65rem; color: #6c757d; transition: transform 0.15s; }
.dd.open .dd-caret { transform: rotate(180deg); }
.dd-menu {
    display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 500;
    min-width: 100%; max-height: 260px; overflow-y: auto;
    background: var(--header-meta-bg);
    border: 1.5px solid color-mix(in srgb, var(--teal-dark) 30%, var(--header-meta-bg));
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(15, 76, 92, 0.18), 0 3px 8px rgba(15, 76, 92, 0.10);
    padding: 6px; box-sizing: border-box;
}
.dd.open .dd-menu { display: block; }
.dd-option {
    font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem; font-weight: 500;
    letter-spacing: 0.04em; color: #1A1A1A; white-space: nowrap;
    padding: 8px 14px; border-radius: 8px; cursor: pointer;
}
.dd-option:hover { background: rgba(15, 76, 92, 0.08); }
.dd-option.selected { background: #0F4C5C; color: #fff; }
.container.bd-dark .dd-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
}
.container.bd-dark .dd-btn:hover,
.container.bd-dark .dd.open .dd-btn { border-color: #8FD3DE; }
.container.bd-dark .dd-caret { color: rgba(255, 255, 255, 0.7); }
/* Calendar tiles — the cards' square-ish 4px corners. Playable days are
   paper with the stone rim (like the answer tiles); days still to come are
   a faint outline so they recede into the card. */
.cal-dow-row { margin-bottom: 8px; }
.cal-dow {
    text-align: center; font-family: 'IBM Plex Mono', monospace;
    font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--panel-label, #6c757d);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; width: 100%; }
.cal-day {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    border-radius: 4px; font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem; color: #ABABAB; width: 100%; box-sizing: border-box;
    background: transparent; border: var(--frame-w) solid rgba(140, 123, 101, 0.16);
}
.cal-day.empty { background: transparent; border-color: transparent; }
.cal-day.has-puzzle {
    background: #FCFBF7; border-color: var(--card-edge); color: #1A1A1A;
    cursor: pointer; font-weight: 500; transition: all 0.15s;
    box-shadow: 0 1px 2px rgba(30, 30, 40, 0.06);
}
.cal-day.has-puzzle:hover { border-color: #0F4C5C; color: #0F4C5C; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(15,76,92,0.16); }
/* Today: a teal ring marks "you are here", unmistakable vs. the faint future tiles */
.cal-day.today { background: #FCFBF7; border: 2px solid #0F4C5C; color: #0F4C5C; font-weight: 700; }
.cal-day.future { color: #C9C3BA; }
.cal-day.replayed { background: #D0D0D0; border-color: #C0C0C0; color: #6B6B6B; cursor: pointer; }
.cal-day.played-solved { background: #0F4C5C; border-color: #0F4C5C; color: #fff; font-weight: 600; cursor: pointer; }
.cal-day.played-failed { background: #c45c6a; border-color: #c45c6a; color: #fff; font-weight: 600; cursor: pointer; }
.container.bd-dark .cal-day { border-color: rgba(255, 255, 255, 0.10); }
.container.bd-dark .cal-day.empty { border-color: transparent; }
.container.bd-dark .cal-day.future { color: rgba(255, 255, 255, 0.3); }
.container.bd-dark .cal-day.has-puzzle {
    background: rgba(255, 255, 255, 0.10); border-color: rgba(255, 255, 255, 0.30);
    color: #fff; box-shadow: none;
}
.container.bd-dark .cal-day.has-puzzle:hover { border-color: #8FD3DE; color: #8FD3DE; }
.container.bd-dark .cal-day.today { background: rgba(255, 255, 255, 0.10); border-color: #8FD3DE; color: #8FD3DE; }
/* Legend — key for the tile colours, at the foot of the card */
.cal-legend {
    display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 14px 2px 0;
    font-family: 'IBM Plex Mono', monospace; font-size: 9px; font-weight: 500;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--panel-label, #6c757d);
}
.cal-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; box-sizing: border-box; }
.lg-unplayed { background: #FCFBF7; border: 1.5px solid var(--card-edge); }
.lg-solved { background: #0F4C5C; }
.lg-failed { background: #c45c6a; }
.lg-replayed { background: #D0D0D0; border: 1px solid #C0C0C0; }
.container.bd-dark .lg-unplayed { background: rgba(255, 255, 255, 0.10); border-color: rgba(255, 255, 255, 0.30); }
.container.bd-dark .lg-solved { background: #8FD3DE; }
/* Played-day pop-up — a small version of the results card: warm paper,
   the cards' stone rim, a teal-tinted lift; mono date eyebrow, italic
   serif word, a hairline rule, the score, and a solid Review button.
   Stays paper on Midnight, like the results pop-up. */
#sa-tooltip {
    display: none; position: fixed; z-index: 1000;
    background: #FCFBF7;
    border: var(--frame-w) solid var(--card-edge);
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(15, 76, 92, 0.16), 0 2px 6px rgba(15, 76, 92, 0.10);
    padding: 14px 18px 14px; box-sizing: border-box;
    min-width: 170px; max-width: 220px; pointer-events: auto;
    text-align: center;
    animation: ttIn 0.18s ease both;
}
#sa-tooltip.below { animation-name: ttInBelow; }
@keyframes ttIn { from { opacity: 0; margin-top: 4px; } to { opacity: 1; margin-top: 0; } }
@keyframes ttInBelow { from { opacity: 0; margin-top: -4px; } to { opacity: 1; margin-top: 0; } }
#sa-tooltip .tt-date { font-family: 'IBM Plex Mono', monospace; font-size: 9px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal-dark); }
#sa-tooltip .tt-word { font-family: 'EB Garamond', serif; font-size: 22px; font-style: italic; font-weight: 500; line-height: 1.1; color: var(--ink, #1A1A1A); margin-top: 6px; overflow-wrap: anywhere; }
#sa-tooltip .tt-rule { display: block; width: 34px; height: 1px; margin: 8px auto; background: linear-gradient(90deg, transparent, var(--teal-dark), transparent); opacity: 0.6; }
#sa-tooltip .tt-score { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink, #1A1A1A); }
#sa-tooltip .tt-score .star { color: #0F4C5C; }
#sa-tooltip .tt-action {
    display: inline-block; margin-top: 12px;
    padding: 7px 16px; border: 1px solid #0F4C5C; border-radius: 3px;
    background: #0F4C5C; color: #fff;
    font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600;
    letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
    transition: background 0.15s ease;
}
#sa-tooltip .tt-action:hover { background: #0c3d4a; }
/* Full-screen game view — swaps in for the calendar and mirrors the home
   page layout for a past day's puzzle. The game's date and the "Archive"
   link live in the header meta bar (archive.js setArchiveHeader), so the body
   starts at the word, exactly like the home page. */
#sa-game-view { animation: sa-fade 0.2s ease; }
@keyframes sa-fade { from { opacity: 0; } to { opacity: 1; } }
.sa-modal-date {
    font-family: 'IBM Plex Mono', monospace; font-size: 0.65rem;
    font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
    color: #6c757d; margin-bottom: 12px;
    display: flex; align-items: center; gap: 12px;
}
.sa-modal-date::after { content: ''; display: block; flex: 1; height: 1px; background: #E0D8CC; }
.sa-otp-box {
    /* Identical sizing/typography to the main game's .letter-input so the
       boxes read the same. --otp-fit shrinks them to fit long words on one
       row; the clamp caps them at the main game's size for short words. */
    --otp-fit: calc((100cqw - (var(--word-length, 6) - 1) * clamp(5px, 1.33vw, 6px)) / var(--word-length, 6));
    width: min(clamp(40px, 10.64vw, 47.5px), var(--otp-fit));
    height: auto;
    aspect-ratio: 1 / 1;
    /* Frosted, theme-driven fill (same tokens as the main game's letter
       boxes) so the boxes re-theme with the backdrop instead of sitting as
       a flat opaque slab. */
    background: var(--tile-fill, rgba(255, 255, 255, 0.5));
    border: 1.5px solid var(--tile-border, rgba(120, 140, 146, 0.5));
    border-radius: clamp(5px, 1.4vw, 7px);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    font-family: 'EB Garamond', serif;
    font-size: min(clamp(21px, 5.6vw, 25px), calc(var(--otp-fit) * 0.5));
    font-weight: 500;
    text-align: center;
    text-transform: uppercase;
    color: var(--tile-text, #1A1A1A);
    outline: none;
    box-sizing: border-box;
    padding: 0;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
    caret-color: transparent;
}
.sa-otp-box { transition: border-color 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sa-otp-box:focus { border-color: #1A7A8A; box-shadow: 0 0 0 2px rgba(26, 122, 138, 0.15); }
/* Play-mode typing: one transparent input covers the row (see
   setupOtpCapture); the boxes mirror it and .is-active draws a centred caret. */
.sa-otp-capture {
    position: absolute; inset: 0; width: 100%; height: 100%;
    margin: 0; padding: 0; border: 0; background: transparent;
    color: transparent; caret-color: transparent; font-size: 16px;
    opacity: 0; outline: none; cursor: text; z-index: 3;
    -webkit-appearance: none; appearance: none;
}
.sa-otp-box.is-active { border-color: #1A7A8A; box-shadow: 0 0 0 2px rgba(26, 122, 138, 0.15); }
.sa-otp-box.filled:not(.revealed) { border-color: #26A69A; }
/* Same smooth caret as the main game (otpCaretIn / otpCaretPulse and
   --caret-a live in style.css). */
.sa-otp-box.is-active:not(.filled) {
    --caret-colour: color-mix(in srgb, var(--tile-caret, #1A7A8A) calc(var(--caret-a) * 100%), transparent);
    background-image: linear-gradient(var(--caret-colour), var(--caret-colour));
    background-repeat: no-repeat;
    background-position: center;
    background-size: 1.5px 48%;
    animation: otpCaretIn 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both,
               otpCaretPulse 1.1s ease-in-out 0.5s infinite;
}
@media (prefers-reduced-motion: reduce) {
    .sa-otp-box.is-active:not(.filled) { animation: none; }
}
/* Revealed answer reads like the game's finished board: teal-green outline
   over the themed fill, not a solid slab. */
.sa-otp-box.revealed {
    background: var(--tile-fill, rgba(255, 255, 255, 0.5));
    border-color: #26A69A;
    color: var(--tile-text, #1A1A1A);
}
.sa-modal-word {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow: hidden;
    gap: clamp(5px, 1.33vw, 6px);
    margin-bottom: 14px;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    container-type: inline-size;
    position: relative;
}
.sa-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(5px, 1.5vw, 12px);   /* = home #game-playing .status-row */
    margin-bottom: 14px;
    width: 100%;
    box-sizing: border-box;
    container-type: inline-size;
}
.sa-submit {
    height: 42px;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    padding: 0;   /* = home .guess-button (drops the UA button padding) */
    background: transparent;
    color: #767676;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: not-allowed;
    box-sizing: border-box;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sa-submit:not(:disabled) {
    background: #0F4C5C;
    color: #fff;
    border-color: #0F4C5C;
    cursor: pointer;
}
/* Disabled Guess stays solid teal (matching the main game) so it's always
   legible — never a transparent ghost over the backdrop. */
.sa-submit:disabled {
    background: #1A7A8A;
    color: #fff;
    border: 1px solid #1A7A8A;
    cursor: not-allowed;
    opacity: 1;
}
/* Reveal ("give up") button — quiet bordered action next to Submit,
   matching the treatment on the main game. */
.sa-reveal {
    height: 42px;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    background: #ffffff;
    color: #0F4C5C;
    border: 1px solid #B7D6DC;
    border-radius: 4px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;   /* = home .reveal-button; padding here widened the button at the score box's expense */
    box-sizing: border-box;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
/* Disabled Reveal takes the frosted panel look (like the game's finished
   surfaces) so it stays readable instead of fading to transparent. */
.sa-reveal:disabled {
    background: var(--panel-fill, rgba(255, 255, 255, 0.42));
    color: var(--panel-label, #767676);
    border: 1px solid var(--panel-border, rgba(120, 140, 146, 0.4));
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    cursor: not-allowed;
    opacity: 1;
}
/* Stats boxed together in the same light-teal tint as the header
   sub-bar, matching the grouped readout used on the main game. */
.sa-stat-row {
    display: flex;
    align-items: center;
    flex: 2.7 1 0;
    justify-content: space-around;
    min-width: 0;
    height: 42px;
    /* Frosted translucent panel (same --panel-* tokens as the main game's
       guesses/score readout) so it re-themes with the backdrop. */
    background: var(--stats-fill, rgba(255, 255, 255, 0.55));
    border: 1px solid var(--panel-border, rgba(120, 140, 146, 0.4));
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    border-radius: 4px;
    box-sizing: border-box;
}
.sa-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    padding: 0 5px;
    box-sizing: border-box;
    position: relative;
}
.sa-stat:first-child::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 1px;
    height: 60%;
    background: rgba(26, 122, 138, 0.15);
}
.sa-stat-val {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 17px;
    font-weight: 700;
    color: var(--tile-text, #1A1A1A);
    line-height: 1;
    white-space: nowrap;
}
.sa-stat-lbl {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(7px, 2.1vw, 8.5px);   /* = home #game-playing .stat-label */
    font-weight: 500;
    letter-spacing: clamp(0.01em, 0.3vw, 0.08em);
    word-spacing: -0.18em;
    text-transform: uppercase;
    color: var(--panel-label, #767676);
    margin-top: 1px;
    text-align: center;
    white-space: nowrap;
}
/* Tall phones: mirror the home page's scale-up of the label / score readout
   (style.css's tall-phone block scopes those to #game-playing). */
@media (max-width: 480px) and (max-aspect-ratio: 1/2) {
    #sa-word-label, #sa-clues-label { font-size: 11px; }
    .sa-stat-row { flex: 3.2 1 0; }
    .sa-stat-lbl { font-size: clamp(7px, 2.07vw, 8.5px); }
}
/* Layout/gap/card sizing shared with the home page's #hints-container in style.css. */
#sa-modal-clues .category-pill {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.arc-card-divider {
    border: none;
    border-top: 1px solid rgba(0,0,0,0.1);
    margin: clamp(1px, 0.27vw, 2px) 0;
    width: 100%;
    display: block;
}
.arc-writeup {
    font-family: 'Crimson Pro', serif; font-size: clamp(13px,3.47vw,15px);
    font-style: italic; color: rgba(26,26,26,0.8); line-height: 1.45; margin: 0;
}
