:root {
  --ink: #121a2c;
  --panel: rgba(17, 25, 43, .86);
  --panel-b: rgba(240, 192, 74, .28);
  --cream: #fbf3df;
  --muted: #b9c2d6;
  --gold: #f0c04a;
  --gold2: #ffe27a;
  --parch: #efe2c1;
  --ok: #5fd68a;
  --bad: #ff6b5a;
  --roman: #d2553a;
  --saxon: #3f9a63;
  --viking: #3d82c9;
  --font: "Fredoka", "Trebuchet MS", "Segoe UI Rounded", system-ui, sans-serif;
  --serif: "Cinzel", Georgia, "Times New Roman", serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a2236; color: var(--cream); font-family: var(--font); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; cursor: grab; }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
svg { display: block; }

#fade { position: fixed; inset: 0; background: #0d1424; opacity: 0; pointer-events: none; transition: opacity .26s ease; z-index: 80; }
#fade.on { opacity: 1; }

.screen { position: fixed; inset: 0; z-index: 30; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen.center { display: flex; align-items: center; justify-content: center; padding: 16px; }

/* ---------- botões ---------- */
.btn { appearance: none; border: 0; cursor: pointer; font-weight: 700; font-size: 1.05rem; color: #3a2606; padding: 13px 26px; border-radius: 16px; background: linear-gradient(#ffe48a, #f0b53a); box-shadow: 0 5px 0 #a8710f, 0 12px 24px rgba(240, 181, 58, .28); transition: transform .08s, box-shadow .08s, filter .15s; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #a8710f, 0 4px 10px rgba(240, 181, 58, .3); }
.btn.big { width: 100%; font-size: 1.45rem; padding: 16px; margin-top: 10px; }
.btn.ghost { background: rgba(255, 255, 255, .1); color: var(--cream); border: 1.5px solid rgba(255, 255, 255, .2); box-shadow: 0 4px 0 rgba(0, 0, 0, .35); }
.btn.small { font-size: .9rem; padding: 9px 14px; border-radius: 13px; }
.btn + .btn { margin-top: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row .btn + .btn { margin-top: 0; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--panel-b); background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 1.1rem; font-weight: 700; cursor: pointer; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0, 0, 0, .3); }
.round.txt { font-size: .85rem; letter-spacing: .5px; }
.round:active { transform: scale(.94); }
.error { color: #ffb3a6; }

/* ---------- carregando ---------- */
#loading { background: radial-gradient(ellipse at 50% 30%, #3a4a72, #121a2c 70%); z-index: 90; }
.load-box { text-align: center; }
.load-icon { font-size: 4rem; animation: dig 1s ease-in-out infinite; transform-origin: 50% 90%; }
.load-box h2 { font-family: var(--serif); margin-top: 8px; }
.load-box p { color: var(--muted); margin-top: 8px; }
@keyframes dig { 0%, 100% { transform: rotate(-22deg); } 50% { transform: rotate(18deg) translateY(6px); } }

/* ---------- menu ---------- */
#menu { background: linear-gradient(180deg, rgba(12, 18, 34, .55), rgba(12, 18, 34, .35) 40%, rgba(12, 18, 34, .8)); }
.menu-wrap { width: min(1040px, 100%); margin: 0 auto; padding: calc(24px + var(--safe-t)) 18px 36px; }
.logo { text-align: center; text-shadow: 0 4px 22px rgba(0, 0, 0, .6); margin-bottom: 20px; }
.logo-kicker { font-family: var(--serif); letter-spacing: 4px; font-size: .78rem; color: var(--gold2); font-weight: 600; }
.logo h1 { font-family: var(--serif); font-weight: 800; font-size: clamp(2.2rem, 7vw, 4.2rem); line-height: 1.05; margin: 6px 0 10px; color: var(--cream); }
.logo h1 em { font-style: normal; color: var(--gold); }
.tagline { max-width: 560px; margin: 0 auto; color: #e8edf7; font-size: 1.05rem; line-height: 1.45; }
.menu-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 16px; align-items: start; }
.card { background: var(--panel); border: 1.5px solid var(--panel-b); border-radius: 24px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 18px 50px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .08); padding: 22px; }
.card h3 { font-family: var(--serif); font-size: 1rem; color: var(--gold2); letter-spacing: 1px; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.field input { font: inherit; font-size: 1.1rem; padding: 12px 14px; border-radius: 14px; border: 1.5px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: var(--cream); outline: none; user-select: text; -webkit-user-select: text; }
.field input:focus { border-color: var(--gold); }
.menu-stats { display: flex; gap: 14px; flex-wrap: wrap; margin: 14px 0 4px; color: var(--muted); font-weight: 500; }
.menu-stats b { color: var(--gold2); }
.menu-row { margin-top: 14px; justify-content: space-between; }
.seg { display: inline-flex; background: rgba(255, 255, 255, .1); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 9px; font-weight: 700; cursor: pointer; font-size: .85rem; }
.seg button[aria-pressed="true"] { background: var(--gold); color: #3a2606; }
.peoples { display: grid; gap: 10px; }
.people { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 12px 14px 12px 18px; border-radius: 16px; background: rgba(255, 255, 255, .06); border-left: 6px solid var(--c); }
.people b { font-family: var(--serif); font-size: 1.15rem; color: var(--cream); }
.people span { color: var(--gold2); font-weight: 600; font-size: .9rem; }
.people small { color: var(--muted); font-size: .88rem; line-height: 1.35; }
.back { text-align: center; margin-top: 22px; }
.back a { color: var(--muted); text-decoration: none; font-size: .9rem; }
.back a:hover { color: var(--cream); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#hud > * { pointer-events: auto; }
.topbar { position: absolute; top: calc(10px + var(--safe-t)); left: 10px; right: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.topbar .actions { display: flex; gap: 8px; }
.title { font-family: var(--serif); font-weight: 800; font-size: 1.05rem; letter-spacing: .5px; padding: 9px 18px; border-radius: 999px; background: var(--panel); border: 1.5px solid var(--panel-b); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); text-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.title em { font-style: normal; color: var(--gold); }
.tip { position: absolute; top: calc(66px + var(--safe-t)); left: 50%; transform: translateX(-50%); max-width: min(560px, calc(100vw - 24px)); text-align: center; padding: 9px 18px; border-radius: 16px; background: rgba(17, 25, 43, .78); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: .95rem; line-height: 1.3; pointer-events: none; }
.era-tabs { position: absolute; top: calc(112px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.era-tab { border: 1.5px solid rgba(255, 255, 255, .18); background: var(--panel); border-bottom: 4px solid var(--c); border-radius: 14px; padding: 8px 14px; cursor: pointer; text-align: center; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: transform .12s; min-width: 108px; }
.era-tab b { display: block; font-family: var(--serif); font-size: .95rem; }
.era-tab small { color: var(--muted); font-size: .72rem; }
.era-tab.on { background: color-mix(in srgb, var(--c) 38%, #111a2b); border-color: var(--c); transform: translateY(-2px); }
.has-tip .era-tabs { top: calc(112px + var(--safe-t)); }

.gauge { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 148px; padding: 12px 10px; border-radius: 18px; background: var(--panel); border: 1.5px solid var(--panel-b); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; flex-direction: column; gap: 5px; }
.gauge h4 { font-family: var(--serif); font-size: .8rem; letter-spacing: 1px; color: var(--gold2); text-align: center; }
.g-ends { display: block; text-align: center; color: var(--muted); font-size: .68rem; }
.band { position: relative; padding: 9px 8px 8px 12px; border-radius: 10px; background: linear-gradient(90deg, var(--soil), color-mix(in srgb, var(--soil) 70%, #000)); border-left: 6px solid var(--c); display: flex; flex-direction: column; gap: 1px; transition: transform .2s, box-shadow .2s, filter .2s; filter: saturate(.85) brightness(.9); }
.band b { font-size: .78rem; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); line-height: 1.1; }
.band small { font-size: .66rem; opacity: .85; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.band[data-layer="3"] b, .band[data-layer="3"] small { color: #20190e; text-shadow: none; }
.band[data-layer="0"] { padding: 5px 8px 5px 12px; }
.band.hl { transform: scale(1.06); box-shadow: 0 0 0 2px var(--gold2), 0 0 18px rgba(255, 226, 122, .55); filter: none; z-index: 2; }

.bottombar { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 10px calc(10px + var(--safe-b)); display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; pointer-events: none; }
.bottombar > * { pointer-events: auto; }
.tray { display: flex; gap: 8px; padding: 8px 10px; border-radius: 18px; background: var(--panel); border: 1.5px solid var(--panel-b); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.tray-era { display: flex; gap: 5px; align-items: center; padding: 3px 6px 3px 4px; border-radius: 12px; background: color-mix(in srgb, var(--c) 18%, transparent); }
.tray-era i { width: 6px; align-self: stretch; border-radius: 4px; background: var(--c); }
.slot { width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .18); background: rgba(0, 0, 0, .35); overflow: hidden; padding: 0; cursor: pointer; display: grid; place-items: center; color: rgba(255, 255, 255, .4); font-weight: 700; }
.slot.on { border-color: var(--gold); background: var(--parch); }
.slot svg { width: 150%; height: 150%; margin: -25%; transform: scale(1.0); }
.modes { display: flex; gap: 8px; }
.modes button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 84px; padding: 8px 12px; border-radius: 16px; background: var(--panel); border: 1.5px solid var(--panel-b); cursor: pointer; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.modes button span { font-size: 1.35rem; line-height: 1.1; }
.modes button b { font-size: .8rem; }
.modes button.on { background: linear-gradient(#ffe48a, #f0b53a); color: #3a2606; border-color: #fff2b8; box-shadow: 0 4px 0 #a8710f; }
.badge { position: absolute; top: -6px; right: -4px; background: #ff5a4a; color: #fff; font-style: normal; font-weight: 700; font-size: .72rem; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); animation: pop 1.4s ease-in-out infinite; }
@keyframes pop { 50% { transform: scale(1.18); } }

/* ---------- painel do achado ---------- */
.sheet { position: fixed; z-index: 40; right: 14px; top: calc(70px + var(--safe-t)); bottom: 100px; width: min(430px, 42vw); display: flex; align-items: center; pointer-events: none; }
.sheet-card { pointer-events: auto; width: 100%; max-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 18px 20px; border-radius: 24px; background: var(--panel); border: 1.5px solid var(--c, var(--panel-b)); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0, 0, 0, .5), 0 0 0 4px color-mix(in srgb, var(--c, #888) 22%, transparent); display: flex; flex-direction: column; gap: 10px; animation: slideIn .45s cubic-bezier(.2, .9, .3, 1.2); }
.sheet-card .btn { align-self: stretch; margin-top: 4px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px) scale(.96); } }
.sheet-card h2 { font-family: var(--serif); font-size: 1.45rem; line-height: 1.15; }
.f-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-block; font-weight: 700; font-size: .78rem; padding: 4px 11px; border-radius: 999px; background: var(--c); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.f-date { color: var(--gold2); font-weight: 600; font-size: .85rem; }
.f-art { border-radius: 14px; overflow: hidden; border: 2px solid rgba(255, 255, 255, .15); aspect-ratio: 400 / 260; background: var(--parch); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.f-art svg { width: 100%; height: 100%; }
.f-art.small { aspect-ratio: 400 / 190; }
.f-text { line-height: 1.5; font-size: 1.02rem; color: #f3ead3; }
.f-word { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 14px; background: rgba(240, 192, 74, .12); border: 1px dashed rgba(240, 192, 74, .55); font-size: .95rem; line-height: 1.35; }
.f-word b { color: var(--gold2); font-size: .72rem; letter-spacing: 1px; text-transform: uppercase; }
.f-stars { text-align: center; color: var(--gold); font-size: 2rem; letter-spacing: 6px; text-shadow: 0 2px 10px rgba(240, 192, 74, .5); }
.f-stars.big { font-size: 1.6rem; letter-spacing: 2px; }
.q-title { font-weight: 700; font-size: 1.18rem; line-height: 1.3; }
.q-hint { color: var(--muted); font-size: .9rem; }
.q-note { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .07); font-size: .95rem; line-height: 1.4; }
.q-note.ok, .q-note .ok { color: var(--ok); }
.q-note .no { color: var(--bad); font-weight: 700; }
.q-note.no { color: var(--bad); }
.opts { display: grid; gap: 9px; }
.opt { text-align: left; cursor: pointer; padding: 13px 16px; border-radius: 15px; border: 2px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .07); font-size: 1.02rem; transition: transform .1s, background .15s, border-color .15s; display: flex; flex-direction: column; gap: 1px; }
.opt:hover { background: rgba(255, 255, 255, .13); transform: translateX(3px); }
.opt small { color: var(--muted); font-size: .78rem; }
.era-opts .opt { border-left: 8px solid var(--c); }
.opt.bad { border-color: var(--bad); background: rgba(255, 90, 74, .18); animation: shake .35s; }
.opt.good { border-color: var(--ok); background: rgba(95, 214, 138, .22); }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.sheet.info { bottom: calc(100px + var(--safe-b)); top: auto; left: 50%; right: auto; transform: translateX(-50%); width: min(520px, calc(100vw - 24px)); }
.sheet-card.slim { padding: 14px 16px; }
.sheet-card.slim h2 { font-size: 1.2rem; }

/* ---------- modais ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 24, .62); display: flex; align-items: center; justify-content: center; padding: 14px; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fadeIn .25s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-card { width: min(560px, 100%); max-height: calc(100vh - 28px); overflow-y: auto; background: var(--panel); border: 1.5px solid var(--c, var(--panel-b)); border-radius: 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: popIn .45s cubic-bezier(.2, .9, .3, 1.25); -webkit-overflow-scrolling: touch; }
@keyframes popIn { from { opacity: 0; transform: translateY(24px) scale(.92); } }
.modal-card.event { width: min(520px, 100%); }
.ev-art { position: relative; aspect-ratio: 400 / 260; border-radius: 24px 24px 0 0; overflow: hidden; }
.ev-art svg { width: 100%; height: 100%; }
.ev-label { position: absolute; left: 14px; bottom: 12px; font-family: var(--serif); font-weight: 800; font-size: 1.15rem; padding: 5px 14px; border-radius: 999px; background: rgba(12, 18, 34, .8); color: var(--gold2); border: 1.5px solid var(--gold); }
.ev-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.ev-body h2 { font-family: var(--serif); font-size: 1.5rem; line-height: 1.15; }
.ev-body p { line-height: 1.5; color: #f3ead3; }
.kicker { color: var(--c, var(--gold2)) !important; filter: brightness(1.5); font-weight: 700; font-size: .75rem; letter-spacing: 2px; text-transform: uppercase; }
.unlock { padding: 10px 12px; border-radius: 12px; background: rgba(95, 214, 138, .14); border: 1px solid rgba(95, 214, 138, .5); font-size: .94rem; line-height: 1.4; }
.unlock.gold { background: rgba(240, 192, 74, .14); border-color: rgba(240, 192, 74, .6); }

.modal-card.journal { width: min(900px, 100%); height: min(720px, calc(100vh - 28px)); display: flex; flex-direction: column; overflow: hidden; }
.journal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 6px; }
.journal header h2 { font-family: var(--serif); }
.x { width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); cursor: pointer; font-size: 1rem; }
.tabs { display: flex; gap: 6px; padding: 6px 20px 10px; overflow-x: auto; }
.tabs button { flex: none; padding: 8px 16px; border-radius: 999px; border: 1.5px solid rgba(255, 255, 255, .18); background: none; cursor: pointer; font-weight: 600; }
.tabs button.on { background: var(--gold); color: #3a2606; border-color: var(--gold); }
.j-body { flex: 1; overflow-y: auto; padding: 4px 20px 22px; -webkit-overflow-scrolling: touch; }
.timeline { display: grid; gap: 12px; position: relative; }
.tl { display: grid; grid-template-columns: 170px 1fr; gap: 14px; padding: 10px; border-radius: 18px; background: rgba(255, 255, 255, .06); border-left: 6px solid var(--c); }
.tl.lock { opacity: .55; }
.tl-art { aspect-ratio: 400 / 260; border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, .35); display: grid; place-items: center; font-size: 2rem; color: var(--muted); }
.tl-art svg { width: 100%; height: 100%; }
.tl-year { font-family: var(--serif); color: var(--gold2); font-weight: 800; }
.tl h3 { font-size: 1.1rem; margin: 2px 0 4px; }
.tl p { font-size: .92rem; line-height: 1.45; color: #e7dfca; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.mini { padding: 10px; border-radius: 18px; background: rgba(255, 255, 255, .06); border-top: 5px solid var(--c); display: flex; flex-direction: column; gap: 4px; }
.mini.lock { opacity: .55; }
.mini-art { aspect-ratio: 400 / 260; border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, .35); display: grid; place-items: center; font-size: 2rem; color: var(--muted); }
.mini-art svg { width: 100%; height: 100%; }
.mini h3 { font-family: var(--serif); font-size: 1rem; }
.mini small { color: var(--gold2); }
.mini p { font-size: .85rem; line-height: 1.4; color: #e7dfca; }
.mini .f-stars { font-size: 1.1rem; letter-spacing: 3px; }
.words { display: grid; gap: 10px; }
.word { padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .06); border-left: 6px solid var(--c); display: flex; flex-direction: column; gap: 2px; }
.word b { font-family: var(--serif); font-size: 1.05rem; }
.word span { color: #e7dfca; font-size: .95rem; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.quiz { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.qpair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.qcard { cursor: pointer; padding: 8px; border-radius: 18px; border: 2.5px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); display: flex; flex-direction: column; gap: 6px; align-items: center; border-bottom: 6px solid var(--c); }
.qcard .tl-art { width: 100%; }
.qcard h3 { font-size: .95rem; padding: 0 4px 4px; }
.qcard.good { border-color: var(--ok); background: rgba(95, 214, 138, .18); }
.qcard.bad { border-color: var(--bad); background: rgba(255, 90, 74, .18); }

.modal-card.help { padding: 22px; width: min(520px, 100%); }
.help h2 { font-family: var(--serif); margin-bottom: 10px; }
.help ul { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.help li { line-height: 1.45; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.modal-card.finale { padding: 22px; width: min(560px, 100%); display: grid; gap: 16px; text-align: center; }
.cert { padding: 26px 20px; border-radius: 18px; background: linear-gradient(160deg, #f5e8c5, #dcc58f); color: #3a2410; border: 4px double #8a6a3a; }
.cert h2 { font-family: var(--serif); font-size: 1.9rem; margin: 6px 0; }
.cert p { line-height: 1.45; }
.cert .seal { font-size: 3rem; }
.cert .by { margin-top: 12px; font-size: .85rem; letter-spacing: 1px; text-transform: uppercase; opacity: .75; }
.cert .who { font-family: var(--serif); font-weight: 800; font-size: 1.9rem; margin: 4px 0 8px; color: #7a2a14; }
.cert .f-stars { color: #a66f08; text-shadow: none; }
.finale .row { justify-content: center; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 18px; border-radius: 14px; background: rgba(17, 25, 43, .94); border: 1.5px solid var(--gold); transition: all .3s; max-width: calc(100vw - 24px); text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- telas estreitas / retrato ---------- */
@media (max-width: 860px), (max-aspect-ratio: 1/1) {
  .menu-grid { grid-template-columns: 1fr; }
  .title { display: none; }
  .topbar { justify-content: space-between; }
  .tip { top: calc(62px + var(--safe-t)); font-size: .86rem; padding: 7px 14px; }
  .era-tabs { top: calc(108px + var(--safe-t)); }
  .era-tab { min-width: 92px; padding: 6px 8px; }
  .gauge { width: 112px; padding: 8px 6px; gap: 4px; top: 38%; }
  .band b { font-size: .68rem; }
  .band small { display: none; }
  .band { padding: 7px 6px 7px 9px; }
  .bottombar { flex-direction: column; align-items: stretch; gap: 8px; }
  .tray { justify-content: center; gap: 4px; padding: 6px; }
  .tray-era { gap: 3px; padding: 3px; }
  .slot { width: 38px; height: 38px; }
  .modes { justify-content: center; }
  .modes button { flex: 1; min-width: 0; padding: 6px 4px; }
  .sheet { right: 0; left: 0; top: auto; bottom: 0; width: 100%; max-height: 56vh; align-items: flex-end; }
  .sheet-card { border-radius: 24px 24px 0 0; max-height: 56vh; padding-bottom: calc(20px + var(--safe-b)); animation-name: slideUp; }
  .sheet.info { left: 0; transform: none; width: 100%; bottom: calc(112px + var(--safe-b)); padding: 0 10px; }
  .sheet.info .sheet-card { border-radius: 20px; }
  @keyframes slideUp { from { opacity: 0; transform: translateY(60px); } }
  .tl { grid-template-columns: 110px 1fr; gap: 10px; }
  .tl p { font-size: .85rem; }
  .toast { bottom: calc(150px + var(--safe-b)); }
  .f-art { aspect-ratio: 400 / 190; }
  .f-text { font-size: .96rem; line-height: 1.42; }
  .sheet-card h2 { font-size: 1.25rem; }
}
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .gauge { display: none; }
  .tray { transform: scale(.85); transform-origin: left bottom; }
  .sheet { top: 60px; bottom: 72px; }
  .tip { top: 56px; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01s !important; } }

#hud.build .tip { top: calc(122px + var(--safe-t)); }
#hud.build .era-tabs { top: calc(60px + var(--safe-t)); }
@media (max-width: 860px), (max-aspect-ratio: 1/1) { #hud.build .era-tabs { top: calc(58px + var(--safe-t)); } #hud.build .tip { top: calc(112px + var(--safe-t)); } }

#hud.finding .gauge { opacity: 0; pointer-events: none; }
.gauge { transition: opacity .25s; }

.near-btn { position: fixed; z-index: 35; left: 50%; bottom: calc(112px + var(--safe-b)); transform: translateX(-50%); padding: 12px 22px; border-radius: 999px; border: 0; font-weight: 700; font-size: 1.05rem; color: #3a2606; background: linear-gradient(#ffe48a, #f0b53a); box-shadow: 0 5px 0 #a8710f, 0 12px 28px rgba(0, 0, 0, .35); cursor: pointer; animation: pop 1.4s ease-in-out infinite; }
.talk-card h2 small { display: block; font-family: var(--font); font-size: .8rem; font-weight: 500; color: var(--gold2); letter-spacing: .5px; margin-top: 2px; }
.bubble { font-size: 1.12rem; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); }
.qmode { align-self: center; margin-bottom: 4px; }
.fact-opts { width: 100%; text-align: left; }
.modes button { min-width: 70px; }
@media (max-width: 860px), (max-aspect-ratio: 1/1) { .near-btn { bottom: calc(138px + var(--safe-b)); } .modes button b { font-size: .72rem; } }
@media (max-width: 860px), (max-aspect-ratio: 1/1) { .slot { width: 27px; height: 27px; border-width: 1.5px; } .tray { gap: 3px; padding: 5px; } .tray-era { gap: 2px; padding: 2px 3px; } .tray-era i { width: 4px; } }
