/* ===== 视觉系统 ===== */
:root {
  --ink: #17304f;
  --ink-deep: #0e2340;
  --sky: #356f87;
  --cream: #fff7e5;
  --paper: #fffdf7;
  --gold: #f6bd4a;
  --coral: #ec6b56;
  --teal: #2fa3a0;
  --line: rgba(23, 48, 79, .14);
  --glass: rgba(15, 40, 72, .82);
  --shadow-lg: 0 28px 80px rgba(4, 19, 42, .38);
  --shadow-md: 0 14px 32px rgba(4, 19, 42, .22);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  padding: 16px;
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: #183657;
  background-image:
    linear-gradient(180deg, rgba(9, 28, 55, .18), rgba(9, 34, 51, .34)),
    url("assets/sky-voyage-bg.png");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 242, 210, .12), transparent 32%),
    linear-gradient(90deg, rgba(5, 22, 45, .1), transparent 25%, transparent 75%, rgba(5, 22, 45, .1));
}

button { font: inherit; }
.hidden { display: none !important; }

.panel-kicker,
.english-title,
.eyebrow {
  font-weight: 800;
  letter-spacing: .16em;
}

.panel-kicker {
  color: #8a7650;
  font-size: 10px;
  line-height: 1.2;
}

/* ===== 品牌标记 ===== */
.brand-mark {
  position: relative;
  display: grid;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 24px;
  color: var(--ink-deep);
  font-size: 34px;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .7);
  background: linear-gradient(145deg, #fff3ca, #f4b847);
  box-shadow: 0 12px 25px rgba(5, 20, 41, .22), inset 0 1px 0 rgba(255, 255, 255, .72);
  transform: rotate(-5deg);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px dashed rgba(255, 235, 187, .5);
  border-radius: 27px;
}

.brand-mark-small {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  font-size: 19px;
  box-shadow: 0 6px 15px rgba(5, 20, 41, .18), inset 0 1px 0 rgba(255, 255, 255, .72);
}

.brand-mark-small::after { inset: -3px; border-radius: 15px; }

/* ===== 设置界面 ===== */
#setup-screen {
  display: grid;
  width: 100%;
  min-height: calc(100vh - 32px);
  place-items: center;
}

.setup-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(390px, .96fr);
  width: min(100%, 1040px);
  min-height: 554px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 32px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px) saturate(115%);
  -webkit-backdrop-filter: blur(16px) saturate(115%);
}

.card {
  position: relative;
  display: flex;
  min-width: 0;
  padding: 50px 48px 42px;
  flex-direction: column;
  justify-content: center;
  color: #fffaf0;
  background:
    radial-gradient(circle at 100% 0, rgba(61, 152, 159, .25), transparent 36%),
    linear-gradient(150deg, rgba(14, 38, 72, .96), rgba(16, 47, 77, .88));
}

.card::after {
  content: "";
  position: absolute;
  right: 26px;
  bottom: 26px;
  width: 96px;
  height: 48px;
  opacity: .16;
  border-top: 1px dashed #fff;
  border-radius: 50%;
  transform: rotate(-18deg);
  pointer-events: none;
}

.eyebrow {
  display: flex;
  margin-bottom: 25px;
  align-items: center;
  gap: 9px;
  color: rgba(255, 246, 220, .65);
  font-size: 10px;
}

.eyebrow span {
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
}

.title-lockup {
  display: flex;
  align-items: center;
  gap: 20px;
}

.card h1 {
  color: #fffaf0;
  font-family: "STKaiti", "KaiTi", "PingFang SC", sans-serif;
  font-size: clamp(46px, 5vw, 64px);
  font-weight: 900;
  line-height: .96;
  letter-spacing: .08em;
  text-shadow: 0 4px 18px rgba(0, 0, 0, .18);
}

.english-title {
  margin-top: 8px;
  color: var(--gold);
  font-size: 11px;
}

.subtitle {
  margin: 25px 0 30px;
  color: rgba(255, 250, 240, .72);
  font-size: 15px;
  letter-spacing: .05em;
}

