:root {
  color-scheme: dark;
  --bg: #06140f;
  --panel: rgba(6, 18, 14, 0.82);
  --panel-strong: rgba(3, 12, 10, 0.92);
  --line: rgba(126, 241, 169, 0.24);
  --text: #f2fff7;
  --muted: rgba(242, 255, 247, 0.68);
  --mint: #32e891;
  --blue: #1191ff;
  --gold: #ffc83d;
  --red: #ff584f;
  --orange: #ff9d21;
  --cream: #fff4c8;
  --ink: #180f09;
  --copper: #b66d32;
  --bronze: #77502a;
  --steel: #9fb7bd;
  --enamel-green: #12744d;
  --enamel-blue: #155a91;
  --enamel-red: #8f2630;
  --enamel-violet: #573787;
  --ui-bright-edge: rgba(255, 244, 200, 0.86);
  --ui-metal-edge: rgba(255, 208, 104, 0.62);
  --ui-dark-edge: rgba(34, 17, 5, 0.86);
  --ui-recess: rgba(5, 13, 11, 0.74);
  --button-metal:
    linear-gradient(180deg, rgba(255, 252, 220, 0.40), transparent 22%),
    linear-gradient(180deg, #d6a04c 0%, #8d5524 48%, #3d2312 100%);
  --button-jewel:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.70), transparent 0 20%, transparent 38%),
    linear-gradient(180deg, #5ff1b3 0%, #148e58 54%, #073321 100%);
  --button-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.44),
    inset 0 -5px 0 rgba(0, 0, 0, 0.26),
    0 12px 24px rgba(0, 0, 0, 0.34);
  --ui-button-gold-art: url("./assets/ui/buttons/button-gold-wide.png");
  --ui-button-green-art: url("./assets/ui/buttons/button-green.png");
  --ui-button-blue-art: url("./assets/ui/buttons/button-blue.png");
  --ui-button-red-art: url("./assets/ui/buttons/button-red.png");
  --ui-button-dark-art: url("./assets/ui/buttons/button-dark.png");
  --ui-button-round-settings-art: url("./assets/ui/buttons/button-round-settings.png");
  --ui-button-round-back-art: url("./assets/ui/buttons/button-round-back.png");
  --ui-icon-solo-art: url("./assets/ui/icons/icon-menu-solo.png");
  --ui-icon-tutorial-art: url("./assets/ui/icons/icon-menu-tutorial.png");
  --ui-icon-party-art: url("./assets/ui/icons/icon-menu-party.png");
  --ui-icon-online-art: url("./assets/ui/icons/icon-menu-online.png");
  --ui-icon-compendium-art: url("./assets/ui/icons/icon-menu-compendium.png");
  --ui-icon-settings-art: url("./assets/ui/icons/icon-settings-gear.png");
  --ui-icon-chest-art: url("./assets/ui/icons/icon-chest.png");
  --ui-icon-cauldron-art: url("./assets/ui/icons/icon-cauldron.png");
  --ui-icon-vent-heat-art: url("./assets/ui/icons/icon-vent-heat.png");
  --ui-icon-vent-pressure-art: url("./assets/ui/icons/icon-vent-pressure.png");
  --ui-icon-filter-pollution-art: url("./assets/ui/icons/icon-filter-pollution.png");
  --cc-font-display: "STKaiti", "KaiTi", "Songti SC", "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif;
  --cc-font-body: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --cc-font-number: "SF Mono", "Menlo", "DIN Alternate", "Arial Rounded MT Bold", ui-monospace, monospace;
  --title-font: var(--cc-font-display);
  --typo-display-title: clamp(38px, 6.6vw, 76px);
  --typo-screen-title: clamp(26px, 3.3vw, 44px);
  --typo-card-title: clamp(18px, 2vw, 26px);
  --typo-body: clamp(14px, 1.45vw, 18px);
  --typo-caption: clamp(11px, 1.05vw, 14px);
  --typo-button: clamp(16px, 1.65vw, 22px);
  --typo-score-number: clamp(24px, 3vw, 38px);
  --typo-risk-number: clamp(14px, 1.55vw, 20px);
  --typo-result-title: clamp(24px, 3.2vw, 42px);
  --radius: 8px;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--cc-font-body);
}

button, input { font: inherit; }

button {
  border: 0;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.78;
  filter: grayscale(0.38) brightness(0.82);
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 360px;
  overflow: hidden;
  background:
    radial-gradient(circle at 60% 25%, rgba(45, 220, 128, 0.14), transparent 32%),
    linear-gradient(120deg, #06170f, #04100c 58%, #08160f);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
}

.screen.active { display: block; }

.loading-screen {
  background: #000 url("./assets/art/alchemy-loading-bg-v1.png") center / cover no-repeat;
}

.loading-vignette,
.menu-screen::before,
.sub-screen::before,
.game-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.58)),
    radial-gradient(circle at 52% 45%, transparent 20%, rgba(0, 0, 0, 0.38) 70%);
  pointer-events: none;
}

.loading-copy {
  position: absolute;
  left: 50%;
  bottom: 12%;
  width: min(520px, 82vw);
  transform: translateX(-50%);
  text-align: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.loading-copy h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 68px);
  font-weight: 1000;
  color: #050505;
  -webkit-text-stroke: 1px #f3e7c5;
  text-shadow: 0 0 20px rgba(255, 220, 120, 0.35);
  letter-spacing: 0;
}

.loading-copy p {
  margin: 4px 0 18px;
  color: var(--gold);
  font-weight: 800;
}

.loading-copy .world-lore {
  margin: 0 0 18px;
  color: rgba(242, 255, 247, 0.88);
  font-size: clamp(14px, 1.55vw, 18px);
  font-weight: 800;
  line-height: 1.55;
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 8%;
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--gold));
  border-radius: inherit;
  transition: width 0.28s ease;
}

#loadingText {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.loading-enter {
  display: inline-grid;
  place-items: center;
  min-width: 190px;
  min-height: 48px;
  margin-top: 18px;
  padding: 0 24px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffe873, #c77718);
  color: #1b1000;
  border: 2px solid rgba(255, 247, 186, 0.74);
  font-size: 20px;
  font-weight: 1000;
  box-shadow:
    0 0 26px rgba(255, 215, 65, 0.32),
    0 12px 24px rgba(0, 0, 0, 0.36);
}

.loading-enter[hidden] {
  display: none;
}

.menu-screen,
.sub-screen {
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: #061b10 url("./assets/art/alchemy-main-menu-bg-v2.png") center / cover no-repeat;
}

.top-bar {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: min(820px, 100%);
}

.avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, #22b66a, #147cff);
  font-size: 28px;
  overflow: hidden;
  border: 2px solid rgba(255, 229, 123, 0.72);
  box-shadow: 0 0 18px rgba(80, 240, 165, 0.18);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-pill strong,
.profile-pill span,
.top-metric span,
.top-metric strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.profile-pill strong { font-weight: 1000; }
.profile-pill span, .top-metric span { color: var(--muted); font-size: 12px; }
.profile-pill span {
  color: #d8eedc;
  max-width: 100%;
}
.top-metric strong { color: #fff3a7; font-size: 20px; }

.top-metric {
  padding: 9px 12px;
  background: rgba(10, 60, 38, 0.58);
  border: 1px solid rgba(111, 232, 157, 0.22);
  border-radius: 999px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  border: 2px solid rgba(255, 218, 88, 0.72);
  color: var(--gold);
  font-size: 24px;
  font-weight: 1000;
}

.icon-button.small {
  width: 42px;
  height: 42px;
  font-size: 18px;
}

.main-menu-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(135px, 1fr));
  gap: 18px;
  height: calc(100dvh - 162px);
  align-items: center;
}

