/* The idle game (GamePage): line icons, painted pictures for items, colours only from the theme. */

/* Items' painted pictures (GameItemIcon) carry the class "icon", so icon size rules size them too; next to text
   (no such rule) they're a little bigger than a line icon, as a picture needs more room to be read. */
img.icon.item-art { object-fit: contain; }
img.item-art:where(.icon) { width: 1.5em; height: 1.5em; vertical-align: -0.38em; }
img.item-art.game-item__icon, img.item-art.game-building__icon { width: 3rem; height: 3rem; margin-bottom: 2px; }

.game-wallet { display: flex; gap: 14px; align-items: center; color: var(--ink-muted); }
.game-wallet strong { color: var(--ink); font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.game-wallet .icon { width: 1em; height: 1em; vertical-align: -0.12em; }

/* What's running: a big icon, the name, the round's bar. */
.game-now, .game-skill, .game-sell { display: flex; align-items: center; gap: 16px; padding: 16px 18px; }
.game-now__icon, .game-skill__icon { width: 2.6rem; height: 2.6rem; color: var(--accent); stroke-width: 1.5; }
.game-now__text, .game-skill__text, .game-sell__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.game-now__text strong { font-size: 1.15rem; }
.game-now__skill { color: var(--ink-muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.game-now__hint { color: var(--ink-muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

.game-bar { position: relative; height: 8px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
.game-bar > span {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    border-radius: inherit;
    background: var(--accent);
    animation-name: game-round;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
.game-bar--static > span { animation: none; transition: width 0.3s ease; }

@keyframes game-round {
    from { width: 0; }
    to { width: 100%; }
}

.game-location { margin: 0; color: var(--ink-muted); font-size: 0.9rem; }

/* What the rest of Shani brought: inspiration while it lasts, the latest bonuses, what gives what. */
.game-shani { display: flex; flex-direction: column; gap: 4px; margin-top: -8px; font-size: 0.82rem; }
.game-shani p { margin: 0; }
.game-shani__inspired { align-self: flex-start; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--accent); color: var(--bg); font-weight: 600; }
.game-shani__note { color: var(--ink); }
.game-shani__hint { color: var(--ink-muted); font-size: 0.76rem; }
.game-location strong { color: var(--ink); }

/* Tabs: two rows (skills, village), wrapping rather than scrolling off the side on a phone. */
.game-tabs { flex-wrap: wrap; overflow-x: visible; width: fit-content; max-width: 100%; }
.game-tabs + .game-tabs { margin-top: -10px; }
.game-tabs .tab { display: inline-flex; align-items: center; gap: 6px; }

/* First steps: one goal at a time for someone new. */
.game-guide { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-color: var(--accent); }
.game-guide__icon { width: 2rem; height: 2rem; color: var(--accent); flex: none; }
.game-guide__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

@media (max-width: 560px) {
    .game-tabs .tab { padding: 6px 9px; font-size: 0.8rem; }
    .game-guide { flex-wrap: wrap; }
}

/* Actions of a skill: a grid of cards, locked ones greyed out. */
.game-actions, .game-bank { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.game-actions { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.game-bank { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

.game-action, .game-item {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 10px;
    color: var(--ink);
    font: inherit;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.game-action:hover:not(:disabled), .game-item:hover { transform: translateY(-2px); border-color: var(--accent); }
.game-action.is-active, .game-item.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), var(--shadow); }
.game-action.is-locked { opacity: 0.5; cursor: default; }
.game-action:disabled:not(.is-locked) { cursor: default; }
.game-action__icon, .game-item__icon { width: 2.2rem; height: 2.2rem; margin-bottom: 4px; color: var(--accent); stroke-width: 1.5; }
.game-action.is-locked .game-action__icon { color: var(--ink-muted); }
.game-action__meta { color: var(--ink-muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.game-action__state { margin-top: 6px; color: var(--accent); font-size: 0.8rem; font-weight: 700; }

.game-item { padding: 12px 8px; }
.game-item__count { font-weight: 700; font-variant-numeric: tabular-nums; }
.game-item__name { color: var(--ink-muted); font-size: var(--text-xs); }

.game-tabs .game-tabs__lock { width: 0.9em; height: 0.9em; opacity: 0.7; }

/* What making something takes: each ingredient with what the bank has; missing ones fade. */
.game-action__inputs { display: flex; flex-direction: column; gap: 2px; color: var(--ink-muted); font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.game-action__inputs .is-missing, .game-cost .is-missing { opacity: 0.5; text-decoration: line-through; }

/* The village: a card per building with its level, bonus and the next level's cost. */
.game-village { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.game-building { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.game-building.is-unbuilt .game-building__icon { color: var(--ink-muted); }
.game-building__head { display: flex; align-items: center; gap: 12px; }
.game-building__head div { display: flex; flex-direction: column; gap: 2px; }
.game-building__icon { width: 2.4rem; height: 2.4rem; color: var(--accent); stroke-width: 1.5; }
.game-building__bonus { margin: 0; font-size: var(--text-sm); }
.game-building__next { margin: 0; color: var(--ink-muted); font-size: 0.8rem; }
.game-building .primary-button { align-self: flex-start; margin-top: auto; }
.game-cost { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.game-cost__have { color: var(--ink-muted); }

.game-away__used { opacity: 0.75; }

/* The character (stage 7): the drawn figure on a soft stage, what it's at beside it; wardrobe and Mei's salon below. */
.game-figure { display: grid; grid-template-columns: minmax(180px, 280px) 1fr; gap: 20px; padding: 18px; }
.game-figure__stage { border-radius: var(--radius-lg); background: radial-gradient(ellipse at 50% 40%, var(--surface-2), transparent 70%); padding: 8px; }
.game-figure__about { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.game-figure__about h2 { margin: 0; }
.game-figure__label { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; font-size: var(--text-sm); color: var(--ink-muted); }
.game-figure__label .icon { width: 1.1em; height: 1.1em; color: var(--accent); }
.game-figure__stage-text { display: flex; flex-direction: column; gap: 4px; margin: 0; color: var(--ink-muted); font-size: var(--text-sm); }
.game-figure__stage-text strong { color: var(--ink); font-size: 1rem; }
/* The stages reached so far small, the current one marked; the ones to come only as a lock. */
.game-figure__stages { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: auto 0 0; }
.game-figure__step { display: block; border-radius: var(--radius-md); opacity: 0.5; }
.game-figure__step.is-current { opacity: 1; background: var(--surface-2); }
.game-figure__step.is-locked { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 488 / 800;
    opacity: 1; background: var(--surface-2); color: var(--ink-muted); font-size: var(--text-xs); }
.game-figure__step.is-locked .icon { width: 1.2em; height: 1.2em; }
.game-figure__title { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; font-size: var(--text-md); }
.game-figure__title .icon { width: 1.1em; height: 1.1em; color: var(--accent); }

/* The figure's layers on top of each other; the hair colour multiplies over the light grey hair, only where it is. */
.game-pic { display: block; position: relative; width: 100%; aspect-ratio: 488 / 800; isolation: isolate; }
.game-pic__layers { position: absolute; inset: 0; }
.game-pic__layers > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.game-pic img { display: block; object-fit: contain; }
.game-pic__tint { mix-blend-mode: multiply; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.game-pic.is-silhouette .game-pic__hair { filter: brightness(0); opacity: 0.55; }
/* Head and shoulders: the figure larger than its square frame, the head in view. */
.game-pic--head { aspect-ratio: 1; overflow: hidden; }
.game-pic--head .game-pic__layers { inset: auto; left: -69%; top: -15.5%; width: 238%; aspect-ratio: 488 / 800; }
/* A related figure stands in until its own pictures are drawn: a small mark at the bottom says so. */
.game-pic__coming { position: absolute; left: 50%; bottom: var(--space-1); z-index: 1; transform: translateX(-50%); white-space: nowrap; pointer-events: none; }
.game-pic__coming .icon { width: 1em; height: 1em; }

.game-hairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.game-hair { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; text-align: center; }
.game-hair.is-active { border-color: var(--accent); }
.game-hair__face { display: block; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 12px; background: var(--surface-2); }
.game-hair__face--body { aspect-ratio: 3 / 4; display: flex; justify-content: center; }
.game-hair__face--body .game-pic { width: auto; height: 100%; }
.game-hair__mystery { align-items: center; flex-direction: column; justify-content: center; gap: 6px; color: var(--ink-muted); font-weight: 600; }
.game-hair__mystery .icon { width: 2em; height: 2em; opacity: 0.6; }
.game-hair.is-locked strong { color: var(--ink-muted); }
.game-hair .primary-button, .game-hair .secondary-button { margin: 0; justify-content: center; width: 100%; }
/* No spoilers: what isn't yours yet is only an outline; what's still to discover is a veiled card. */
.game-hair.is-unknown .game-hair__face img { filter: brightness(0); opacity: 0.35; }
.game-action.is-unknown, .game-building.is-unknown { border-style: dashed; opacity: 0.7; }
.game-action.is-unknown strong, .game-building.is-unknown strong { letter-spacing: 0.15em; }
.game-hair .primary-button .icon { width: 1em; height: 1em; }

/* Making the character, and Mei's dyes: the four figures as heads, the colours as swatches. */
.game-create__figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.game-create__figure { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border: 2px solid var(--line); border-radius: 14px;
    background: var(--surface-2); color: var(--ink); font: inherit; font-size: 0.8rem; cursor: pointer; }
.game-create__figure .game-pic { border-radius: 10px; }
.game-create__figure.is-active { border-color: var(--accent); }
.game-create__go { align-self: flex-start; }
.game-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.game-colors__swatch { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 2px solid var(--line);
    background: var(--swatch); color: #222; cursor: pointer; }
.game-colors__swatch.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.game-colors__swatch:disabled { cursor: default; opacity: 0.5; }
.game-colors--small { justify-content: center; gap: var(--space-1); }
.game-colors--small .game-colors__swatch { width: 24px; height: 24px; }
.game-colors--small .game-colors__swatch .icon { width: 12px; height: 12px; }
.game-colors__swatch .icon { width: 16px; height: 16px; filter: drop-shadow(0 0 2px #fff); }
.game-dye { display: flex; flex-direction: column; gap: 8px; padding: 16px; margin-top: 12px; }
.game-dye h3, .game-dye p { margin: 0; }
.game-away__find { font-weight: 600; color: var(--accent); }

@media (max-width: 640px) {
    .game-figure { grid-template-columns: 1fr; }
    .game-figure__stage { max-width: 260px; margin: 0 auto; }
    .game-create__figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* The household: the village project (each need with its bar and a give button) and gifts. */
.game-project__needs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.game-project__needs li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 4px 12px; font-size: var(--text-sm); }
.game-project__needs .game-bar { grid-column: 1 / 3; }
.game-project__needs .secondary-button, .game-project__needs li > .game-now__hint { grid-column: 3; grid-row: 1 / 3; }
.game-project__count { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.game-gift { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.game-gift p { margin: 0; }
.game-gift__form { display: flex; flex-wrap: wrap; gap: 8px; }
.game-gift__form select, .game-gift__form input {
    min-width: 0;
}
.game-gift__form input { width: 6rem; }

.game-sell { flex-wrap: wrap; }
/* The sell buttons side by side, all the same size. */
.game-sell__actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.game-sell__actions > button { margin: 0; justify-content: center; text-align: center; }
@media (max-width: 600px) {
    .game-sell__actions { width: 100%; }
}

.game-away__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.game-away__list li { padding: 8px 12px; border-radius: 12px; background: var(--surface); font-variant-numeric: tabular-nums; }
.game-away p { margin: 0; }

@media (max-width: 560px) {
    .game-now { flex-wrap: wrap; }
    .game-now__icon, .game-skill__icon { width: 2rem; height: 2rem; }
    .game-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    .game-action, .game-item { transition: none; }
}

/* ---------- Stage 8: settlement, queue, mastery, rare finds, collection book ---------- */

.game-settlement { display: flex; flex-direction: column; gap: 10px; padding: 16px; margin-bottom: 12px; }
.game-settlement__head { display: flex; align-items: center; gap: 14px; }
.game-settlement__head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.game-settlement__icon { width: 44px; height: 44px; flex: none; color: var(--accent); }
.game-settlement .primary-button { align-self: flex-start; }

.game-queue { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; margin: 10px 0; }
.game-queue__title { display: flex; align-items: center; gap: 8px; }
.game-queue__list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding-left: 1.4em; }
.game-queue__list li { display: flex; align-items: center; gap: 8px; }
.game-queue__list li > span { flex: 1; min-width: 0; }
.game-queue__list .icon { width: 16px; height: 16px; color: var(--accent); }

/* The queue button sits in the action card's corner (outside it: a button can't hold another). */
.game-action-slot { position: relative; }
.game-action__queue { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; background: var(--surface-2); }
.game-action__queue .icon { width: 16px; height: 16px; }

.game-queue-form { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; margin-top: 10px; }
.game-queue-form__picks { display: flex; flex-wrap: wrap; gap: 6px; }
.game-queue-form .field input { max-width: 180px; }

.game-away__rare { color: var(--accent); font-weight: 600; }

.game-book { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin: 10px 0 0; padding: 0; list-style: none; }
.game-book__page { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.game-book__page.is-complete { border-color: var(--accent); }
.game-book__head { display: flex; align-items: center; gap: 8px; }
.game-book__head .icon { width: 20px; height: 20px; color: var(--accent); }
.game-book__head .badge { margin-left: auto; }
.game-book__items { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.game-book__items li { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: var(--radius-pill); background: var(--surface-2); font-size: 0.8rem; }
.game-book__items li .icon { width: 15px; height: 15px; }
.game-book__items li.is-rare { box-shadow: inset 0 0 0 1px var(--accent); }
.game-book__items li.is-unknown { color: var(--ink-muted); }

/* Farming's fields (stage 8): each field a row, ripe ones stand out. */
.game-fields { display: flex; flex-direction: column; gap: 10px; padding: 14px; margin-bottom: 12px; }
.game-fields__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.game-fields__head strong { display: flex; align-items: center; gap: 8px; }
.game-fields__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.game-field { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.game-field.is-ripe { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.game-field.is-free { border-style: dashed; opacity: .75; }
.game-field__icon { width: 28px; height: 28px; flex: none; color: var(--accent); }
.game-field__text { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }

/* Equipment and the character's values (stage 8, phase 3). */
.game-gear { display: flex; flex-direction: column; gap: 12px; padding: 16px; margin: 12px 0; }
.game-gear__slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.game-gear__slot { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.game-gear__slot.is-empty { border-style: dashed; opacity: .75; }
.game-gear__slot > div { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.game-gear__icon { width: 28px; height: 28px; flex: none; color: var(--accent); }
.game-gear__values { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.game-gear__values li { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.game-gear__values strong { display: flex; align-items: center; gap: 6px; }

/* Expeditions and the boss of the week (stage 8, phase 4). */
.game-expedition { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 12px; }
.game-expedition.is-active { border-color: var(--accent); }
.game-expedition__icon { width: 36px; height: 36px; flex: none; color: var(--accent); }
.game-expedition__text { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.game-boss { display: flex; flex-direction: column; gap: 10px; padding: 16px; margin-bottom: 12px; }
.game-boss__hp span { background: var(--danger, #e5484d); }
.game-boss__fighters { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; font-size: .9em; }
.game-boss__fighters li { display: flex; align-items: center; gap: 6px; }
.game-boss__attack { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.game-boss__attack label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.game-boss__attack label:first-child { flex: 1 1 220px; }
.game-boss__attack input { width: 110px; }

/* Household and seasons (stage 8, phase 6): a big order's two parts, each with its bar, who did what and a button. */
.game-big-order__part { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 0.9rem; }
.game-big-order button { align-self: flex-start; }
.game-big-order__abandon { margin-top: 4px; }
.game-shani__inspired .secondary-button { margin-left: 8px; padding: 4px 10px; font-size: 0.8rem; }

/* The village lives (stage 8, phase 5): the market's prices of the day and the household's trade offers. */
.game-prices { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.game-price { display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 4px 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: var(--text-sm); }
.game-price__icon { width: 24px; height: 24px; color: var(--accent); }
.game-price__name { min-width: 0; overflow-wrap: anywhere; }
.game-price__percent, .game-price__coins { font-variant-numeric: tabular-nums; white-space: nowrap; }
.game-price__percent.is-up { color: var(--success, #30a46c); }
.game-price__percent.is-down { color: var(--ink-muted); }
.game-offers { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.game-offer { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: var(--text-sm); }
.game-offer__text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }

@media (max-width: 640px) {
    .game-price { grid-template-columns: auto 1fr auto; }
    .game-price__coins { grid-column: 2; }
    .game-price .secondary-button { grid-column: 3; grid-row: 2; }
}

/* Start page tile: Hoshimura at a glance */
.game-section { display: flex; flex-direction: column; gap: 8px; }
.game-section__card { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; color: inherit; text-decoration: none; }
.game-section__card:hover strong { color: var(--accent); }
.game-section__row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.game-section__row > .icon { flex: none; width: 22px; height: 22px; color: var(--accent); }
.game-section__text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.game-section__text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-section__text small, .game-section__aside { color: var(--muted); }
.game-section__aside { flex: none; text-align: right; }
.game-section .is-due { color: var(--accent); font-weight: 600; }
.game-section .game-bar { margin-top: 3px; }
.game-bank-room { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; padding: 14px 18px; margin-bottom: 12px; }
.tab__count.is-full { color: var(--accent); font-weight: 700; }
.game-boss__stars { margin-left: 6px; color: var(--accent); letter-spacing: 1px; }

/* The living character: breathing from the feet, a blink now and then, the hair swaying a little. A cheer hops, tired
   breathes slower and sags. Layers lie on top of each other; nothing moves for people who want less motion. */
.game-alive { position: relative; display: block; transform-origin: 50% 100%; animation: game-breathe 4.2s ease-in-out infinite; }
.game-alive__blink { opacity: 0; animation: game-blink 5.3s linear infinite; }
.game-alive .game-pic__hair, .game-alive .game-pic__tint { transform-origin: 50% 14%; animation: game-sway 6.5s ease-in-out infinite; }
.game-alive.is-cheer { animation: game-cheer 0.6s ease-out 3, game-breathe 4.2s ease-in-out 1.8s infinite; }
.game-alive.is-tired { animation: game-tired 6.5s ease-in-out infinite; filter: saturate(0.85); }

@keyframes game-breathe {
    0%, 100% { transform: scale(1, 1); }
    45% { transform: scale(1.004, 1.012); }
}

@keyframes game-blink {
    0%, 93%, 97.5%, 100% { opacity: 0; }
    94.5%, 96% { opacity: 1; }
}

@keyframes game-sway {
    0%, 100% { transform: rotate(0deg); }
    30% { transform: rotate(0.5deg); }
    70% { transform: rotate(-0.4deg); }
}

@keyframes game-cheer {
    0%, 100% { transform: translateY(0) scale(1, 1); }
    35% { transform: translateY(-4%) scale(0.99, 1.02); }
    70% { transform: translateY(0) scale(1.02, 0.98); }
}

@keyframes game-tired {
    0%, 100% { transform: scale(1, 0.992); }
    50% { transform: scale(1.003, 1.004); }
}

@media (prefers-reduced-motion: reduce) {
    .game-alive, .game-alive__blink, .game-alive .game-pic__hair, .game-alive .game-pic__tint { animation: none; }
}

/* Active play (GameMomentPanel): moments drawn as animations on the server's clock (--show, --open, --window, --sweep
   are the moment's times from when it was first drawn). */
.game-moments { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3) var(--space-4); }
.game-moments__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.game-moments__head .icon { width: 1em; height: 1em; vertical-align: -0.12em; }
.game-moments__focus--on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); font-weight: 600; }
.game-moments__modes { display: flex; gap: var(--space-1); margin-left: auto; }

.game-moment { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.game-moment__label { font-weight: 600; font-size: var(--text-sm); }
.game-moment button:disabled { cursor: progress; }

/* Strike: a float bobs on the water; at the bite it dips and rings spread. Tap anywhere on the pool. */
.game-moment__pool {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2);
    width: 100%; min-height: 7rem; border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--accent) 6%, var(--surface-2)); color: var(--ink); cursor: pointer; overflow: hidden;
}
.game-moment__float { width: 2.4rem; height: 2.4rem; color: var(--accent); animation: game-moment-bob 1.6s ease-in-out infinite; }
.game-moment__ripple {
    position: absolute; left: 50%; top: 42%; width: 3rem; height: 3rem; margin: -1.5rem 0 0 -1.5rem;
    border: 2px solid var(--accent); border-radius: 50%; opacity: 0;
    animation: game-moment-ripple var(--window) ease-out var(--open) forwards;
}
.game-moment--strike .game-moment__float { animation: game-moment-bob 1.6s ease-in-out infinite, game-moment-dip var(--window) ease-out var(--open) forwards; }

/* Spot: a row of rocks (or embers, threads); one glows for a moment. */
.game-moment__spots { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; }
.game-moment__spot {
    display: grid; place-items: center; width: 3.2rem; height: 3.2rem; border: 1px solid var(--line); border-radius: var(--radius-md);
    background: var(--surface-2); color: var(--ink-muted); cursor: pointer;
}
.game-moment__spot .icon { width: 1.6rem; height: 1.6rem; }
.game-moment__spot--target { animation: game-moment-glow var(--window) linear var(--open) forwards; }

/* Meter: a marker sweeps once across the bar; the zone is where to tap. */
.game-moment__meter {
    display: flex; flex-direction: column; align-items: stretch; gap: var(--space-2); width: 100%; padding: var(--space-3);
    border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--ink); cursor: pointer;
}
.game-moment__track { position: relative; height: 14px; border-radius: var(--radius-pill); background: var(--surface); overflow: hidden; }
.game-moment__zone {
    position: absolute; top: 0; bottom: 0; left: var(--zone-from); width: var(--zone-width);
    background: color-mix(in srgb, var(--success) 55%, transparent);
}
.game-moment__marker {
    position: absolute; top: -2px; bottom: -2px; left: 0; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--ink);
    animation: game-moment-sweep var(--sweep) linear var(--show) forwards;
}

.game-moment__result { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; color: var(--ink-muted); font-size: var(--text-sm); }
.game-moment__result .icon { width: 1.1em; height: 1.1em; vertical-align: -0.15em; }
.game-moment__result--hit { color: var(--ink); }
.game-moment__result--hit > .icon:first-child { color: var(--accent); }
.game-moment__rare { color: var(--accent); font-weight: 600; }

@keyframes game-moment-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
@keyframes game-moment-dip {
    0% { translate: 0 10px; color: var(--success); }
    80% { translate: 0 8px; color: var(--success); }
    100% { translate: 0 0; }
}
@keyframes game-moment-ripple {
    0% { opacity: 1; transform: scale(0.6); }
    100% { opacity: 0; transform: scale(3); }
}
@keyframes game-moment-glow {
    0%, 85% { color: var(--bg); background: var(--warning); border-color: var(--warning); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 35%, transparent); }
    100% { color: var(--ink-muted); background: var(--surface-2); border-color: var(--line); box-shadow: none; }
}
@keyframes game-moment-sweep {
    from { left: 0; }
    to { left: 100%; }
}

@media (max-width: 640px) {
    .game-moments__modes { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    /* Only what's needed to play stays moving: the marker, the glow, the bite (without the bobbing). */
    .game-moment__float { animation: none; }
    .game-moment--strike .game-moment__float { animation: game-moment-dip var(--window) step-end var(--open) forwards; }
    .game-moment__ripple { animation-timing-function: step-end; }
}

/* ---------- Phase 8: the page's frame (docs/spiel-plan.md, phase 8, A) ----------
   "Running now" stays under the app's top bar while scrolling; the groups are one row of five big buttons (they fit a
   phone without scrolling), the tabs of the open group a row below; the overview is a grid of three cards. */

.game-nowbar {
    position: sticky;
    top: var(--game-sticky-top, 72px);
    z-index: 6;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}
.game-nowbar__row { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3); }
.game-nowbar__main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.game-nowbar__main.is-idle { cursor: default; }
.game-nowbar__icon { flex: none; width: 1.8rem; height: 1.8rem; color: var(--accent); stroke-width: 1.5; }
.game-nowbar__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.game-nowbar__name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.game-nowbar__skill { color: var(--ink-muted); font-size: var(--text-xs); }
.game-nowbar__text .game-bar { height: 6px; }
.game-nowbar__chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-1); }
.game-nowbar__chip { border: 0; font: inherit; font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
button.game-nowbar__chip { cursor: pointer; }
.game-nowbar__chip .icon { width: 1em; height: 1em; }
.game-nowbar__chip.is-due { background: var(--accent); color: var(--bg); }
.game-nowbar__chip.is-glow { color: var(--accent); }
.game-nowbar__tools { display: flex; align-items: center; gap: var(--space-1); flex: none; }
.game-nowbar__tools .secondary-button { margin: 0; }
.game-nowbar__toggle .icon { transition: transform var(--dur-fast); }
.game-nowbar.is-open .game-nowbar__toggle .icon { transform: rotate(180deg); }
.game-nowbar__more {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-height: 50vh;
    overflow-y: auto;
    padding: 0 var(--space-3) var(--space-3);
    border-top: 1px solid var(--line);
}
.game-nowbar__more > :first-child { margin-top: var(--space-3); }
.game-nowbar__more p { margin: 0; }

/* The five groups: icon over the name, the badge says how much waits there. */
.game-groups {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-1);
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.game-groups__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-height: 52px;
    padding: var(--space-1);
    border: 0;
    border-radius: 13px;
    background: none;
    color: var(--ink-muted);
    font: inherit;
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--dur-fast), color var(--dur-fast);
}
.game-groups__item .icon { width: 1.35rem; height: 1.35rem; }
.game-groups__item:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.game-groups__item.is-active { background: var(--accent); color: var(--bg); }
.game-groups__item > span:not(.game-groups__badge) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-groups__badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 1.5rem);
    min-width: 1.2rem;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--danger);
    color: #fff;
    font-size: 0.68rem;
    line-height: 1.2rem;
}

/* The open group's tabs: wrapping rows; the skills with a small heading per kind. */
.game-subtabs { flex-wrap: wrap; overflow-x: visible; width: fit-content; max-width: 100%; }
.game-subtabs .tab { display: inline-flex; align-items: center; gap: 6px; }
.game-subtabs__kind {
    flex-basis: 100%;
    padding: var(--space-1) var(--space-2) 0;
    color: var(--ink-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.game-panel { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }

/* The overview: running, ready, next – three cards side by side where there's room. */
.game-overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-3); }
.game-overview__card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); }
.game-overview__title { display: flex; align-items: center; gap: var(--space-2); margin: 0; font-size: var(--text-md); }
.game-overview__title .icon { color: var(--accent); }
.game-overview__card .muted { margin: 0; }
.game-overview__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.game-overview__line {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2);
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: var(--text-sm);
    text-align: left;
}
button.game-overview__line { cursor: pointer; }
button.game-overview__line:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.game-overview__line > .icon { flex: none; width: 1.3rem; height: 1.3rem; color: var(--accent); }
.game-overview__line > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.game-overview__line small { color: var(--ink-muted); font-size: var(--text-xs); }
.game-overview__line.is-quiet { color: var(--ink-muted); }
.game-overview__line.is-quiet > .icon { color: var(--ink-muted); }
.game-overview__line.is-due { background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 600; }
.game-overview__aside { margin-left: auto; white-space: nowrap; }

/* Welcome back: the best of it as tiles, the rest to open. */
.game-away__highlights { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-2); }
.game-away__tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    font-size: var(--text-sm);
}
.game-away__tile .icon { width: 1.4rem; height: 1.4rem; color: var(--ink-muted); }
.game-away__tile span { color: var(--ink-muted); }
.game-away__tile.is-special { border-color: var(--accent); }
.game-away__tile.is-special .icon { color: var(--accent); }
.game-away__more summary { cursor: pointer; color: var(--ink-muted); font-weight: 600; padding: var(--space-1) 0; }
.game-away__more[open] summary { margin-bottom: var(--space-2); }
.game-away h2:focus { outline: none; }

/* Wide screens: the page doesn't stretch past what reads well. */
@media (min-width: 1800px) {
    .page.game { max-width: 1600px; margin-inline: auto; }
}

@media (max-width: 560px) {
    .game-nowbar__row { flex-wrap: wrap; }
    .game-nowbar__main { flex: 1 1 0; }
    .game-nowbar__icon { width: 1.5rem; height: 1.5rem; }
    .game-nowbar__skill { display: none; }
    .game-nowbar__chips { order: 3; flex-basis: 100%; justify-content: flex-start; }
    .game-nowbar__chips:empty { display: none; }
    .game-groups__item { min-height: 48px; font-size: 0.66rem; }
    .game-subtabs .tab { padding: 6px 9px; font-size: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
    .game-nowbar__toggle .icon, .game-groups__item { transition: none; }
}

/* ---------- Phase 8: forged gear (docs/spiel-plan.md, phase 8, C) ----------
   Every rarity has its colour (tokens in components.css) and a shape of its own: dot, diamond, square, triangle, star;
   hidden pieces glow violet. The same classes colour the armoury, the worn slots and the reveal. */

.game-rarity--common, .game-piece--common { --rc: var(--rarity-common); }
.game-rarity--uncommon, .game-piece--uncommon { --rc: var(--rarity-uncommon); }
.game-rarity--rare, .game-piece--rare { --rc: var(--rarity-rare); }
.game-rarity--epic, .game-piece--epic { --rc: var(--rarity-epic); }
.game-rarity--legendary, .game-piece--legendary { --rc: var(--rarity-legendary); }
.game-rarity--hidden, .game-piece--hidden { --rc: var(--rarity-hidden); }

.game-rarity {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--rc);
    font-size: var(--text-xs);
    font-weight: 700;
    white-space: nowrap;
    vertical-align: middle;
}
.game-rarity__shape { flex: none; width: 0.62em; height: 0.62em; background: currentColor; }
.game-rarity--common .game-rarity__shape { border-radius: 50%; }
.game-rarity--uncommon .game-rarity__shape { transform: rotate(45deg) scale(0.85); }
.game-rarity--rare .game-rarity__shape { border-radius: 1px; }
.game-rarity--epic .game-rarity__shape { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.game-rarity--legendary .game-rarity__shape,
.game-rarity--hidden .game-rarity__shape {
    width: 0.8em;
    height: 0.8em;
    clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* A piece: a coloured frame and a stripe on top, so the rarity shows at a glance. */
.game-piece { position: relative; border-color: color-mix(in oklab, var(--rc) 55%, var(--line)); box-shadow: inset 0 3px 0 var(--rc); }
.game-piece.game-item:hover { border-color: var(--rc); }
.game-piece.is-active { border-color: var(--rc); box-shadow: inset 0 3px 0 var(--rc), 0 0 0 2px var(--rc); }
.game-piece .game-item__icon { color: var(--rc); }
.game-piece .game-item__name { color: var(--ink); font-weight: 600; }
.game-piece__marks { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; color: var(--ink-muted); }
.game-piece__marks .icon { width: 0.9rem; height: 0.9rem; }
.game-piece--hidden { box-shadow: inset 0 3px 0 var(--rc), 0 0 0 2px var(--rc), 0 0 16px color-mix(in oklab, var(--rc) 60%, transparent); animation: game-hidden-glow 3s ease-in-out infinite; }
.game-gear__slot.game-piece { box-shadow: inset 3px 0 0 var(--rc); }
.game-gear__slot .game-gear__icon { color: var(--rc, var(--accent)); }

@keyframes game-hidden-glow {
    50% { box-shadow: inset 0 3px 0 var(--rc), 0 0 0 2px var(--rc), 0 0 26px color-mix(in oklab, var(--rc) 80%, transparent); }
}

.game-pieces { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.game-armoury__head { flex-wrap: wrap; }
.game-armoury__tools { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-2); }
.game-armoury__tools .field { display: flex; flex-direction: column; gap: 2px; font-size: var(--text-xs); color: var(--ink-muted); }
.game-armoury__filters { gap: var(--space-1); }
.game-armoury__divider { width: 1px; align-self: stretch; margin: 0 var(--space-1); background: var(--line); }
.game-armoury__filters .chip--toggle.is-active .game-rarity { color: var(--bg); }
.game-armoury__bulk { align-self: flex-start; }

.game-piece-detail { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-color: var(--rc); box-shadow: inset 0 3px 0 var(--rc); }
.game-piece-detail__head { display: flex; align-items: center; gap: var(--space-3); }
.game-piece-detail__head > div { display: flex; flex-direction: column; gap: 2px; }
.game-piece-detail__head .game-item__icon { color: var(--rc); margin: 0; }
.game-piece-detail__lines { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 2px; font-size: var(--text-sm); }
.game-piece-detail p { margin: 0; }

/* The reveal: a card that turns round to show a very rare, legendary or hidden piece. */
.game-reveal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: var(--space-4); }
.game-reveal__backdrop { position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(4px); }
.game-reveal__card {
    position: relative;
    width: min(320px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-6) var(--space-5) var(--space-5);
    border: 2px solid var(--rc);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: 0 0 40px color-mix(in oklab, var(--rc) 45%, transparent), var(--shadow);
    text-align: center;
    animation: game-reveal-turn 0.9s var(--ease-out) both;
}
.game-reveal__card h2 { margin: 0; font-size: var(--text-xl); }
.game-reveal__kicker { color: var(--rc); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.game-reveal__icon { width: 4rem; height: 4rem; color: var(--rc); stroke-width: 1.3; }
.game-reveal__lines { margin: 0; padding: 0; list-style: none; color: var(--ink-muted); font-size: var(--text-sm); }
.game-reveal__card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(115deg, transparent 30%, color-mix(in oklab, var(--rc) 35%, transparent) 50%, transparent 70%);
    background-size: 250% 100%;
    animation: game-reveal-shine 1.6s 0.8s ease-out both;
    pointer-events: none;
}

@keyframes game-reveal-turn {
    0% { transform: perspective(800px) rotateY(90deg) scale(0.8); opacity: 0; }
    60% { transform: perspective(800px) rotateY(-12deg) scale(1.03); opacity: 1; }
    100% { transform: none; opacity: 1; }
}
@keyframes game-reveal-shine {
    from { background-position: 120% 0; }
    to { background-position: -120% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .game-piece--hidden { animation: none; }
    .game-reveal__card { animation: game-reveal-fade 0.3s ease both; }
    .game-reveal__card::after { display: none; }
}
@keyframes game-reveal-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Upgrading a piece: what it costs, the chance with its pity, the buttons. */
.game-upgrade { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border: 1px dashed color-mix(in oklab, var(--rc) 60%, var(--line)); border-radius: var(--radius-md); }
.game-upgrade > strong { display: flex; align-items: center; gap: var(--space-2); }
.game-upgrade > strong .icon { color: var(--rc); }
.game-upgrade .game-cost { margin: 0; }
.game-upgrade__chance { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-sm); font-weight: 600; }
.game-upgrade__chance .game-bar > span { background: var(--rc); }
.game-upgrade__buttons { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.game-upgrade__buttons > button { margin: 0; }

/* ---------- Arriving: the character creation as a talk with Oba-san (docs/spiel-plan.md, character creation C1) ---------- */

.game-arrival { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); max-width: 980px; margin-inline: auto; width: 100%; }
.game-arrival__head { display: flex; flex-direction: column; gap: var(--space-2); }
.game-arrival__head h2 { margin: 0; font-size: var(--text-xl); }
.game-arrival__head h2:focus { outline: none; }
.game-arrival__speech { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--surface-2); }
.game-arrival__speech p { margin: 0; font-style: italic; line-height: 1.5; }
.game-arrival__speech strong { display: block; font-style: normal; color: var(--accent); font-size: var(--text-sm); }
.game-arrival__speaker { flex: none; width: 2rem; height: 2rem; color: var(--accent); }
.game-arrival__prologue p { margin: 0 0 var(--space-3); line-height: 1.6; }
.game-arrival__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); }
.game-arrival__grid--small { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.game-arrival__race, .game-arrival__option {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-3);
    border: 2px solid var(--line);
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.game-arrival__race.is-active, .game-arrival__option.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.game-arrival__pic { position: relative; align-self: center; }
.game-arrival__pic .game-pic { width: 110px; border-radius: var(--radius-md); }
.game-arrival__soon { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); }
.game-figure__stage { position: relative; }
.game-figure__stage > .game-arrival__soon { bottom: var(--space-3); }
.game-arrival__traits { margin: 0; padding: 0; list-style: none; font-size: var(--text-xs); display: flex; flex-direction: column; gap: 1px; }
.game-arrival__traits .is-good { color: var(--success); }
.game-arrival__traits .is-bad { color: var(--danger); }
.game-arrival__quirk { font-style: italic; }
.game-arrival__icon { width: 1.6rem; height: 1.6rem; color: var(--accent); }
.game-arrival__look { display: grid; grid-template-columns: minmax(160px, 260px) 1fr; gap: var(--space-4); align-items: start; }
.game-arrival__choices { display: flex; flex-direction: column; gap: var(--space-2); }
.game-arrival__keywords { gap: var(--space-2); }
.game-arrival__origin { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3) var(--space-4); border-color: var(--accent); }
.game-arrival__origin p { margin: 0; font-style: italic; }
.game-arrival__values { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-2); max-width: 420px; }
.game-arrival__values li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.game-arrival__values small { margin-left: var(--space-2); }
.game-arrival__stepper { display: inline-flex; align-items: center; gap: var(--space-2); font-variant-numeric: tabular-nums; }
.game-arrival__stepper strong { min-width: 1.2em; text-align: center; }
.game-arrival__summary { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 2px; }
.game-arrival__nav { display: flex; justify-content: flex-end; gap: var(--space-2); }
.game-arrival__nav > button { margin: 0; }
.game-arrival__thought { margin: 0; font-style: italic; color: var(--ink-muted); }

/* The status window: like the half-transparent windows of the games one knew. */
.game-status { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-color: color-mix(in oklab, var(--accent) 50%, var(--line)); background: color-mix(in srgb, var(--surface) 88%, var(--accent)); }
.game-status__head { display: flex; flex-direction: column; gap: 2px; }
.game-status__head h2 { margin: 0; font-size: var(--text-xl); }
.game-status__title { color: var(--accent); font-weight: 600; font-size: var(--text-sm); }
.game-status__facts { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--space-4); margin: 0; font-size: var(--text-sm); }
.game-status__facts dt { color: var(--ink-muted); }
.game-status__facts dd { margin: 0; }
.game-status__values { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-2); }
.game-status__values li { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.game-status__values strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.game-status__kami summary { cursor: pointer; color: var(--ink-muted); font-size: var(--text-sm); }
.game-status__kami .chips { margin-top: var(--space-2); }
.game-status-sheet { display: flex; flex-direction: column; gap: var(--space-3); }

@media (max-width: 640px) {
    .game-arrival { padding: var(--space-4); }
    .game-arrival__look { grid-template-columns: 1fr; }
    .game-arrival__look .game-figure__stage { max-width: 220px; margin-inline: auto; }
}

/* Talents of the path (character creation C2): three branches side by side, ten tiers as small bars. */
.game-talents { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
.game-talents__head { display: flex; flex-direction: column; gap: 2px; }
.game-talents__head .game-figure__title { margin: 0; }
.game-talents__branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3); }
.game-talents__branch { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); }
.game-talents__branch.is-combat { border-style: dashed; }
.game-talents__branch > button { align-self: flex-start; margin-top: auto; }
.game-talents__tiers { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; }
.game-talents__tiers span { height: 6px; border-radius: var(--radius-pill); background: var(--surface-2); }
.game-talents__tiers span.is-on { background: var(--accent); }
.game-talents__cap { font-style: italic; }
.game-talents__dojo summary { cursor: pointer; color: var(--ink-muted); font-size: var(--text-sm); }
.game-talents__dojo p { margin: var(--space-2) 0; }

/* Quests and factions (character creation C3). */
.game-factions { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
.game-factions .game-figure__title { margin: 0; }
.game-factions__list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); }
.game-factions__list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-1) var(--space-2); }
.game-factions__list .icon { color: var(--accent); }
.game-factions__list .game-bar { grid-column: 1 / -1; }
.game-factions__name { display: flex; flex-direction: column; }
.game-factions__name small { color: var(--ink-muted); }
.game-quests { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-3); }
.game-quest { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); }
.game-quest > .primary-button { align-self: flex-start; }
.game-quest__thought { margin: 0; font-style: italic; }
.game-quest__choices { display: grid; gap: var(--space-2); }
.game-quest__choice { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3); border: 1px solid var(--line); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.game-quest__choice:hover:not(:disabled) { border-color: var(--accent); }
.game-quest__final { align-self: flex-start; color: var(--warning); }
.game-quests__done summary { cursor: pointer; color: var(--ink-muted); }
.game-status__pick { align-self: flex-start; }

/* The own character's introductions (phase 8, step 5): a small face and a speech bubble. */
.game-intro { display: flex; align-items: flex-end; gap: var(--space-3); margin-bottom: var(--space-4); }
.game-intro__face { flex: none; width: 56px; height: 56px; border-radius: var(--radius-pill); overflow: hidden; background: var(--surface-2); }
.game-intro__bubble { position: relative; display: flex; flex-direction: column; gap: var(--space-2); max-width: 640px; padding: var(--space-3) var(--space-4);
    border: 1px solid var(--line); border-radius: var(--radius-lg); border-bottom-left-radius: var(--radius-sm); background: var(--surface); }
.game-intro__bubble p { margin: 0; }
.game-intro__bubble em { color: var(--ink-muted); }
.game-intro__bubble .text-button { align-self: flex-end; }
.game-intro__again { float: right; margin: 0 0 var(--space-2) var(--space-2); color: var(--ink-muted); }
@media (prefers-reduced-motion: no-preference) {
    .game-intro__bubble { animation: game-intro-in 240ms ease-out; }
    @keyframes game-intro-in { from { opacity: 0; transform: translateY(6px); } }
}

/* Devices (phase 8, step 5). Wide screens: the village gets room, but never more than 1,600 px; the overview runs in
   three columns. A Fold opened (about 700–900 px) and tablets keep two columns of cards. */
@media (min-width: 1500px) {
    .page.game { max-width: 1600px; }
    .game-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 640px) and (max-width: 1023px) {
    .game-overview, .game-quests { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
    .game-intro { gap: var(--space-2); }
    .game-intro__face { width: 40px; height: 40px; }
}

/* Companions, the household contest and the game's push switches (phase 8, step 6). */
.game-companions, .game-contest { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
.game-companions .game-figure__title { margin: 0; }
.game-companions__list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-2); }
.game-companions__item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); }
.game-companions__item.is-going { border-color: var(--accent); }
.game-companions__item.is-locked { opacity: 0.6; }
.game-companions__icon { flex: none; width: 2rem; height: 2rem; color: var(--accent); }
.game-companions__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.game-companions__text small { color: var(--ink-muted); }
.game-companions__feed { display: flex; flex-direction: column; gap: var(--space-2); }
.game-companions__feed p { margin: 0; }
.game-contest__title { margin: 0; font-size: var(--text-md); }
.game-contest__standings { margin: 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-1); }
.game-contest__standings li { display: flex; justify-content: space-between; gap: var(--space-3); font-variant-numeric: tabular-nums; }
.game-contest__standings li.is-me { color: var(--accent); }
.game-contest p { margin: 0; }
.game-pushes { padding: var(--space-3) var(--space-4); }
.game-pushes summary { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; font-weight: 600; }
.game-pushes p { margin: var(--space-2) 0; }
.game-pushes__list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-2); }
.game-pushes__switch { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; }