.choose-card {
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 22px;
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

.choose-label {
  margin-bottom: 14px;
  color: #fff7e4;
  font-size: 14px;
  font-weight: 700;
}

.player-count {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.player-count button {
  position: relative;
  display: flex;
  min-width: 0;
  padding: 13px 8px 12px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 14px;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.player-count button::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--coral);
}

.player-count button:nth-child(2)::before { background: var(--gold); }
.player-count button:nth-child(3)::before { background: var(--teal); }

.player-count button span {
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
}

.player-count button em {
  color: rgba(255, 255, 255, .67);
  font-size: 10px;
  font-style: normal;
  white-space: nowrap;
}

.player-count button:hover {
  border-color: rgba(255, 239, 200, .65);
  background: rgba(255, 255, 255, .16);
  box-shadow: 0 10px 20px rgba(0, 0, 0, .16);
  transform: translateY(-3px);
}

.start-note {
  margin-top: 14px;
  color: rgba(255, 255, 255, .53);
  font-size: 10px;
  letter-spacing: .04em;
  text-align: center;
}

.start-note span { color: #7ce0b5; font-size: 8px; }

.mode-toggle {
  display: grid;
  width: 100%;
  margin-top: 12px;
  padding: 9px 11px;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 238, 192, .25);
  border-radius: 13px;
  color: #fff8e8;
  text-align: left;
  background: rgba(255, 255, 255, .08);
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
}

.mode-toggle:hover {
  border-color: rgba(255, 222, 141, .65);
  background: rgba(255, 255, 255, .14);
  transform: translateY(-1px);
}

.mode-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  color: var(--ink-deep);
  font-size: 17px;
  background: linear-gradient(145deg, #ffe7a2, #eeb13d);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65);
}

.mode-copy { display: flex; min-width: 0; flex-direction: column; }
.mode-copy b { font-size: 12px; letter-spacing: .05em; }
.mode-copy small { margin-top: 1px; color: rgba(255, 255, 255, .5); font-size: 9px; }

.mode-state {
  padding: 4px 7px;
  border-radius: 999px;
  color: #9ce6bd;
  font-size: 8px;
  font-weight: 900;
  background: rgba(75, 194, 131, .14);
}

.mode-toggle[aria-pressed="false"] { opacity: .68; }
.mode-toggle[aria-pressed="false"] .mode-icon { color: #667482; background: #c4c9c9; }
.mode-toggle[aria-pressed="false"] .mode-state { color: rgba(255, 255, 255, .58); background: rgba(255, 255, 255, .08); }

.rules-brief {
  display: flex;
  min-width: 0;
  padding: 43px 42px 36px;
  flex-direction: column;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 253, 247, .96), rgba(255, 248, 231, .95)),
    repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(31, 61, 94, .04) 24px);
}

.rules-heading {
  display: flex;
  margin-bottom: 22px;
  align-items: center;
  gap: 13px;
}

.rule-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 16px;
  color: var(--ink-deep);
  font-size: 30px;
  background: #f9d581;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}

.rules-brief h3 {
  margin-top: 3px;
  color: var(--ink-deep);
  font-size: 22px;
  letter-spacing: .04em;
}

.rules-brief ul { list-style: none; }

.rules-brief li {
  display: grid;
  grid-template-columns: 34px 1fr;
  padding: 11px 0;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.rules-brief li > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: #83601a;
  font-size: 10px;
  font-weight: 900;
  background: #ffedbd;
}

.rules-brief li p {
  color: #536477;
  font-size: 12px;
  line-height: 1.45;
}

.rules-brief li b { color: #d05543; }
.rules-brief li.supply-rule > span { color: #6d5117; background: #f6d67b; }

.rules-footnote {
  margin-top: auto;
  padding-top: 18px;
  color: #9b8b6d;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
}

/* ===== 游戏界面布局 ===== */
#game-screen {
  display: grid;
  grid-template-columns: 600px 320px;
  grid-template-rows: 48px 600px;
  width: min(100%, 944px);
  margin: 0 auto;
  align-items: start;
  justify-content: center;
  gap: 12px 24px;
}

.game-topbar {
  display: flex;
  grid-column: 1 / -1;
  height: 48px;
  padding: 0 14px 0 8px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(255, 231, 174, .2);
  border-radius: 17px;
  color: #fff9ec;
  background: linear-gradient(110deg, rgba(9, 31, 59, .94), rgba(14, 52, 73, .88));
  box-shadow: 0 12px 28px rgba(5, 20, 40, .24), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.game-brand { display: flex; align-items: center; gap: 11px; }
.game-brand div { display: flex; flex-direction: column; }
.game-brand b { font-size: 15px; letter-spacing: .12em; }
.game-brand small { margin-top: 1px; color: rgba(255, 255, 255, .48); font-size: 7px; font-weight: 800; letter-spacing: .16em; }

.game-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 250, 236, .72);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
}