.feature-card {
  min-height: 210px;
  padding: 18px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(160deg, rgba(29, 160, 88, 0.88), rgba(3, 35, 24, 0.94));
  text-align: center;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.feature-card:hover { transform: translateY(-4px); filter: brightness(1.08); }
.feature-card.gold { background: linear-gradient(160deg, #ffcf52, #bc5f11); }
.feature-card.blue { background: linear-gradient(160deg, #56bbff, #154fc0); }
.feature-card.violet { background: linear-gradient(160deg, #9354ff, #3d158d); }
.feature-card.red { background: linear-gradient(160deg, #ff6d6d, #9f1f35); }
.feature-card.green { background: linear-gradient(160deg, #2eed91, #0b6a37); }

.feature-icon {
  display: block;
  font-size: 56px;
  margin-bottom: 22px;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.28));
}

.feature-card strong {
  display: block;
  font-size: clamp(22px, 2.6vw, 34px);
  font-weight: 1000;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
}

.feature-card small {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.setup-lead {
  margin: 8px 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(255, 211, 63, 0.18), rgba(0, 0, 0, 0.42));
  border: 1px solid rgba(255, 211, 63, 0.34);
  color: #fff2a9;
  font-size: clamp(17px, 1.8vw, 22px);
  font-weight: 900;
  line-height: 1.45;
}

.ai-level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.ai-level-card {
  min-height: 260px;
  padding: 20px 18px;
  border-radius: var(--radius);
  border: 2px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.ai-level-card:hover {
  transform: translateY(-4px);
  filter: brightness(1.08);
}

.ai-level-card.apprentice {
  background: linear-gradient(160deg, rgba(71, 184, 111, 0.94), rgba(8, 72, 43, 0.95));
}

.ai-level-card.adept {
  background: linear-gradient(160deg, rgba(26, 139, 255, 0.94), rgba(11, 46, 136, 0.95));
}

.ai-level-card.master {
  background: linear-gradient(160deg, rgba(255, 190, 58, 0.96), rgba(129, 48, 13, 0.96));
}

.ai-level-card strong {
  display: block;
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 1000;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
}

.ai-level-card span {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  color: #fff7c8;
  font-weight: 1000;
}

.ai-level-card p {
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.5;
}

.menu-footer {
  position: absolute;
  z-index: 1;
  left: max(18px, env(safe-area-inset-left));
  right: max(18px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
}

.text-button,
.back-button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 900;
}

.game-screen {
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background:
    linear-gradient(90deg, rgba(2, 25, 15, 0.88), rgba(2, 30, 17, 0.52), rgba(1, 16, 10, 0.92)),
    radial-gradient(circle at 46% 34%, rgba(49, 204, 139, 0.22), transparent 35%),
    #052716 url("./assets/art/alchemy-workshop-bg-v1.png") center / cover no-repeat;
}

.game-board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(250px, 0.98fr) minmax(300px, 1fr) minmax(250px, 0.98fr);
  gap: 10px;
  height: 100%;
}

.panel,
.ledger,
.round-prompt,
.session-card,
.tool-card,
.history-card,
.commission-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
}

.left-panel,
.right-panel,
.center-panel {
  min-height: 0;
}

.left-panel,
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow: hidden;
}

.center-panel {
  display: grid;
  grid-template-rows: minmax(120px, 1fr) minmax(76px, 0.42fr) auto auto;
  gap: 8px;
  min-width: 0;
}

.game-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.game-header-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 0 0 auto;
}

.menu-return-button {
  min-height: 42px;
  padding: 0 13px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 211, 63, 0.96), rgba(180, 103, 18, 0.96));
  color: #221000;
  border: 2px solid rgba(255, 241, 153, 0.62);
  font-weight: 1000;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
  white-space: nowrap;
}

.menu-return-button.danger {
  background: linear-gradient(180deg, rgba(255, 116, 86, 0.96), rgba(116, 28, 22, 0.98));
  color: #fff5de;
  border-color: rgba(255, 204, 156, 0.72);
}

.game-header h2 {
  margin: 0 0 4px;
  font-size: clamp(22px, 2.6vw, 34px);
}

.game-header p {
  margin: 0;
  color: var(--muted);
}

.commission-card,
.session-card,
.tool-card,
.history-card,
.online-scoreboard,
.online-live-panel,
.ledger,
.round-prompt {
  padding: 10px;
}

.commission-card h3 {
  margin: 8px 0;
  font-size: 22px;
}

.commission-card p,
.session-card p,
.round-prompt {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.45;
}

.online-scoreboard {
  background: linear-gradient(180deg, rgba(8, 37, 29, 0.92), rgba(3, 16, 13, 0.9));
  border: 1px solid rgba(111, 255, 170, 0.32);
  border-radius: var(--radius);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
}

.online-scoreboard[hidden] {
  display: none;
}

.online-live-panel[hidden] {
  display: none;
}

.online-live-panel {
  border-color: rgba(78, 204, 255, 0.30);
  background:
    linear-gradient(180deg, rgba(64, 183, 255, 0.12), transparent 50%),
    rgba(4, 20, 18, 0.86);
}

.online-countdown {
  color: #ffe873;
  font-variant-numeric: tabular-nums;
}

.online-countdown b {
  font-size: 1.18em;
}

.online-countdown.warning b {
  color: #ff4848;
  text-shadow: 0 0 12px rgba(255, 50, 50, 0.68), 0 2px 0 rgba(0, 0, 0, 0.46);
  animation: warningPulse 0.8s ease-in-out infinite alternate;
}

@keyframes warningPulse {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.35);
  }
}

.live-headline {
  margin-bottom: 8px;
  color: #dfffee;
  font-size: 13px;
  line-height: 1.35;
}

.live-players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.live-player {
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.20);
}

.live-player.active {
  border-color: rgba(255, 211, 63, 0.50);
  box-shadow: 0 0 18px rgba(255, 211, 63, 0.12);
}

.live-player strong,
.live-player span,
.live-player small {
  display: block;
}

.live-player strong {
  color: #7dffae;
}

.live-player span,
.live-player p,
.live-player small {
  margin: 3px 0 0;
  color: rgba(239, 255, 244, 0.72);
  line-height: 1.28;
}

.live-player p {
  color: #ffe873;
  font-weight: 900;
}

.live-timeline {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.live-timeline b {
  color: #ffe873;
}

.live-timeline span {
  display: block;
  padding: 5px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.20);
  color: rgba(239, 255, 244, 0.76);
  font-size: 12px;
  line-height: 1.3;
}

.scoreboard-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.scoreboard-row:first-child {
  border-top: 0;
}

.scoreboard-row b {
  color: #7dffae;
}

.scoreboard-row.current b {
  color: #ffd33f;
}

.scoreboard-row small {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.25;
}

.scoreboard-score {
  color: #fff7aa;
  font-weight: 1000;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.round-prompt {
  border-color: rgba(255, 203, 55, 0.42);
  font-weight: 800;
}

.round-prompt strong {
  display: block;
  margin-bottom: 4px;
  color: #ffd33f;
  font-size: 18px;
}

.round-prompt span {
  display: block;
  color: rgba(255, 255, 255, 0.84);
}

.tutorial-mode .round-prompt {
  position: relative;
  padding: 13px 14px 13px 54px;
  background:
    linear-gradient(90deg, rgba(255, 200, 61, 0.20), rgba(0, 0, 0, 0.54)),
    rgba(6, 18, 14, 0.88);
  border: 2px solid rgba(255, 211, 63, 0.82);
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.26),
    0 0 24px rgba(255, 211, 63, 0.28);
}

.tutorial-mode .round-prompt::before {
  content: "!";
  position: absolute;
  left: 14px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #ffd33f;
  color: #1b1200;
  font-weight: 1000;
  box-shadow: 0 0 18px rgba(255, 211, 63, 0.62);
}

.tutorial-mode .round-prompt strong {
  margin-bottom: 6px;
  color: #fff0a3;
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 1000;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
}

.tutorial-action {
  color: #fff;
  font-size: 17px;
  font-weight: 1000;
}

.tutorial-why {
  margin-top: 3px;
  color: #a9ffd1;
  font-size: 14px;
  font-weight: 800;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-weight: 1000;
}

.status-badge {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.status-badge.good { color: #bfffd8; background: rgba(38, 196, 91, 0.22); }
.status-badge.bad { color: #ffd0d0; background: rgba(255, 78, 78, 0.22); }

.requirement-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.requirement-list li {
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.requirement-list li.ok {
  color: #96ffbb;
  background: rgba(40, 218, 102, 0.16);
}

.meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-height: 150px;
}

.meter {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  padding: 9px 8px 8px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 34%),
    radial-gradient(circle at 50% 46%, color-mix(in srgb, currentColor 20%, transparent), transparent 58%),
    rgba(0, 0, 0, 0.50);
  border: 1px solid color-mix(in srgb, currentColor 58%, transparent);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 -18px 30px rgba(0, 0, 0, 0.26),
    0 10px 20px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.meter::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
  pointer-events: none;
}

.meter::after {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  top: 34px;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, currentColor 56%, transparent), transparent);
  pointer-events: none;
}

.meter label {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  font-weight: 900;
  position: relative;
  z-index: 2;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.42);
}

.meter label button {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: currentColor;
  color: #07100b;
  font-size: 13px;
  font-weight: 1000;
}

.meter.heat { color: #ff5a55; border-color: rgba(255, 90, 85, 0.5); }
.meter.pressure { color: #ffb22e; border-color: rgba(255, 178, 46, 0.5); }
.meter.pollution { color: #35ee88; border-color: rgba(53, 238, 136, 0.5); }

.thermo,
.vial {
  align-self: center;
  justify-self: center;
  position: relative;
  width: 48px;
  height: 92px;
  border-radius: 22px 22px 18px 18px;
  border: 4px solid rgba(255, 255, 255, 0.44);
  overflow: hidden;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0 2px, transparent 2px 12px),
    rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.52),
    0 0 22px color-mix(in srgb, currentColor 30%, transparent);
}

.thermo span,
.vial span {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 0;
  height: 0%;
  border-radius: 16px 16px 12px 12px;
  transition: height 0.25s ease;
  box-shadow:
    inset 0 8px 12px rgba(255, 255, 255, 0.28),
    0 0 16px currentColor;
}

.thermo span { background: linear-gradient(#ffcf4b, #ff4038); }
.vial span { background: linear-gradient(#72ffc3, #28d95d); }

.thermo::after,
.vial::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 8px;
  width: 8px;
  height: 62px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.52), transparent);
  pointer-events: none;
}

.gauge {
  position: relative;
  align-self: center;
  justify-self: center;
  width: 100px;
  height: 72px;
  border-radius: 100px 100px 18px 18px;
  background:
    radial-gradient(circle at 50% 100%, rgba(0, 0, 0, 0.88) 0 23%, transparent 24%),
    conic-gradient(from 230deg at 50% 100%, #35ee88 0 52deg, #ffd33f 52deg 104deg, #ff5a55 104deg 160deg, transparent 160deg 360deg);
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.34),
    inset 0 0 0 10px rgba(0, 0, 0, 0.36),
    0 0 22px rgba(255, 178, 46, 0.26);
  overflow: hidden;
}

.gauge::before {
  content: "";
  position: absolute;
  inset: 12px 12px 0;
  border-radius: 80px 80px 10px 10px;
  background:
    repeating-conic-gradient(from 232deg at 50% 100%, rgba(255, 255, 255, 0.55) 0 2deg, transparent 2deg 15deg),
    radial-gradient(circle at 50% 100%, rgba(4, 12, 10, 0.96) 0 36%, rgba(255, 255, 255, 0.08) 37% 66%, transparent 67%);
}

.gauge span {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 5px;
  height: 50px;
  transform-origin: bottom center;
  transform: rotate(-75deg);
  background: linear-gradient(180deg, #fff3a4, var(--orange));
  border-radius: 999px;
  transition: transform 0.25s ease;
  box-shadow: 0 0 8px rgba(255, 178, 46, 0.72);
}

.gauge span::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 15px;
  height: 15px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #ffd33f;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.42);
}

.meter strong {
  text-align: center;
  color: #fff;
  font-size: 18px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

.meter.warning {
  filter: brightness(1.08);
}

.meter.critical {
  animation: meterCritical 0.72s ease-in-out infinite;
}

@keyframes meterCritical {
  50% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.10),
      inset 0 -18px 30px rgba(0, 0, 0, 0.26),
      0 0 24px color-mix(in srgb, currentColor 68%, transparent);
  }
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.score-strip div {
  padding: 10px 6px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.score-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.score-strip strong {
  display: block;
  font-size: 24px;
}

.cauldron-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 38%, rgba(69, 255, 185, 0.22), transparent 30%),
    radial-gradient(ellipse at 50% 82%, rgba(4, 12, 8, 0.82), transparent 47%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.76));
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.stage-glow {
  position: absolute;
  inset: 8% 12% 5%;
  border-radius: 42%;
  background:
    radial-gradient(circle at 50% 28%, rgba(95, 255, 221, 0.26), transparent 32%),
    radial-gradient(ellipse at 50% 78%, rgba(255, 196, 72, 0.14), transparent 46%);
  filter: blur(10px);
  opacity: 0.95;
}

.cauldron-art {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 4%;
  width: min(520px, 92%);
  max-height: 96%;
  transform: translateX(-50%);
  object-fit: contain;
  filter:
    drop-shadow(0 24px 26px rgba(0, 0, 0, 0.62))
    drop-shadow(0 0 16px rgba(58, 255, 220, 0.12));
  mix-blend-mode: screen;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.18s ease, filter 0.18s ease, transform 0.18s ease;
}

.cauldron-lid {
  display: none;
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 43.5%;
  width: min(128px, 31%);
  height: min(36px, 9%);
  transform: translateX(-50%) translateY(0);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(255, 243, 173, 0.96), rgba(204, 136, 34, 0.86) 46%, rgba(91, 50, 8, 0.25) 70%, transparent 74%);
  box-shadow:
    0 10px 18px rgba(0, 0, 0, 0.38),
    0 0 22px rgba(255, 220, 126, 0.34);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.20s ease;
  pointer-events: none;
}

.cauldron-stage.open .cauldron-art {
  opacity: 0.46;
  filter:
    drop-shadow(0 24px 26px rgba(0, 0, 0, 0.62))
    drop-shadow(0 0 22px rgba(58, 255, 220, 0.24));
}

.cauldron-stage.open .cauldron-lid {
  transform: translateX(-50%) translate(-54px, -82px) rotate(-18deg) scale(0.92, 0.78);
  opacity: 0.96;
}

.cauldron-stage.closing .cauldron-lid {
  opacity: 0.88;
  transform: translateX(-50%) translate(-8px, -10px) rotate(-4deg) scale(0.98, 0.9);
}

.brew-surface {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 54%;
  width: min(166px, 40%);
  height: min(38px, 10%);
  transform: translateX(-50%);
  border-radius: 50%;
  background: #34d7be;
  box-shadow:
    inset 0 8px 14px rgba(255, 255, 255, 0.24),
    0 0 26px rgba(64, 255, 207, 0.58);
  opacity: 0;
  transition: background 0.25s ease, box-shadow 0.25s ease, opacity 0.24s ease;
  pointer-events: none;
}

.cauldron-stage.open .brew-surface {
  opacity: 0.72;
}

.cauldron-stage.reacting .brew-surface {
  opacity: 0.46;
}

.cauldron-stage.critical .stage-glow {
  animation: criticalPulse 1.05s ease-in-out infinite;
}

.cauldron-stage.busted .cauldron-art {
  animation: cauldronShake 0.18s linear 4;
}