/* The game's statistics (phase 8, step 7). */
.game-stats { display: flex; flex-direction: column; gap: var(--space-3); }
.game-stats__tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.game-stats__tile { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3) var(--space-4); }
.game-stats__tile strong { font-size: var(--text-xl); font-variant-numeric: tabular-nums; }
.game-stats__tile span { color: var(--ink-muted); font-size: var(--text-sm); }
.game-stats__chart, .game-stats__table { padding: var(--space-4); }
.game-stats__table summary { cursor: pointer; color: var(--ink-muted); }
.game-stats__table table { width: 100%; margin-top: var(--space-3); border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: var(--text-sm); }
.game-stats__table th, .game-stats__table td { padding: var(--space-1) var(--space-2); text-align: right; border-bottom: 1px solid var(--line); }
.game-stats__table th[scope="row"], .game-stats__table thead th:first-child { text-align: left; font-weight: 400; }
.game-stats__rarities { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); }
.game-stats__rarities li { display: flex; align-items: center; gap: var(--space-2); font-variant-numeric: tabular-nums; }
.game-stats__totals { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-2) var(--space-5); }
.game-stats__totals div { display: flex; justify-content: space-between; gap: var(--space-3); border-bottom: 1px solid var(--line); padding-bottom: var(--space-1); }
.game-stats__totals dt { color: var(--ink-muted); }
.game-stats__totals dd { margin: 0; font-variant-numeric: tabular-nums; }