.game-actions {
  display: flex;
  align-items: center;
  gap: 13px;
}

#sound-btn {
  display: flex;
  height: 32px;
  padding: 0 10px 0 7px;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 11px;
  color: rgba(255, 250, 236, .78);
  font-size: 9px;
  font-weight: 800;
  background: rgba(255, 255, 255, .08);
  cursor: pointer;
  transition: color .15s, background .15s, transform .15s;
}

#sound-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, .15);
  transform: translateY(-1px);
}

.sound-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 7px;
  color: var(--ink-deep);
  font-size: 13px;
  background: var(--gold);
}

#sound-btn[aria-pressed="true"] .sound-icon {
  color: rgba(255, 255, 255, .72);
  background: rgba(255, 255, 255, .14);
}

.game-status span,
.live-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #72dfae;
  box-shadow: 0 0 0 4px rgba(114, 223, 174, .12);
}

#board-wrap {
  position: relative;
  width: 600px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  flex-shrink: 0;
  border-radius: 28px;
  background: #eee4ce;
  box-shadow: 0 30px 75px rgba(4, 19, 42, .42), 0 0 0 1px rgba(255, 244, 214, .55);
}

#board-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 10;
  border: 6px solid rgba(255, 249, 230, .9);
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(23, 48, 79, .16), inset 0 0 30px rgba(85, 61, 22, .06);
  pointer-events: none;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
  filter: saturate(.94) contrast(1.01);
}

#planes { position: absolute; inset: 0; pointer-events: none; }

.plane {
  position: absolute;
  z-index: 2;
  display: flex;
  width: 7.8%;
  aspect-ratio: 1 / 1;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 0;
  background-color: transparent;
  background-image: url("assets/plane-tokens.png");
  background-repeat: no-repeat;
  background-size: 200% 200%;
  filter: drop-shadow(0 4px 3px rgba(6, 24, 45, .38));
  transform: translate(-50%, -50%) rotate(var(--plane-angle, 0deg));
  transition: left .18s ease, top .18s ease, transform .18s ease;
  pointer-events: auto;
  user-select: none;
}

.plane[data-color="0"] { background-position: 0 0; }
.plane[data-color="1"] { background-position: 100% 0; }
.plane[data-color="2"] { background-position: 0 100%; }
.plane[data-color="3"] { background-position: 100% 100%; }

.plane.shielded::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 2px solid rgba(116, 226, 255, .9);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(127, 230, 255, .05) 45%, rgba(95, 198, 238, .24) 72%, transparent 74%);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .38), 0 0 14px rgba(96, 218, 255, .82), inset 0 0 8px rgba(255, 255, 255, .5);
  pointer-events: none;
  animation: shieldGlow 1.2s ease-in-out infinite alternate;
}

@keyframes shieldGlow {
  from { opacity: .72; transform: scale(.94); }
  to { opacity: 1; transform: scale(1.05); }
}

.plane.movable {
  z-index: 5;
  cursor: pointer;
  animation: pulse .7s infinite alternate;
}

@keyframes pulse {
  from {
    filter: drop-shadow(0 3px 2px rgba(6, 24, 45, .35)) drop-shadow(0 0 2px #fff8dd);
    transform: translate(-50%, -50%) rotate(var(--plane-angle, 0deg)) scale(1);
  }
  to {
    filter: drop-shadow(0 7px 5px rgba(6, 24, 45, .46)) drop-shadow(0 0 7px #fff3a8);
    transform: translate(-50%, -50%) rotate(var(--plane-angle, 0deg)) scale(1.2);
  }
}

/* ===== 侧边栏 ===== */
#side-panel {
  display: flex;
  width: 320px;
  height: 600px;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
}

#turn-banner {
  position: relative;
  min-height: 57px;
  padding: 19px 18px 13px;
  overflow: hidden;
  border: 1px solid rgba(255, 250, 228, .5);
  border-radius: 18px;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .03em;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .22);
  box-shadow: 0 13px 26px rgba(5, 20, 40, .24), inset 0 1px 0 rgba(255, 255, 255, .34);
  filter: saturate(.86);
  transition: background .3s;
}

#turn-banner::before {
  content: "CURRENT TURN";
  position: absolute;
  top: 5px;
  left: 50%;
  color: rgba(255, 255, 255, .64);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .16em;
  transform: translateX(-50%);
}

#turn-banner::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -30px;
  width: 90px;
  height: 70px;
  border: 1px dashed rgba(255, 255, 255, .35);
  border-radius: 50%;
}

