* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; background: #07080c; scrollbar-width: none; }
body {
  margin: 0;
  min-height: 100%;
  background: #07080c;
  color: #f4efe4;
  font-family: Roboto, "Segoe UI", sans-serif;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
body::-webkit-scrollbar { display: none; }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid #e4c36a; outline-offset: 2px; }
img, svg { max-width: 100%; }
img { -webkit-user-drag: none; }
.app {
  width: min(560px, 100%);
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 40% at 50% -10%, rgba(208, 18, 45, 0.18), transparent 46%),
    #07080c;
}
body.playing { height: 100%; overflow: hidden; position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 100%; }
body.playing .app { height: 100%; min-height: 0; overflow: hidden; }
.top {
  position: sticky;
  top: 0;
  z-index: 4;
  background: linear-gradient(180deg, #10131b 0%, #090b10 100%);
  border-bottom: 1px solid rgba(228, 195, 106, 0.28);
  box-shadow: inset 0 -2px 0 #8d0c1e;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 8px;
  min-width: 0;
}
.brand-seal {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  transform: rotate(45deg);
  border: 1px solid #e4c36a;
  background: linear-gradient(160deg, #4a121c, #120e0c 62%);
  color: #f8e7b0;
  font-family: Palatino, Georgia, serif;
  font-weight: 700;
}
.brand-seal span { transform: rotate(-45deg); display: block; font-size: 16px; }
.brand-text { min-width: 0; display: grid; }
.brand-text strong {
  font-family: Palatino, Georgia, serif;
  font-size: 18px;
  letter-spacing: 0.22em;
  line-height: 1;
  background: linear-gradient(180deg, #fff6d8, #e4c36a 55%, #a9782b);
  -webkit-background-clip: text;
  background-clip: text;
  color: #f3e2ae;
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .brand-text strong { color: transparent; }
}
.brand-text small {
  color: #d7c7a2;
  letter-spacing: 0.18em;
  font-size: 9px;
  margin-top: 3px;
}
.brand-count {
  margin-left: auto;
  flex: none;
  min-width: 46px;
  text-align: right;
}
.brand-count b {
  display: block;
  color: #f8e7b0;
  font-size: 16px;
  line-height: 1;
}
.brand-count span {
  color: #a7a297;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.ticker { overflow: hidden; white-space: nowrap; margin: 0; color: #f0d48a; font-size: 12px; padding: 0 0 8px; }
.ticker span { display: inline-block; padding-left: 100%; animation: drift 26s linear infinite; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-100%); } }
main { flex: 1; padding-bottom: 112px; }
body.playing main { min-height: 0; overflow: hidden; padding-bottom: 0; display: flex; flex-direction: column; }
.screen { display: none; padding: 14px 14px 8px; }
.screen.active { display: block; }
#screen-dayung.active { padding: 0; height: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.hero {
  min-height: clamp(228px, 64vw, 340px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  border: 1px solid rgba(228, 195, 106, 0.4);
  background:
    linear-gradient(180deg, rgba(7, 8, 12, 0.08) 0%, rgba(7, 8, 12, 0.9) 74%),
    url("hero-night.jpg") center 35% / cover no-repeat;
}
.eyebrow {
  margin: 0;
  color: #e4c36a;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
  font-style: normal;
}
h1, h2, h3 { font-family: Palatino, Georgia, serif; font-weight: 700; }
h1 {
  margin: 6px 0 0;
  font-size: clamp(30px, 8.4vw, 46px);
  line-height: 0.96;
  background: linear-gradient(180deg, #fff8e4, #e4c36a 58%, #b8883a);
  -webkit-background-clip: text;
  background-clip: text;
  color: #f3e2ae;
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  h1 { color: transparent; }
}
.lead, .page-head p, .note p, .blurb { color: #e7e1d6; line-height: 1.45; }
.lead { margin: 8px 0 0; font-size: 15px; }
.actions, .sheet-actions { display: grid; gap: 8px; margin-top: 12px; }
.primary, .secondary, .pad-btn {
  width: 100%;
  border-radius: 999px;
  min-height: 48px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 13px;
}
.primary {
  position: relative;
  overflow: hidden;
  border: 1px solid #f0d48a;
  color: #fff8ea;
  background: linear-gradient(180deg, #ff3148 0%, #c10f28 55%, #8d0c1e 100%);
  box-shadow: 0 8px 18px rgba(141, 12, 30, 0.35);
}
.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.28) 48%, transparent 62%);
  transform: translateX(-120%);
  animation: sheen 3.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sheen { 40%, 100% { transform: translateX(120%); } }
.secondary {
  background: transparent;
  color: #f8e7b0;
  border: 1px solid rgba(228, 195, 106, 0.75);
}
.secondary.small { min-height: 40px; font-size: 12px; margin-top: 8px; }
.quiet {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: none;
  border: 0;
  color: #e4c36a;
  min-height: 40px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-align: center;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.panel {
  background: linear-gradient(180deg, rgba(28, 24, 16, 0.96), rgba(10, 12, 16, 0.96));
  border: 1px solid rgba(228, 195, 106, 0.38);
  box-shadow: inset 0 0 0 1px rgba(228, 195, 106, 0.08);
}
.stat { padding: 10px 8px; text-align: center; min-width: 0; }
.stat b {
  display: block;
  font-size: clamp(16px, 4.8vw, 22px);
  color: #f8e7b0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat span { display: block; margin-top: 2px; color: #a7a297; font-size: 10px; letter-spacing: 0.04em; }
.section { margin-top: 18px; }
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: #f8e7b0;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.section-title::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, rgba(228, 195, 106, 0.75), transparent);
}
.continue {
  width: 100%;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px;
  padding: 8px;
  text-align: left;
  color: inherit;
}
.continue img { width: 104px; height: 104px; object-fit: cover; display: block; }
.continue-copy { display: grid; gap: 4px; min-width: 0; align-content: center; }
.continue-copy strong { font-size: 18px; color: #fff8ea; }
.meta { margin: 0; color: #a7a297; font-size: 12px; }
.blurb {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-size: 13px;
}
.teach article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(228, 195, 106, 0.16);
}
.teach article > span {
  font-family: Palatino, Georgia, serif;
  color: #e4c36a;
  font-size: 20px;
}
.teach h3, .page-head h2, .note h3, .island-copy h3, .find h3 { margin: 0; color: #fff8ea; }
.teach p { margin: 4px 0 0; font-size: 14px; }
.page-head { margin-bottom: 12px; }
.page-head h2 { margin: 4px 0 6px; font-size: clamp(28px, 7vw, 36px); }
.page-head p { margin: 0; font-size: 14px; }
.map-list { position: relative; display: grid; gap: 12px; padding-left: 18px; }
.map-list::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: linear-gradient(180deg, #e4c36a, #8d0c1e);
}
.island-card {
  position: relative;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  padding: 8px;
  align-items: center;
}
.island-card::before {
  content: "";
  position: absolute;
  left: -17px;
  top: 22px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e4c36a;
  box-shadow: 0 0 0 3px #07080c;
}
.island-card.locked { opacity: 0.72; }
.island-card.locked::before { background: #3a3428; }
.island-card img { width: 96px; height: 112px; object-fit: cover; display: block; }
.island-copy { min-width: 0; }
.island-copy h3 { font-size: 18px; }
.badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 6px;
  background: #8d0c1e;
  color: #fff8ea;
  border: 1px solid #f0d48a;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lock-line { margin: 8px 0 0; color: #c7bba6; font-size: 13px; }
.collection { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.find { padding: 8px; min-width: 0; }
.find h3 { margin-top: 8px; font-size: 16px; }
.find-art {
  height: 92px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, #3a301c, #0c0e12 72%);
}
.find-art img { width: 72px; height: 72px; object-fit: contain; }
.find-mark { color: #e4c36a; font-family: Palatino, Georgia, serif; font-size: 28px; }
.find.locked .find-art { background: #12141a; }
.note { display: grid; gap: 8px; padding: 8px; margin-bottom: 12px; }
.note img { width: 100%; height: clamp(120px, 34vw, 180px); object-fit: cover; display: block; }
.note h3 { font-size: 22px; }
.note p { margin: 0; font-size: 15px; }
.playfield { position: relative; flex: 1; height: auto; min-height: 0; overflow: hidden; touch-action: none; background: #07110e; }
#water { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; display: block; }
.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  padding: 8px 10px 16px;
  background: linear-gradient(180deg, rgba(7, 8, 12, 0.88), rgba(7, 8, 12, 0));
  pointer-events: none;
}
.hud .ghost, .hud .meter { pointer-events: none; }
.hud .ghost { pointer-events: auto; }
.hud-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.hud-name { min-width: 0; flex: 1; text-align: center; }
.hud-name span, .hud-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-name span { color: #e4c36a; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.hud-name strong { font-size: 13px; }
.ghost {
  flex: none;
  border: 1px solid rgba(228, 195, 106, 0.65);
  background: rgba(7, 8, 12, 0.55);
  color: #f8e7b0;
  border-radius: 999px;
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pips { display: flex; gap: 4px; flex: none; }
.pip { width: 10px; height: 14px; border: 1px solid #e4c36a; transform: skewX(-14deg); background: #e4c36a; }
.pip.off { background: transparent; }
.pip.warn { background: #d0122d; border-color: #d0122d; }
.progress { height: 3px; margin-top: 8px; background: rgba(255, 255, 255, 0.08); }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8d0c1e, #e4c36a); }
.hud-second { margin-top: 6px; }
.meter { color: #d9cbb4; font-size: 11px; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.meter b { color: #fff8ea; font-size: 13px; margin-left: 4px; }
.stamina { width: 72px; height: 8px; flex: none; border: 1px solid rgba(228, 195, 106, 0.55); }
.stamina i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #8d6a2a, #f0d48a); }
.stamina.is-low i { background: #d0122d; }
.pad {
  position: absolute;
  left: 10px; right: 10px; bottom: 10px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pad-btn { min-height: 52px; touch-action: manipulation; }
#burst { border: 1px solid #f0d48a; color: #fff8ea; background: linear-gradient(180deg, #ff3148, #9d0c22); }
#dive { border: 1px solid rgba(228, 195, 106, 0.7); color: #f8e7b0; background: linear-gradient(180deg, #1b4450, #102028); }
.pad-btn.is-empty { opacity: 0.45; }
.overlay { display: none; position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 3; padding: 78px 12px 12px; background: linear-gradient(180deg, rgba(5, 6, 10, 0.05), rgba(5, 6, 10, 0.78) 46%); }
.overlay.open { display: flex; align-items: flex-end; justify-content: center; overflow: auto; }
.sheet { width: min(100%, 460px); max-height: 100%; overflow: auto; padding: 14px; }
.sheet h2 { margin: 4px 0 8px; font-size: clamp(26px, 7vw, 34px); }
.sheet p { margin: 0; font-size: 14px; line-height: 1.45; }
.legend { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.legend li { display: flex; gap: 8px; align-items: center; min-width: 0; font-size: 13px; color: #f4efe4; }
.swatch { width: 18px; height: 8px; border-radius: 99px; flex: none; }
.swatch.gold { background: linear-gradient(90deg, #fff1c4, #e4c36a); }
.swatch.crimson { background: #d0122d; }
.swatch.dive { background: #7eb8c9; }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.result-stats div { min-width: 0; padding: 8px; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(228, 195, 106, 0.2); }
.result-stats span { display: block; color: #a7a297; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.result-stats b { display: block; margin-top: 2px; color: #fff8ea; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(560px, 100%);
  height: 78px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(228, 195, 106, 0.28), rgba(228, 195, 106, 0) 16%),
    linear-gradient(180deg, #151923, #090b10);
  border-top: 1px solid rgba(228, 195, 106, 0.48);
}
.dock::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 22px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #e4c36a, #d0122d, #e4c36a, transparent);
  background-size: 220% 100%;
  animation: current-slide 4.2s linear infinite;
  pointer-events: none;
}
@keyframes current-slide { from { background-position: 0 0; } to { background-position: 220% 0; } }
.dock-bead {
  position: absolute;
  top: 8px;
  left: 10%;
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fff1c4, #e4c36a);
  transform: translateX(-50%);
  transition: left 0.28s ease;
  pointer-events: none;
}
.dock-slot {
  position: relative;
  border: 0;
  background: transparent;
  color: #b7b1a4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  padding: 0 2px 8px;
  min-width: 0;
}
.dock-slot[aria-current="page"] { color: #f8e7b0; }
.dock-ico { width: 26px; height: 26px; display: grid; place-items: center; }
.dock-ico svg { width: 22px; height: 22px; display: block; }
.dock-label { font-size: 10px; line-height: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-slot.play { color: #fff8ea; }
.dock-slot.play .dock-ico {
  position: absolute;
  top: -22px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1.5px solid #f0d48a;
  background: radial-gradient(circle at 50% 38%, #ff3a50 0%, #b10e24 58%, #4a0b12 100%);
  box-shadow: 0 0 0 6px #07080c, 0 10px 18px rgba(0, 0, 0, 0.45);
}
.dock-slot.play[aria-current="page"] .dock-ico { box-shadow: 0 0 0 6px #07080c, 0 0 0 8px #e4c36a, 0 10px 20px rgba(0, 0, 0, 0.45); }
.dock-slot.play .dock-ico svg { width: 28px; height: 28px; }
body.playing .dock { display: none; }
body.playing .ticker { display: none; }
@media (max-width: 360px) {
  .brand { padding-left: 10px; padding-right: 10px; }
  .brand-text strong { letter-spacing: 0.14em; font-size: 16px; }
  .continue { grid-template-columns: 84px minmax(0, 1fr); }
  .continue img { width: 84px; height: 96px; }
  .island-card { grid-template-columns: 78px minmax(0, 1fr); }
  .island-card img { width: 78px; height: 96px; }
  .dock-slot.play .dock-ico { width: 56px; height: 56px; top: -18px; }
}
@media (min-width: 480px) {
  .collection { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .screen { padding-left: 18px; padding-right: 18px; }
}
@media (max-height: 520px) {
  .hero { min-height: 180px; }
  .overlay { padding-top: 52px; }
  .pad-btn { min-height: 42px; }
  body.playing .top { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ticker span, .dock::before, .primary::after { animation: none; }
  .ticker span { padding-left: 0; }
  .dock-bead { transition: none; }
}
