:root {
  --bg: #16352c;
  --card: #f7f1e4;
  --ink: #1a1a16;
  --muted: #5a5348;
  --gold: #d4a017;
  --green: #1e4d3a;
  --green-2: #2a6b50;
  --red: #c44536;
  --blue: #00209f;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; user-select: none; touch-action: none; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#footer { position: fixed; left: 0; right: 0; bottom: 2px; text-align: center; font-size: 11px;
  color: rgba(255,255,255,.72); text-shadow: 0 1px 2px #0008; pointer-events: none; z-index: 6;
  padding-bottom: var(--safe-b); letter-spacing: .02em; }
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud-top { pointer-events: auto; display: flex; align-items: center; gap: 8px;
  padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r)) 0 calc(10px + var(--safe-l)); }
.pyon-chip { background: #1a1a16e6; color: #ffe08a; border: 1px solid #d4a01788; border-radius: 999px;
  padding: 6px 12px; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.pyon-dot { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3, #e2b84a 45%, #8a6a14);
  box-shadow: 0 0 0 1px #6a5010; }
.lang-row { display: flex; gap: 4px; margin-left: auto; }
.lang-row button { pointer-events: auto; background: #fff; border: 2px solid #0000; border-radius: 4px;
  padding: 2px 3px; line-height: 0; cursor: pointer; min-width: 36px; }
.lang-row button[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.lang-row .flagsvg { width: 28px; height: 18px; display: block; }
.icon-btn { pointer-events: auto; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: #1a1a16e6; color: #f7f1e4; font-size: 16px; cursor: pointer; font-weight: 700; }
.icon-btn[aria-pressed="true"] { background: var(--green-2); color: #fff; }
.prompt { position: absolute; left: 50%; top: calc(22% + var(--safe-t)); transform: translateX(-50%);
  background: #1a1a16f0; color: #fff; padding: 8px 14px; border-radius: 10px; font-size: 14px;
  max-width: 86vw; text-align: center; pointer-events: none; box-shadow: 0 4px 16px #0006; }
.ride-hint { position: absolute; left: 50%; bottom: calc(28px + var(--safe-b)); transform: translateX(-50%);
  background: #1a1a16cc; color: #ffe08a; padding: 4px 10px; border-radius: 8px; font-size: 12px; }

#touch { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.stick { position: absolute; left: calc(18px + var(--safe-l)); bottom: calc(28px + var(--safe-b));
  width: 128px; height: 128px; pointer-events: auto; }
.stick-base { width: 100%; height: 100%; border-radius: 50%; background: #0005; border: 2px solid #fffc;
  box-shadow: inset 0 0 20px #0004; }
.stick-knob { position: absolute; width: 56px; height: 56px; border-radius: 50%; background: #fffc;
  border: 2px solid #fff; left: 50%; top: 50%; margin: -28px 0 0 -28px; pointer-events: none; }
.act-btn { pointer-events: auto; position: absolute; right: calc(22px + var(--safe-r));
  bottom: calc(42px + var(--safe-b)); width: 86px; height: 86px; border-radius: 50%;
  border: 3px solid #fff; background: #c44536ee; color: #fff; font-size: 13px; font-weight: 700;
  letter-spacing: .02em; cursor: pointer; box-shadow: 0 6px 16px #0006; }
.act-btn:active { transform: scale(.96); }

#toast { position: fixed; left: 50%; top: 40%; transform: translate(-50%,-50%); z-index: 20;
  background: #1a1a16f2; color: #fff; padding: 12px 18px; border-radius: 12px; max-width: 80vw;
  text-align: center; font-size: 15px; box-shadow: 0 8px 24px #0007; }

.overlay { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); background: #0d1f1ae8; }
#splash { background: #101816; z-index: 12; }
.splash-inner { text-align: center; animation: fadeup .8s ease both; }
.splash-mark, .title-mark { font-size: 28px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; text-shadow: 0 2px 0 #5a3d00, 0 0 24px #d4a01755; }
.splash-bar { width: 120px; height: 3px; margin: 16px auto 0; background: linear-gradient(90deg, #00209f, #fff, #d21034); border-radius: 2px; }
.title-mark { font-size: 13px; letter-spacing: .2em; margin-bottom: 6px; }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card { background: var(--card); color: var(--ink); border-radius: 16px; padding: 22px 20px 20px;
  width: min(420px, 94vw); max-height: min(88vh, 720px); overflow: auto; box-shadow: 0 16px 40px #0007;
  touch-action: pan-y; }
.title-card { text-align: center; }
.title-card h1 { margin: 0; font-size: 56px; letter-spacing: .12em; color: var(--green); line-height: 1; }
.subtitle { margin: 4px 0 0; font-size: 20px; color: var(--red); font-weight: 700; }
.tag { margin: 10px 0 16px; color: var(--muted); font-size: 14px; }
.title-langs { justify-content: center; margin: 0 0 16px; }
button.primary, .btn { display: inline-block; background: var(--green); color: #fff; border: 0; border-radius: 10px;
  padding: 12px 22px; font: inherit; font-weight: 700; cursor: pointer; font-size: 16px; }
button.primary { width: 100%; }
button.primary:active, .btn:active { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--green); border: 1.5px solid var(--green); }
.btn.row { width: 100%; text-align: left; margin: 0 0 8px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.btn[disabled] { opacity: .5; cursor: default; }
.modal-card h2 { margin: 0 0 8px; font-size: 20px; color: var(--green); }
.modal-card p { margin: 0 0 12px; line-height: 1.45; }
.verse { background: #efe6d2; border-left: 3px solid var(--gold); padding: 10px 12px; border-radius: 8px; font-style: italic; }
.verse cite { display: block; font-style: normal; font-weight: 700; margin-top: 8px; color: var(--muted); font-size: 13px; }
.shop-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #e4d9c4; }
.shop-item b { font-size: 13px; color: var(--muted); white-space: nowrap; }
.arcade { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.arcade a, .arcade button.linkish { text-decoration: none; }
.muted { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.actions .btn, .actions .primary { flex: 1; text-align: center; width: auto; }
[hidden] { display: none !important; }
@media (min-width: 800px) {
  .stick, .act-btn { opacity: .55; }
  body.touch-on .stick, body.touch-on .act-btn { opacity: 1; }
}
