:root { --ink: #14223a; --cream: #fff7e8; --sun: #ffb02e; --coral: #ff5d5d; --teal: #19b5a5; --sky: #4fa9ff; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0d1626; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
body { font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; color: var(--cream); }
canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; }
#ui { position: fixed; left: 0; top: 0; right: 0; height: 100dvh; pointer-events: none; }
#ui > * { pointer-events: auto; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.2vmin; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); text-align: center; }
.screen.dim { background: rgba(10, 18, 34, 0.62); backdrop-filter: blur(3px); }
.logo { font-size: clamp(34px, 11vmin, 96px); font-weight: 900; letter-spacing: 0.02em; line-height: 0.9; color: #fff; text-shadow: 0 0.06em 0 #c2410c, 0 0.12em 0 rgba(0,0,0,0.25); transform: rotate(-3deg); }
.logo span { color: var(--sun); }
.tag { font-size: clamp(13px, 3vmin, 22px); opacity: 0.9; }
.btn { font: inherit; font-weight: 800; font-size: clamp(15px, 3.6vmin, 26px); color: var(--ink); background: var(--sun); border: 0; border-radius: 999px; padding: 0.55em 1.6em; box-shadow: 0 0.22em 0 #b45309; cursor: pointer; min-width: 9em; }
.btn:active { transform: translateY(0.16em); box-shadow: 0 0.06em 0 #b45309; }
.btn.alt { background: #e8eefb; box-shadow: 0 0.22em 0 #8a9bbd; }
.btn.small { font-size: clamp(13px, 3vmin, 20px); min-width: 0; padding: 0.45em 1.1em; }
.row { display: flex; gap: 2.4vmin; flex-wrap: wrap; justify-content: center; align-items: center; }
.chars { display: flex; gap: 3vmin; }
.char { width: clamp(110px, 24vmin, 200px); aspect-ratio: 3 / 4; border-radius: 3vmin; border: 0.6vmin solid transparent; background: rgba(255,255,255,0.1); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 1.2vmin; cursor: pointer; font-weight: 800; font-size: clamp(14px, 3.2vmin, 22px); position: relative; overflow: hidden; }
.char canvas { position: static; width: 100%; height: 82%; }
.char.on { border-color: var(--sun); background: rgba(255,176,46,0.18); }
h2 { margin: 0; font-size: clamp(22px, 6vmin, 48px); }
.map { display: flex; gap: 2.4vmin; flex-wrap: wrap; justify-content: center; max-width: 92vw; }
.room { width: clamp(84px, 18vmin, 150px); aspect-ratio: 1; border-radius: 2.6vmin; border: 0; font: inherit; font-weight: 800; color: var(--ink); background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6vmin; cursor: pointer; box-shadow: 0 0.6vmin 0 rgba(0,0,0,0.25); }
.room .n { font-size: clamp(22px, 6vmin, 46px); line-height: 1; }
.room .tod { font-size: clamp(11px, 2.4vmin, 16px); opacity: 0.75; }
.room .stars { color: var(--sun); font-size: clamp(12px, 2.6vmin, 18px); letter-spacing: 0.1em; }
.room[disabled] { opacity: 0.4; cursor: default; }
.stats { font-size: clamp(15px, 3.4vmin, 24px); line-height: 1.5; }
.big-stars { font-size: clamp(30px, 9vmin, 70px); color: var(--sun); letter-spacing: 0.08em; text-shadow: 0 0.06em 0 #b45309; }
.big-stars .off { color: rgba(255,255,255,0.25); text-shadow: none; }
.iconbtn { position: absolute; top: max(8px, env(safe-area-inset-top)); display: flex; align-items: center; justify-content: center; padding: 0; width: clamp(36px, 8vmin, 56px); height: clamp(36px, 8vmin, 56px); border-radius: 50%; border: 0; background: rgba(255,255,255,0.16); color: #fff; font-size: clamp(16px, 4vmin, 26px); font-weight: 900; cursor: pointer; }
#rotate { position: fixed; inset: 0; background: #14223a; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; z-index: 50; font-size: 18px; text-align: center; padding: 24px; }
#rotate[hidden] { display: none; }
.rot-ico { width: 64px; height: 104px; border: 6px solid var(--sun); border-radius: 12px; animation: rot 1.8s ease-in-out infinite; }
@keyframes rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
.ver { position: absolute; bottom: max(8px, env(safe-area-inset-bottom)); right: max(12px, env(safe-area-inset-right)); font-size: 12px; opacity: 0.5; }

.world { justify-content: flex-start; padding-top: max(18px, env(safe-area-inset-top)); }
.cities { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(120px, 20vmin, 170px), 1fr)); gap: 1.6vmin; width: min(100%, 1100px); overflow-y: auto; padding: 1vmin 1vmin 3vmin; }
.city { --h: 200; font: inherit; border: 0; border-radius: 2.2vmin; padding: 1.4vmin 1vmin; color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0.4vmin;
  background: linear-gradient(160deg, hsl(var(--h) 70% 52%), hsl(var(--h) 65% 32%)); box-shadow: 0 0.5vmin 0 rgba(0,0,0,0.3); }
.city .cn { font-size: clamp(11px, 2.2vmin, 15px); opacity: 0.8; font-weight: 800; }
.city .name { font-size: clamp(15px, 3.2vmin, 22px); font-weight: 900; line-height: 1.05; }
.city .cc { font-size: clamp(10px, 2vmin, 13px); opacity: 0.85; }
.city .stars { font-size: clamp(11px, 2.2vmin, 15px); color: #ffe08a; font-weight: 800; }
.city[disabled] { filter: grayscale(0.85) brightness(0.65); cursor: default; }

/* ---------------------------------------------------------------- title: the departure lounge */
.title { flex-direction: row; justify-content: center; gap: clamp(18px, 6vw, 90px);
  background: radial-gradient(120% 90% at 30% 40%, rgba(8,14,30,0.05) 0%, rgba(8,14,30,0.55) 70%, rgba(8,14,30,0.8) 100%),
              linear-gradient(90deg, rgba(8,14,30,0.72) 0%, rgba(8,14,30,0.25) 48%, rgba(8,14,30,0.05) 100%); }
.t-left { display: flex; flex-direction: column; align-items: flex-start; gap: clamp(8px, 2.6vmin, 22px); text-align: left; max-width: 42vw; }
.title .logo { transform: rotate(-4deg); transform-origin: left center; display: flex; flex-direction: column; line-height: 0.82; margin-bottom: 0.6vmin; }
.title .logo .l1 { font-size: clamp(28px, 9.5vmin, 92px); color: #fff; -webkit-text-stroke: 0.04em #14223a; paint-order: stroke fill;
  text-shadow: 0 0.07em 0 #14223a, 0 0.14em 0.2em rgba(0,0,0,0.35); }
.title .logo .l2 { font-size: clamp(34px, 13vmin, 124px); margin-left: 0.5em; background: linear-gradient(180deg, #ffe27a 0%, #ffb02e 52%, #ff7a1a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: 0.035em #14223a; paint-order: stroke fill;
  filter: drop-shadow(0 0.06em 0 #14223a) drop-shadow(0 0.14em 0.16em rgba(0,0,0,0.35)); }
.title .tag { font-size: clamp(13px, 3.2vmin, 22px); font-weight: 700; color: #e9f1ff; opacity: 1; text-shadow: 0 2px 6px rgba(0,0,0,0.5); max-width: 30ch; }
.btn.play { font-size: clamp(18px, 5vmin, 36px); padding: 0.5em 1.5em; min-width: 0; letter-spacing: 0.04em; text-transform: uppercase;
  background: linear-gradient(180deg, #ffd25e, #ffa21f); box-shadow: 0 0.2em 0 #b45309, 0 0.5em 1.4em rgba(255,150,30,0.45); animation: pulse 2.4s ease-in-out infinite; }
.btn.play .arr { font-size: 0.7em; margin-left: 0.25em; vertical-align: 0.08em; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.045); } }
.btn.ghost { background: rgba(255,255,255,0.12); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.35); backdrop-filter: blur(6px); }
.btn.ghost:active { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.6); }
.t-right { display: flex; flex-direction: column; align-items: center; gap: clamp(6px, 2vmin, 16px); }
.pick { font-size: clamp(12px, 2.6vmin, 18px); font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: #fff; opacity: 0.9; text-shadow: 0 2px 6px rgba(0,0,0,0.6); }
.title .chars { gap: clamp(10px, 3vmin, 28px); }
/* each hero is a boarding pass */
.title .char { --w: clamp(130px, 34vmin, 250px); width: var(--w); aspect-ratio: auto; height: calc(var(--w) * 1.5); padding: 0; border: 0; border-radius: calc(var(--w) * 0.07);
  font: inherit; color: #14223a; background: linear-gradient(180deg, rgba(20,34,58,0.55), rgba(20,34,58,0.78)); backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.35), 0 10px 30px rgba(0,0,0,0.35); display: flex; flex-direction: column; justify-content: stretch; align-items: stretch;
  transition: transform 0.28s cubic-bezier(.2,.9,.3,1.3), box-shadow 0.25s, filter 0.25s; filter: saturate(0.55) brightness(0.85); transform: scale(0.93); overflow: hidden; }
.title .char.on { filter: none; transform: scale(1) translateY(-4px); background: radial-gradient(90% 60% at 50% 70%, rgba(255,190,80,0.45), rgba(20,34,58,0.7) 75%);
  box-shadow: inset 0 0 0 2.5px #ffc24a, 0 0 0 4px rgba(255,194,74,0.25), 0 16px 40px rgba(0,0,0,0.45), 0 0 50px rgba(255,170,40,0.35); }
.p-top { display: flex; justify-content: space-between; align-items: center; gap: 0.6em; padding: 0.8em 0.9em 0; font-size: calc(var(--w) * 0.05); white-space: nowrap; font-weight: 900; letter-spacing: 0.12em; color: #fff; opacity: 0.85; }
.p-route { letter-spacing: 0.05em; color: #ffd36b; }
.p-art { flex: 1; min-height: 0; display: flex; align-items: flex-end; justify-content: center; }
.p-art canvas.hero { position: static; width: 100%; height: 100%; object-fit: contain; }
.p-foot { flex: none; position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: end; padding: 0.55em 0.9em 0.5em; background: #fff7e8;
  font-size: calc(var(--w) * 0.06); text-align: left; }
.p-foot::before { content: ""; position: absolute; left: 0.6em; right: 0.6em; top: -1px; border-top: 2px dashed rgba(20,34,58,0.35); }
.p-lbl { grid-column: 1; font-size: 0.72em; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.55; }
.p-name { grid-column: 1; font-size: 1.9em; font-weight: 900; line-height: 1; }
.p-seat { grid-column: 2; grid-row: 1 / 3; align-self: center; font-weight: 900; font-size: 1.05em; padding: 0.25em 0.45em; border-radius: 0.35em; background: #14223a; color: #ffd36b; }
.title .char.on .p-seat { background: #ff7a1a; color: #fff; }
.p-code { flex: none; height: calc(var(--w) * 0.1); background: #fff7e8 repeating-linear-gradient(90deg, #14223a 0 2px, transparent 2px 4px, #14223a 4px 5px, transparent 5px 8px, #14223a 8px 11px, transparent 11px 13px);
  background-clip: content-box; padding: 0 0.9em 0.55em; background-origin: content-box; opacity: 0.85; }
@media (max-aspect-ratio: 1/1) { .title { flex-direction: column; } .t-left { align-items: center; text-align: center; max-width: none; } }

/* ---------------------------------------------------------------- desktop ad rails (web only) */
.rail { position: fixed; top: 0; bottom: 0; width: var(--rail); display: flex; align-items: center; justify-content: center; z-index: 5; pointer-events: auto; }
.rail.left { left: 0; } .rail.right { right: 0; }
.rail-demo { border: 2px dashed rgba(255,255,255,0.35); border-radius: 10px; background: rgba(13,22,38,0.55); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: rgba(255,255,255,0.6); font-weight: 900; letter-spacing: 0.2em; }
.rail-demo small { font-weight: 700; letter-spacing: 0.05em; opacity: 0.7; }
body.rails .screen { padding-left: calc(var(--rail) + 12px); padding-right: calc(var(--rail) + 12px); }
body.rails .screen > .iconbtn { left: calc(var(--rail) + 10px) !important; }
body.rails .ver { right: calc(var(--rail) + 12px); }

/* demo ad break */
.mockad { position: fixed; inset: 0; z-index: 60; background: rgba(5,9,18,0.92); display: flex; align-items: center; justify-content: center; }
.mockad-box { width: min(80vw, 640px); aspect-ratio: 16 / 9; border: 2px dashed rgba(255,255,255,0.4); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #fff; }
.mockad-tag { font-weight: 900; letter-spacing: 0.2em; opacity: 0.7; }
.mockad-t { font-size: 42px; font-weight: 900; }
.mockad.done { cursor: pointer; }

/* title sub buttons */
.t-sub { justify-content: flex-start; gap: 8px; }

/* game over continue */
.btn.cont { background: linear-gradient(180deg, #5eead4, #19b5a5); box-shadow: 0 0.22em 0 #0f766e; color: #062a26; }

/* ---------------------------------------------------------------- how to play */
.help, .shop { justify-content: flex-start; overflow-y: auto; gap: 2vmin; }
.help h2, .shop h2 { margin-top: 1vmin; }
.hgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 1.6vmin; width: min(100%, 1060px); text-align: left; }
.hcard { background: rgba(20,34,58,0.72); border: 1.5px solid rgba(255,255,255,0.14); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.hcard.wide { grid-column: 1 / -1; }
.hcard h3 { margin: 0 0 6px; font-size: clamp(14px, 2.8vmin, 19px); color: #ffd36b; letter-spacing: 0.02em; }
.hcard p { margin: 0; font-size: clamp(12px, 2.4vmin, 15px); line-height: 1.45; color: #e9f1ff; }
.hcard .pic { width: 100%; max-width: 360px; height: auto; position: static; display: block; margin: 2px 0 6px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; margin-top: 10px; }
.it { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; }
.it .ic { grid-row: 1 / 3; width: 40px; height: 40px; }
.it canvas.ico { position: static; width: 40px; height: 40px; }
.it b { font-size: clamp(12px, 2.3vmin, 14px); color: #fff; }
.it span { font-size: clamp(11px, 2vmin, 12.5px); opacity: 0.75; line-height: 1.25; }

/* ---------------------------------------------------------------- shop */
.offers { display: flex; gap: 2vmin; flex-wrap: wrap; justify-content: center; align-items: stretch; }
.offer { position: relative; width: clamp(170px, 30vmin, 250px); background: rgba(20,34,58,0.78); border: 1.5px solid rgba(255,255,255,0.16); border-radius: 18px; padding: 16px 14px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 0 10px 30px rgba(0,0,0,0.35); }
.offer.best { border: 2.5px solid #ffc24a; background: radial-gradient(100% 70% at 50% 0%, rgba(255,190,80,0.3), rgba(20,34,58,0.85) 70%); transform: translateY(-6px); }
.offer .ribbon { position: absolute; top: -12px; background: #ff7a1a; color: #fff; font-size: 12px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; padding: 4px 12px; border-radius: 999px; }
.o-ic { font-size: clamp(30px, 8vmin, 50px); line-height: 1; }
.offer h3 { margin: 0; font-size: clamp(16px, 3.4vmin, 22px); }
.offer p { margin: 0; flex: 1; font-size: clamp(12px, 2.3vmin, 14px); opacity: 0.85; line-height: 1.4; }
.offer .btn { min-width: 0; width: 100%; font-size: clamp(14px, 3vmin, 19px); }
.offer .btn[disabled] { opacity: 0.6; cursor: default; }
.help, .shop, .cities { touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.hgrid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.offer.best { padding-top: 22px; }