.cauldron-stage.settling .cauldron-art {
  animation: cauldronSettle 0.22s ease-out;
}

.cauldron-label {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  color: #fff;
  font-size: clamp(20px, 2vw, 30px);
  font-weight: 1000;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.62),
    0 0 16px rgba(52, 215, 190, 0.22);
  white-space: nowrap;
  pointer-events: none;
}

.mist {
  position: absolute;
  z-index: 3;
  width: 52%;
  height: 28px;
  left: 24%;
  top: 24%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(207, 255, 236, 0.32), transparent);
  filter: blur(12px);
  animation: mistDrift 4.6s linear infinite;
}

.mist-b {
  top: 36%;
  animation-delay: -2.2s;
  opacity: 0.72;
}

@keyframes mistDrift {
  from { transform: translateX(-22%); opacity: 0; }
  30% { opacity: 1; }
  to { transform: translateX(28%); opacity: 0; }
}

@keyframes criticalPulse {
  50% { opacity: 1; filter: blur(7px) brightness(1.18); }
}

@keyframes cauldronShake {
  25% { transform: translateX(calc(-50% - 5px)) rotate(-1deg); }
  75% { transform: translateX(calc(-50% + 5px)) rotate(1deg); }
}

@keyframes cauldronSettle {
  40% { transform: translateX(-50%) scaleX(1.025) scaleY(0.985); }
}

.ingredient-model {
  position: absolute;
  z-index: 8;
  left: 38%;
  top: 13%;
  width: 76px;
  height: 76px;
  transform: translate(-50%, -90px);
  opacity: 0;
  pointer-events: none;
}

.alchemy-chest {
  position: absolute;
  z-index: 9;
  right: 3%;
  bottom: 5%;
  width: min(210px, 32%);
  aspect-ratio: 1.44;
  transform-origin: 50% 85%;
  transition: transform 0.22s ease, filter 0.22s ease;
  pointer-events: none;
}

.alchemy-chest img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.58));
  mix-blend-mode: screen;
}

.alchemy-chest.opening {
  transform: translateY(-4px) scale(1.03);
}

.alchemy-chest.revealed {
  transform: translateY(-8px) scale(1.08);
}

.chest-light {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 22%;
  width: 82%;
  height: 70%;
  transform: translateX(-50%);
  border-radius: 50%;
  opacity: 0;
  filter: blur(12px);
  transition: opacity 0.16s ease;
}

.alchemy-chest.common .chest-light {
  background: radial-gradient(circle, rgba(91, 255, 155, 0.86), transparent 66%);
}

.alchemy-chest.uncommon .chest-light {
  background: radial-gradient(circle, rgba(84, 190, 255, 0.92), transparent 66%);
}

.alchemy-chest.rare .chest-light {
  background: radial-gradient(circle, rgba(255, 221, 92, 0.96), rgba(173, 80, 255, 0.72) 45%, transparent 72%);
}

.alchemy-chest.revealed .chest-light {
  opacity: 1;
  animation: chestGlowPulse 0.72s ease-in-out infinite alternate;
}

.chest-preview {
  z-index: 3;
  left: 50% !important;
  top: -12% !important;
  width: 46% !important;
  height: auto !important;
  transform: translateX(-50%) translateY(18px) scale(0.58);
  opacity: 0;
  border-radius: 18px;
  box-shadow: 0 0 20px rgba(255, 247, 166, 0.28);
  transition: opacity 0.2s ease, transform 0.22s ease;
}

.alchemy-chest.revealed .chest-preview {
  opacity: 1;
  transform: translateX(-50%) translateY(-10px) scale(0.86);
}

@keyframes chestGlowPulse {
  from { transform: translateX(-50%) scale(0.88); filter: blur(13px) brightness(1); }
  to { transform: translateX(-50%) scale(1.12); filter: blur(8px) brightness(1.32); }
}

.flying-ingredient {
  position: absolute;
  z-index: 12;
  left: 82%;
  top: 70%;
  width: min(96px, 14%);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 18px;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.25));
}

.flying-ingredient.fly {
  animation: ingredientFly 0.9s cubic-bezier(.2, .86, .28, 1) forwards;
}

.flying-ingredient.fire { box-shadow: 0 0 28px rgba(255, 89, 31, 0.5); }
.flying-ingredient.water { box-shadow: 0 0 28px rgba(80, 202, 255, 0.5); }
.flying-ingredient.air { box-shadow: 0 0 28px rgba(142, 255, 224, 0.5); }
.flying-ingredient.earth { box-shadow: 0 0 28px rgba(111, 236, 121, 0.45); }
.flying-ingredient.metal { box-shadow: 0 0 28px rgba(255, 217, 96, 0.45); }
.flying-ingredient.rare { filter: drop-shadow(0 0 18px rgba(255, 226, 88, 0.76)) saturate(1.15); }

@keyframes ingredientFly {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-8deg) scale(0.62); }
  15% { opacity: 1; transform: translate(-50%, -50%) translate(var(--fly-x1, -34px), var(--fly-y1, -96px)) rotate(4deg) scale(1.06); }
  62% { opacity: 1; transform: translate(-50%, -50%) translate(var(--fly-x2, -250px), var(--fly-y2, -124px)) rotate(18deg) scale(1.02); }
  90% { opacity: 1; transform: translate(-50%, -50%) translate(var(--fly-x3, -350px), var(--fly-y3, -22px)) rotate(42deg) scale(0.74); }
  100% { opacity: 0; transform: translate(-50%, -50%) translate(var(--fly-x3, -378px), var(--fly-y3, 10px)) rotate(56deg) scale(0.28); }
}

.impact-burst {
  position: absolute;
  z-index: 11;
  left: 50%;
  top: 50%;
  width: 180px;
  height: 90px;
  transform: translate(-50%, -50%) scale(0.35);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.impact-burst.active {
  animation: impactBloom 0.58s ease-out forwards;
}

.impact-burst.fire { background: radial-gradient(circle, rgba(255, 96, 31, 0.92), transparent 68%); }
.impact-burst.water { background: radial-gradient(circle, rgba(69, 208, 255, 0.92), transparent 68%); }
.impact-burst.air { background: radial-gradient(circle, rgba(156, 255, 229, 0.82), transparent 68%); }
.impact-burst.earth { background: radial-gradient(circle, rgba(94, 236, 115, 0.82), transparent 68%); }
.impact-burst.metal { background: radial-gradient(circle, rgba(255, 222, 102, 0.88), transparent 68%); }
.impact-burst.rare { box-shadow: 0 0 42px rgba(255, 220, 82, 0.5); }

@keyframes impactBloom {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.35); filter: blur(3px); }
  42% { opacity: 0.96; transform: translate(-50%, -50%) scale(1.15); filter: blur(8px) brightness(1.2); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.86); filter: blur(15px); }
}

.ingredient-model.drop {
  animation: ingredientDrop 0.96s ease forwards;
}

@keyframes ingredientDrop {
  0% { opacity: 0; transform: translate(-72px, -88px) rotate(-22deg) scale(0.78); }
  16% { opacity: 1; transform: translate(-34px, -54px) rotate(-8deg) scale(1.08); }
  72% { opacity: 1; transform: translate(96px, 82px) rotate(35deg) scale(0.86); }
  100% { opacity: 0; transform: translate(124px, 112px) rotate(58deg) scale(0.28); }
}

.model-bottle {
  position: absolute;
  left: 18px;
  top: 8px;
  width: 28px;
  height: 48px;
  border-radius: 10px 10px 13px 13px;
  border: 2px solid rgba(218, 255, 255, 0.9);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.44), rgba(155, 237, 255, 0.24));
  box-shadow: 0 0 18px rgba(88, 210, 255, 0.55);
}

.model-bottle i {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 5px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(180deg, #9ef7ff, #148aff);
}

.model-bottle b {
  position: absolute;
  left: 8px;
  top: -9px;
  width: 12px;
  height: 12px;
  border-radius: 4px 4px 0 0;
  background: rgba(255, 255, 255, 0.72);
}

.model-stream {
  position: absolute;
  left: 46px;
  top: 42px;
  width: 54px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(118, 240, 255, 0.85), rgba(20, 124, 255, 0));
  transform: rotate(-18deg);
}

.model-flame i,
.model-flame b {
  position: absolute;
  left: 23px;
  top: 9px;
  width: 36px;
  height: 48px;
  border-radius: 70% 20% 70% 45%;
  transform: rotate(38deg);
  background: linear-gradient(135deg, #fff176, #ff3928 72%);
  border: 2px solid rgba(255, 255, 255, 0.48);
  box-shadow: 0 0 22px rgba(255, 70, 32, 0.66);
}

.model-flame b {
  left: 33px;
  top: 26px;
  width: 18px;
  height: 24px;
  background: #ffe96a;
  border: 0;
}

.model-dust i {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f2d69b, #8a5d2f);
  box-shadow: 0 0 8px rgba(242, 199, 128, 0.4);
}

.model-dust i:nth-child(1) { left: 16px; top: 16px; }
.model-dust i:nth-child(2) { left: 34px; top: 12px; }
.model-dust i:nth-child(3) { left: 48px; top: 24px; }
.model-dust i:nth-child(4) { left: 24px; top: 36px; }
.model-dust i:nth-child(5) { left: 42px; top: 42px; }
.model-dust i:nth-child(6) { left: 12px; top: 48px; }
.model-dust i:nth-child(7) { left: 56px; top: 44px; }
.model-dust i:nth-child(8) { left: 33px; top: 56px; }

.model-swirl i {
  position: absolute;
  border: 3px solid rgba(210, 246, 255, 0.82);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  filter: drop-shadow(0 0 10px rgba(166, 235, 255, 0.55));
}

.model-swirl i:nth-child(1) { inset: 10px 10px 34px 12px; transform: rotate(12deg); }
.model-swirl i:nth-child(2) { inset: 24px 20px 22px 20px; transform: rotate(36deg); }
.model-swirl i:nth-child(3) { inset: 38px 28px 12px 28px; transform: rotate(64deg); }

.model-shards i {
  position: absolute;
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #ffffff, #879ba8);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: 0 0 12px rgba(217, 231, 241, 0.55);
}

.model-shards i:nth-child(1) { left: 12px; top: 26px; }
.model-shards i:nth-child(2) { left: 30px; top: 14px; }
.model-shards i:nth-child(3) { left: 46px; top: 32px; }
.model-shards i:nth-child(4) { left: 28px; top: 46px; }

.ingredient-ledger {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
  overflow: auto;
  max-height: 96px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 900;
}

.chip img {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.chip.fire { color: #ff8b66; }
.chip.water { color: #67c8ff; }
.chip.air { color: #d2f2ff; }
.chip.earth { color: #d6b071; }
.chip.metal { color: #d9e4ef; }

.primary-action,
.bottle-action {
  width: 100%;
  min-height: 54px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #1899ff, #0874df);
  color: #fff;
  font-size: 22px;
  font-weight: 1000;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.primary-action.continue-action {
  background: linear-gradient(180deg, #ffe873, #c77718);
  color: #211100;
  border: 2px solid rgba(255, 247, 186, 0.74);
  animation: continuePulse 0.95s ease-in-out infinite;
}

@keyframes continuePulse {
  50% {
    filter: brightness(1.12);
    box-shadow: 0 0 24px rgba(255, 211, 63, 0.42), 0 10px 24px rgba(0, 0, 0, 0.24);
  }
}

.bottle-action {
  background: linear-gradient(180deg, #35e98c, #109b4f);
}

.vent-grid,
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.vent-grid button,
.tool-grid button {
  min-height: 58px;
  padding: 8px 6px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 900;
}

.tool-grid button {
  min-height: 54px;
  font-size: 13px;
}

.tutorial-target {
  position: relative;
  z-index: 12;
  outline: 4px solid #ffe13a;
  outline-offset: 3px;
  box-shadow:
    0 0 0 8px rgba(255, 210, 48, 0.18),
    0 0 24px rgba(255, 225, 58, 0.72),
    0 12px 24px rgba(0, 0, 0, 0.28);
  animation: tutorialPulse 0.9s ease-in-out infinite;
}

.tutorial-target::after {
  content: "☝";
  position: absolute;
  right: 12px;
  bottom: -38px;
  font-size: 34px;
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.45));
  animation: tutorialTap 0.78s ease-in-out infinite;
  pointer-events: none;
}

@keyframes tutorialPulse {
  50% { filter: brightness(1.14); }
}

@keyframes tutorialTap {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(0.92); }
}

.history-card {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.history-card ol {
  margin: 8px 0 0;
  padding-left: 22px;
  max-height: 132px;
  overflow: auto;
  color: var(--muted);
}

.sub-screen {
  overflow: auto;
}

.sub-panel {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 32px));
  min-height: min(520px, calc(100dvh - 28px));
  margin: 0 auto;
  padding: 18px;
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sub-panel.wide {
  width: min(1160px, calc(100vw - 32px));
}

.tutorial-intro-panel {
  min-height: min(560px, calc(100dvh - 28px));
}

.tutorial-intro-lead {
  margin: 8px 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(255, 211, 63, 0.20), rgba(0, 0, 0, 0.42));
  border: 1px solid rgba(255, 211, 63, 0.46);
  color: #fff2a9;
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 1000;
  line-height: 1.45;
}

.tutorial-intro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.tutorial-intro-grid article,
.tutorial-intro-rule {
  padding: 13px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 42%),
    rgba(0, 0, 0, 0.44);
  border: 1px solid rgba(126, 241, 169, 0.26);
}

.tutorial-intro-grid strong,
.tutorial-intro-rule b {
  display: block;
  margin-bottom: 6px;
  color: #ffd33f;
  font-size: 20px;
  font-weight: 1000;
}

.tutorial-intro-grid p,
.tutorial-intro-rule span {
  display: block;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.55;
  font-weight: 700;
}

.tutorial-intro-rule {
  margin-top: 10px;
  border-color: rgba(255, 211, 63, 0.44);
}

.tutorial-start-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.34fr) minmax(260px, 0.66fr);
  gap: 10px;
  margin-top: 12px;
}

.network-panel {
  min-height: min(560px, calc(100dvh - 28px));
}

.network-lead {
  margin: 8px 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(50, 232, 145, 0.18), rgba(0, 0, 0, 0.44));
  border: 1px solid rgba(126, 241, 169, 0.32);
  color: rgba(242, 255, 247, 0.9);
  font-size: clamp(17px, 1.8vw, 22px);
  font-weight: 900;
  line-height: 1.5;
}

.network-console {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(17, 145, 255, 0.10), transparent 48%),
    rgba(0, 0, 0, 0.50);
  border: 1px solid rgba(126, 241, 169, 0.30);
}

.network-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
}