#dice-area,
.log-panel {
  border: 1px solid rgba(255, 237, 197, .15);
  color: #fff8e8;
  background:
    radial-gradient(circle at 100% 0, rgba(52, 133, 138, .16), transparent 36%),
    linear-gradient(145deg, rgba(9, 32, 61, .97), rgba(17, 52, 72, .94));
  box-shadow: 0 15px 32px rgba(5, 20, 40, .26), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#dice-area {
  position: relative;
  padding: 16px 20px 14px;
  border-radius: 20px;
  overflow: hidden;
  text-align: center;
}

#dice-area::after {
  content: "";
  position: absolute;
  top: 17px;
  right: -24px;
  width: 82px;
  height: 46px;
  border-top: 1px dashed rgba(255, 238, 194, .17);
  border-radius: 50%;
  transform: rotate(18deg);
  pointer-events: none;
}

#dice-area .panel-kicker,
.log-panel .panel-kicker { color: rgba(246, 189, 74, .76); }

#dice-area h2,
.log-heading h2 {
  margin-top: 2px;
  color: #fff8e8;
  font-size: 16px;
  letter-spacing: .04em;
}

.dice-stage {
  position: relative;
  display: grid;
  width: 92px;
  height: 86px;
  margin: 7px auto 8px;
  place-items: center;
  z-index: 1;
  border: 1px solid rgba(255, 238, 199, .28);
  border-radius: 23px;
  background:
    radial-gradient(circle at 45% 35%, #fffdf7, #f7edda 58%, #d9c8a8 100%);
  box-shadow: 0 12px 24px rgba(1, 15, 33, .34), inset 0 1px 0 #fff;
  transform: rotate(-2deg);
}

.dice-stage::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px dashed rgba(23, 48, 79, .13);
  border-radius: 18px;
}

#dice-modifier {
  position: absolute;
  top: 7px;
  right: 6px;
  z-index: 3;
  display: grid;
  min-width: 29px;
  height: 29px;
  padding: 0 5px;
  place-items: center;
  border: 2px solid #fff7df;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  background: linear-gradient(145deg, #f18b55, #ca4f3f);
  box-shadow: 0 5px 12px rgba(75, 27, 20, .3);
  animation: modifierPop .25s ease-out;
}

@keyframes modifierPop {
  from { opacity: 0; transform: scale(.35) rotate(-18deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

#dice {
  --pip: #17304f;
  position: relative;
  display: block;
  width: 62px;
  height: 62px;
  border: 2px solid #fff;
  border-radius: 17px;
  background: linear-gradient(145deg, #fffefa 0%, #fff7e4 58%, #e8ddc5 100%);
  box-shadow:
    0 9px 14px rgba(20, 43, 67, .2),
    inset 4px 4px 8px rgba(255, 255, 255, .9),
    inset -5px -6px 9px rgba(118, 96, 55, .13);
  transform: rotate(-4deg);
  transform-origin: center;
}

#dice::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
}

#dice[data-face="0"]::before {
  content: "✦";
  width: auto;
  height: auto;
  border-radius: 0;
  color: #d89b2d;
  font-size: 29px;
  line-height: 1;
}

#dice[data-face="1"]::before { background: var(--pip); }
#dice[data-face="2"]::before {
  box-shadow: -17px -17px 0 var(--pip), 17px 17px 0 var(--pip);
}
#dice[data-face="3"]::before {
  background: var(--pip);
  box-shadow: -17px -17px 0 var(--pip), 17px 17px 0 var(--pip);
}
#dice[data-face="4"]::before {
  box-shadow: -17px -17px 0 var(--pip), 17px -17px 0 var(--pip),
    -17px 17px 0 var(--pip), 17px 17px 0 var(--pip);
}
#dice[data-face="5"]::before {
  background: var(--pip);
  box-shadow: -17px -17px 0 var(--pip), 17px -17px 0 var(--pip),
    -17px 17px 0 var(--pip), 17px 17px 0 var(--pip);
}
#dice[data-face="6"]::before {
  box-shadow: -17px -17px 0 var(--pip), 17px -17px 0 var(--pip),
    -17px 0 0 var(--pip), 17px 0 0 var(--pip),
    -17px 17px 0 var(--pip), 17px 17px 0 var(--pip);
}

#dice.rolling { animation: diceRoll .12s ease-in-out infinite alternate; }

