/* Sticky Phrases site: what site.js adds around the game (game-core.css
   styles the game itself). */

/* Header: a paper strip, so the logo reads over any art; Packs, on a
   phone the icon alone. Snug: half the page's top margin, a smaller
   logo (34px, not the playtest's 54px; 38px until the Alegreya logo; the bar keeps 50px), little room
   round the buttons. */
#top-bar { background: #fff; border: 1px solid #ddd0ba; border-radius: 0.5rem; padding: 0.2rem 0.4rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }
@media (min-width: 641px) { #top-bar { padding: 0.2rem 0.6rem; min-height: 50px; } .top-logo-img { height: 34px; } }
/* Short of room the logo's box narrows; the logo shrinks whole inside it,
   never squeezed narrower at full height */
.top-logo-img { object-fit: contain; object-position: left center; }
body.p-2 { padding-top: 0.25rem; }
@media (min-width: 640px) { body.p-2 { padding-top: 0.5rem; } }
#submit-btn { font-size: 1.125rem; }
/* The right pane's headings at the header buttons' size */
:is(#submitted-heading, #chain-graph-title, #right-results-box h4) { font-size: 0.875rem; line-height: 1.4; }
@media (min-width: 641px) { :is(#submitted-heading, #chain-graph-title, #right-results-box h4) { font-size: 1rem; } }
@media (max-width: 640px) { .top-label { display: none; } #top-packs-btn { padding: 0.35rem 0.5rem; } }
#top-logo { cursor: pointer; }
/* The ? larger than the other labels (testers found it small), its ink
   about 90% of the gear's height, which reads as the same (a slim upright
   mark looks taller than a round one); its face is set in themes.css,
   where the buttons' label face is */
#top-help-btn { font-size: 1.35rem; line-height: 1; padding-top: 1px; }   /* the padding centres the glyph */
@media (min-width: 641px) { #top-help-btn { font-size: 1.6rem; padding-top: 0.1em; } }
/* The header's buttons all one height (on a phone the mode button came out
   34px, Puzzles 29, the gear and ? 32) */
#top-bar .top-btn { height: 2rem; padding-top: 0; padding-bottom: 0; }
#top-mode-btn { padding-right: 0.35rem; }   /* little room right of the arrow */
@media (min-width: 641px) { #top-mode-btn { padding-right: 0.5rem; } }
@media (min-width: 641px) { #top-bar .top-btn { height: 2.5rem; } }
/* The mode menu as wide as its longest line, so no caption wraps; on a
   phone it hangs from the header's right edge, where there is room for it */
#top-mode-menu { width: max-content; max-width: calc(100vw - 2rem); }
#top-mode-menu span { white-space: nowrap; }
@media (max-width: 640px) { #top-bar { position: relative; } #top-mode-wrap { position: static; } #top-mode-menu { right: 0.4rem; } }
/* How to play's running text a size up on a phone (14px was hard on the eyes) */
@media (max-width: 640px) { #instructions-content > p { font-size: 15px; } }
/* The header is the same on the pack screen as in a game (2026-11-15:
   testers were confused when it changed): there the mode menu sets the
   mode games open in, and ? opens How to play. Not on a finished game
   (switching would start it over). */
.game-done #top-mode-wrap { display: none; }
/* How to play: above the pack screen and the game (site.js moves it out of
   the game's grid), as wide as the game's panes and as far above them */
#instructions-container { margin-bottom: 1.25rem; }
@media (min-width: 1024px) { #instructions-container { max-width: 51.5rem; margin-left: auto; margin-right: auto; } }
@media (min-width: 641px) and (max-width: 1023px) and (orientation: landscape) {
    #instructions-container { max-width: 31.5rem; margin-left: auto; margin-right: auto; } }
#give-up-row { display: none !important; }   /* Give up dropped for now (2026-11-10): it sat under Misses */
.set-link { width: 100%; text-align: left; border-top: 1px solid #e5e7eb; border-radius: 0; margin-top: 0.2rem; }
/* The footer: under every screen, at the window's foot when the screen is
   shorter (the body a column, the game (#app, game-core.js's markup) taking
   the room; its full width, as auto margins would shrink it to fit; the
   body's other children are position: fixed); a small paper strip, so it
   reads over any art */
body { display: flex; flex-direction: column; }
#app { flex: 1 0 auto; width: 100%; }
#site-footer { margin-top: 0.75rem; text-align: center; }
#site-footer span { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 0.375rem; font-size: 0.7rem; line-height: 1.3;
    color: var(--t-ink-soft, #6b7280); background: #efe6d6; }   /* the paper bands beside the art (#bg-fill.paper); the warm secondary ink */
html.dark #site-footer span { color: var(--t-ink-soft, #9ca3af); background: rgba(31, 41, 55, 0.82); }
/* the pack screen's page is plain light or dark paper, so no strip there */
body.on-pack #site-footer span { background: none; }   /* as specific as the html.dark rule, and after it */
.set-note { padding: 0.45rem 0.65rem 0.5rem; font-size: 0.75rem; line-height: 1.3; color: #6b7280; border-top: 1px solid #e5e7eb; }   /* the stats notice */

/* The status row's empty squares and spent misses: an ink outline, so they
   hold on any panel colour or paper */
:is(.progress-seg:not(.found), .miss-dot.used) { box-shadow: inset 0 0 0 1px rgba(60, 45, 25, 0.3); }
html.dark :is(.progress-seg:not(.found), .miss-dot.used) { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); }

/* Pack screen: a grid of game tiles */
#pack-screen { max-width: 51.5rem; margin: 0 auto; }
#pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.7rem; }
@media (max-width: 640px) { #pack-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; } }
.pack-tile { position: relative; }
.tile-open { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%;
    min-height: 10rem; padding: 0.6rem 0.35rem 0.5rem;
    border-radius: 0.75rem; border: 1px solid #e5e7eb; background: #f9fafb; color: #374151;
    transition: background-color 0.15s ease, transform 0.1s ease; }
@media (max-width: 640px) { .tile-open { min-height: 9rem; } }
.tile-text { display: flex; flex-direction: column; align-items: center; width: 100%; }
/* A finished game shows its art (a thumbnail, art-thumbs/, from make_site.py)
   under a veil that keeps its label readable */
.has-art .tile-open { background-size: cover !important; background-position: center !important;
    background-repeat: no-repeat !important; justify-content: flex-end; padding: 0.35rem; }
/* the label is a small strip at the bottom (number and result on one line), so the art shows */
.has-art .tile-text { background: rgba(255, 255, 255, 0.84); border-radius: 0.5rem; padding: 0.1rem 0.45rem 0.15rem;
    width: auto; max-width: 100%; flex-direction: row; align-items: baseline; justify-content: center; gap: 0.35rem; }
.has-art .tile-num { font-size: 1.05rem; }
.has-art .tile-status { margin-top: 0; font-size: 0.72rem; white-space: nowrap; }
.has-art :is(.tile-size, .tile-mode) { display: none; }   /* more art; the button's label still says them */
.has-art.won .tile-text { background: rgba(240, 253, 244, 0.88); }
.has-art.perfect .tile-text { background: rgba(220, 252, 231, 0.9); }
.has-art.lost .tile-text { background: rgba(243, 244, 246, 0.88); }
.has-art .tile-reset { background: rgba(255, 255, 255, 0.85); }
.tile-open:hover { background: #eff6ff; border-color: #bfdbfe; }
.tile-open:active { transform: scale(0.97); }
.tile-num { font-size: 1.6rem; font-weight: 800; line-height: 1.1; color: #1f2937; }
.tile-size { font-size: 0.75rem; color: #6b7280; }
.tile-status { font-size: 0.8rem; font-weight: 600; margin-top: 0.35rem; }
.tile-mode { font-size: 0.7rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; }
.unplayed .tile-status { color: #9ca3af; font-weight: 500; }
/* in progress: amber, to find the game left off at a glance */
.playing .tile-open { background: #fef3c7; border-color: #f59e0b; border-width: 2px; padding: calc(0.6rem - 1px) calc(0.35rem - 1px) calc(0.5rem - 1px); }
.playing .tile-status { color: #b45309; }
.won .tile-open { background: #f0fdf4; border-color: #bbf7d0; }
.won .tile-status { color: #15803d; }
.perfect .tile-open { background: #dcfce7; border-color: #22b33a; }
.perfect .tile-status { color: #166534; }
.lost .tile-open { background: #f3f4f6; }
.lost .tile-status { color: #6b7280; }
.tile-reset { position: absolute; top: 0.3rem; right: 0.3rem; width: 1.6rem; height: 1.6rem; display: flex;
    align-items: center; justify-content: center; border-radius: 9999px; color: #6b7280; }
.tile-reset:hover { background: rgba(0, 0, 0, 0.07); color: #1f2937; }

/* The board's fold (site.js): a chevron in the board panel's top right
   (on hover where there's a mouse, always on touch screens) folds the
   board to one line, to see the art; the same corner unfolds it */
#left-pane > .panel-paper { position: relative; }
#board-min-btn { position: absolute; top: 0.4rem; right: 0.5rem; margin: 0 !important; z-index: 5; width: 1.9rem; height: 1.9rem; display: flex;
    align-items: center; justify-content: center; border-radius: 9999px; color: #6b7280; transition: opacity 0.15s ease; }
#board-min-btn:hover { background: rgba(0, 0, 0, 0.07); color: #1f2937; }
@media (hover: hover) {
    #board-min-btn { opacity: 0; }
    #left-pane > .panel-paper:hover #board-min-btn, #board-min-btn:focus-visible, .board-min #board-min-btn { opacity: 1; }
}
#board-min-btn svg { transition: transform 0.2s ease; }
.board-min #board-min-btn svg { transform: rotate(180deg); }
#board-min-label { display: none; margin: 0 !important; }
:is(.no-art, .no-bg) #board-min-btn { display: none; }   /* nothing behind the board to show */
.board-min #left-pane > .panel-paper > :not(#board-min-btn, #board-min-label) { display: none !important; }
.board-min #right-pane { display: none !important; }   /* Phrases entered folds away with the board */
/* folded: one line, the credit centred in it (it may wrap), the chevron centred beside it */
.board-min #left-pane > .panel-paper { display: flex; align-items: center; min-height: 2.6rem;
    padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; }
.board-min #board-min-btn { top: 50%; transform: translateY(-50%); }
.board-min #board-min-label { display: block; width: 100%; text-align: left; padding: 0.1rem 2rem 0.1rem 0.25rem;
    font-size: 0.9rem; line-height: 1.35; color: #4b5563; }
html.dark #board-min-btn { color: #9ca3af; }
html.dark #board-min-btn:hover { background: rgba(255, 255, 255, 0.1); color: #f3f4f6; }

/* The pack screen's heading, the Gallery button beside it */
.pack-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
#gallery-btn { flex: none; margin-top: 0.15rem; }
/* The gallery: one picture at a time, whole, on black, its credit below */
#gallery { position: fixed; inset: 0; z-index: 80; background: #0b0b0c; display: flex; flex-direction: column; touch-action: pan-y; }
#gallery.hidden { display: none; }
#gal-img { flex: 1; min-height: 0; width: 100%; object-fit: contain; padding: 0.75rem 0.75rem 0; user-select: none; -webkit-user-drag: none; }
#gal-caption { padding: 0.6rem 1rem calc(0.8rem + env(safe-area-inset-bottom)); text-align: center; color: #f3f4f6; }
#gal-credit { font-size: 1rem; line-height: 1.35; }
#gal-meta { font-size: 0.8rem; color: #9ca3af; margin-top: 0.15rem; }
.gal-words { color: #e5e7eb; font-size: 0.9rem; }
#gal-close { position: absolute; top: calc(0.5rem + env(safe-area-inset-top)); right: 0.6rem; width: 2.6rem; height: 2.6rem; border-radius: 9999px;
    font-size: 1.9rem; line-height: 1; color: #f3f4f6; background: rgba(0, 0, 0, 0.45); }
.gal-step { position: absolute; top: 45%; width: 2.8rem; height: 3.6rem; border-radius: 0.5rem; font-size: 2.4rem; line-height: 1;
    color: #f3f4f6; background: rgba(0, 0, 0, 0.35); transform: translateY(-50%); }
.gal-step.hidden { display: none; }
#gal-prev { left: 0.5rem; } #gal-next { right: 0.5rem; }
@media (hover: hover) { :is(#gal-close, .gal-step):hover { background: rgba(0, 0, 0, 0.7); } }
.gallery-open { overflow: hidden; }

/* Pack game summary: Next game, Back to pack */
.sum-actions { display: flex; gap: 0.6rem; margin-top: 1.25rem; }
.sum-actions .sum-next { margin-top: 0; flex: 1; }
.sum-back { flex: 1; padding: 0.7rem; border-radius: 0.5rem; background: #e5e7eb; color: #374151; font-weight: 700; }
.sum-back:hover { background: #d1d5db; }

html.dark #top-bar { background: #1f2937; border-color: #4b5563; }
html.dark :is(.set-link, .set-note) { border-color: #4b5563; }
html.dark .set-note { color: #9ca3af; }
html.dark .tile-open { background: #1f2937; border-color: #4b5563; color: #e5e7eb; }
html.dark .tile-open:hover { background: #1e3a8a; border-color: #3b82f6; }
html.dark .tile-num { color: #f3f4f6; }
html.dark :is(.tile-size, .tile-mode) { color: #9ca3af; }
html.dark .unplayed .tile-status { color: #6b7280; }
html.dark .playing .tile-open { background: #451a03; border-color: #f59e0b; }
html.dark .playing .tile-status { color: #fcd34d; }
html.dark .has-art .tile-text { background: rgba(17, 24, 39, 0.82); }
html.dark .has-art.won .tile-text { background: rgba(20, 83, 45, 0.85); }
html.dark .has-art.perfect .tile-text { background: rgba(22, 101, 52, 0.88); }
html.dark .has-art .tile-reset { background: rgba(17, 24, 39, 0.8); }
html.dark .won .tile-open { background: #14532d; border-color: #166534; }
html.dark .won .tile-status { color: #bbf7d0; }
html.dark .perfect .tile-open { background: #166534; border-color: #4ade80; }
html.dark .perfect .tile-status { color: #dcfce7; }
html.dark .lost .tile-open { background: #111827; }
html.dark .lost .tile-status { color: #9ca3af; }
html.dark .tile-reset { color: #9ca3af; }
html.dark .tile-reset:hover { background: rgba(255, 255, 255, 0.1); color: #f3f4f6; }
html.dark .sum-back { background: #374151; color: #e5e7eb; }
html.dark .sum-back:hover { background: #4b5563; }
