/* In-game HUD, panels and touch controls for /play. The landing and login
   screens live in styles.css and are intentionally untouched here. */

.page-game {
  --glass: linear-gradient(160deg, rgba(31, 60, 80, .94), rgba(13, 29, 45, .94));
  --gold-line: #f1d18a;
  --hud-shadow: 0 5px 0 rgba(8, 15, 27, .55), 0 10px 24px rgba(4, 10, 18, .28);
  --hud-text: #fff4d6;
  --hud-muted: #c6d9d6;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

.game-shell { position: relative; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; background: #101820; }
.game-canvas { position: absolute; inset: 0; width: 100vw; height: 100vh; height: 100dvh; outline: none; }
.game-canvas canvas { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.brand-chip, .player-chip, .perspective-toggle, .resource-strip, .quest-card, .social-card, .game-dock, .control-hint, .controls-help {
  border: 3px solid var(--gold-line);
  background: var(--glass);
  box-shadow: var(--hud-shadow);
  color: var(--hud-text);
}

/* ——— Header ——— */
.adventure-header { position: absolute; top: calc(14px + var(--safe-top)); left: calc(16px + var(--safe-left)); right: calc(16px + var(--safe-right)); z-index: 20; display: flex; align-items: center; gap: 10px; pointer-events: none; }
.adventure-header > * { pointer-events: auto; }
.brand-chip { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px 0 6px; border-radius: 13px; font-size: 1rem; font-weight: 1000; }
.brand-mark { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; background: linear-gradient(#ffdd63, #e78b35); color: #263449; box-shadow: inset 0 -4px rgba(136, 72, 36, .25); }
.brand-chip:hover, .brand-chip:focus-visible { filter: brightness(1.1); }
.player-chip { display: flex; align-items: center; gap: 9px; height: 46px; padding: 4px 14px 4px 6px; border-radius: 13px; pointer-events: none; }
.mini-avatar { display: grid; width: 32px; height: 32px; place-items: center; border: 2px solid #fff0b5; border-radius: 50%; background: #ed7664; font-size: 17px; }
.mini-avatar[data-palette="lagoon"] { background: #45a9c8; }
.mini-avatar[data-palette="moss"] { background: #6fa659; }
.mini-avatar[data-palette="violet"] { background: #866cb4; }
.player-chip > span:last-child { display: grid; line-height: 1.05; }
.player-chip strong { font-size: .95rem; }
.player-chip small { margin-top: 3px; color: #b9cfcc; font-size: .64rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.resource-strip { margin-left: auto; display: flex; height: 46px; align-items: center; gap: 4px; padding: 4px; border-radius: 13px; pointer-events: none; }
.resource-strip span { display: flex; align-items: center; gap: 6px; min-width: 62px; height: 32px; padding: 0 11px; border-radius: 9px; background: rgba(255, 255, 255, .08); font-size: .98rem; }
.resource-strip b { font-size: 1rem; font-weight: 400; }
.perspective-toggle { display: flex; height: 46px; align-items: center; gap: 7px; padding: 0 12px; border-radius: 13px; cursor: pointer; }
.perspective-toggle span { color: #f3d579; font-size: 19px; font-weight: 1000; }
.perspective-toggle small { font-size: .64rem; font-weight: 1000; letter-spacing: .05em; text-transform: uppercase; }
.perspective-toggle:hover, .perspective-toggle:focus-visible { background: linear-gradient(145deg, rgba(56, 99, 103, .98), rgba(21, 59, 67, .98)); }
.perspective-toggle:focus-visible, .brand-chip:focus-visible, .game-dock button:focus-visible, .controls-help:focus-visible { outline: 3px solid #fff7a8; outline-offset: 2px; }

/* ——— Trail tracker and room card ——— */
.quest-card { position: absolute; left: calc(16px + var(--safe-left)); top: calc(76px + var(--safe-top)); z-index: 20; display: grid; width: 272px; padding: 11px 14px 12px; border-radius: 13px; line-height: 1.2; cursor: default; }
.quest-kicker { color: #f3d579; font-size: .64rem; font-weight: 1000; letter-spacing: .13em; text-transform: uppercase; }
.quest-card strong { margin: 3px 0 2px; font-size: 1rem; }
.quest-card > span:not(.quest-kicker) { color: var(--hud-muted); font-size: .78rem; font-weight: 700; line-height: 1.3; }
.quest-progress { height: 7px; margin-top: 9px; overflow: hidden; border-radius: 8px; background: #0b1e2b; box-shadow: inset 0 1px 0 rgba(0, 0, 0, .4); }
.quest-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #73c968, #f0d65f); transition: width .5s ease; }
.quest-card[data-complete="true"] .quest-kicker::after { content: " · complete"; color: #9be39a; }

.social-card { position: absolute; right: calc(16px + var(--safe-right)); top: calc(76px + var(--safe-top)); z-index: 20; display: grid; width: 236px; gap: 7px; padding: 9px 12px; border-radius: 13px; line-height: 1.2; cursor: pointer; transition: opacity .3s; }
.social-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.social-head strong { color: #fff2c5; font-size: .92rem; }
.social-head small { padding: 3px 8px; border-radius: 20px; background: rgba(125, 239, 162, .14); color: #8ff0ae; font-size: .66rem; font-weight: 900; white-space: nowrap; }
.social-head small::before { content: "● "; }
.social-feed { display: grid; gap: 5px; }
.social-feed span { padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, .07); color: var(--hud-muted); font-size: .72rem; font-weight: 800; }
.social-card.collapsed .social-feed { display: none; }
.social-card.collapsed { opacity: .92; }

/* ——— Arrival banner and objective pointer ——— */
.location-banner { position: absolute; left: 50%; top: 21%; z-index: 18; display: grid; justify-items: center; gap: 4px; padding: 12px 34px 14px; transform: translateX(-50%); border-radius: 16px; background: linear-gradient(90deg, transparent, rgba(12, 26, 40, .78) 18%, rgba(12, 26, 40, .78) 82%, transparent); color: #fff4d6; text-align: center; pointer-events: none; }
.location-banner[hidden] { display: none; }
.location-banner strong { font-size: clamp(1.5rem, 3.2vw, 2.3rem); font-weight: 1000; letter-spacing: .02em; text-shadow: 0 3px 0 #3a2418; }
.location-banner small { color: #f3d579; font-size: .72rem; font-weight: 1000; letter-spacing: .14em; text-transform: uppercase; }
.location-banner.show { animation: banner 2.6s ease both; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, 10px); } 12%, 78% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -6px); } }

.objective-arrow { position: absolute; left: 0; top: 0; z-index: 17; width: 0; height: 0; pointer-events: none; }
.objective-arrow[hidden] { display: none; }
.objective-arrow i { position: absolute; left: -19px; top: -19px; width: 38px; height: 38px; border: 3px solid #fff0b5; border-radius: 50%; background: #f3c343; box-shadow: 0 4px 0 #8d4e2d, 0 0 18px rgba(255, 220, 110, .55); }
.objective-arrow i::after { content: ""; position: absolute; left: 50%; top: 50%; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 13px solid #3b2a2c; transform: translate(-35%, -50%); }
.objective-arrow span { position: absolute; left: 26px; top: -13px; padding: 4px 9px; border: 2px solid #f1d18a; border-radius: 9px; background: rgba(13, 29, 42, .92); color: #fff4d6; font-size: .74rem; font-weight: 900; white-space: nowrap; }
.objective-arrow.label-left span { left: auto; right: 26px; }

/* ——— Dock, prompt, toast ——— */
.game-dock { position: absolute; left: 50%; bottom: calc(16px + var(--safe-bottom)); z-index: 20; display: flex; gap: 4px; padding: 6px; transform: translateX(-50%); border-radius: 17px; }
.game-dock button { position: relative; display: grid; width: 64px; min-height: 56px; place-items: center; align-content: center; gap: 1px; border: 0; border-radius: 11px; background: rgba(255, 255, 255, .06); color: #f8edce; cursor: pointer; transition: transform .12s, background .12s; }
.game-dock button:hover { background: rgba(255, 223, 132, .18); transform: translateY(-2px); }
.game-dock button:active { transform: translateY(1px); }
.game-dock button span { font-size: 22px; line-height: 1.1; }
.game-dock button small { font-size: .62rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
/* Pulse with light only: a moving button is hard to tap and never "stable". */
.game-dock button.needs-attention { background: rgba(255, 214, 90, .22); animation: attention 1.2s ease-in-out infinite; }
.game-dock button.needs-attention::after { content: "!"; position: absolute; right: 4px; top: 3px; display: grid; width: 17px; height: 17px; place-items: center; border-radius: 50%; background: #ffd24a; color: #3b2a2c; font-size: .7rem; font-weight: 1000; }
@keyframes attention { 0%, 100% { box-shadow: inset 0 0 0 2px #ffd24a; } 50% { box-shadow: inset 0 0 0 2px #fff3b0, 0 0 16px 3px rgba(255, 210, 74, .75); } }

.interaction-prompt { position: absolute; left: 50%; bottom: calc(100px + var(--safe-bottom)); z-index: 25; display: flex; align-items: center; gap: 9px; padding: 7px 14px 7px 7px; transform: translateX(-50%); border: 2px solid #fff0b5; border-radius: 12px; background: rgba(13, 29, 42, .95); box-shadow: 0 4px 0 rgba(0, 0, 0, .35); color: #fff5d4; font-weight: 900; white-space: nowrap; pointer-events: none; animation: prompt-in .16s ease-out; }
@keyframes prompt-in { from { opacity: 0; transform: translate(-50%, 6px); } }
.interaction-prompt[hidden], .game-toast[hidden] { display: none; }
.interaction-prompt kbd, .control-hint kbd { display: inline-grid; min-width: 26px; place-items: center; padding: 3px 7px; border: 2px solid #e9ca82; border-radius: 7px; background: #f5e4b5; color: #26394b; box-shadow: 0 2px #805d36; font-family: inherit; font-weight: 1000; }

.game-toast { position: absolute; left: 50%; top: calc(80px + var(--safe-top)); z-index: 60; max-width: min(520px, calc(100vw - 32px)); padding: 11px 18px; transform: translateX(-50%); border: 3px solid #f1d18a; border-radius: 12px; background: #172f42; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); color: #fff1c4; font-weight: 900; text-align: center; animation: toast-in .25s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }

.control-hint { position: absolute; right: calc(16px + var(--safe-right)); bottom: calc(16px + var(--safe-bottom)); z-index: 19; padding: 8px 12px; border-radius: 12px; color: #c5d8d9; font-size: .72rem; font-weight: 800; line-height: 2.1; pointer-events: none; transition: opacity .4s, transform .4s; }
.control-hint kbd { min-width: 0; padding: 1px 6px; margin-right: 3px; font-size: .66rem; }
.control-hint.learned { opacity: 0; transform: translateY(8px); }
.controls-help { position: absolute; right: calc(16px + var(--safe-right)); bottom: calc(16px + var(--safe-bottom)); z-index: 19; display: none; width: 38px; height: 38px; border-radius: 50%; font-weight: 1000; cursor: pointer; }
.control-hint.learned + .controls-help { display: grid; place-items: center; }
.page-game .version-label { display: none; }

/* ——— Touch controls ——— */
.touch-controls { position: absolute; right: 18px; left: 18px; bottom: 18px; z-index: 22; display: none; align-items: flex-end; justify-content: space-between; pointer-events: none; }
.touch-stick { position: relative; width: 112px; height: 112px; border: 3px solid rgba(233, 202, 130, .9); border-radius: 50%; background: radial-gradient(circle, rgba(30, 60, 80, .75), rgba(14, 35, 51, .82)); box-shadow: 0 5px 0 rgba(0, 0, 0, .38), inset 0 0 0 12px rgba(255, 255, 255, .035); touch-action: none; user-select: none; -webkit-user-select: none; pointer-events: auto; }
.touch-stick::before, .touch-stick::after { content: ""; position: absolute; inset: 50% auto auto 50%; background: rgba(255, 236, 180, .2); transform: translate(-50%, -50%); pointer-events: none; }
.touch-stick::before { width: 2px; height: 74px; }
.touch-stick::after { width: 74px; height: 2px; }
.touch-stick.active { border-color: #fff0ae; }
.touch-stick i { position: absolute; left: 50%; top: 50%; z-index: 2; width: 50px; height: 50px; border: 3px solid #fff0ae; border-radius: 50%; background: linear-gradient(#4a7590, #1d4058); box-shadow: 0 4px 0 #071725; transform: translate(-50%, -50%); transition: transform 70ms linear; pointer-events: none; }
.touch-action { display: grid; width: 76px; height: 76px; margin-bottom: 8px; place-items: center; align-content: center; gap: 0; border: 3px solid #fff0ae; border-radius: 50%; background: linear-gradient(#ffd969, #d88738); box-shadow: 0 5px 0 #7e472d; color: #26384a; font-weight: 1000; text-transform: uppercase; touch-action: manipulation; pointer-events: auto; }
.touch-action span { font-size: 22px; line-height: 1; }
.touch-action small { font-size: .6rem; }
.touch-action:active { transform: translateY(3px); box-shadow: 0 2px 0 #7e472d; }

/* ——— Dialogs ——— */
.game-dialog { width: min(760px, calc(100vw - 32px)); max-height: 90vh; max-height: calc(100dvh - 32px); overflow: auto; padding: 0; border: 4px solid #f0d38e; border-radius: 22px; background: linear-gradient(155deg, #23465c, #10293e 70%); box-shadow: 0 12px 0 #081726, 0 26px 80px rgba(0, 0, 0, .58); color: #fff1ce; overscroll-behavior: contain; }
.game-dialog[open] { animation: dialog-in .2s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.game-dialog[data-tone="nature"], .game-dialog[data-tone="meadow"] { background: linear-gradient(155deg, #2c5a4a, #13332e 72%); }
.game-dialog[data-tone="battle"] { background: linear-gradient(155deg, #2b4a3d, #142a26 55%, #1f2438); }
.game-dialog[data-tone="victory"], .game-dialog[data-tone="hatch"] { background: radial-gradient(circle at 50% 18%, #3d6372, #13304a 62%); }
.game-dialog::backdrop { background: rgba(4, 13, 23, .62); backdrop-filter: blur(4px); }
.dialog-close { position: absolute; right: 13px; top: 11px; z-index: 3; width: 44px; height: 44px; border: 2px solid #ddc58d; border-radius: 10px; background: #1b3449; color: #ffe6aa; font-size: 25px; font-weight: 900; cursor: pointer; }
.dialog-close:hover { background: #26475f; }
.game-dialog small, .menu-panel > small, .activity-panel > small, .battle-panel > small, .expedition-panel > small, .victory-panel > small, .pet-discovery > small, .hatch-panel > small, .dialog-hero small { color: #f3d579; font-size: .68rem; font-weight: 1000; letter-spacing: .13em; text-transform: uppercase; }
.game-dialog h1 { margin: 5px 0 9px; font-size: clamp(1.6rem, 4vw, 2.5rem); line-height: 1; }
.game-dialog p { color: #c8dcda; line-height: 1.5; }
.dialog-hero { display: flex; gap: 18px; padding: 28px 30px 12px; align-items: center; }
.dialog-hero > span { font-size: 58px; }
.creator-form { display: grid; gap: 18px; padding: 12px 30px 30px; }
.creator-form label { display: grid; gap: 7px; color: #f4dfa8; font-weight: 900; }
.creator-form input, .pet-name-field input { height: 52px; border: 3px solid #bf9866; border-radius: 10px; background: #fff0c9; color: #2e3740; padding: 0 14px; font-size: 1.08rem; font-weight: 800; outline: 0; }
.creator-form input:focus-visible, .pet-name-field input:focus-visible { border-color: #ffe178; box-shadow: 0 0 0 3px rgba(255, 225, 120, .35); }
.creator-form fieldset { border: 0; padding: 0; margin: 0; }
.creator-form legend { margin-bottom: 9px; color: #f4dfa8; font-weight: 900; }
.choice-grid { display: flex; gap: 10px; }
.avatar-choice, .palette-choice { width: 64px; height: 58px; border: 3px solid #668097; border-radius: 12px; background: #142c41; font-size: 28px; cursor: pointer; }
.avatar-choice.selected, .palette-choice.selected { border-color: #ffe178; box-shadow: 0 0 0 3px rgba(255, 225, 120, .22); transform: translateY(-2px); }
.palette-choice { position: relative; }
.palette-choice::after { content: ""; position: absolute; inset: 9px; border-radius: 8px; background: var(--swatch); }
.adventure-button { display: flex; width: 100%; min-height: 54px; align-items: center; justify-content: center; gap: 9px; border: 3px solid #fff0a7; border-radius: 11px; background: linear-gradient(#ffe66e, #edaa3b); box-shadow: 0 5px 0 #8d4e2d; color: #273342; font: inherit; font-weight: 1000; text-transform: uppercase; cursor: pointer; }
.adventure-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.adventure-button:active { transform: translateY(2px); box-shadow: 0 3px 0 #8d4e2d; }
.adventure-button:disabled, .adventure-button.claimed { filter: saturate(.45); cursor: default; transform: none; }
.adventure-button:focus-visible { outline: 3px solid #fff7a8; outline-offset: 3px; }

.portrait { display: block; width: 100%; height: 100%; }
.pet-discovery, .activity-panel, .battle-panel, .expedition-panel, .victory-panel, .hatch-panel, .menu-panel { padding: 32px 34px; text-align: center; }
.discovery-glow { display: grid; width: 160px; height: 160px; margin: 0 auto 14px; padding: 18px; place-items: center; border-radius: 50%; background: radial-gradient(#d9f78e, #77bb72 45%, rgba(82, 161, 117, .05) 70%); animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.trait-row, .reward-preview { display: flex; justify-content: center; gap: 9px; margin: 16px 0; flex-wrap: wrap; }
.trait-row span, .reward-preview span { padding: 8px 12px; border: 2px solid #8ba58c; border-radius: 20px; background: #173a3d; font-weight: 800; }
.pet-name-field { display: grid; max-width: 340px; margin: 18px auto; gap: 6px; text-align: left; color: #f4dfa8; font-weight: 900; }

.chime-field { position: relative; height: 260px; margin: 20px 0 12px; border: 4px solid #78a866; border-radius: 18px; background: linear-gradient(#8fd3e2 0 40%, #79b961 40%); overflow: hidden; }
.chime-field::before { content: ""; position: absolute; left: -5%; right: -5%; top: 32%; height: 22%; border-radius: 50% 50% 0 0; background: #5f9f52; }
.chime-field::after { content: ""; position: absolute; inset: auto 0 0; height: 45%; background: radial-gradient(circle at 20% 60%, #f7db61 0 4px, transparent 5px), radial-gradient(circle at 70% 40%, #e994bb 0 5px, transparent 6px), radial-gradient(circle at 45% 80%, #fff4dc 0 4px, transparent 5px); background-size: 70px 60px; }
.chime-pet { position: absolute; left: 50%; bottom: 10px; z-index: 1; width: 86px; height: 86px; transform: translateX(-50%); animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translate(-50%, -6px); } }
.chime-field button { position: absolute; left: var(--x); top: var(--y); z-index: 2; width: 58px; height: 58px; border: 3px solid #fff3a4; border-radius: 50%; background: #f4cf4f; color: #63413a; font-size: 28px; font-weight: 1000; box-shadow: 0 0 24px #fff6a8; cursor: pointer; animation: note-float 1.2s infinite alternate; transition: opacity .3s, transform .3s; }
.chime-field button.caught { opacity: 0; transform: scale(1.7); }
.chime-score { display: inline-block; padding: 6px 14px; border-radius: 20px; background: rgba(0, 0, 0, .25); color: #ffe38a; }
@keyframes note-float { to { translate: 0 -8px; } }

.battle-stage { display: flex; align-items: center; justify-content: center; gap: 28px; margin: 14px 0; }
.battler { display: grid; width: 200px; gap: 6px; justify-items: center; }
.battler .portrait { width: 96px; height: 96px; }
.battler.enemy .portrait { animation: bob-small 1.6s ease-in-out infinite; }
.battler.hero .portrait { animation: bob-small 1.3s ease-in-out infinite reverse; }
@keyframes bob-small { 50% { transform: translateY(-4px); } }
.battler i { width: 100%; height: 12px; overflow: hidden; border: 2px solid #0c1e2c; border-radius: 10px; background: #1a2630; }
.battler i b { display: block; height: 100%; background: linear-gradient(90deg, #64bd66, #a7e17e); transition: width .25s; }
.battler.enemy i b { background: linear-gradient(90deg, #e2735f, #f2b36b); }
.battler small { color: #cfe0dd; letter-spacing: 0; }
.battle-versus { color: #f4ce68; font-size: 1.4rem; font-weight: 1000; transform: rotate(-7deg); }
.energy { margin: 8px; color: #f4cf5f; font-weight: 1000; }
.energy span { letter-spacing: .15em; }
.card-hand, .deck-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.battle-card, .deck-grid article { position: relative; display: grid; min-height: 150px; place-items: center; padding: 12px 8px; border: 3px solid #e1c487; border-radius: 12px; background: linear-gradient(#345b71, #1c3a50); color: #fff0c5; font: inherit; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.battle-card:hover { transform: translateY(-8px); box-shadow: 0 10px 20px rgba(0, 0, 0, .35); }
.battle-card > span, .deck-grid article > span { font-size: 35px; }
.battle-card small { color: #bfd1d1; font-size: .67rem; }
.battle-card b { position: absolute; right: 6px; top: 6px; display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: #f1c851; color: #273442; }
.battle-card:disabled { opacity: .5; transform: none; }

.expedition-icon, .victory-panel > span { display: block; font-size: 82px; margin-bottom: 10px; }
.expedition-portrait, .reveal-portrait { width: 120px; height: 120px; margin: 0 auto 10px; }
.expedition-portrait.walking { animation: walking 1s infinite alternate ease-in-out; }
@keyframes walking { from { transform: translateX(-24px); } to { transform: translateX(24px); } }
.reveal-portrait { width: 150px; height: 150px; animation: pulse 1.6s infinite; }
.idle-timer { display: grid; width: 130px; height: 130px; margin: 24px auto; place-items: center; border: 8px solid #efcf68; border-radius: 50%; background: #17384b; font-size: 2.2rem; font-weight: 1000; box-shadow: 0 0 35px rgba(239, 207, 104, .2); }
.egg-orbit { position: relative; display: grid; width: 180px; height: 180px; margin: 0 auto 18px; place-items: center; border-radius: 50%; background: radial-gradient(#efffc1, #6bc0b4 35%, transparent 68%); }
.egg-orbit .portrait { width: 110px; height: 110px; animation: egg-wiggle .7s infinite alternate; }
.egg-orbit i { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #fff1a0; box-shadow: 0 0 15px #fff; animation: orbit 3s linear infinite; }
.egg-orbit i:nth-of-type(2) { animation-delay: -1s; }
.egg-orbit i:nth-of-type(3) { animation-delay: -2s; }
@keyframes orbit { from { transform: rotate(0deg) translateX(80px); } to { transform: rotate(360deg) translateX(80px); } }
@keyframes egg-wiggle { to { transform: rotate(7deg) scale(1.03); } }
.hatch-reveal { background: radial-gradient(circle at 50% 30%, rgba(255, 245, 156, .22), transparent 45%); }

.pet-roster, .inventory-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 22px 0; }
.pet-roster article, .inventory-grid article { display: flex; align-items: center; gap: 13px; min-height: 86px; padding: 13px; border: 3px solid #66879a; border-radius: 13px; background: #17364a; text-align: left; }
.pet-roster article .portrait { flex: 0 0 64px; width: 64px; height: 64px; }
.pet-roster article > span, .inventory-grid article > span { font-size: 40px; }
.pet-roster article > span { display: grid; flex: 0 0 64px; height: 64px; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .06); color: #9fb6bf; font-weight: 1000; }
.pet-roster article div { display: grid; gap: 2px; }
.pet-roster article small { color: #b8cfce; letter-spacing: 0; text-transform: none; font-size: .8rem; }
.pet-roster article.locked { opacity: .5; }
.inventory-grid { grid-template-columns: repeat(3, 1fr); }
.inventory-grid article { display: grid; place-items: center; gap: 6px; text-align: center; }
.inventory-grid article .portrait { width: 48px; height: 48px; }
.inventory-grid article strong { font-size: .78rem; }
.deck-grid { margin-top: 20px; }
.deck-grid article { min-height: 120px; cursor: default; }
.deck-grid article small { color: #aac7c8; font-size: .66rem; letter-spacing: 0; text-transform: none; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0; }
.profile-stats span { display: grid; padding: 15px; border: 2px solid #66879a; border-radius: 11px; background: #17364a; }
.profile-stats b { color: #f3d46f; font-size: 1.5rem; }
.demo-disclosure { font-size: .72rem; }
.build-label { margin: 4px 0 0; color: #7f9aa6 !important; font-size: .64rem; }
.equip-list { display: grid; gap: 9px; margin: 18px 0; }
.equip-list button { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 0 13px; border: 2px solid #e0c17d; border-radius: 10px; background: #17364a; color: #fff0c5; font: inherit; font-weight: 900; cursor: pointer; }
.equip-list button.equipped { background: #2f654c; color: #f7ffd7; }

.mini-map { position: relative; height: 330px; margin-top: 18px; border: 4px solid #b9915f; border-radius: 18px; background: linear-gradient(160deg, #7fbf5a, #5a9a4e); overflow: hidden; }
.map-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-spot { position: absolute; z-index: 2; display: grid; justify-items: center; gap: 2px; min-width: 128px; padding: 8px 12px; border: 2px solid #f4df9a; border-radius: 12px; background: rgba(24, 55, 74, .94); box-shadow: 0 4px 0 rgba(0, 0, 0, .3); transform: translate(-50%, -50%); }
.map-spot .map-icon { font-size: 24px; }
.map-spot strong { font-size: .88rem; }
.map-spot small { color: #b8cfce !important; font-size: .62rem !important; letter-spacing: .06em !important; }
.map-spot.here { border-color: #8ff0ae; box-shadow: 0 0 0 4px rgba(143, 240, 174, .25), 0 4px 0 rgba(0, 0, 0, .3); }
.map-spot.here small { color: #8ff0ae !important; }
.map-spot.target { border-color: #ffd24a; animation: attention 1.2s ease-in-out infinite; }
.map-spot.here, .map-spot.target { z-index: 3; }
.map-spot.target small { color: #ffd24a !important; }
.map-spot.locked { opacity: .72; filter: saturate(.4); }
.map-house { left: 23%; top: 26%; }
.map-town { left: 50%; top: 53%; }
.map-wild { left: 78%; top: 72%; }
.map-goal { margin: 14px 0 0; }
.map-goal b { color: #f3d579; }

/* ——— Responsive ——— */
@media (min-width: 701px) and (max-width: 1100px) {
  .control-hint { display: none; }
  .control-hint.learned + .controls-help { display: none; }
}

@media (max-width: 900px) {
  .social-card { display: none; }
  .brand-name { display: none; }
  .brand-chip { padding: 0 6px; }
}

@media (max-width: 700px) {
  .adventure-header { top: calc(10px + var(--safe-top)); left: calc(10px + var(--safe-left)); right: calc(10px + var(--safe-right)); gap: 6px; }
  .brand-chip, .player-chip, .resource-strip, .perspective-toggle { height: 42px; border-radius: 12px; }
  .player-chip { min-width: 0; padding-right: 10px; }
  .player-chip small { display: none; }
  .player-chip strong { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
  .resource-strip span { min-width: 0; height: 30px; padding: 0 8px; font-size: .9rem; gap: 4px; }
  .perspective-toggle { width: 42px; padding: 0; justify-content: center; }
  .perspective-toggle small { display: none; }
  .quest-card { top: calc(62px + var(--safe-top)); left: calc(10px + var(--safe-left)); right: auto; width: min(290px, calc(100vw - 20px)); padding: 7px 12px 8px; cursor: pointer; }
  .quest-card .quest-kicker { display: none; }
  .quest-card strong { margin: 0; font-size: .9rem; }
  .quest-card > span:not(.quest-kicker) { display: none; }
  .quest-card.expanded > span:not(.quest-kicker) { display: block; margin-top: 3px; }
  .quest-card strong::after { content: "▾"; float: right; margin-left: 8px; color: #f3d579; font-size: .7rem; }
  .quest-card.expanded strong::after { content: "▴"; }
  .quest-progress { margin-top: 6px; height: 6px; }
  .game-toast { top: calc(116px + var(--safe-top)); padding: 9px 14px; font-size: .9rem; }
  /* A compact strip below the trail card, well above the explorer. */
  .location-banner { top: calc(166px + var(--safe-top)); max-width: calc(100vw - 24px); padding: 6px 28px 8px; gap: 2px; white-space: nowrap; }
  .location-banner strong { font-size: 1.3rem; }
  .location-banner small { display: none; }
  .control-hint, .controls-help { display: none !important; }
  .card-hand, .deck-grid { grid-template-columns: repeat(2, 1fr); }
  .battle-stage { gap: 8px; }
  .battler { width: 130px; }
  .battler .portrait { width: 76px; height: 76px; }
  .pet-roster { grid-template-columns: 1fr; }
  .inventory-grid { grid-template-columns: repeat(2, 1fr); }
  .game-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .dialog-hero, .creator-form, .menu-panel, .activity-panel, .battle-panel, .expedition-panel, .victory-panel, .hatch-panel, .pet-discovery { padding-left: 18px; padding-right: 18px; }
  .menu-panel, .activity-panel, .battle-panel, .expedition-panel, .victory-panel, .hatch-panel, .pet-discovery { padding-top: 26px; padding-bottom: 24px; }
  .choice-grid { flex-wrap: wrap; }
  .mini-map { height: 300px; }
  .map-spot { min-width: 0; padding: 6px 8px; }
  .map-spot strong { font-size: .76rem; }
  .map-house { left: 27%; top: 20%; }
  .map-town { left: 52%; top: 50%; }
  .map-wild { left: 72%; top: 78%; }
  .battle-card, .deck-grid article { min-height: 118px; }
}

@media (pointer: coarse) {
  .touch-controls { display: flex; right: calc(12px + var(--safe-right)); left: calc(12px + var(--safe-left)); bottom: calc(80px + var(--safe-bottom)); }
  .game-dock { right: calc(10px + var(--safe-right)); bottom: calc(8px + var(--safe-bottom)); left: calc(10px + var(--safe-left)); width: auto; transform: none; gap: 3px; padding: 5px; border-radius: 14px; }
  .game-dock button { width: auto; min-width: 0; min-height: 52px; flex: 1; padding: 3px 1px; touch-action: manipulation; }
  .game-dock button:hover { transform: none; }
  .game-dock button span { font-size: 20px; }
  .game-dock button small { font-size: .58rem; }
  .interaction-prompt { left: auto; right: calc(12px + var(--safe-right)); bottom: calc(176px + var(--safe-bottom)); max-width: min(260px, calc(100vw - 150px)); transform: none; padding: 7px 12px; white-space: normal; line-height: 1.2; animation: none; }
  .interaction-prompt kbd { display: none; }
  .control-hint, .controls-help { display: none !important; }
  .social-card { display: none; }
}

@media (pointer: coarse) and (orientation: landscape) {
  .touch-controls { bottom: calc(10px + var(--safe-bottom)); }
  .touch-stick { width: 96px; height: 96px; }
  .touch-stick i { width: 44px; height: 44px; }
  .touch-action { width: 68px; height: 68px; margin-bottom: 4px; }
  .game-dock { right: auto; left: 50%; bottom: calc(8px + var(--safe-bottom)); width: min(330px, 44vw); transform: translateX(-50%); }
  .game-dock button { min-height: 46px; }
  .interaction-prompt { right: calc(12px + var(--safe-right)); bottom: calc(94px + var(--safe-bottom)); max-width: 230px; white-space: normal; text-align: right; }
  .player-chip { display: none; }
  .quest-card { top: calc(60px + var(--safe-top)); width: 220px; padding: 7px 12px 8px; cursor: pointer; }
  .quest-card .quest-kicker, .quest-card > span:not(.quest-kicker) { display: none; }
  .quest-card.expanded > span:not(.quest-kicker) { display: block; margin-top: 3px; }
  .quest-card strong { margin: 0; font-size: .9rem; }
  .quest-progress { margin-top: 6px; height: 6px; }
  .game-toast { top: calc(116px + var(--safe-top)); left: auto; right: calc(12px + var(--safe-right)); transform: none; max-width: 300px; animation: none; }
  .location-banner { top: calc(62px + var(--safe-top)); padding: 5px 26px 7px; gap: 1px; white-space: nowrap; }
  .location-banner strong { font-size: 1.2rem; }
  .location-banner small { display: none; }
}

@media (max-width: 360px) {
  .brand-chip { display: none; }
  .resource-strip span { padding: 0 6px; }
  .touch-stick { width: 100px; height: 100px; }
  .touch-action { width: 68px; height: 68px; }
  .game-dialog { width: calc(100vw - 12px); border-width: 3px; border-radius: 16px; }
  .dialog-close { right: 8px; top: 8px; width: 44px; height: 44px; }
  .dialog-hero { gap: 9px; padding-top: 22px; }
  .dialog-hero > span { font-size: 40px; }
  .game-dialog h1 { padding-right: 28px; font-size: 1.55rem; }
  .game-dialog p { margin: 7px 0; line-height: 1.35; }
  .creator-form { gap: 12px; padding-top: 8px; padding-bottom: 22px; }
  .avatar-choice, .palette-choice { width: 52px; height: 50px; }
  .choice-grid { gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .page-game *, .page-game *::before, .page-game *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