@keyframes diceRoll {
  from { transform: rotate(-11deg) translateY(-2px) scale(.96); }
  to { transform: rotate(8deg) translateY(2px) scale(1.04); }
}

#roll-btn {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 11px 20px;
  border: 0;
  border-radius: 13px;
  color: #fffaf1;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .12em;
  background: linear-gradient(135deg, var(--roll-a, #ef825e), var(--roll-b, #d65b4b) 62%, var(--roll-c, #bb463f));
  box-shadow: 0 9px 18px rgba(2, 16, 34, .28), inset 0 1px 0 rgba(255, 255, 255, .28);
  cursor: pointer;
  transition: transform .15s, filter .15s, box-shadow .15s;
}

#roll-btn:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 11px 20px var(--roll-shadow, rgba(191, 70, 58, .32)), inset 0 1px 0 rgba(255, 255, 255, .28);
  transform: translateY(-2px);
}

#roll-btn:disabled {
  color: rgba(255, 255, 255, .72);
  background: #a9b1b4;
  box-shadow: none;
  cursor: not-allowed;
}

.hint { position: relative; z-index: 1; margin-top: 8px; color: rgba(255, 247, 225, .48); font-size: 9px; }

kbd {
  margin-right: 4px;
  padding: 2px 5px;
  border: 1px solid rgba(255, 242, 212, .25);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: #f9ddb0;
  font-family: inherit;
  font-size: 7px;
  font-weight: 900;
  background: rgba(255, 255, 255, .08);
}

/* ===== 补给道具 ===== */
.item-panel {
  padding: 11px 12px 12px;
  border: 1px solid rgba(255, 237, 197, .16);
  border-radius: 18px;
  color: #fff8e8;
  background:
    radial-gradient(circle at 100% 0, rgba(241, 170, 53, .15), transparent 42%),
    linear-gradient(145deg, rgba(9, 32, 61, .97), rgba(17, 52, 72, .94));
  box-shadow: 0 12px 26px rgba(5, 20, 40, .23), inset 0 1px 0 rgba(255, 255, 255, .05);
}

.item-heading {
  display: flex;
  margin-bottom: 8px;
  align-items: end;
  justify-content: space-between;
}

.item-heading h2 { margin-top: 1px; font-size: 14px; letter-spacing: .04em; }
.item-heading .panel-kicker { color: rgba(246, 189, 74, .76); }

#item-status {
  color: rgba(255, 246, 222, .48);
  font-size: 7px;
  font-weight: 800;
}

.item-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.item-list button {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 7px 4px 6px;
  grid-template-columns: 24px 1fr;
  grid-template-rows: 16px 11px;
  align-items: center;
  gap: 1px 5px;
  border: 1px solid rgba(255, 240, 204, .2);
  border-radius: 11px;
  color: #fff8e9;
  text-align: left;
  background: rgba(255, 255, 255, .075);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s, opacity .15s;
}

.item-list button:hover:not(:disabled) {
  border-color: rgba(255, 218, 130, .68);
  background: rgba(255, 255, 255, .14);
  transform: translateY(-2px);
}

.item-list button:disabled { opacity: .38; cursor: not-allowed; }

.item-icon {
  display: grid;
  width: 24px;
  height: 24px;
  grid-row: 1 / 3;
  place-items: center;
  border-radius: 8px;
  color: #5a4215;
  font-size: 15px;
  font-weight: 900;
  background: linear-gradient(145deg, #ffe7a4, #e9ad3d);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65);
}

.item-list button:nth-child(2) .item-icon { color: #783224; background: linear-gradient(145deg, #ffc3a2, #e96f4e); }
.item-list button:nth-child(3) .item-icon { color: #164d67; background: linear-gradient(145deg, #bcefff, #57bddf); }
.item-list b { overflow: hidden; font-size: 10px; white-space: nowrap; }
.item-list em { color: rgba(255, 247, 226, .54); font-size: 8px; font-style: normal; font-weight: 800; }

#end-turn-btn {
  width: 100%;
  margin-top: 7px;
  padding: 6px 8px;
  border: 1px dashed rgba(255, 235, 193, .28);
  border-radius: 9px;
  color: rgba(255, 248, 230, .68);
  font-size: 9px;
  font-weight: 800;
  background: rgba(255, 255, 255, .06);
  cursor: pointer;
}

#end-turn-btn:hover { color: #fff; background: rgba(255, 255, 255, .11); }

.log-panel {
  display: flex;
  min-height: 0;
  padding: 14px 16px 12px;
  flex: 1;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
}

.log-heading {
  display: flex;
  padding-bottom: 10px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 245, 218, .12);
}

.live-badge {
  display: flex;
  padding: 4px 7px;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  color: #9ae2bb;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .08em;
  background: rgba(68, 177, 116, .13);
}

.live-badge i { display: block; width: 5px; height: 5px; box-shadow: none; }

#log {
  min-height: 0;
  padding: 7px 2px 0;
  flex: 1;
  overflow-y: auto;
  color: rgba(255, 248, 230, .68);
  font-size: 11px;
  scrollbar-color: rgba(246, 189, 74, .4) transparent;
  scrollbar-width: thin;
}

