:root {
  --ink: #134b57;
  --ink-soft: #3d6870;
  --seafoam: #bfe6df;
  --seafoam-dark: #8bc9bd;
  --ivory: #fff9ec;
  --ivory-dim: #d7d1c3;
  --sand: #e9d3ab;
  --terracotta: #d7652d;
  --teal: #159a9c;
  --danger: #c64a32;
  --tile-w: clamp(64px, 17.2vw, 78px);
  --tile-h: calc(var(--tile-w) * 1.15);
}
html.extra-readable { --tile-w: clamp(70px, 18vw, 82px); }

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overscroll-behavior: none;
  background: #799b96;
  color: var(--ink);
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  display: grid;
  place-items: center;
  min-height: 100svh;
}

button { font: inherit; }

.game-shell {
  position: relative;
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(100vw, 460px);
  height: min(100svh, 860px);
  min-height: min(650px, 100svh);
  overflow: hidden;
  padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 14% 8%, rgba(255,255,255,.45), transparent 24%),
    linear-gradient(140deg, rgba(255,255,255,.08) 25%, transparent 25%) 0 0/22px 22px,
    var(--seafoam);
  box-shadow: 0 16px 60px rgba(17, 60, 66, .36);
  user-select: none;
}
.home-screen { position: absolute; inset: 0; z-index: 3000; display: none; flex-direction: column; justify-content: flex-start; gap: 0; padding: max(18px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)); overflow: auto; background: radial-gradient(circle at 90% 4%, rgba(255,214,135,.8), transparent 24%), linear-gradient(180deg, #dff5ed 0%, #b9e5da 58%, #efd7a6 100%); text-align: center; }
.home-screen.show { display: flex; }
.home-settings-button { position: absolute; z-index: 6; top: max(28px, calc(env(safe-area-inset-top) + 10px)); right: 26px; display: grid; place-items: center; width: 48px; height: 48px; padding: 10px; border: 2px solid rgba(255,255,255,.9); border-radius: 50%; background: rgba(255,253,246,.94); color: #174f59; box-shadow: 0 4px 0 rgba(32,90,93,.23), 0 8px 18px rgba(26,80,83,.2); cursor: pointer; }
.home-settings-button svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.home-brand { position: relative; min-height: 258px; overflow: hidden; border: 2px solid rgba(255,255,255,.72); border-radius: 30px 30px 18px 18px; color: var(--ink); box-shadow: 0 16px 35px rgba(17,76,82,.18); text-align: left; }
.home-visual { position: absolute; inset: 0; width: 100%; height: 100%; }
.home-kicker { position: absolute; z-index: 2; top: 21px; left: 22px; padding: 6px 10px; border-radius: 999px; background: rgba(255,253,245,.85); color: #39777a; font-size: .65rem; font-weight: 900; letter-spacing: .18em; }
.home-brand h1 { position: absolute; z-index: 2; top: 58px; left: 22px; margin: 0; color: #174f59; font: 900 clamp(2.45rem, 11vw, 3.35rem)/.82 Georgia, serif; letter-spacing: .02em; text-shadow: 0 3px 0 rgba(255,255,255,.72); }
.home-brand h1 b { color: #d7652d; font-weight: inherit; }
.home-brand p { position: absolute; z-index: 2; left: 22px; bottom: 20px; margin: 0; padding: 7px 11px; border-radius: 10px; background: rgba(15,71,77,.76); color: #fffaf0; font-size: .88rem; font-weight: 800; }
.home-stamp { position: absolute; z-index: 2; top: 82px; right: 18px; display: grid; place-items: center; width: 58px; height: 58px; border: 2px solid rgba(255,255,255,.88); border-radius: 50%; background: #d7652d; color: white; font: 900 1.25rem/1 Georgia, serif; text-align: center; transform: rotate(7deg); box-shadow: 0 4px 12px rgba(72,50,29,.24); }
.home-stamp small { font: 800 .47rem/1 sans-serif; letter-spacing: .08em; }
.home-card { position: relative; z-index: 3; margin: -18px 7px 0; padding: 16px 15px 14px; border: 2px solid #fff8e8; border-radius: 24px; background: rgba(255,253,246,.97); box-shadow: 0 8px 0 rgba(35,102,102,.21), 0 20px 36px rgba(23,79,89,.18); }
.home-current { color: #315d61; font-size: .95rem; font-weight: 900; letter-spacing: .12em; }
.home-play { position: relative; width: 100%; min-height: 65px; margin: 8px 0 12px; border: 0; border-radius: 18px; background: linear-gradient(135deg, #e8783f, #c9562f); color: white; box-shadow: 0 5px 0 #913d26, 0 9px 18px rgba(174,76,41,.22); font-size: 1.42rem; font-weight: 900; cursor: pointer; }
.home-play::after { content: "›"; position: absolute; right: 18px; top: 50%; font: 900 2rem/1 Georgia, serif; transform: translateY(-54%); }
.home-daily { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.home-daily span { padding: 8px; border: 1px solid #d6b47b; border-radius: 12px; background: #fff6df; }
.home-daily small, .home-daily strong { display: block; }
.home-daily small { color: #77593d; font-size: .72rem; font-weight: 800; }
.home-daily strong { margin-top: 2px; color: #174f59; font-size: 1.1rem; }
.home-mission { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding: 9px 12px; border: 1px solid #4a9290; border-radius: 12px; background: #eaf9f1; text-align: left; }
.home-mission span small, .home-mission span strong { display: block; }
.home-mission span small { color: #477476; font-size: .7rem; font-weight: 800; }
.home-mission span strong { color: var(--ink); font-size: .95rem; }
.home-mission b { color: #d45f2c; font-size: 1.05rem; white-space: nowrap; }
.home-mission.complete { border-color: #d89433; background: #fff1c7; }
.home-route-label { display: flex; align-items: baseline; justify-content: space-between; margin: 9px 2px 4px; color: #6d5941; font-size: .63rem; font-weight: 800; }
.home-route-label span { color: #b55a35; letter-spacing: .12em; }
.home-route-label b { font-size: .68rem; }
.home-journey-track { height: 10px; margin: 0 2px 11px; overflow: hidden; border: 1px solid #b78d58; border-radius: 999px; background: #e3d5bd; }
.home-journey-track i { display: block; height: 100%; background: linear-gradient(90deg, #21aaa4, #f0ad42); }
.home-save-note { margin: 16px 0 0; color: #416a6d; font-size: .74rem; font-weight: 800; }

.top-ui {
  z-index: 20;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  gap: 10px;
  align-items: center;
}

.round-button {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 11px;
  border: 2px solid rgba(19,75,87,.25);
  border-radius: 50%;
  background: linear-gradient(#fffdf5, #f3e6cc);
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(58,105,105,.22), 0 7px 13px rgba(19,75,87,.18);
  cursor: pointer;
}

.round-button:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(58,105,105,.22); }
.round-button svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }

.progress-area { min-width: 0; }
.stage-label { margin-bottom: 2px; color: var(--ink-soft); text-align: center; font-size: .7rem; font-weight: 900; letter-spacing: .1em; line-height: 1; }
.milestones { display: flex; justify-content: space-around; margin-bottom: 5px; font-family: Georgia, serif; font-size: 1.5rem; line-height: 1; }
.progress-track { position: relative; height: 12px; border: 2px solid #275d63; border-radius: 999px; background: #375a5e; box-shadow: inset 0 1px 3px rgba(0,0,0,.35); }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1cb1aa, #f5b64d); transition: width .35s ease; }
.notch { position: absolute; top: -6px; width: 12px; height: 12px; transform: rotate(45deg); border-left: 2px solid #275d63; border-top: 2px solid #275d63; background: var(--seafoam); }
.notch-1 { left: 21%; }.notch-2 { left: 49%; }.notch-3 { left: 82%; }

.holder-wrap { z-index: 18; display: flex; justify-content: center; padding: 10px 0 6px; }
.holder {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  width: min(90%, 360px);
  padding: 8px;
  border: 3px solid #bf9d6c;
  border-radius: 18px;
  background: linear-gradient(#f9edcf, #e6cea5);
  box-shadow: 0 5px 0 rgba(79,87,66,.24), 0 8px 18px rgba(23,77,79,.18);
}
.holder-slot {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1 / 1.08;
  overflow: hidden;
  border: 2px solid rgba(122,94,54,.38);
  border-radius: 12px;
  background: rgba(118,93,58,.09);
}
.holder-slot .tile-icon { width: 82%; height: 82%; }
.holder-slot.filled { background: var(--ivory); box-shadow: inset 0 -3px 0 #d8c8a8; }
.danger-mark { position: absolute; right: 4px; bottom: 4px; display: none; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: var(--danger); color: white; font-weight: 900; font-size: 12px; }
.holder-slot.danger.warning .danger-mark { display: grid; }
.holder.matching { animation: holderPulse .34s ease 2; }
.holder.recovered { animation: recoveredGlow .7s ease; }

.board-wrap { position: relative; min-height: 0; }
.board {
  position: absolute;
  /* Keep the full tile face and its lower depth shadow inside the play field. */
  inset: calc(var(--tile-h) * .25) 0 calc(var(--tile-h) * .36);
}
@media (max-height: 680px) {
  .board { inset: calc(var(--tile-h) * .37) 0 calc(var(--tile-h) * .52); }
}

.tile {
  position: absolute;
  display: grid;
  place-items: center;
  width: var(--tile-w);
  height: var(--tile-h);
  padding: 5px;
  border: 2px solid #b9a77f;
  border-radius: 14px;
  background: linear-gradient(145deg, #fffef7, #f2e7cf);
  box-shadow: 0 5px 0 #aa9b7d, 0 8px 14px rgba(39,67,63,.28);
  transform: translate(-50%, -50%);
  transition: filter .18s ease, opacity .18s ease, transform .18s ease, left .25s ease, top .25s ease;
  cursor: pointer;
}
.tile.free { border-color: #a98a55; background: linear-gradient(145deg, #fffef9, #f4e4c5); }
.tile.free:focus-visible { outline: 5px solid #f0a63c; outline-offset: 3px; }
.tile.blocked { filter: saturate(.68) brightness(.84); cursor: default; }
.tile.blocked::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: rgba(68,77,68,.10); }
.tile.free:hover { transform: translate(-50%, -53%) scale(1.025); }
.tile.hinted { animation: hintPulse .72s ease 3; z-index: 999 !important; }
.tile.danger-hint { outline: 5px solid #e56c35; outline-offset: 2px; }
.tile.removing { opacity: 0; transform: translate(-50%, -50%) scale(.35); }
.tile-icon { display: block; width: 100%; height: 100%; pointer-events: none; }
.tile-icon svg { width: 100%; height: 100%; overflow: visible; }

.toast { position: absolute; z-index: 1200; left: 50%; bottom: 18px; max-width: 90%; padding: 10px 16px; border-radius: 999px; background: rgba(17,69,78,.92); color: white; font-weight: 800; text-align: center; opacity: 0; transform: translate(-50%, 12px); transition: .2s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.combo { position: absolute; z-index: 1100; inset: 30% 0 auto; text-align: center; color: #c9572d; font: 900 2.3rem Georgia, serif; text-shadow: 0 2px white; opacity: 0; pointer-events: none; }
.combo.show { animation: comboPop .65s ease; }

.bottom-ui { z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; padding: 6px 20px 20px; }
.booster { position: relative; display: grid; place-items: center; aspect-ratio: 1; padding: 20%; border: 3px solid rgba(30,101,107,.38); border-radius: 50%; background: linear-gradient(#fffdf5, #e8eadc); color: var(--ink); box-shadow: 0 5px 0 rgba(48,101,99,.25), 0 8px 14px rgba(19,75,87,.16); cursor: pointer; }
.booster:active { transform: translateY(2px); }
.booster:disabled { filter: grayscale(.8); opacity: .5; cursor: default; }
.booster svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.booster small { position: absolute; top: calc(100% + 4px); white-space: nowrap; color: var(--ink); font: 700 .78rem Georgia, serif; letter-spacing: .05em; }
.badge { position: absolute; z-index: 2; top: -7px; right: -3px; display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 7px; border: 2px solid #fff4da; border-radius: 999px; background: var(--terracotta); color: white; font-weight: 900; }

.modal-backdrop, .ad-sim {
  position: fixed;
  z-index: 5000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(12,45,50,.68);
  opacity: 0;
  visibility: hidden;
  transition: .2s ease;
}
.modal-backdrop.show, .ad-sim.show { opacity: 1; visibility: visible; }
.modal-card {
  width: min(100%, 390px);
  padding: 28px 24px 24px;
  border: 3px solid #d8c6a3;
  border-radius: 28px;
  background: linear-gradient(#fffdf6, #f8ead2);
  box-shadow: 0 14px 0 rgba(77,75,57,.24), 0 24px 50px rgba(0,0,0,.28);
  text-align: center;
}
.modal-kicker { margin: 0 0 4px; color: var(--teal); font-size: .75rem; font-weight: 900; letter-spacing: .16em; }
.modal-card h1 { margin: 4px 0 12px; font-size: clamp(1.55rem, 7vw, 2rem); line-height: 1.2; }
.modal-card p { margin: 0 auto 18px; max-width: 31ch; color: var(--ink-soft); font-weight: 650; line-height: 1.65; }
.modal-holder { display: none; grid-template-columns: repeat(4, 1fr); gap: 3px; margin: 12px auto 20px; padding: 7px; border-radius: 14px; background: #e3cfaa; }
.modal-holder.show { display: grid; }
.modal-holder .mini-tile { display: grid; place-items: center; aspect-ratio: 1 / 1.08; padding: 4px; border-radius: 9px; background: var(--ivory); box-shadow: 0 3px 0 #b6a486; }
.modal-holder .tile-icon { width: 100%; height: 100%; }
.modal-details { display: none; margin: 4px 0 20px; }
.modal-details.show { display: block; }
.settings-panel { display: grid; gap: 8px; }
.setting-toggle { min-height: 48px; border: 2px solid #2b7779; border-radius: 12px; background: #eefaf4; color: var(--ink); font-size: 1rem; font-weight: 900; cursor: pointer; }
.metrics-summary { margin-top: 10px; color: var(--ink-soft); font-size: .78rem; font-weight: 800; }
.extra-readable .stage-label { font-size: .98rem; }
.extra-readable .booster small { font-size: .9rem; }
.extra-readable .modal-card p { font-size: 1.08rem; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.result-stats.daily-reward { grid-template-columns: 1fr; max-width: 210px; margin: auto; }
.result-stat { overflow: hidden; border: 2px solid #c69b61; border-radius: 12px; background: #fffaf0; }
.result-stat small { display: block; padding: 4px 2px; background: #765036; color: #fff2d5; font-size: .68rem; font-weight: 800; }
.result-stat strong { display: block; padding: 7px 2px; color: var(--ink); font: 800 1.05rem Georgia, serif; }
.journey-label { margin: 14px 0 7px; color: #70462e; font-weight: 900; }
.journey-track { position: relative; height: 16px; overflow: hidden; border: 2px solid #b78d58; border-radius: 999px; background: #e3d5bd; }
.journey-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #21aaa4, #f0ad42); }
.journey-note { margin-top: 6px; color: var(--ink-soft); font-size: .8rem; font-weight: 800; }
.chest-reward { margin-top: 9px; padding: 9px; border: 2px solid #d89433; border-radius: 12px; background: #fff1c7; color: #74451f; font-weight: 900; }
.daily-mission-reward { margin-top: 9px; padding: 9px; border: 2px solid #2a918e; border-radius: 12px; background: #e5f8f1; color: #235e61; font-weight: 900; }
.modal-actions { display: grid; gap: 10px; }
.primary-action, .secondary-action { min-height: 62px; border: 0; border-radius: 999px; font-size: 1.35rem; font-weight: 900; cursor: pointer; }
.primary-action { background: linear-gradient(#22aaa5, #118b8d); color: white; box-shadow: 0 5px 0 #0d6669; }
.primary-action:disabled { filter: grayscale(.75); opacity: .56; box-shadow: 0 3px 0 #777; cursor: default; }
.secondary-action { background: linear-gradient(#f7ddb0, #eac58d); color: #70462e; box-shadow: 0 5px 0 #bd9561; }
.secondary-action.hidden { display: none; }

.ad-sim-card { width: min(90vw, 330px); padding: 28px; border-radius: 24px; background: #fffdf4; color: var(--ink); text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.ad-sim-card strong { display: block; margin-top: 12px; font-size: 1.35rem; }
.ad-sim-card p { margin: 7px 0 18px; color: var(--ink-soft); }
.video-icon { display: grid; place-items: center; width: 64px; height: 52px; margin: auto; border-radius: 13px; background: var(--teal); color: white; font-size: 1.5rem; }
.ad-progress { height: 10px; overflow: hidden; border-radius: 999px; background: #d9ded7; }
.ad-progress i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--teal), #f3b14c); }

@keyframes hintPulse { 0%,100% { filter: none; } 50% { filter: drop-shadow(0 0 12px #fff) drop-shadow(0 0 8px #eea72e); transform: translate(-50%, -53%) scale(1.08); } }
@keyframes holderPulse { 50% { transform: scale(1.025); box-shadow: 0 0 18px #f0bb3f; } }
@keyframes recoveredGlow { 50% { box-shadow: 0 0 25px 8px rgba(75,221,175,.85); } }
@keyframes comboPop { 0% { opacity: 0; transform: scale(.5); } 35% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: translateY(-40px) scale(1); } }

@media (max-height: 720px) {
  :root { --tile-w: clamp(58px, 16.3vw, 68px); }
  .game-shell { min-height: min(590px, 100svh); padding-top: 8px; }
  .top-ui { grid-template-columns: 46px 1fr 46px; }
  .round-button { width: 45px; height: 45px; }
  .holder-wrap { padding: 5px 0 2px; }
  .bottom-ui { padding-top: 2px; }
}

@media (max-width: 360px) {
  :root { --tile-w: clamp(60px, 17vw, 64px); }
  .holder { width: 94%; }
}

@media (min-width: 700px) and (min-height: 900px) {
  .game-shell { border-radius: 34px; }
}

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

/* Premium full-bleed home, benchmarked against leading tile games. */
.home-screen {
  justify-content: flex-end;
  padding: max(22px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom));
  overflow: hidden;
  background: #062c38 url("assets/voyage-home-keyart.png") center center / cover no-repeat;
  color: #fff;
  isolation: isolate;
}
.home-screen::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, rgba(2,22,29,.68) 0%, rgba(2,22,29,.06) 24%, rgba(2,22,29,0) 48%, rgba(2,22,29,.45) 61%, rgba(2,22,29,.97) 100%);
  pointer-events: none;
}
.home-settings-button {
  top: max(22px, calc(env(safe-area-inset-top) + 8px));
  right: 20px;
  width: 48px;
  height: 48px;
  padding: 11px;
  border: 1px solid rgba(255,255,255,.55);
  background: rgba(3,34,43,.5);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  backdrop-filter: blur(12px);
}
.home-brand {
  position: absolute;
  z-index: 2;
  top: max(24px, calc(env(safe-area-inset-top) + 10px));
  left: 20px;
  right: 78px;
  min-height: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  color: #fff;
  box-shadow: none;
  text-align: left;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.42));
}
.home-visual, .home-stamp { display: none; }
.home-kicker {
  position: static;
  display: block;
  width: max-content;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #f7d58d;
  font-size: .59rem;
  letter-spacing: .2em;
}
.home-brand h1 {
  position: static;
  margin: 5px 0 0;
  color: #fffdf5;
  font-size: clamp(1.9rem, 8.6vw, 2.55rem);
  line-height: .88;
  text-shadow: 0 3px 10px rgba(0,0,0,.5);
}
.home-brand h1 br { display: none; }
.home-brand h1 b { margin-left: .16em; color: #ff8b63; }
.home-brand p {
  position: static;
  margin: 7px 0 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255,255,255,.9);
  font-size: .78rem;
}
.home-card {
  position: relative;
  z-index: 3;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.home-current {
  width: max-content;
  margin: 0 auto 10px;
  padding: 7px 15px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  background: rgba(3,35,44,.65);
  color: #fff8e8;
  font-size: .82rem;
  backdrop-filter: blur(10px);
}
.home-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 330px);
  min-height: 70px;
  margin: 0 auto 11px;
  border: 2px solid rgba(255,248,221,.9);
  border-radius: 999px;
  background: linear-gradient(180deg, #ff8c65, #dc5637);
  color: #fff;
  box-shadow: 0 7px 0 #8e3628, 0 12px 26px rgba(0,0,0,.36), inset 0 2px 1px rgba(255,255,255,.34);
  font-size: 1.3rem;
  letter-spacing: .03em;
}
.home-play::before {
  content: "▶";
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-right: 12px;
  padding-left: 3px;
  border-radius: 50%;
  background: #fff8df;
  color: #d85637;
  font-size: .9rem;
}
.home-play::after { display: none; }
.home-play:active { transform: translateY(3px); box-shadow: 0 4px 0 #8e3628, 0 8px 18px rgba(0,0,0,.3); }
.home-daily {
  grid-template-columns: 1fr 1fr;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 13px;
  background: rgba(3,35,44,.68);
  backdrop-filter: blur(10px);
}
.home-daily span {
  padding: 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.home-daily span + span { border-left: 1px solid rgba(255,255,255,.2); }
.home-daily small { color: rgba(255,255,255,.64); font-size: .62rem; }
.home-daily strong { margin-top: 1px; color: #fff8e8; font-size: .9rem; }
.home-mission {
  margin-top: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 13px;
  background: rgba(3,35,44,.68);
  color: #fff;
  backdrop-filter: blur(10px);
}
.home-mission span small { color: #f7d58d; font-size: .64rem; }
.home-mission span strong { color: #fff; font-size: .88rem; }
.home-mission b { color: #ffd682; font-size: .98rem; }
.home-mission.complete { border-color: #e5bc65; background: rgba(105,72,21,.75); }
.home-route-label { margin: 7px 2px 4px; color: rgba(255,255,255,.65); }
.home-route-label span { color: #f7d58d; }
.home-journey-track { height: 9px; margin: 0 2px 8px; border-color: rgba(255,255,255,.3); background: rgba(0,0,0,.36); }
.home-save-note { margin: 0; color: rgba(255,255,255,.58); font-size: .65rem; }

@media (max-height: 720px) {
  .home-brand p { display: none; }
  .home-current { margin-bottom: 7px; }
  .home-play { min-height: 60px; margin-bottom: 8px; }
  .home-daily span { padding: 5px; }
  .home-mission { margin-top: 5px; padding: 6px 9px; }
  .home-route-label { margin-top: 5px; }
  .home-save-note { display: none; }
}

/* Premium gameplay table: material depth and a single visual hierarchy. */
body { background: #031c24; }
.game-shell {
  background: #062f3a url("assets/game-board-bg-v1.png") center center / cover no-repeat;
  box-shadow: 0 18px 70px rgba(0,0,0,.6);
}
.top-ui {
  margin-top: 1px;
  padding: 7px 8px;
  border: 1px solid rgba(232,201,139,.34);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(5,31,37,.8), rgba(3,24,30,.63));
  box-shadow: 0 8px 22px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(12px);
}
.round-button {
  width: 50px;
  height: 50px;
  padding: 12px;
  border: 1px solid rgba(240,211,154,.65);
  background: linear-gradient(145deg, rgba(255,250,231,.98), rgba(221,200,158,.95));
  color: #0b4b55;
  box-shadow: 0 4px 0 #6f573b, 0 7px 15px rgba(0,0,0,.38), inset 0 2px 1px rgba(255,255,255,.85);
}
.round-button:active { transform: translateY(2px); box-shadow: 0 2px 0 #6f573b, 0 4px 10px rgba(0,0,0,.32); }
.stage-label { margin-bottom: 4px; color: #f5ddb0; font-size: .72rem; text-shadow: 0 1px 2px #000; }
.milestones { margin-bottom: 5px; color: #fff8e7; font-size: 1.35rem; text-shadow: 0 2px 3px rgba(0,0,0,.65); }
.progress-track {
  height: 11px;
  border: 1px solid #c9a86c;
  background: rgba(0,0,0,.56);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.65), 0 1px 0 rgba(255,255,255,.12);
}
.progress-track i { background: linear-gradient(90deg, #35c5b0, #f7c35f); box-shadow: 0 0 8px rgba(69,216,190,.45); }
.notch { top: -5px; width: 10px; height: 10px; border-color: #c9a86c; background: #f0d9a9; box-shadow: 1px 1px 2px rgba(0,0,0,.35); }

.holder-wrap { padding: 11px 0 8px; }
.holder {
  gap: 5px;
  width: min(92%, 370px);
  padding: 7px;
  border: 2px solid #c89f5c;
  border-radius: 20px;
  background: linear-gradient(180deg, #795032, #4c2e1f);
  box-shadow: 0 6px 0 #2b1a13, 0 12px 24px rgba(0,0,0,.42), inset 0 2px 1px rgba(255,230,177,.34);
}
.holder-slot {
  border: 1px solid rgba(225,190,126,.55);
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(1,28,32,.78), rgba(3,47,50,.62));
  box-shadow: inset 0 3px 8px rgba(0,0,0,.52), 0 1px 0 rgba(255,255,255,.08);
}
.holder-slot.filled {
  border-color: #e2c78f;
  background: linear-gradient(145deg, #fffdf5, #e9d8b6);
  box-shadow: inset 0 2px 2px #fff, inset 0 -4px 0 #bd9f72, 0 3px 5px rgba(0,0,0,.3);
}

.board-wrap::before {
  content: "";
  position: absolute;
  inset: 3px -4px 1px;
  border-radius: 26px;
  background: radial-gradient(circle at 48% 38%, rgba(45,172,159,.08), transparent 52%);
  box-shadow: inset 0 0 26px rgba(0,0,0,.2);
  pointer-events: none;
}
.tile {
  padding: 6px;
  border: 2px solid #d2bc8d;
  border-radius: 15px;
  background: linear-gradient(145deg, #fffef8 0%, #f5ead4 55%, #dfcba7 100%);
  box-shadow: 0 7px 0 #8f795a, 0 10px 16px rgba(0,0,0,.46), inset 0 2px 2px rgba(255,255,255,.95), inset 0 -2px 4px rgba(131,101,59,.16);
}
.tile::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(157,126,77,.15);
  border-radius: 10px;
  background: radial-gradient(circle at 35% 22%, rgba(255,255,255,.48), transparent 48%);
  pointer-events: none;
}
.tile.free {
  border-color: #e3c57e;
  background: linear-gradient(145deg, #fffefb 0%, #f6e7c8 62%, #dec192 100%);
  box-shadow: 0 7px 0 #8c704a, 0 11px 18px rgba(0,0,0,.52), inset 0 2px 2px #fff, inset 0 -2px 4px rgba(125,86,32,.18);
}
.tile.blocked { filter: saturate(.68) brightness(.61); opacity: .9; }
.tile.blocked::after { background: rgba(3,28,31,.2); }
.tile-icon { position: relative; z-index: 1; filter: drop-shadow(0 2px 1px rgba(75,54,28,.22)); }
.tile.free:hover { transform: translate(-50%, -55%) scale(1.035); filter: brightness(1.05); }
.tile.danger-hint { outline-color: #ff8a56; box-shadow: 0 7px 0 #8c704a, 0 0 22px rgba(255,111,69,.82); }
.combo { color: #ffd777; text-shadow: 0 3px 0 #6f351d, 0 7px 16px rgba(0,0,0,.5); }
.toast { bottom: 20px; border: 1px solid rgba(243,210,149,.5); background: rgba(3,30,36,.94); box-shadow: 0 8px 20px rgba(0,0,0,.35); }

.bottom-ui {
  gap: 20px;
  padding: 7px 22px 22px;
}
.booster {
  padding: 22%;
  border: 2px solid #d5b46e;
  background: linear-gradient(145deg, #fffdf4, #dcc8a0);
  color: #0b4b55;
  box-shadow: 0 6px 0 #66432d, 0 10px 18px rgba(0,0,0,.44), inset 0 2px 1px rgba(255,255,255,.9);
}
.booster:active { transform: translateY(3px); box-shadow: 0 3px 0 #66432d, 0 6px 12px rgba(0,0,0,.38); }
.booster:disabled { filter: grayscale(.75) brightness(.72); opacity: .72; }
.booster small {
  top: calc(100% + 6px);
  color: #f5ddb0;
  font-family: "Yu Gothic UI", system-ui, sans-serif;
  font-size: .68rem;
  font-weight: 900;
  text-shadow: 0 2px 3px rgba(0,0,0,.8);
}
.badge {
  top: -6px;
  right: -4px;
  min-width: 29px;
  height: 29px;
  border-color: #ffedc7;
  background: linear-gradient(#f58155, #c94c31);
  box-shadow: 0 3px 5px rgba(0,0,0,.4);
}

@media (max-width: 699px) {
  .game-shell { height: 100svh; max-height: none; }
}
@media (max-height: 720px) {
  .top-ui { padding: 5px 7px; }
  .holder-wrap { padding: 7px 0 5px; }
  .bottom-ui { padding: 4px 22px 17px; }
  .booster small { top: calc(100% + 3px); font-size: .62rem; }
}

/* Vita-scale calibration: the tiles lead, utility chrome stays secondary. */
:root { --tile-w: clamp(68px, 18.5vw, 82px); --tile-h: calc(var(--tile-w) * 1.2); }
html.extra-readable { --tile-w: clamp(74px, 19.5vw, 86px); }
.top-ui {
  grid-template-columns: 46px 1fr 46px;
  gap: 12px;
  margin-top: 0;
  padding: 3px 4px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.round-button {
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 2px solid #b97b3f;
  background: linear-gradient(145deg, #925128, #613019);
  color: #ffe3a5;
  box-shadow: 0 4px 0 #3a1c12, 0 6px 12px rgba(0,0,0,.42), inset 0 2px 1px rgba(255,220,158,.28);
}
.round-button:active { box-shadow: 0 2px 0 #3a1c12, 0 3px 8px rgba(0,0,0,.36); }
.stage-label { margin-bottom: 2px; font-size: .64rem; }
.milestones { margin-bottom: 3px; font-size: 1.2rem; }
.progress-track { height: 9px; }
.notch { top: -4px; width: 9px; height: 9px; }

.holder-wrap { padding: 6px 0 5px; }
.holder {
  gap: 3px;
  width: min(68%, 274px);
  padding: 5px;
  border-width: 2px;
  border-radius: 15px;
  box-shadow: 0 4px 0 #2b1a13, 0 8px 16px rgba(0,0,0,.38), inset 0 2px 1px rgba(255,230,177,.28);
}
.holder-slot { border-radius: 9px; }
.holder-slot .tile-icon { width: 78%; height: 78%; }

@media (max-width: 340px) {
  .holder { width: min(78%, 274px); }
}

.bottom-ui {
  grid-template-columns: repeat(3, 66px);
  justify-content: center;
  gap: 42px;
  padding: 4px 14px 16px;
}
.booster {
  width: 66px;
  height: 66px;
  padding: 19%;
  border-width: 2px;
  box-shadow: 0 5px 0 #55331f, 0 8px 15px rgba(0,0,0,.42), inset 0 2px 1px rgba(255,255,255,.88);
}
.booster small { top: calc(100% + 4px); font-size: .62rem; }
.badge {
  top: -7px;
  right: -5px;
  min-width: 25px;
  height: 25px;
  padding: 0 5px;
  font-size: .78rem;
}

@media (max-height: 720px) {
  :root { --tile-w: clamp(64px, 18vw, 70px); --tile-h: calc(var(--tile-w) * 1.18); }
  html.extra-readable { --tile-w: clamp(69px, 19.2vw, 74px); }
  .top-ui { padding: 2px 4px 3px; }
  .holder-wrap { padding: 4px 0; }
  .bottom-ui { grid-template-columns: repeat(3, 60px); gap: 38px; padding: 3px 14px 12px; }
  .booster { width: 60px; height: 60px; }
  .booster small { font-size: .58rem; }
}

/* Illustrated travel tiles: richer faces without sacrificing readability. */
.tile,
.tile.free {
  border-color: #dfc487;
  background:
    radial-gradient(circle at 28% 18%, rgba(255,255,255,.96), transparent 30%),
    linear-gradient(145deg, #fffdf5 0%, #f6e8cc 58%, #ddc295 100%);
  box-shadow: 0 7px 0 #9b523b, 0 11px 19px rgba(0,0,0,.52), inset 0 2px 2px #fff, inset 0 -2px 5px rgba(123,79,31,.2);
}
.tile::before {
  inset: 3px;
  border: 1px solid rgba(156,111,49,.24);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(255,255,255,.34), transparent 48%);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.22);
}
.tile-icon { width: 98%; height: 98%; filter: drop-shadow(0 2px 1px rgba(69,44,21,.24)); }
.tile.blocked { filter: saturate(.56) brightness(.58); opacity: .92; }
.tile.danger-hint { box-shadow: 0 7px 0 #9b523b, 0 0 24px rgba(255,126,66,.86); }

/* Premium dialog system shared by intro, results, settings and recovery. */
.modal-backdrop {
  padding: 28px 18px 18px;
  overflow: auto;
  background: rgba(1,18,23,.78);
  backdrop-filter: blur(6px) saturate(.8);
}
.modal-card {
  position: relative;
  width: min(100%, 370px);
  overflow: visible;
  padding: 0;
  border: 2px solid #d1aa69;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% -8%, rgba(255,222,156,.8), transparent 28%),
    linear-gradient(180deg, #fffaf0 0%, #f5e4c5 100%);
  box-shadow: 0 9px 0 #6c422a, 0 17px 0 rgba(25,16,13,.36), 0 30px 60px rgba(0,0,0,.48), inset 0 2px 0 rgba(255,255,255,.9);
}
.modal-scroll {
  max-height: calc(100svh - 42px);
  overflow: auto;
  padding: 48px 22px 22px;
  border-radius: inherit;
  scrollbar-width: none;
}
.modal-scroll::-webkit-scrollbar { display: none; }
.modal-card::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(145,91,44,.22);
  border-radius: 21px;
  pointer-events: none;
}
.modal-crest {
  position: absolute;
  z-index: 2;
  top: -1px;
  left: 50%;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 3px solid #f2d694;
  border-radius: 50%;
  background: linear-gradient(145deg, #9d5c31, #5d2f1d);
  color: #fff0bd;
  box-shadow: 0 5px 0 #3f2117, 0 8px 18px rgba(0,0,0,.35), inset 0 2px 1px rgba(255,226,166,.35);
  font: 900 1.7rem/1 Georgia, serif;
  transform: translate(-50%, -42%);
}
.modal-kicker {
  margin: 0 0 6px;
  color: #9a6338;
  font-size: .66rem;
  letter-spacing: .2em;
}
.modal-card h1 {
  margin: 4px 0 10px;
  color: #123f47;
  font: 900 clamp(1.55rem, 7vw, 2rem)/1.2 "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif;
  letter-spacing: .02em;
}
.modal-card p {
  max-width: 29ch;
  margin-bottom: 14px;
  color: #49656a;
  font-size: .92rem;
  line-height: 1.65;
}
.rule-steps { display: grid; gap: 7px; margin: 2px 0 16px; text-align: left; }
.rule-steps > div {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid rgba(48,119,118,.28);
  border-radius: 12px;
  background: rgba(237,248,238,.72);
  color: #244f55;
  font-size: .84rem;
  font-weight: 850;
}
.rule-steps b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1f8e8d;
  color: #fff;
  box-shadow: 0 2px 0 #126565;
}
.modal-holder {
  gap: 5px;
  margin: 9px auto 18px;
  padding: 8px;
  border: 2px solid #b6783e;
  border-radius: 15px;
  background: linear-gradient(#75472c, #4a2b20);
  box-shadow: 0 4px 0 #331c15, inset 0 2px 1px rgba(255,220,158,.25);
}
.modal-holder .mini-tile {
  border: 1px solid #d8b66f;
  background: linear-gradient(145deg, #fffdf5, #e3c99a);
  box-shadow: 0 4px 0 #97513b, 0 6px 8px rgba(0,0,0,.25), inset 0 1px #fff;
}
.modal-details { margin-bottom: 16px; }
.result-stats { gap: 8px; }
.result-stat {
  border: 1px solid #c39554;
  border-radius: 13px;
  background: linear-gradient(180deg, #fffdf6, #edd7ad);
  box-shadow: 0 3px 0 #a56a3d, inset 0 1px #fff;
}
.result-stat small {
  padding: 5px 2px 3px;
  background: transparent;
  color: #8a5a35;
  font-size: .62rem;
  letter-spacing: .06em;
}
.result-stat strong { padding: 3px 2px 8px; color: #174f59; font-size: 1.2rem; }
.journey-label { margin: 15px 0 6px; color: #75492d; font-size: .84rem; }
.journey-track { height: 13px; border-color: #a66f39; background: #d9c5a5; }
.journey-note { color: #41676a; font-size: .74rem; }
.daily-mission-reward,
.chest-reward {
  margin-top: 9px;
  padding: 9px 10px;
  border-width: 1px;
  border-radius: 12px;
  box-shadow: inset 0 1px rgba(255,255,255,.65);
}
.modal-actions { position: relative; z-index: 1; gap: 9px; }
.primary-action,
.secondary-action { min-height: 58px; font-size: 1.14rem; }
.primary-action {
  border: 2px solid #f5d796;
  background: linear-gradient(180deg, #f17b55, #cf5037);
  color: #fff;
  box-shadow: 0 5px 0 #843422, 0 9px 16px rgba(0,0,0,.2), inset 0 2px 1px rgba(255,255,255,.3);
}
.secondary-action {
  border: 1px solid #bb854b;
  background: linear-gradient(#f8e0b5, #e8bf80);
  color: #6d432b;
  box-shadow: 0 4px 0 #a66d3e;
}
.setting-toggle {
  position: relative;
  min-height: 51px;
  padding: 0 42px 0 15px;
  border: 1px solid #417f7e;
  border-radius: 13px;
  background: linear-gradient(180deg, #f3fbf4, #dceee7);
  color: #174f59;
  text-align: left;
  box-shadow: 0 3px 0 #9bb5a9, inset 0 1px #fff;
}
.setting-toggle::after {
  content: "›";
  position: absolute;
  top: 50%;
  right: 16px;
  color: #b76b39;
  font: 900 1.45rem/1 Georgia, serif;
  transform: translateY(-53%);
}
.metrics-summary { color: #6f756e; font-size: .7rem; }
.modal-backdrop[data-kind="clear"] .modal-crest,
.modal-backdrop[data-kind="daily"] .modal-crest { background: linear-gradient(145deg, #2da69c, #146765); }
.modal-backdrop[data-kind="fail"] .modal-crest { background: linear-gradient(145deg, #e46a47, #932f25); }
.modal-backdrop[data-kind="help"] .modal-crest,
.modal-backdrop[data-kind="settings"] .modal-crest { background: linear-gradient(145deg, #397f82, #174c55); }
.modal-backdrop[data-kind="clear"] .primary-action,
.modal-backdrop[data-kind="daily"] .primary-action,
.modal-backdrop[data-kind="settings"] .primary-action,
.modal-backdrop[data-kind="help"] .primary-action {
  background: linear-gradient(180deg, #2cb3aa, #14827f);
  box-shadow: 0 5px 0 #0d5f5e, 0 9px 16px rgba(0,0,0,.2), inset 0 2px 1px rgba(255,255,255,.28);
}

@media (max-height: 720px) {
  .modal-backdrop { padding-top: 22px; }
  .modal-card { border-radius: 24px; }
  .modal-scroll { max-height: calc(100svh - 30px); padding: 40px 18px 18px; }
  .modal-crest { width: 54px; height: 54px; font-size: 1.45rem; }
  .modal-card h1 { font-size: 1.45rem; }
  .modal-card p { margin-bottom: 10px; font-size: .82rem; line-height: 1.5; }
  .rule-steps { gap: 5px; margin-bottom: 11px; }
  .rule-steps > div { min-height: 36px; }
  .primary-action, .secondary-action { min-height: 52px; }
}