.network-toolbar label,
.network-actions section {
  display: grid;
  gap: 7px;
}

.network-toolbar label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.network-toolbar strong {
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.44);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffe873;
}

.network-reconnect-notice {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 232, 115, 0.44);
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 232, 115, 0.16), transparent 36%),
    rgba(10, 35, 27, 0.82);
  color: #fff6c7;
  font-weight: 950;
}

.network-console input {
  min-height: 42px;
  width: 100%;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
  outline: none;
}

.network-console input:focus {
  border-color: rgba(50, 232, 145, 0.72);
  box-shadow: 0 0 0 2px rgba(50, 232, 145, 0.16);
}

.verification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.verification-row .text-button {
  min-height: 42px;
  white-space: nowrap;
}

.network-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.network-panel.room-detail-active .network-actions,
.network-panel.room-detail-active .network-lobby-grid {
  display: none;
}

.network-actions section,
.network-room-list,
.network-player-list,
.network-leaderboard-list,
.network-current-room,
.network-match-state {
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.network-lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.7fr) minmax(220px, 0.75fr);
  gap: 12px;
}

.network-small-note {
  margin: 0;
  color: rgba(240, 255, 245, 0.68);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.35;
}

.network-console h3 {
  margin: 0;
  color: #ffe873;
  font-size: 20px;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.network-output {
  min-height: 42px;
  padding: 9px 10px;
  border-radius: var(--radius);
  background: rgba(4, 18, 13, 0.70);
  border: 1px solid rgba(126, 241, 169, 0.18);
  color: rgba(255, 255, 255, 0.84);
  font-weight: 750;
  line-height: 1.4;
}

.network-output .room-row,
.network-output .online-row,
.network-output .member-row,
.network-output .leaderboard-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.network-output .room-row {
  cursor: pointer;
}

.network-output .room-row:hover {
  background: rgba(17, 145, 255, 0.10);
}

.lobby-room-name {
  color: #47bbff;
  text-shadow: 0 0 10px rgba(71, 187, 255, 0.30);
}

.lobby-player-name {
  color: #63f5a0;
  text-shadow: 0 0 10px rgba(99, 245, 160, 0.28);
}

.network-output .room-row > span:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.network-output .room-row.joined {
  margin: 2px -4px;
  padding-inline: 8px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(77, 240, 148, 0.18), rgba(17, 145, 255, 0.08));
  border-bottom-color: transparent;
  box-shadow: inset 0 0 0 1px rgba(99, 245, 160, 0.28);
}

.network-output .room-row:last-child,
.network-output .online-row:last-child,
.network-output .member-row:last-child,
.network-output .leaderboard-row:last-child {
  border-bottom: 0;
}

.network-output .leaderboard-row {
  align-items: center;
  flex-wrap: wrap;
}

.network-output .leaderboard-row b {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff6c7;
}

.network-output .leaderboard-row b > span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #1a1000;
  background: linear-gradient(180deg, #fff4ae, #c99025);
}

.network-output .leaderboard-row strong {
  color: #7dffae;
}

.network-output .leaderboard-row small {
  width: 100%;
  color: rgba(255, 245, 180, 0.72);
}

.records-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 10px 0 14px;
}

.match-records-list {
  display: grid;
  gap: 14px;
  max-height: min(62vh, 620px);
  overflow: auto;
  padding-right: 6px;
}

.match-record-card {
  border: 1px solid rgba(126, 255, 176, 0.22);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(6, 26, 16, 0.9), rgba(1, 12, 8, 0.84));
  padding: 16px;
  box-shadow: inset 0 0 22px rgba(78, 255, 174, 0.08);
}

.match-record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.match-record-head strong {
  display: block;
  color: #fff6bb;
  font-size: clamp(18px, 1.6vw, 26px);
}

.match-record-head span,
.match-record-card p,
.match-record-round small {
  color: rgba(232, 255, 241, 0.78);
}

.match-record-head b {
  color: #7dffad;
  font-size: clamp(28px, 3vw, 48px);
  text-shadow: 0 0 16px rgba(92, 255, 169, 0.35);
}

.match-record-card details {
  margin-top: 12px;
}

.match-record-card summary {
  cursor: pointer;
  color: #7dffad;
  font-weight: 900;
}

.match-record-round {
  margin-top: 10px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.match-record-round.bust strong {
  color: #ff8d82;
}

.match-record-round small {
  display: block;
  margin-top: 6px;
  line-height: 1.65;
}

.leaderboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.leaderboard-tabs .text-button.active {
  color: #14210f;
  background: linear-gradient(180deg, #fff6b9, #d7a43a);
  border-color: rgba(255, 246, 185, 0.78);
}

.season-summary {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 232, 115, 0.32);
  background: rgba(7, 30, 22, 0.72);
}

.season-summary b {
  color: #fff6c7;
  font-size: 22px;
}

.season-summary span,
.season-summary small {
  color: rgba(239, 255, 244, 0.72);
}

.leaderboard-list .leaderboard-row.full {
  padding: 10px 0;
}

.network-output button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: var(--radius);
  background: rgba(17, 145, 255, 0.26);
  border: 1px solid rgba(17, 145, 255, 0.42);
  color: #dff2ff;
  font-size: 13px;
  font-weight: 900;
}

.network-friendly-state {
  color: #63f5a0;
}

.network-output .inline-room-action {
  width: 100%;
  margin-top: 8px;
}

.room-detail-head,
.room-detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.room-detail-head > div {
  display: grid;
  gap: 4px;
}

.room-detail-head span,
.room-rule-note {
  color: rgba(240, 255, 245, 0.78);
}

.room-rule-note,
.room-countdown {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(126, 241, 169, 0.22);
  background: rgba(5, 28, 19, 0.72);
}

.room-countdown {
  color: #ffe873;
  font-size: 22px;
  font-weight: 1000;
  text-align: center;
  box-shadow: 0 0 18px rgba(255, 232, 115, 0.18);
}

.room-copy-button {
  min-width: 168px;
}

.network-output .ready {
  color: #63f5a0;
}

.network-output .not-ready {
  color: #ffcc66;
}

.network-output b {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: #fff2a9;
}

.network-output b.lobby-room-name {
  color: #47bbff;
  text-shadow: 0 0 10px rgba(71, 187, 255, 0.30);
}

.network-output b.lobby-player-name {
  color: #63f5a0;
  text-shadow: 0 0 10px rgba(99, 245, 160, 0.28);
}

.network-room-preview {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(5px);
}

.network-room-preview.open {
  display: grid;
}

.network-room-preview-card {
  position: relative;
  width: min(680px, calc(100vw - 28px));
  max-height: min(86dvh, 720px);
  overflow: auto;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(126, 241, 169, 0.34);
  background:
    linear-gradient(180deg, rgba(17, 145, 255, 0.14), transparent 44%),
    rgba(0, 16, 11, 0.94);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.50), inset 0 0 0 1px rgba(255, 232, 115, 0.14);
}

.network-room-preview-card h3 {
  margin: 0 0 10px;
  color: #ffe873;
  font-size: 24px;
}

.preview-close-button {
  float: right;
  width: auto;
  min-height: 36px;
  padding: 0 14px;
}

.member-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 232, 115, 0.68);
}

.network-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.network-grid article {
  min-height: 150px;
  padding: 14px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 46%),
    rgba(0, 0, 0, 0.48);
  border: 1px solid rgba(126, 241, 169, 0.24);
}

.network-grid strong {
  display: block;
  color: #ffe873;
  font-size: 21px;
  font-weight: 1000;
}

.network-grid p {
  min-height: 70px;
  margin: 8px 0 10px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.48;
  font-weight: 700;
}

.network-grid span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(17, 145, 255, 0.18);
  border: 1px solid rgba(17, 145, 255, 0.34);
  color: #9bd7ff;
  font-size: 12px;
  font-weight: 900;
}

.party-panel {
  max-width: min(1180px, 96vw);
}

.party-config {
  display: grid;
  grid-template-columns: minmax(220px, 0.36fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 232, 115, 0.08), transparent 58%),
    rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 232, 115, 0.28);
}

.party-count-control,
.party-name-row {
  display: grid;
  gap: 8px;
  align-content: center;
}

.party-count-control span,
.party-name-row span {
  color: var(--cream);
  font-weight: 1000;
}

.party-count-control b {
  color: var(--mint);
  font-size: 28px;
}

.party-count-control input[type="range"] {
  width: 100%;
  accent-color: var(--mint);
}

.party-name-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.party-name-row[hidden] {
  display: none;
}

.party-name-row input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(126, 241, 169, 0.34);
  background: rgba(3, 12, 10, 0.78);
  color: var(--text);
  font-weight: 1000;
  outline: none;
}