.log-entry {
  padding: 7px 4px;
  border-bottom: 1px dashed rgba(255, 246, 220, .1);
  line-height: 1.35;
}

.log-entry:first-child { color: #fff8e8; font-weight: 700; }
.log-entry:last-child { border-bottom: 0; }

#restart-btn,
#again-btn {
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 14px;
  color: #fff9ea;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  background: rgba(11, 36, 65, .72);
  box-shadow: 0 8px 18px rgba(5, 20, 40, .16);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: background .15s, transform .15s;
}

#restart-btn:hover,
#again-btn:hover { background: rgba(21, 58, 91, .92); transform: translateY(-1px); }

/* ===== 胜利浮层 ===== */
#win-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(5, 20, 42, .68);
  backdrop-filter: blur(8px);
}

.win-card {
  position: relative;
  width: min(92vw, 430px);
  padding: 45px 50px 38px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 30px;
  text-align: center;
  background: linear-gradient(150deg, #fffdf7, #fff1cc);
  box-shadow: var(--shadow-lg);
  animation: pop .4s ease;
}

.win-card::before,
.win-card::after {
  content: "✦";
  position: absolute;
  color: #e9a93b;
  font-size: 54px;
  opacity: .23;
}

.win-card::before { top: 12px; left: 18px; transform: rotate(-12deg); }
.win-card::after { right: 18px; bottom: 4px; transform: rotate(12deg); }

#win-text { margin: 12px 0 24px; color: var(--ink-deep); font-size: 31px; font-weight: 900; }
#again-btn { position: relative; z-index: 1; width: 100%; color: #fff; background: var(--ink); }

@keyframes pop {
  from { opacity: 0; transform: translateY(18px) scale(.78) rotate(-2deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

/* ===== 响应式 ===== */
@media (max-width: 1020px) {
  body { padding: 14px; background-attachment: scroll; }

  #game-screen {
    grid-template-columns: min(94vw, 650px);
    grid-template-rows: 48px auto auto;
    width: 100%;
    gap: 12px;
  }

  .game-topbar { grid-column: 1; }

  #board-wrap {
    width: min(94vw, 650px);
  }

  #side-panel {
    width: min(94vw, 650px);
    height: auto;
  }

  .log-panel { min-height: 210px; }
}

@media (max-width: 820px) {
  .setup-shell {
    grid-template-columns: 1fr;
    width: min(100%, 570px);
    border-radius: 25px;
  }

  .card { padding: 38px 32px 32px; }
  .rules-brief { padding: 34px 32px 30px; }
}

@media (max-width: 520px) {
  body { padding: 9px; }
  #setup-screen { min-height: calc(100vh - 18px); }
  .setup-shell { border-radius: 22px; }
  .card { padding: 32px 20px 25px; }
  .title-lockup { gap: 14px; }
  .brand-mark { width: 58px; height: 58px; border-radius: 19px; font-size: 28px; }
  .card h1 { font-size: 43px; }
  .subtitle { margin: 21px 0 25px; font-size: 13px; }
  .choose-card { padding: 14px; }
  .player-count { gap: 7px; }
  .player-count button { flex-direction: column; gap: 3px; }
  .player-count button span { font-size: 23px; }
  .rules-brief { padding: 30px 20px 26px; }
  .rules-brief li { grid-template-columns: 30px 1fr; gap: 9px; }
  .rules-brief li p { font-size: 11px; }
  .game-status { font-size: 9px; }
  .game-topbar { padding-right: 10px; }
  .game-actions { gap: 7px; }
  .sound-label { display: none; }
  #sound-btn { width: 30px; padding: 0 4px; justify-content: center; }
  #board-wrap { border-radius: 17px; }
  #board-wrap::after { border-width: 4px; }
}

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

button:focus-visible {
  outline: 3px solid #fff1bd;
  outline-offset: 3px;
}
