@font-face { font-family: Andika; src: url(fonts/andika-Regular.woff2) format('woff2'); font-weight: 400; font-display: block; }
@font-face { font-family: Andika; src: url(fonts/andika-Bold.woff2) format('woff2'); font-weight: 700; font-display: block; }

:root { --bg: #FFF8EC; --ink: #2B2B2B; --soft: #6B6358; --card: #FFFFFF; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
    -webkit-user-select: none; user-select: none; touch-action: manipulation; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: Andika, "Avenir Next", system-ui, sans-serif; }
body { min-height: 100vh; overscroll-behavior: none; }
img, video { -webkit-user-drag: none; display: block; }

/* ---------- menu: a contact sheet of words ---------- */
#menu { padding: max(20px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 40px max(24px, env(safe-area-inset-left)); }
.top { display: flex; align-items: baseline; gap: 18px; margin: 4px 4px 14px; }
.top h1 { margin: 0; font-size: 44px; font-weight: 700; letter-spacing: .5px; }
.top p { margin: 0; font-size: 26px; color: var(--soft); }
.group h2 { font-size: 26px; font-weight: 700; color: var(--soft); margin: 18px 6px 12px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 760px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.tile { all: unset; display: flex; flex-direction: column; background: var(--card); border-radius: 22px; overflow: hidden;
        border: 6px solid var(--c); box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 55%, #000 0%), 0 6px 18px rgba(60,40,10,.10);
        cursor: pointer; transition: transform .12s ease; }
.tile:active, .tile.pressed { transform: scale(.96); }
.tile img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #eee; }
.tile .name { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px;
              min-height: 76px; padding: 8px 10px 10px; text-align: center; }
.tile .w { font-size: 30px; font-weight: 700; line-height: 1.05; color: var(--cd); }
.pill { display: inline-block; font-size: 20px; font-weight: 700; color: #fff; background: var(--c); border-radius: 999px;
        padding: 2px 14px 4px; line-height: 1.2; }
.pill:empty { display: none; }

/* ---------- stage: the word, its sentence, then the clips ---------- */
#stage { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center;
         padding: max(18px, env(safe-area-inset-top)) 28px 24px; opacity: 0; transition: opacity .25s ease; z-index: 5; }
#stage.on { opacity: 1; }
#stage[hidden] { display: none; }
#close { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 18px; width: 72px; height: 72px; border-radius: 50%;
         border: 0; background: #fff; color: var(--ink); font-size: 34px; font-family: inherit; box-shadow: 0 3px 10px rgba(0,0,0,.15); }
.say { text-align: center; max-width: 82%; min-height: 150px; }
.wordline { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
#s-word { font-size: 70px; font-weight: 700; line-height: 1.05; color: var(--cd); transition: transform .2s ease; }
#s-label { font-size: 32px; padding: 4px 22px 6px; }
#s-sentence { margin: 8px 0 0; font-size: 40px; line-height: 1.2; color: var(--ink); opacity: .35; transition: opacity .3s ease; }
#stage.speaking-word #s-word { transform: scale(1.06); }
#stage.speaking-sentence #s-sentence, #stage.playing #s-sentence { opacity: 1; }

.screen { position: relative; flex: 1; width: 100%; min-height: 0; display: flex; align-items: center; justify-content: center;
          margin-top: 10px; container-type: size; }
.screen img, .screen video { width: min(100cqw, calc(100cqh * 16 / 9)); height: auto; aspect-ratio: 16 / 9; border-radius: 26px;
                             border: 10px solid var(--c); background: #000; object-fit: contain; }
.screen video { position: absolute; opacity: 0; object-fit: cover; transition: opacity .2s ease; }
#stage.playing .screen video { opacity: 1; }
.game { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); background: #2B2540; color: #fff;
        font-size: 28px; font-weight: 700; padding: 8px 24px 10px; border-radius: 999px; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.game[hidden] { display: none; }