.party-name-row input:focus {
  border-color: rgba(255, 232, 115, 0.76);
  box-shadow: 0 0 0 3px rgba(255, 232, 115, 0.14);
}

.party-rule-grid article {
  min-height: 130px;
}

.party-start-action {
  margin-top: 16px;
}

.party-settlement-summary .duel-scoreline {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.sub-panel h2 {
  margin: 12px 0 6px;
  font-size: clamp(28px, 4vw, 42px);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  font-size: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-row input {
  width: 24px;
  height: 24px;
  accent-color: var(--mint);
}

.volume-row {
  gap: 18px;
}

.volume-row span {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 190px;
}

.volume-row b {
  min-width: 48px;
  color: var(--mint);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.setting-row input[type="range"] {
  appearance: none;
  width: min(360px, 42vw);
  height: 12px;
  border: 1px solid rgba(205, 153, 76, 0.56);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(111, 232, 157, 0.88), rgba(255, 217, 112, 0.86)),
    linear-gradient(180deg, #2d2119, #080f0c);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.42), 0 0 12px rgba(111, 232, 157, 0.12);
  cursor: pointer;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 238, 173, 0.92);
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 255, 255, 0.76), transparent 28%),
    linear-gradient(180deg, #ffe28a, #8d5524);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.34), 0 0 10px rgba(255, 226, 138, 0.42);
}

.setting-row input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 238, 173, 0.92);
  background: linear-gradient(180deg, #ffe28a, #8d5524);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.34);
}

.settings-account-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin: 12px 0 14px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(111, 232, 157, 0.22);
  background: rgba(5, 28, 18, 0.62);
}

.settings-avatar-preview {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 224, 104, 0.78);
  box-shadow: 0 0 20px rgba(255, 196, 62, 0.2);
}

.settings-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-account-card strong,
.settings-account-card span {
  display: block;
}

.settings-account-card strong {
  color: #fff3a7;
  font-size: 22px;
  font-weight: 1000;
}

.settings-account-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.settings-section-title {
  margin: 10px 0 8px;
  color: #ffe873;
  font-size: 18px;
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 14px;
}

.avatar-option {
  position: relative;
  min-height: 0;
  padding: 4px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  aspect-ratio: 1;
  overflow: hidden;
}

.avatar-option img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-option.selected {
  border-color: #ffe873;
  box-shadow: 0 0 0 3px rgba(55, 215, 117, 0.32), 0 0 18px rgba(255, 224, 104, 0.34);
}

.avatar-option.selected::after {
  content: "✓";
  position: absolute;
  right: 2px;
  bottom: 2px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #20d06b;
  color: #062613;
  font-weight: 1000;
  font-size: 14px;
}

.text-button.danger {
  border-color: rgba(255, 102, 102, 0.5);
  color: #ff9d8f;
}

.compendium-grid {
  margin-top: 14px;
  max-height: calc(100dvh - 160px);
  overflow: auto;
}

.compendium-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.compendium-section-title {
  margin: 18px 0 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(255, 211, 63, 0.20), rgba(0, 0, 0, 0.24));
  border: 1px solid rgba(255, 211, 63, 0.32);
  color: #ffe873;
  font-size: 22px;
  font-weight: 1000;
}

.compendium-section-title:first-child {
  margin-top: 0;
}

.card-item {
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.44);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ingredient-card-item {
  position: relative;
  overflow: hidden;
}

.ingredient-card-item.common {
  border-color: rgba(102, 237, 146, 0.24);
}

.ingredient-card-item.uncommon {
  border-color: rgba(92, 188, 255, 0.30);
}

.ingredient-card-item.rare {
  border-color: rgba(255, 220, 92, 0.42);
  box-shadow: inset 0 0 24px rgba(255, 194, 61, 0.08);
}

.compendium-art {
  display: block;
  width: 100%;
  max-width: 156px;
  aspect-ratio: 1;
  margin: 0 auto 10px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 12px 18px rgba(0, 0, 0, 0.28),
    0 0 22px rgba(80, 220, 174, 0.10);
}

.tool-art {
  max-width: 168px;
  padding: 8px;
  object-fit: contain;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 224, 116, 0.18), transparent 54%),
    radial-gradient(circle at 50% 58%, rgba(77, 240, 195, 0.12), transparent 62%),
    linear-gradient(180deg, rgba(18, 47, 34, 0.82), rgba(4, 13, 9, 0.92));
  border-color: rgba(255, 211, 63, 0.28);
  object-position: center;
}

.tool-item {
  border-color: rgba(255, 211, 63, 0.26);
  background:
    linear-gradient(180deg, rgba(255, 211, 63, 0.08), transparent 44%),
    rgba(0, 0, 0, 0.48);
}

.card-item strong {
  display: block;
  font-size: 18px;
}

.card-item p {
  min-height: 42px;
  margin: 7px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.card-item small {
  color: #aef8c8;
  font-weight: 800;
}

.settlement-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.online-settlement-summary {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.settlement-summary > div,
.settlement-rounds > article {
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

.settlement-rounds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.settlement-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.duel-hero,
.duel-scoreline,
.reward-badges,
.duel-stats,
.duel-round-table,
.full-battle-report {
  border: 1px solid rgba(133, 255, 177, 0.26);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 241, 158, 0.08), transparent 48%),
    rgba(2, 14, 11, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 30px rgba(0, 0, 0, 0.24);
}

.duel-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(220px, 0.7fr);
  gap: 12px;
  padding: 16px;
}

.duel-hero.win {
  border-color: rgba(255, 218, 75, 0.44);
}

.duel-hero span,
.duel-title-block span,
.reward-badges span {
  display: block;
  color: rgba(255, 245, 180, 0.72);
  font-weight: 900;
}

.duel-hero h3 {
  margin: 6px 0 8px;
  color: #fff6c7;
  font-size: clamp(24px, 3vw, 38px);
}

.duel-hero p {
  margin: 0;
  color: rgba(239, 255, 244, 0.86);
  line-height: 1.45;
}

.mvp-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-left: 8px;
  padding: 0 10px;
  border-radius: 999px;
  color: #2b1400;
  background: linear-gradient(180deg, #fff39c, #d99b1b);
  box-shadow: 0 0 18px rgba(255, 214, 69, 0.34);
  font-size: 16px;
  vertical-align: middle;
}

.victory-mark {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 34px;
  margin-left: 6px;
  padding: 0 8px;
  border: 1px solid rgba(255, 247, 189, 0.72);
  border-radius: 10px;
  color: #fff7bf;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.48), transparent 26%),
    linear-gradient(145deg, rgba(115, 81, 22, 0.98), rgba(40, 89, 57, 0.94));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 16px rgba(255, 222, 91, 0.28);
  font-size: 14px;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
  vertical-align: middle;
}

.victory-mark.legend,
.duel-title-block.legend {
  border-color: rgba(255, 244, 139, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 26px rgba(255, 222, 91, 0.26);
}

.victory-mark.crown,
.duel-title-block.crown {
  border-color: rgba(255, 197, 68, 0.74);
}

.victory-mark.arcane,
.duel-title-block.arcane {
  border-color: rgba(160, 122, 255, 0.72);
}

.victory-mark.burst,
.duel-title-block.burst {
  border-color: rgba(255, 106, 75, 0.72);
}

.victory-mark.tool,
.duel-title-block.tool {
  border-color: rgba(96, 224, 255, 0.68);
}

.victory-mark.clutch,
.duel-title-block.clutch {
  border-color: rgba(255, 138, 82, 0.72);
}

.victory-mark.balance,
.duel-title-block.balance {
  border-color: rgba(147, 225, 255, 0.70);
}

.victory-mark.verdict,
.duel-title-block.verdict {
  border-color: rgba(255, 125, 125, 0.72);
}

.victory-mark.steady,
.duel-title-block.steady {
  border-color: rgba(125, 255, 174, 0.64);
}

.duel-title-block {
  align-self: stretch;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 218, 75, 0.08);
  text-align: center;
}

.duel-title-block strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #7dffae;
  font-size: clamp(20px, 2.4vw, 30px);
}

.duel-title-block strong i {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 34px;
  padding: 0 7px;
  border-radius: 9px;
  background: rgba(255, 232, 115, 0.14);
  color: #fff2a1;
  font-style: normal;
  font-size: 0.58em;
  box-shadow: inset 0 0 0 1px rgba(255, 231, 129, 0.35);
}

.duel-title-block small {
  display: block;
  max-width: 28em;
  color: rgba(239, 255, 244, 0.74);
  font-weight: 800;
  line-height: 1.35;
}

.duel-scoreline,
.reward-badges,
.duel-stats {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.duel-scoreline {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.duel-scoreline div {
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.duel-scoreline div.winner {
  border: 1px solid rgba(255, 218, 75, 0.42);
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 222, 91, 0.20), transparent 35%),
    rgba(255, 255, 255, 0.08);
}

.duel-scoreline span {
  color: rgba(255, 255, 255, 0.62);
  font-weight: 900;
}

.duel-scoreline strong {
  display: block;
  margin: 4px 0;
  color: #fff6c7;
}

.duel-scoreline b {
  display: block;
  color: #7dffae;
  font-size: clamp(28px, 4vw, 48px);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.42);
}

.reward-badges {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.reward-badges div {
  padding: 12px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 238, 132, 0.18), transparent 34%),
    rgba(255, 255, 255, 0.06);
  text-align: center;
}

.reward-badges strong {
  display: block;
  margin-top: 3px;
  color: #fff6c7;
  font-size: clamp(22px, 2.8vw, 34px);
}

.duel-stats {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.duel-stats div {
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(5, 23, 18, 0.76);
}

.duel-stats strong {
  display: block;
  color: #ffe873;
}

.duel-stats span {
  display: block;
  margin-top: 4px;
  color: rgba(239, 255, 244, 0.78);
  line-height: 1.35;
}

.online-settlement-rounds {
  display: block;
}

.duel-round-table {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.duel-round-row {
  padding: 0;
  overflow: hidden;
}

.duel-round-row h3 {
  margin: 0;
  padding: 10px 12px;
  color: #ffe873;
  background: rgba(255, 255, 255, 0.06);
}

.duel-round-players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  padding: 10px;
}

.duel-round-cell {
  min-height: 126px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(125, 255, 174, 0.20);
  background: rgba(3, 18, 14, 0.82);
}

.duel-round-cell.bust {
  border-color: rgba(255, 82, 72, 0.55);
  background:
    linear-gradient(135deg, rgba(255, 54, 48, 0.18), transparent 54%),
    rgba(20, 6, 5, 0.78);
}

.duel-round-cell.empty {
  opacity: 0.62;
}

.duel-round-cell strong,
.duel-round-cell span,
.duel-round-cell small {
  display: block;
}

.duel-round-cell strong {
  color: #fff6c7;
}

.duel-round-cell b {
  display: inline-block;
  margin: 8px 0 6px;
  color: #7dffae;
  font-size: 26px;
}

.duel-round-cell.bust b {
  color: #ff6b61;
}

.duel-round-cell span {
  color: rgba(255, 255, 255, 0.88);
}

.duel-round-cell small {
  margin-top: 5px;
  color: rgba(239, 255, 244, 0.66);
  line-height: 1.35;
}

.duel-round-cell em {
  display: block;
  margin-top: 7px;
  padding: 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.24);
  color: #ffe873;
  font-style: normal;
  font-size: 12px;
  line-height: 1.35;
}

.score-formula-parts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-top: 8px;
}

.score-formula-parts i {
  display: grid;
  place-items: center;
  min-height: 28px;
  padding: 3px 4px;
  border-radius: 5px;
  background: rgba(125, 255, 174, 0.10);
  color: #fff6c7;
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.full-battle-report {
  margin-top: 12px;
  padding: 12px;
}

.full-battle-report h3 {
  margin: 0 0 10px;
  color: #ffe873;
}

.full-battle-report details {
  margin-top: 8px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.20);
}