/* Wrapped: your year in Hoshimura – the sea at dusk. */
.wrapped__card--hoshimura { --w1: #0e2a3a; --w2: #2f7d8c; --w3: #f2c46d; }

/* The village map (phase 8, step 8): all colours from the theme, mixed – light and dark themes both work. The few
   nature hues (grass, sea, sun) have no token, so they're mixed into the surface instead of standing alone. */
.game-map { margin: 0; padding: 0; overflow: hidden; }
.game-map svg { display: block; width: 100%; height: auto; max-height: 420px; }
.game-map figcaption { padding: var(--space-2) var(--space-4); }
.game-map {
    --map-sky: color-mix(in srgb, #8fc6e8 38%, var(--surface));
    --map-land: color-mix(in srgb, #6d9f58 40%, var(--surface));
    --map-mountain: color-mix(in srgb, var(--ink-muted) 35%, var(--surface));
    --map-sea: color-mix(in srgb, #3c7fb0 55%, var(--surface));
    --map-beach: color-mix(in srgb, #e3c98d 50%, var(--surface));
    --map-wall: color-mix(in srgb, #f1e6d0 75%, var(--surface));
    --map-roof: color-mix(in srgb, var(--accent) 70%, var(--ink));
    --map-line: color-mix(in srgb, var(--ink) 55%, transparent);
    --map-light: var(--accent);
}
.game-map.is-night {
    --map-sky: color-mix(in srgb, #0b1030 80%, var(--bg));
    --map-land: color-mix(in srgb, #2c4a32 65%, var(--bg));
    --map-mountain: color-mix(in srgb, #1b2036 70%, var(--bg));
    --map-sea: color-mix(in srgb, #12304e 75%, var(--bg));
    --map-beach: color-mix(in srgb, #4d4430 60%, var(--bg));
    --map-wall: color-mix(in srgb, #8a7f6c 45%, var(--bg));
}
.game-map__sky { fill: var(--map-sky); }
.game-map__sun { fill: color-mix(in srgb, #ffd36e 80%, var(--surface)); }
.game-map__moon { fill: color-mix(in srgb, #f3edd8 90%, var(--bg)); }
.game-map__star { fill: color-mix(in srgb, #ffffff 80%, transparent); }
.game-map__mountain { fill: var(--map-mountain); }
.game-map__mountain.is-far { fill: color-mix(in srgb, var(--map-mountain) 60%, var(--map-sky)); }
.game-map__hill, .game-map__land { fill: var(--map-land); }
.game-map__beach { fill: var(--map-beach); }
.game-map__sea { fill: var(--map-sea); }
.game-map__wave, .game-map__path, .game-map__pier, .game-map__mast, .game-map__torii, .game-map__townwall, .game-map__garland, .game-map__field,
.game-map__helper path { fill: none; stroke: var(--map-line); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.game-map__wave { stroke: color-mix(in srgb, #ffffff 55%, transparent); }
.game-map__path { stroke: color-mix(in srgb, var(--map-beach) 70%, var(--map-land)); stroke-width: 7; }
.game-map__torii { stroke: var(--danger); stroke-width: 3.5; }
.game-map__townwall { stroke-width: 4; }
.game-map__field { stroke: color-mix(in srgb, #6d9f58 70%, var(--ink)); stroke-width: 3; }
.game-map__wall, .game-map__hut, .game-map__rock { fill: var(--map-wall); stroke: var(--map-line); stroke-width: 1.5; stroke-linejoin: round; }
.game-map__rock { fill: var(--map-mountain); }
.game-map__cave, .game-map__door { fill: color-mix(in srgb, var(--ink) 70%, var(--map-wall)); }
.game-map__roof, .game-map__boat { fill: var(--map-roof); stroke: var(--map-line); stroke-width: 1.5; stroke-linejoin: round; }
.game-map__lean-to { fill: none; stroke: var(--map-line); stroke-width: 2.5; stroke-linecap: round; }
.game-map__fire { fill: var(--warning); }
.game-map__window { fill: color-mix(in srgb, var(--ink) 30%, var(--map-wall)); }
.game-map__window.is-lit { fill: var(--map-light); }
.game-map__lantern { fill: var(--danger); stroke: var(--map-line); stroke-width: 1; }
.game-map.is-night .game-map__lantern { fill: var(--warning); }
.game-map__sign, .game-map__trophy g { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.game-map__pip { fill: var(--accent); }
.game-map__plinth { fill: var(--map-wall); stroke: var(--map-line); }
.game-map__trophy g { stroke: var(--warning); }
.game-map__count { fill: var(--ink); font-size: 12px; font-weight: 700; }
.game-map__building { cursor: pointer; outline: none; }
.game-map__building:hover .game-map__wall, .game-map__building:focus-visible .game-map__wall { stroke: var(--accent); stroke-width: 2.5; }
.game-map__building:focus-visible .game-map__sign { stroke: var(--accent); }
.game-map__helper circle { fill: var(--map-roof); }
.game-map__helper { transform: translate(var(--walk-from), 330px); }
@media (prefers-reduced-motion: no-preference) {
    .game-map__helper { animation: game-map-walk 14s linear infinite alternate; animation-delay: var(--walk-delay); }
    .game-map__fire { animation: game-map-flicker 1.6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: bottom; }
    @keyframes game-map-walk { from { transform: translate(var(--walk-from), 332px); } to { transform: translate(calc(var(--walk-from) + 160px), 318px); } }
    @keyframes game-map-flicker { from { transform: scaleY(1); } to { transform: scaleY(1.18); } }
}

/* The pilgrimage (phase 8, step 9). */
.game-pilgrimage { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
.game-pilgrimage .game-figure__title, .game-pilgrimage p { margin: 0; }
.game-pilgrimage > .secondary-button { align-self: flex-start; }
.game-pilgrimage__lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-3); }
.game-pilgrimage__lists ul { margin: var(--space-1) 0 0; padding-left: var(--space-5); color: var(--ink-muted); }
.game-pilgrimage__confirm { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--warning); border-radius: var(--radius-md); }
