/* 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; } }
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; } }
#top-packs-btn { margin-left: 0.15rem; }
@media (max-width: 640px) { .top-label { display: none; } #top-packs-btn { padding: 0.35rem 0.5rem; } }
#top-logo { cursor: pointer; }
/* The mode menu is for a game being played: not on the pack screen,
   and not on a finished game (switching would start it over) */
.on-pack #top-mode-wrap, .game-done #top-mode-wrap { display: none; }
.on-pack #top-help-btn { display: none; }   /* the instructions are part of a game's screen */
#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 0 0.5rem 0.5rem; margin-top: 0.2rem; }

/* 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; }
/* 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-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 .set-link { border-color: #4b5563; }
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; }
