:root {
  --ink: #102a38;
  --muted: #4d6a7a;
  --panel: rgba(255, 255, 255, 0.92);
  --accent: #1aa0c8;
  --accent-deep: #0d7a9c;
  --warn: #ff6b4a;
  --font-d: "ZCOOL KuaiLe", "Noto Sans SC", sans-serif;
  --font-b: "Noto Sans SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-b);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.5;
  background: #0b3040;
}
.scene {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(80, 200, 255, 0.25), transparent 50%),
    linear-gradient(180deg, #163d52 0%, #0a2a38 40%, #061820 100%);
}
.topbar {
  max-width: 1200px; margin: 0 auto;
  padding: 1rem 1.2rem 0.4rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  color: #e8f6fc;
}
.back { color: #9ed7ea; text-decoration: none; font-weight: 700; }
.brand { display: flex; gap: 0.7rem; align-items: center; flex: 1; }
.mark {
  width: 2.6rem; height: 2.6rem; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #5ad0f0, #1aa0c8);
  color: #042028; font-family: var(--font-d); font-size: 1.3rem;
}
.brand h1 { margin: 0; font-family: var(--font-d); font-size: 1.5rem; }
.brand p { margin: 0; font-size: 0.85rem; opacity: 0.7; }
main { max-width: 1200px; margin: 0 auto; padding: 0.5rem 1.2rem 3rem; }
.panel {
  background: var(--panel); border-radius: 18px; padding: 1.3rem;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25); max-width: 480px;
}
.panel h2 { margin: 0 0 1rem; font-family: var(--font-d); font-size: 1.8rem; }
.field { display: grid; gap: 0.4rem; }
.field > span { font-size: 0.9rem; color: var(--muted); font-weight: 700; }
.row { display: flex; gap: 0.5rem; }
.row input {
  flex: 1; border: 1px solid #c5d8e0; border-radius: 12px;
  padding: 0.7rem 0.85rem; font: inherit;
}
.name-list { list-style: none; margin: 0.8rem 0; padding: 0; display: grid; gap: 0.35rem; }
.name-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0.7rem; background: #e8f4f8; border-radius: 10px; font-weight: 700;
}
.name-list button { border: 0; background: transparent; color: var(--warn); cursor: pointer; font: inherit; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0.8rem 0 0; }
.btn {
  border: 0; cursor: pointer; font: inherit; font-weight: 700;
  border-radius: 14px; padding: 0.75rem 1.3rem;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(145deg, #5ad0f0, #1aa0c8); color: #042028; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid #b8d0da; }
.btn.ghost { background: rgba(255,255,255,0.15); color: #e8f6fc; border: 1px solid rgba(255,255,255,0.25); }
.btn.wide { width: 100%; }
.layout { display: grid; gap: 1rem; }
@media (min-width: 900px) {
  .layout { grid-template-columns: 1fr 270px; }
}
.status {
  display: flex; flex-wrap: wrap; gap: 0.8rem 1.2rem;
  padding: 0.85rem 1rem; border-radius: 14px;
  background: rgba(255,255,255,0.12); color: #e8f6fc; font-size: 1.1rem;
}
.status strong { font-size: 1.25rem; color: #fff; }
.submarine {
  margin-top: 0.9rem; padding: 0.9rem; border-radius: 16px;
  background: linear-gradient(160deg, #2a6a82, #164858); color: #e8f6fc;
}
.sub-label { font-family: var(--font-d); font-size: 1.2rem; margin-bottom: 0.4rem; }
.dock {
  display: flex; flex-wrap: wrap; gap: 0.55rem; min-height: 3.2rem; align-items: flex-end;
}
/* 玩家颜色：每人固定一色 */
.diver {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.78rem;
  line-height: 1.2;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  max-width: 100%;
  z-index: 2;
}
.diver.big {
  font-size: 0.95rem;
  padding: 0.35rem 0.7rem;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4), 0 0 10px rgba(255, 255, 255, 0.25);
}
.diver.current {
  outline: 2px solid #fff;
  outline-offset: 2px;
  animation: diverPulse 1s ease-in-out infinite;
}
.diver.returning {
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4), 0 0 12px rgba(255, 230, 120, 0.7);
}
.diver.c0 { background: linear-gradient(160deg, #ff6b6b, #e03131); }
.diver.c1 { background: linear-gradient(160deg, #4dabf7, #1c7ed6); }
.diver.c2 { background: linear-gradient(160deg, #69db7c, #2f9e44); }
.diver.c3 { background: linear-gradient(160deg, #ffa94d, #e8590c); }
.diver.c4 { background: linear-gradient(160deg, #b197fc, #7048e8); }
.diver.c5 { background: linear-gradient(160deg, #f06595, #c2255c); }
.diver.c6 { background: linear-gradient(160deg, #66d9e8, #0c8599); }
.diver.c7 { background: linear-gradient(160deg, #ffe066, #f59f00); color: #3a2800; }

@keyframes diverPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.air-bar {
  margin-top: 0.7rem; height: 14px; border-radius: 999px;
  background: rgba(0,0,0,0.3); overflow: hidden;
}
.air-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #5ad0f0, #7dffb3);
  transition: width 0.3s ease;
}
.path-wrap {
  margin-top: 0.75rem;
  padding: 0.65rem 0.55rem 0.75rem;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.path-caption {
  margin: 0 0 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(232, 246, 252, 0.7);
}
.path {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.35rem;
}
@media (max-width: 900px) {
  .path { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .path { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.chip {
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  border-radius: 12px;
  padding: 0.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.15);
  color: #e8f6fc;
  position: relative;
}
.chip.has { border-color: #5ad0f0; background: rgba(90, 208, 240, 0.15); }
.chip.blank { opacity: 0.4; }
.chip.occupied {
  z-index: 1;
  transform: scale(1.08);
  min-height: 4.6rem;
  aspect-ratio: auto;
  padding: 0.35rem 0.2rem 0.4rem;
  background: rgba(255, 255, 255, 0.22) !important;
  opacity: 1 !important;
}
.chip.glow-c0 { box-shadow: 0 0 0 3px #ff6b6b, 0 0 16px rgba(255, 107, 107, 0.65); border-color: #ff6b6b; }
.chip.glow-c1 { box-shadow: 0 0 0 3px #4dabf7, 0 0 16px rgba(77, 171, 247, 0.65); border-color: #4dabf7; }
.chip.glow-c2 { box-shadow: 0 0 0 3px #69db7c, 0 0 16px rgba(105, 219, 124, 0.65); border-color: #69db7c; }
.chip.glow-c3 { box-shadow: 0 0 0 3px #ffa94d, 0 0 16px rgba(255, 169, 77, 0.65); border-color: #ffa94d; }
.chip.glow-c4 { box-shadow: 0 0 0 3px #b197fc, 0 0 16px rgba(177, 151, 252, 0.65); border-color: #b197fc; }
.chip.glow-c5 { box-shadow: 0 0 0 3px #f06595, 0 0 16px rgba(240, 101, 149, 0.65); border-color: #f06595; }
.chip.glow-c6 { box-shadow: 0 0 0 3px #66d9e8, 0 0 16px rgba(102, 217, 232, 0.65); border-color: #66d9e8; }
.chip.glow-c7 { box-shadow: 0 0 0 3px #ffe066, 0 0 16px rgba(255, 224, 102, 0.65); border-color: #ffe066; }
.chip .val.treasure-orb {
  width: 2.15rem; height: 2.15rem; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-d); font-size: 0.78rem;
  color: #2a2008; font-weight: 800;
  box-shadow:
    inset 0 -5px 8px rgba(0,0,0,0.28),
    inset 0 3px 6px rgba(255,255,255,0.35),
    0 3px 0 rgba(0,0,0,0.28);
  border: 2px solid rgba(255,255,255,0.35);
  background: linear-gradient(160deg, #d4b06a, #a8843a);
}
.chip.lv1 .val.treasure-orb { background: linear-gradient(160deg, #f0e0a8, #c4a85a); }
.chip.lv2 .val.treasure-orb { background: linear-gradient(160deg, #9ad8ff, #3a8fc4); color: #06304a; }
.chip.lv3 .val.treasure-orb { background: linear-gradient(160deg, #d4b0ff, #7a4cb8); color: #1a0830; }
.chip.lv4 .val.treasure-orb { background: linear-gradient(160deg, #ff9a7a, #c44a30); color: #2a0c08; }
.chip.stack .val.treasure-orb {
  border-radius: 10px;
  background: linear-gradient(145deg, #d4b06a, #6a5340);
  color: #fff8e0;
  font-size: 0.72rem;
}
.chip.blank .val.treasure-orb {
  background: linear-gradient(160deg, #8a96a3, #5a6570);
  color: rgba(255,255,255,0.75);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.12), 0 2px 0 rgba(0,0,0,0.2);
}
.chip .here {
  display: flex; flex-wrap: wrap; gap: 0.15rem; justify-content: center;
  min-height: 0.5rem;
}
.scores .meeple-sm { margin-right: 0.15rem; }
.meeple-sm.c0 { --m: #e03131; }
.meeple-sm.c1 { --m: #1c7ed6; }
.meeple-sm.c2 { --m: #2f9e44; }
.meeple-sm.c3 { --m: #e8590c; }
.meeple-sm.c4 { --m: #7048e8; }
.meeple-sm.c5 { --m: #c2255c; }
.meeple-sm.c6 { --m: #0c8599; }
.meeple-sm.c7 { --m: #f59f00; }
.chip.has::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 8px;
  border: 1px dashed rgba(255,255,255,0.18);
  pointer-events: none;
}
.chip .here {
  display: flex; flex-wrap: wrap; gap: 0.15rem; justify-content: center;
  max-width: 100%;
  margin-top: 0.05rem;
}
.chip .idx {
  position: absolute; top: 2px; left: 4px;
  font-size: 0.55rem; opacity: 0.45; font-weight: 700;
}
.chip.occupied .val {
  transform: scale(0.85);
  opacity: 0.85;
}
.msg {
  text-align: center; font-family: var(--font-d);
  font-size: 1.45rem; color: #7de8ff; min-height: 1.6em; margin: 0.9rem 0 0.15rem;
}
.submsg {
  text-align: center;
  color: rgba(232, 246, 252, 0.78);
  font-size: 0.95rem;
  font-weight: 700;
  min-height: 1.25em;
  margin: 0 0 0.55rem;
}

.dice-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  background: rgba(4, 24, 32, 0.62);
  backdrop-filter: blur(3px);
  padding: 1rem;
}
.dice-overlay[hidden] { display: none !important; }
.dice-card {
  min-width: min(88vw, 320px);
  padding: 1.25rem 1.4rem 1.4rem;
  border-radius: 22px;
  background: linear-gradient(160deg, #1e5a70, #0d3344);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
  color: #e8f6fc;
}
.dice-caption {
  margin: 0 0 0.85rem;
  font-family: var(--font-d);
  font-size: 1.25rem;
  color: #7de8ff;
}
.dice-stage {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: flex-end;
}
.dice-unit {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
}
.dice-unit .lbl {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(232, 246, 252, 0.8);
}
.dice-face {
  width: 4.2rem;
  height: 4.2rem;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 2.1rem;
  font-weight: 900;
  color: #042028;
  background: linear-gradient(145deg, #e8fbff, #5ad0f0);
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}
.dice-face.is-spinning {
  animation: dice-spin 0.09s linear infinite;
}
.dice-face.is-settled {
  animation: dice-land 0.38s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.dice-result {
  margin: 0.9rem 0 0;
  min-height: 1.4em;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}
@keyframes dice-spin {
  0% { transform: rotate(-8deg) scale(0.96); }
  50% { transform: rotate(8deg) scale(1.04); }
  100% { transform: rotate(-8deg) scale(0.96); }
}
@keyframes dice-land {
  0% { transform: scale(1.35) rotate(-12deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.controls { display: flex; flex-wrap: wrap; gap: 0.55rem; justify-content: center; min-height: 3rem; }
.side {
  background: var(--panel); border-radius: 18px; padding: 1rem;
  color: var(--ink); position: sticky; top: 0.6rem;
}
.side h2 { margin: 0; font-family: var(--font-d); font-size: 1.5rem; }
.scores { list-style: none; margin: 0.8rem 0; padding: 0; display: grid; gap: 0.4rem; }
.scores li {
  display: grid;
  grid-template-columns: 1.1rem 1fr auto;
  align-items: center;
  gap: 0.35rem 0.45rem;
  padding: 0.55rem 0.65rem;
  background: #e8f4f8;
  border-radius: 10px;
  border-left: 4px solid transparent;
}
.scores .swatch {
  width: 0.7rem; height: 0.7rem; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.8);
}
.scores .nm { font-weight: 700; font-size: 1.05rem; }
.scores .pts { font-weight: 700; font-size: 1.2rem; color: var(--accent-deep); }
.scores .sub { grid-column: 1 / -1; font-size: 0.85rem; color: var(--muted); }
.scores li.is-turn { box-shadow: inset 0 0 0 2px rgba(26, 160, 200, 0.35); }
.scores li.c0 { border-left-color: #e03131; }
.scores li.c0 .swatch { background: #ff6b6b; }
.scores li.c1 { border-left-color: #1c7ed6; }
.scores li.c1 .swatch { background: #4dabf7; }
.scores li.c2 { border-left-color: #2f9e44; }
.scores li.c2 .swatch { background: #69db7c; }
.scores li.c3 { border-left-color: #e8590c; }
.scores li.c3 .swatch { background: #ffa94d; }
.scores li.c4 { border-left-color: #7048e8; }
.scores li.c4 .swatch { background: #b197fc; }
.scores li.c5 { border-left-color: #f06595; }
.scores li.c5 .swatch { background: #f06595; }
.scores li.c6 { border-left-color: #0c8599; }
.scores li.c6 .swatch { background: #66d9e8; }
.scores li.c7 { border-left-color: #f59f00; }
.scores li.c7 .swatch { background: #ffe066; }
.rules { border-top: 1px solid #d0e2ea; padding-top: 0.7rem; }
.rules .t { margin: 0 0 0.35rem; font-weight: 700; font-size: 0.95rem; }
.rules ul { margin: 0; padding-left: 1.1rem; font-size: 0.88rem; color: var(--muted); line-height: 1.5; }
[hidden] { display: none !important; }