.full-battle-report summary {
  cursor: pointer;
  padding: 12px;
  color: #7dffae;
  font-weight: 1000;
}

.report-round {
  margin: 0 10px 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.report-round.bust {
  border: 1px solid rgba(255, 82, 72, 0.45);
}

.report-round p {
  margin: 5px 0;
  color: #fff6c7;
}

.report-round small {
  color: rgba(239, 255, 244, 0.70);
  line-height: 1.42;
}

.taunt-layer {
  position: fixed;
  z-index: 36;
  inset: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
  padding: 32px;
}

.taunt-burst {
  position: relative;
  max-width: min(760px, 82vw);
  transform: rotate(var(--taunt-tilt, 0deg));
  animation: tauntBurst 2.2s ease both;
}

.taunt-burst span {
  position: relative;
  z-index: 1;
  display: block;
  padding: 12px 22px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.25), transparent 42%),
    linear-gradient(135deg, #ffe869, #ff8d21);
  color: #160900;
  border: 3px solid rgba(255, 255, 255, 0.84);
  font-size: clamp(24px, 4.2vw, 54px);
  font-weight: 1000;
  line-height: 1.18;
  text-align: center;
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.42),
    0 5px 0 rgba(0, 0, 0, 0.22),
    0 0 22px rgba(255, 217, 74, 0.58);
  box-shadow:
    0 18px 0 rgba(0, 0, 0, 0.28),
    0 0 34px rgba(255, 209, 54, 0.50);
}

.taunt-burst::before,
.taunt-burst::after,
.taunt-burst i {
  content: "";
  position: absolute;
  pointer-events: none;
}

.taunt-burst::before {
  inset: -15px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 6% 18%, #fff 0 6px, transparent 7px),
    radial-gradient(circle at 92% 28%, #fff 0 5px, transparent 6px),
    radial-gradient(circle at 18% 88%, #ffe869 0 6px, transparent 7px),
    radial-gradient(circle at 82% 82%, #ffe869 0 5px, transparent 6px);
  animation: tauntSpark 0.42s ease-in-out infinite alternate;
}

.taunt-burst::after {
  left: 50%;
  bottom: -23px;
  width: 54px;
  height: 28px;
  transform: translateX(-50%) skewX(-22deg);
  background: inherit;
  border: 3px solid rgba(255, 255, 255, 0.84);
  border-top: 0;
  clip-path: polygon(0 0, 100% 0, 52% 100%);
}

.taunt-burst i:first-of-type,
.taunt-burst i:last-of-type {
  top: 50%;
  width: 72px;
  height: 5px;
  background: currentColor;
  box-shadow: 0 -14px 0 currentColor, 0 14px 0 currentColor;
  opacity: 0.78;
}

.taunt-burst i:first-of-type {
  left: -86px;
}

.taunt-burst i:last-of-type {
  right: -86px;
}

.taunt-burst.success span {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 42%),
    linear-gradient(135deg, #6effb0, #16b66d);
  color: #022313;
  box-shadow: 0 18px 0 rgba(0, 0, 0, 0.26), 0 0 34px rgba(45, 255, 155, 0.46);
}

.taunt-burst.danger span,
.taunt-burst.bust span {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(135deg, #ffef5a, #ff503f);
  color: #260400;
  box-shadow: 0 18px 0 rgba(0, 0, 0, 0.30), 0 0 36px rgba(255, 80, 63, 0.56);
}

.taunt-burst.relief span {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 42%),
    linear-gradient(135deg, #8ae8ff, #147fff);
  color: #00182c;
  box-shadow: 0 18px 0 rgba(0, 0, 0, 0.26), 0 0 34px rgba(55, 166, 255, 0.48);
}

@keyframes tauntBurst {
  0% {
    opacity: 0;
    transform: translateY(34px) scale(0.54) rotate(var(--taunt-tilt, 0deg));
    filter: blur(3px);
  }
  14% {
    opacity: 1;
    transform: translateY(-12px) scale(1.08) rotate(var(--taunt-tilt, 0deg));
    filter: blur(0);
  }
  24%, 72% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(var(--taunt-tilt, 0deg));
  }
  100% {
    opacity: 0;
    transform: translateY(-40px) scale(0.92) rotate(var(--taunt-tilt, 0deg));
  }
}

@keyframes tauntSpark {
  100% {
    transform: scale(1.05) rotate(1deg);
    filter: brightness(1.18);
  }
}

.audio-enable-button {
  position: fixed;
  z-index: 35;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe873, #c77718);
  color: #1c0d00;
  border: 2px solid rgba(255, 247, 186, 0.74);
  font-size: 17px;
  font-weight: 1000;
  box-shadow:
    0 0 24px rgba(255, 211, 63, 0.36),
    0 10px 22px rgba(0, 0, 0, 0.38);
}

.audio-enable-button[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
}

.modal.open { display: grid; }

.modal-card {
  width: min(520px, 92vw);
  padding: 22px;
  border-radius: var(--radius);
  background: #0c3a78;
  border: 2px solid rgba(255, 165, 45, 0.72);
  box-shadow: var(--shadow);
}

.modal-card h3 {
  margin: 0 0 8px;
  color: #ffa51e;
}

.modal-card p {
  color: #ffa51e;
  line-height: 1.55;
}

/* First-pass alchemy art layer: CSS-only until generated UI bitmaps land. */
button {
  position: relative;
  isolation: isolate;
  letter-spacing: 0;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid rgba(255, 232, 128, 0.92);
  outline-offset: 3px;
}

.loading-copy h1,
.sub-panel h2,
.game-header h2,
.feature-card strong {
  font-family: var(--title-font);
  letter-spacing: 0;
  text-shadow:
    0 1px 0 rgba(255, 247, 198, 0.28),
    0 3px 0 rgba(0, 0, 0, 0.48),
    0 0 18px rgba(255, 206, 96, 0.24);
}

.top-bar,
.sub-panel,
.panel,
.ledger,
.round-prompt,
.session-card,
.tool-card,
.history-card,
.commission-card,
.network-console,
.modal-card {
  background:
    linear-gradient(180deg, rgba(255, 238, 180, 0.08), transparent 20%),
    radial-gradient(circle at 12% 0%, rgba(69, 255, 185, 0.10), transparent 34%),
    var(--panel);
  border-color: rgba(201, 160, 86, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(12, 48, 38, 0.52),
    0 14px 34px rgba(0, 0, 0, 0.30);
}

.top-bar::after,
.sub-panel::after,
.panel::after,
.commission-card::after,
.session-card::after,
.tool-card::after,
.history-card::after,
.ledger::after,
.round-prompt::after,
.modal-card::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 229, 142, 0.13);
  border-radius: 6px;
  pointer-events: none;
}

.top-bar,
.panel,
.commission-card,
.session-card,
.tool-card,
.history-card,
.ledger,
.round-prompt,
.modal-card {
  position: relative;
}

.profile-pill,
.top-metric {
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 241, 182, 0.10), transparent 40%),
    rgba(3, 15, 12, 0.52);
  border: 1px solid rgba(197, 155, 78, 0.38);
}

.avatar,
.settings-avatar-preview,
.avatar-option {
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 255, 255, 0.34), transparent 28%),
    conic-gradient(from 25deg, #ffdc78, #6de6a3, #4e88c9, #ffdc78);
  border-color: rgba(255, 231, 154, 0.88);
}

.text-button,
.back-button,
.menu-return-button,
.primary-action,
.bottle-action,
.loading-enter,
.audio-enable-button,
.vent-grid button,
.tool-grid button,
.network-output button,
.icon-button {
  overflow: hidden;
  border: 1px solid var(--ui-metal-edge);
  box-shadow: var(--button-shadow);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.36);
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.text-button::after,
.back-button::after,
.menu-return-button::after,
.primary-action::after,
.bottle-action::after,
.loading-enter::after,
.audio-enable-button::after,
.vent-grid button::after,
.tool-grid button::after,
.network-output button::after,
.icon-button::after,
.feature-card::after,
.ai-level-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 3px;
  border-radius: 5px;
  border: 1px solid rgba(255, 247, 201, 0.17);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.20), transparent 32%),
    radial-gradient(circle at 50% 0%, rgba(255, 250, 202, 0.18), transparent 34%);
  pointer-events: none;
}

.text-button:hover,
.back-button:hover,
.menu-return-button:hover,
.primary-action:hover,
.bottle-action:hover,
.loading-enter:hover,
.audio-enable-button:hover,
.vent-grid button:hover,
.tool-grid button:hover,
.network-output button:hover,
.icon-button:hover,
.feature-card:hover,
.ai-level-card:hover {
  transform: translateY(-2px);
  filter: brightness(1.08) saturate(1.06);
}

.text-button:active,
.back-button:active,
.menu-return-button:active,
.primary-action:active,
.bottle-action:active,
.loading-enter:active,
.audio-enable-button:active,
.vent-grid button:active,
.tool-grid button:active,
.network-output button:active,
.icon-button:active,
.feature-card:active,
.ai-level-card:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.36),
    0 6px 14px rgba(0, 0, 0, 0.28);
}

.primary-action,
.loading-enter,
.audio-enable-button {
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.46), transparent 22%),
    linear-gradient(180deg, #ffe786 0%, #e09f31 45%, #754116 100%);
  color: #241100;
  border-color: rgba(255, 246, 186, 0.82);
  text-shadow: 0 1px 0 rgba(255, 246, 190, 0.36);
}

.primary-action::before,
.loading-enter::before,
.audio-enable-button::before,
.bottle-action::before,
.text-button::before,
.back-button::before,
.menu-return-button::before,
.vent-grid button::before,
.tool-grid button::before {
  display: inline-grid;
  place-items: center;
  width: 1.45em;
  height: 1.45em;
  margin-right: 0.42em;
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 28%, rgba(255, 255, 255, 0.60), transparent 25%),
    linear-gradient(180deg, rgba(255, 236, 145, 0.94), rgba(128, 72, 22, 0.94));
  color: #1c0e06;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 2px 5px rgba(0, 0, 0, 0.34);
  font-size: 0.78em;
  line-height: 1;
  vertical-align: middle;
}

.primary-action::before { content: "+"; }
.primary-action[data-action="start-tutorial"]::before,
.primary-action[data-action="start-solo"]::before,
.primary-action[data-action="solo"]::before { content: "▶"; }
.primary-action[data-action="menu"]::before,
.text-button[data-action="menu"]::before,
.back-button::before,
.menu-return-button::before { content: "‹"; }
.primary-action[data-action^="network"]::before { content: "◇"; }
.primary-action[data-action="close-modal"]::before { content: "!"; }
.primary-action.continue-action::before { content: "…"; }
.audio-enable-button::before { content: "♪"; }

.bottle-action {
  background:
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.42), transparent 24%),
    linear-gradient(180deg, #75ffc0 0%, #1ba966 50%, #064129 100%);
  color: #f3fff7;
  border-color: rgba(161, 255, 199, 0.72);
}

.bottle-action::before { content: "♙"; }

