:root { --bg: #fff; --fg: #111; --line: #8884; color-scheme: light dark; }
@media (prefers-color-scheme: dark) { :root { --bg: #111; --fg: #eee; } }
body { margin: 0; font-family: system-ui, sans-serif; text-align: center; padding: 16px 16px 0; background: var(--bg); color: var(--fg); }
button { font: inherit; color: inherit; }

header h1 { font-size: clamp(44px, 13vw, 80px); line-height: 1; letter-spacing: -.02em; margin: 16px 0 8px; }
.sub { font-size: clamp(17px, 4.5vw, 21px); max-width: 30em; margin: 0 auto 20px; opacity: .75; }

.quick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px; }
.quick button { font-size: 17px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: none; cursor: pointer; }
.quick button:hover { background: var(--line); }

#search { font-size: 18px; width: 100%; max-width: 22em; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); box-sizing: border-box; }
.hint { font-size: 14px; margin: 8px 0 0; opacity: .55; }

#grid { max-width: 720px; margin: 8px auto; }
#grid h2 { font-size: 15px; text-align: start; margin: 24px 0 8px; opacity: .6; }
#grid .row { display: flex; flex-wrap: wrap; gap: 4px; }
#grid button { font-size: 40px; background: none; border: 0; cursor: pointer; border-radius: 8px; }
#grid button:hover { background: var(--line); }

/* Ad slot: collapses while empty, and never appears behind/over the fullscreen screen */
.ad { max-width: 728px; min-height: 90px; margin: 24px auto; }
.ad[hidden], .showing .ad { display: none !important; }

.uses { max-width: 36em; margin: 32px auto 0; text-align: start; opacity: .7; }
.uses h2 { font-size: 17px; }
.uses ul { padding-inline-start: 20px; line-height: 1.5; }

footer { margin: 32px 0 24px; display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center; }
footer a { color: inherit; opacity: .6; }
footer a[aria-current] { opacity: 1; font-weight: 600; text-decoration: none; }

/* Fullscreen screen */
.showing body { overflow: hidden; }
#big { position: fixed; inset: 0; z-index: 10; display: flex; justify-content: center; align-items: center;
       background: var(--bg); color: var(--fg); cursor: pointer; }
#big[hidden] { display: none; }
#big.idle { cursor: none; }
#stage { display: flex; flex-direction: column; align-items: center; gap: 3vh; font-size: min(70vw, 55vh); line-height: 1; }
#big img, #anim { width: min(70vw, 55vh); height: min(70vw, 55vh); }
#caption { font-weight: 700; line-height: 1.15; max-width: 90vw; min-width: 1em; outline: none; cursor: text; overflow-wrap: normal; }
#caption:empty:focus::before { content: attr(data-ph); opacity: .3; }

#bar { position: absolute; top: max(12px, env(safe-area-inset-top)); inset-inline-end: 12px; display: flex; gap: 8px; transition: opacity .3s; }
#bar button { font-size: 16px; padding: 10px 16px; border-radius: 999px; border: 0; background: #8885; cursor: pointer; }
#big.idle #bar:not(:focus-within) { opacity: 0; pointer-events: none; }
#toast { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); font-size: 16px; padding: 8px 16px; border-radius: 999px; background: #000c; color: #fff; }
#toast:empty { display: none; }

@media (prefers-reduced-motion: reduce) { #bar { transition: none; } }