.text-button,
.back-button,
.menu-return-button,
.network-output button {
  background:
    linear-gradient(180deg, rgba(255, 246, 196, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(108, 73, 40, 0.90), rgba(35, 21, 14, 0.94));
  color: #fff0c8;
  border-color: rgba(220, 170, 88, 0.56);
}

.text-button::before { content: "•"; }
.text-button[data-action="records"]::before { content: "≡"; }
.text-button[data-action="server-status"]::before,
.text-button[data-action="network-connect-ws"]::before { content: "⌁"; }
.text-button[data-action="network-login"]::before { content: "↗"; }
.text-button[data-action="network-logout"]::before,
.text-button[data-action="settings-logout"]::before { content: "×"; }
.text-button[data-action*="refresh"]::before { content: "↻"; }
.text-button[data-action*="join"]::before { content: "＋"; }
.text-button[data-action*="leave"]::before { content: "‹"; }

.text-button.danger {
  background:
    linear-gradient(180deg, rgba(255, 221, 180, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(115, 42, 33, 0.94), rgba(42, 16, 12, 0.96));
}

.icon-button {
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.32), transparent 28%),
    conic-gradient(from 30deg, #ffe08a, #9b612b, #372012, #d99a45, #ffe08a);
  color: #fff0b4;
  border-color: rgba(255, 231, 148, 0.82);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
}

.icon-button span {
  position: relative;
  z-index: 1;
}

.feature-card,
.ai-level-card {
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(242, 190, 96, 0.68);
  background:
    linear-gradient(180deg, rgba(255, 252, 220, 0.30), transparent 18%),
    linear-gradient(160deg, #2da86d, #083322 74%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 246, 193, 0.22),
    inset 0 -12px 26px rgba(0, 0, 0, 0.28),
    0 22px 38px rgba(0, 0, 0, 0.40);
}

.feature-card::before,
.ai-level-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  background:
    repeating-linear-gradient(45deg, rgba(255, 230, 137, 0.20) 0 2px, transparent 2px 9px),
    linear-gradient(135deg, rgba(255, 226, 142, 0.42), rgba(36, 18, 8, 0.30));
  pointer-events: none;
}

.feature-card.gold,
.ai-level-card.master {
  background:
    linear-gradient(180deg, rgba(255, 252, 220, 0.34), transparent 20%),
    radial-gradient(circle at 50% 20%, rgba(255, 242, 157, 0.30), transparent 28%),
    linear-gradient(160deg, #f4b646, #8e4818 72%);
}

.feature-card.blue,
.ai-level-card.adept {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), transparent 20%),
    radial-gradient(circle at 50% 18%, rgba(123, 230, 255, 0.24), transparent 28%),
    linear-gradient(160deg, #287fb6, #102f66 74%);
}

.feature-card.violet {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 20%),
    radial-gradient(circle at 50% 20%, rgba(220, 177, 255, 0.26), transparent 30%),
    linear-gradient(160deg, #7a54b6, #321d62 74%);
}

.feature-card.red {
  background:
    linear-gradient(180deg, rgba(255, 246, 220, 0.24), transparent 20%),
    radial-gradient(circle at 50% 20%, rgba(255, 138, 109, 0.24), transparent 30%),
    linear-gradient(160deg, #bd4a48, #6c1824 74%);
}

.feature-card.green,
.ai-level-card.apprentice {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 20%),
    radial-gradient(circle at 50% 20%, rgba(113, 255, 183, 0.24), transparent 30%),
    linear-gradient(160deg, #1ea66a, #093f27 74%);
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 28%, rgba(255, 255, 255, 0.74), transparent 21%),
    radial-gradient(circle at 50% 58%, rgba(96, 255, 186, 0.22), transparent 55%),
    linear-gradient(180deg, #f8d980, #8b5529);
  border: 2px solid rgba(255, 240, 175, 0.84);
  color: #1b0e08;
  font-size: 40px;
  font-weight: 1000;
  box-shadow:
    inset 0 -8px 16px rgba(0, 0, 0, 0.24),
    0 9px 18px rgba(0, 0, 0, 0.34),
    0 0 20px rgba(255, 216, 116, 0.22);
}

.feature-icon::before {
  line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.28));
}

.icon-solo::before { content: "♛"; }
.icon-tutorial::before { content: "✦"; }
.icon-party::before { content: "☷"; }
.icon-online::before { content: "⌁"; }
.icon-compendium::before { content: "⚗"; }

.feature-card small,
.ai-level-card p,
.network-grid p,
.tutorial-intro-grid p,
.tutorial-intro-rule span {
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.36);
}

.vent-grid button,
.tool-grid button {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.17), transparent 32%),
    linear-gradient(180deg, rgba(39, 78, 67, 0.92), rgba(8, 25, 21, 0.96));
  color: #f2fff7;
  border-color: rgba(147, 218, 179, 0.38);
}

.vent-grid button::before,
.tool-grid button::before {
  content: "✦";
  margin-right: 0.28em;
  background:
    radial-gradient(circle at 42% 28%, rgba(255, 255, 255, 0.62), transparent 26%),
    linear-gradient(180deg, #9af8c3, #166642);
}

.vent-grid button[data-risk="heat"] {
  border-color: rgba(255, 116, 82, 0.52);
  background:
    linear-gradient(180deg, rgba(255, 229, 182, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(138, 50, 30, 0.92), rgba(43, 17, 12, 0.96));
}

.vent-grid button[data-risk="heat"]::before { content: "△"; }
.vent-grid button[data-risk="pressure"] {
  border-color: rgba(255, 198, 92, 0.56);
  background:
    linear-gradient(180deg, rgba(255, 238, 182, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(135, 84, 26, 0.92), rgba(44, 25, 10, 0.96));
}
.vent-grid button[data-risk="pressure"]::before { content: "↧"; }
.vent-grid button[data-risk="pollution"] {
  border-color: rgba(94, 240, 147, 0.54);
  background:
    linear-gradient(180deg, rgba(210, 255, 226, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(33, 99, 61, 0.92), rgba(9, 35, 24, 0.96));
}

button.button-flash {
  animation: button-feedback-flash 0.22s ease-out;
}

@keyframes button-feedback-flash {
  0% {
    filter: brightness(1) saturate(1);
    box-shadow: var(--button-shadow);
  }
  45% {
    filter: brightness(1.45) saturate(1.24);
    box-shadow:
      0 0 0 2px rgba(119, 255, 171, 0.72),
      0 0 20px rgba(119, 255, 171, 0.56),
      var(--button-shadow);
  }
  100% {
    filter: brightness(1) saturate(1);
    box-shadow: var(--button-shadow);
  }
}
.vent-grid button[data-risk="pollution"]::before { content: "◌"; }

/* AI-generated art pass: bitmap frames/icons are decorative; labels stay live text. */
.primary-action,
.loading-enter,
.audio-enable-button {
  background:
    var(--ui-button-gold-art) center / 100% 100% no-repeat,
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.46), transparent 22%),
    linear-gradient(180deg, #ffe786 0%, #e09f31 45%, #754116 100%);
  border-color: transparent;
  font-family: var(--title-font);
  font-weight: 1000;
}

.primary-action[data-action="add"],
.primary-action[data-action="network-register"],
.primary-action[data-action="network-create-room"],
.primary-action[data-action="network-ready"] {
  background:
    var(--ui-button-blue-art) center / 100% 100% no-repeat,
    linear-gradient(180deg, #4ec7ff, #0f6ed8);
  color: #f7fdff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.48), 0 0 12px rgba(78, 199, 255, 0.28);
}

.primary-action.continue-action {
  background:
    var(--ui-button-gold-art) center / 100% 100% no-repeat,
    linear-gradient(180deg, #ffe873, #c77718);
}

.bottle-action {
  background:
    var(--ui-button-green-art) center / 100% 100% no-repeat,
    linear-gradient(180deg, #75ffc0 0%, #1ba966 50%, #064129 100%);
  border-color: transparent;
  font-family: var(--title-font);
  font-weight: 1000;
}

.text-button,
.back-button,
.menu-return-button,
.network-output button,
.vent-grid button,
.tool-grid button {
  background:
    var(--ui-button-dark-art) center / 100% 100% no-repeat,
    linear-gradient(180deg, rgba(108, 73, 40, 0.90), rgba(35, 21, 14, 0.94));
  border-color: transparent;
  font-family: var(--title-font);
  font-weight: 1000;
}

.text-button.danger,
.text-button[data-action="settings-logout"],
.text-button[data-action="network-logout"] {
  background:
    var(--ui-button-red-art) center / 100% 100% no-repeat,
    linear-gradient(180deg, #bd4a48, #6c1824);
  color: #fff5e2;
}

.icon-button {
  background:
    var(--ui-button-round-settings-art) center / contain no-repeat,
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.32), transparent 28%);
  border-color: transparent;
  box-shadow: 0 9px 18px rgba(0, 0, 0, 0.34);
}

.icon-button.small {
  background:
    var(--ui-button-round-back-art) center / 100% 100% no-repeat,
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.32), transparent 28%);
}

.back-button {
  background:
    var(--ui-button-dark-art) center / 100% 100% no-repeat,
    linear-gradient(180deg, rgba(108, 73, 40, 0.90), rgba(35, 21, 14, 0.94));
}

.top-bar .icon-button[data-action="settings"] span {
  display: block;
  width: 64%;
  height: 64%;
  color: transparent;
  background: var(--ui-icon-settings-art) center / contain no-repeat;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.feature-icon {
  width: clamp(74px, 8.2vw, 112px);
  height: clamp(74px, 8.2vw, 112px);
  border: 0;
  border-radius: 0;
  background: var(--feature-icon-art) center / contain no-repeat;
  box-shadow: none;
  filter: drop-shadow(0 13px 16px rgba(0, 0, 0, 0.38)) drop-shadow(0 0 12px rgba(255, 218, 94, 0.18));
}

.feature-icon::before {
  content: "";
}

.icon-solo { --feature-icon-art: var(--ui-icon-solo-art); }
.icon-tutorial { --feature-icon-art: var(--ui-icon-tutorial-art); }
.icon-party { --feature-icon-art: var(--ui-icon-party-art); }
.icon-online { --feature-icon-art: var(--ui-icon-online-art); }
.icon-compendium { --feature-icon-art: var(--ui-icon-compendium-art); }

.primary-action::before,
.bottle-action::before,
.text-button::before,
.back-button::before,
.menu-return-button::before,
.vent-grid button::before,
.tool-grid button::before {
  content: "";
  width: 1.55em;
  height: 1.55em;
  background: var(--action-icon-art, var(--ui-icon-cauldron-art)) center / contain no-repeat;
  border-radius: 0;
  box-shadow: none;
  vertical-align: -0.38em;
}

.primary-action[data-action="add"]::before,
.primary-action.continue-action::before { --action-icon-art: var(--ui-icon-chest-art); }
.bottle-action::before { --action-icon-art: var(--ui-icon-compendium-art); }
.vent-grid button[data-risk="heat"]::before { --action-icon-art: var(--ui-icon-vent-heat-art); }
.vent-grid button[data-risk="pressure"]::before { --action-icon-art: var(--ui-icon-vent-pressure-art); }
.vent-grid button[data-risk="pollution"]::before { --action-icon-art: var(--ui-icon-filter-pollution-art); }
.tool-grid button::before { --action-icon-art: var(--ui-icon-cauldron-art); }
.text-button[data-action="server-status"]::before,
.text-button[data-action="network-connect-ws"]::before,
.primary-action[data-action^="network"]::before { --action-icon-art: var(--ui-icon-online-art); }
.text-button[data-action="records"]::before { --action-icon-art: var(--ui-icon-tutorial-art); }

/* Typography tokens: keep ornate lettering for hierarchy, readable body for dense play text. */
.loading-copy h1 {
  font-family: var(--cc-font-display);
  font-size: var(--typo-display-title);
  font-weight: 1000;
  letter-spacing: 0.04em;
  line-height: 1.02;
}

.game-header h1,
.sub-panel h2,
.modal-card h3,
.settlement-card h2,
.screen-title,
.main-menu-title {
  font-family: var(--cc-font-display);
  font-size: var(--typo-screen-title);
  font-weight: 1000;
  letter-spacing: 0.025em;
  line-height: 1.08;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.46), 0 0 16px rgba(255, 210, 92, 0.16);
}

.feature-card strong,
.ai-level-card strong,
.commission-card h3,
.panel-title,
.ledger-title,
.tutorial-card strong,
.round-row strong,
.card-item h3 {
  font-family: var(--cc-font-display);
  font-size: var(--typo-card-title);
  font-weight: 1000;
  letter-spacing: 0.012em;
  line-height: 1.12;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.38);
}

p,
label,
input,
.world-lore,
.setup-lead,
.feature-card small,
.ai-level-card p,
.tutorial-card,
.network-output,
.round-row,
.result-detail {
  font-family: var(--cc-font-body);
  font-size: var(--typo-body);
  line-height: 1.46;
}

small,
.chip,
.status-pill,
.top-metric span,
.profile-pill span,
.commission-card small,
.caption,
.flow-chip,
.settings-note {
  font-family: var(--cc-font-body);
  font-size: var(--typo-caption);
  line-height: 1.25;
  letter-spacing: 0;
}

button,
.primary-action,
.bottle-action,
.text-button,
.back-button,
.menu-return-button,
.loading-enter,
.audio-enable-button,
.vent-grid button,
.tool-grid button {
  font-family: var(--cc-font-display);
  font-size: var(--typo-button);
  font-weight: 1000;
  letter-spacing: 0.025em;
  line-height: 1.05;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.46);
}

.primary-action,
.bottle-action,
.text-button,
.back-button,
.menu-return-button,
.loading-enter,
.audio-enable-button,
.network-output button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42em;
  line-height: 1;
  text-align: center;
}

.primary-action,
.bottle-action,
.loading-enter,
.audio-enable-button {
  display: flex;
}

.vent-grid button,
.tool-grid button {
  display: flex;
  align-items: center;
  justify-content: center;
  align-content: center;
  gap: 3px 5px;
  flex-wrap: wrap;
  text-align: center;
  line-height: 1.08;
}

.primary-action::before,
.loading-enter::before,
.audio-enable-button::before,
.bottle-action::before,
.text-button::before,
.back-button::before,
.menu-return-button::before,
.vent-grid button::before,
.tool-grid button::before {
  flex: 0 0 auto;
  margin-right: 0;
}

.tool-grid button small {
  flex-basis: 100%;
}

.app-shell button:not(:disabled) {
  color: #70f7a2;
}

.app-shell button:disabled {
  color: #ff5f65;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.58), 0 0 10px rgba(255, 95, 101, 0.32);
}

.app-shell button:not(:disabled)::before,
.app-shell button:not(:disabled) small {
  color: #a9ffd0;
}

.app-shell button:disabled::before,
.app-shell button:disabled small {
  color: #ff777b;
}

.score-value,
.metric-value,
.settlement-score,
.top-metric strong,
.potion-stats strong,
.result-score,
.round-score {
  font-family: var(--cc-font-number);
  font-size: var(--typo-score-number);
  font-weight: 1000;
  letter-spacing: 0.035em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.42), 0 0 16px rgba(255, 217, 91, 0.20);
}

.risk-card strong,
.risk-card .risk-value,
.meter-value,
.vent-grid span,
.round-risk {
  font-family: var(--cc-font-number);
  font-size: var(--typo-risk-number);
  font-weight: 1000;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.risk-card.critical strong,
.risk-card.is-critical strong,
.meter-value.critical {
  color: #ff5f4b;
  text-shadow: 0 0 9px rgba(255, 74, 43, 0.72), 0 2px 0 rgba(0, 0, 0, 0.58);
}

.settlement-card h1,
.settlement-title,
.result-title,
.challenge-title {
  font-family: var(--cc-font-display);
  font-size: var(--typo-result-title);
  font-weight: 1000;
  letter-spacing: 0.035em;
  line-height: 1.08;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.50), 0 0 22px rgba(255, 216, 91, 0.26);
}

.tool-grid button small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 238, 173, 0.82);
}

.setting-row {
  padding: 0 8px;
  color: #fff1c7;
  font-weight: 900;
}

.setting-row input {
  appearance: none;
  position: relative;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, #2d2119, #080f0c);
  border: 1px solid rgba(205, 153, 76, 0.56);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.46);
}

.setting-row input::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 255, 255, 0.68), transparent 28%),
    linear-gradient(180deg, #ffe28a, #8d5524);
  transition: transform 0.18s ease;
}

.setting-row input:checked {
  background:
    linear-gradient(180deg, rgba(140, 255, 187, 0.20), transparent 42%),
    linear-gradient(180deg, #176945, #09241a);
}

.setting-row input:checked::before {
  transform: translateX(24px);
}

.setting-row input[type="range"]::before {
  content: none;
}

.setting-row input[type="range"] {
  position: static;
  width: min(360px, 42vw);
  height: 12px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(111, 232, 157, 0.88), rgba(255, 217, 112, 0.86)),
    linear-gradient(180deg, #2d2119, #080f0c);
}

.card-item,
.network-grid article,
.tutorial-intro-grid article,
.tutorial-intro-rule,
.settlement-summary > div,
.settlement-rounds > article,
.network-actions section,
.network-room-list,
.network-player-list,
.network-leaderboard-list,
.network-current-room,
.network-match-state {
  background:
    linear-gradient(180deg, rgba(255, 246, 196, 0.08), transparent 42%),
    rgba(5, 16, 13, 0.70);
  border-color: rgba(196, 151, 76, 0.30);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.modal {
  background:
    radial-gradient(circle at 50% 42%, rgba(50, 232, 145, 0.16), transparent 32%),
    rgba(0, 0, 0, 0.72);
}

.modal-card {
  background:
    linear-gradient(180deg, rgba(255, 226, 142, 0.12), transparent 28%),
    linear-gradient(160deg, rgba(20, 68, 58, 0.96), rgba(10, 23, 31, 0.98));
}

.modal-card h3 {
  color: #ffe08a;
  font-size: 28px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.42);
}

.modal-card p {
  color: rgba(245, 255, 248, 0.88);
}

.settlement-actions .primary-action,
.settlement-actions .text-button {
  width: auto;
  min-width: 168px;
}

.app-shell.compact .top-metric { display: none; }

@media (orientation: portrait) {
  .game-screen::after {
    content: "请横屏游玩";
    position: fixed;
    z-index: 30;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.88);
    font-size: 34px;
    font-weight: 1000;
    color: #fff;
  }

  .main-menu-grid {
    grid-template-columns: 1fr;
    height: auto;
    margin: 20px 0 80px;
    overflow: auto;
  }

  .feature-card {
    min-height: 120px;
  }

  .ai-level-grid,
  .tutorial-intro-grid,
  .network-grid,
  .network-lobby-grid,
  .network-actions,
  .network-toolbar {
    grid-template-columns: 1fr;
  }

  .top-bar {
    grid-template-columns: 1fr 56px;
  }

  .top-metric { display: none; }
  .settings-account-card {
    grid-template-columns: 60px 1fr;
  }
  .settings-account-card .text-button {
    grid-column: 1 / -1;
  }
  .avatar-picker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 980px), (max-height: 520px) {
  .game-board {
    grid-template-columns: minmax(236px, 0.9fr) minmax(260px, 1fr) minmax(220px, 0.9fr);
    gap: 7px;
  }

  .left-panel,
  .right-panel {
    padding: 7px;
    gap: 6px;
  }

  .commission-card,
  .session-card,
  .tool-card,
  .history-card,
  .ledger,
  .round-prompt {
    padding: 8px;
  }

  .game-header h2 {
    font-size: 18px;
    line-height: 1;
    white-space: nowrap;
  }

  .game-header p {
    font-size: 12px;
    line-height: 1.25;
  }

  .game-header-actions {
    gap: 5px;
  }

  .menu-return-button {
    min-height: 34px;
    padding: 0 8px;
    font-size: 13px;
  }

  .commission-card h3 {
    font-size: 18px;
  }

  .meters {
    order: -1;
    gap: 5px;
  }

  .meters {
    min-height: 94px;
  }

  .meter {
    padding: 6px 5px 5px;
    border-radius: 7px;
  }

  .meter::before {
    inset: 4px;
  }

  .meter::after {
    top: 27px;
  }

  .meter label {
    font-size: 12px;
    line-height: 1;
  }

  .meter label button {
    width: 17px;
    height: 17px;
    font-size: 11px;
  }

  .thermo,
  .vial {
    width: 30px;
    height: 48px;
    border-width: 3px;
  }

  .thermo::after,
  .vial::after {
    left: 6px;
    top: 6px;
    height: 32px;
  }

  .thermo span,
  .vial span {
    left: 3px;
    right: 3px;
  }

  .gauge {
    width: 54px;
    height: 38px;
  }

  .gauge::before {
    inset: 9px 9px 0;
  }

  .gauge span {
    bottom: 6px;
    height: 30px;
    width: 4px;
  }

  .gauge span::after {
    width: 11px;
    height: 11px;
    bottom: -5px;
  }

  .meter strong {
    font-size: 13px;
    line-height: 1.1;
  }

  .score-strip strong {
    font-size: 20px;
  }

  .primary-action,
  .bottle-action {
    min-height: 44px;
    font-size: 18px;
  }

  .vent-grid button,
  .tool-grid button {
    min-height: 46px;
    font-size: 12px;
  }

  .main-menu-grid {
    gap: 10px;
  }

  .feature-card {
    min-height: 150px;
  }

  .feature-icon {
    font-size: 42px;
    margin-bottom: 12px;
  }

  .online-settlement-summary {
    gap: 8px;
  }

  .duel-hero {
    grid-template-columns: minmax(0, 1fr) minmax(170px, 0.55fr);
    gap: 8px;
    padding: 10px;
  }

  .duel-hero h3 {
    margin: 3px 0 5px;
    font-size: clamp(22px, 4vw, 30px);
  }

  .duel-title-block {
    padding: 8px;
  }

  .duel-title-block strong {
    font-size: clamp(18px, 3vw, 24px);
  }

  .duel-scoreline,
  .reward-badges,
  .duel-stats,
  .duel-round-table {
    gap: 8px;
    padding: 8px;
  }

  .duel-scoreline {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .duel-scoreline div,
  .reward-badges div,
  .duel-stats div {
    padding: 8px;
  }

  .duel-scoreline b {
    font-size: clamp(28px, 5vw, 38px);
  }

  .reward-badges {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
  }

  .reward-badges strong {
    font-size: clamp(20px, 3.2vw, 28px);
  }

  .duel-round-players {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 6px;
    padding: 8px;
  }

  .duel-round-cell {
    min-height: 112px;
    padding: 8px;
  }

  .duel-round-cell b {
    margin: 5px 0 4px;
    font-size: 22px;
  }

  .duel-round-cell em {
    padding: 6px;
    font-size: 11px;
  }

  .full-battle-report {
    padding: 8px;
  }

  .settlement-actions {
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 4;
    padding-top: 8px;
    background: linear-gradient(180deg, transparent, rgba(2, 12, 9, 0.9) 42%);
  }

  .settlement-card h1,
  .result-title {
    font-size: clamp(26px, 5vw, 38px);
    margin-bottom: 8px;
  }

  .settlement-summary {
    margin: 8px 0;
  }

  .score-formula-parts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .volume-row {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 10px 8px;
  }

  .volume-row span {
    width: 100%;
    justify-content: space-between;
  }

  .setting-row input[type="range"] {
    width: 100%;
  }

  .duel-hero,
  .duel-scoreline,
  .reward-badges,
  .duel-stats {
    grid-template-columns: 1fr;
  }

  .duel-round-players {
    grid-template-columns: 1fr;
  }

  .duel-scoreline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reward-badges {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
