:root {
  color-scheme: dark;
  --ink: #080b0c;
  --surface: #101517;
  --surface-2: #171d1f;
  --surface-3: #20282a;
  --line: #415156;
  --line-soft: #293438;
  --text: #edf5f2;
  --muted: #93a5a6;
  --lime: #b2da68;
  --orange: #e7a969;
  --cyan: #66c0e8;
  --pink: #db769b;
  --gold: #e6c76f;
  --danger: #ef6670;
  --card-size: 64px;
  --radius: 6px;
  font-family: "Microsoft YaHei UI", "Noto Sans SC", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--ink);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--text);
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
}

.eyebrow {
  color: var(--lime);
  font-family: Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}

.icon-button:hover:not(:disabled) {
  border-color: var(--cyan);
  background: var(--surface-2);
  color: var(--text);
}

.command-button,
.small-button,
.icon-command {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.command-button:hover:not(:disabled),
.small-button:hover:not(:disabled),
.icon-command:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--gold);
  background: var(--surface-3);
}

.command-button:active:not(:disabled),
.small-button:active:not(:disabled),
.icon-command:active:not(:disabled) {
  transform: translateY(0);
}

.command-button:disabled,
.small-button:disabled {
  border-color: #293033;
  background: #111517;
  color: #596568;
}

.command-button--primary,
.small-button.accent {
  border-color: #6c8950;
  background: #26331f;
  color: #e8f8c8;
}

.command-button--primary:hover:not(:disabled),
.small-button.accent:hover:not(:disabled) {
  border-color: var(--lime);
  background: #304326;
}

.small-button.warning {
  border-color: #a86d38;
  background: #3a2819;
  color: #ffe3c2;
}

.small-button.warning:hover:not(:disabled) {
  border-color: var(--orange);
  background: #4a301c;
}

.command-button--network {
  border-color: #497f96;
  background: #172c35;
  color: #d9f3ff;
}

.menu-shell,
.tutorial-shell,
.lobby-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background-color: #090c0d;
  background-image: url("./assets/background.png");
  background-position: center;
  background-size: cover;
}

.menu-shell::before,
.tutorial-shell::before,
.lobby-shell::before {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 8, 0.82);
  content: "";
}

.menu-topbar,
.simple-topbar {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 66px;
  padding: 14px clamp(18px, 4vw, 56px);
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(102, 192, 232, 0.28);
  background: rgba(8, 11, 12, 0.78);
}

.menu-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.simple-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.system-mark {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 12px;
}

.system-mark span {
  width: 6px;
  height: 6px;
  background: var(--line);
}

.system-mark span:first-child {
  background: var(--lime);
}

.system-mark b {
  margin-left: 8px;
  font-weight: 400;
}

.menu-stage {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(980px, calc(100% - 36px));
  min-height: calc(100vh - 132px);
  min-height: calc(100dvh - 132px);
  margin: 0 auto;
  padding: 7vh 0 42px;
  align-content: center;
  gap: 38px;
}

.title-block h1 {
  max-width: 900px;
  margin: 8px 0 10px;
  color: var(--text);
  font-family: Consolas, "Microsoft YaHei UI", monospace;
  font-size: clamp(42px, 8vh, 78px);
  font-weight: 500;
  line-height: 1;
}

.title-block p {
  margin: 0;
  color: #b8c7c7;
  font-size: 17px;
}

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

.mode-option {
  position: relative;
  display: grid;
  min-height: 150px;
  padding: 20px;
  align-content: start;
  gap: 10px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(15, 20, 22, 0.92);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.mode-option::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--line);
  content: "";
}

.mode-option:nth-child(1)::after { background: var(--lime); }
.mode-option:nth-child(2)::after { background: var(--orange); }
.mode-option:nth-child(3)::after { background: var(--pink); }

.mode-option:hover,
.mode-option.is-selected {
  border-color: var(--gold);
  background: rgba(27, 34, 36, 0.96);
  color: var(--text);
}

.mode-option.is-selected {
  box-shadow: inset 0 0 0 1px rgba(230, 199, 111, 0.3);
}

.mode-option strong {
  color: var(--text);
  font-size: 20px;
}

.mode-option > span:not(.mode-check) {
  min-height: 42px;
  font-size: 13px;
  line-height: 1.65;
}

.mode-option small {
  color: var(--gold);
  font-family: Consolas, monospace;
  font-size: 11px;
}

.mode-check {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--lime);
}

.mode-check svg {
  width: 14px;
  height: 14px;
}

.menu-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) 100px;
  gap: 10px;
}

.menu-actions .command-button,
.menu-actions .icon-command {
  height: 54px;
}

.icon-command {
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.menu-footer {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 66px;
  padding: 0 clamp(18px, 4vw, 56px);
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  color: #6f8082;
  font-family: Consolas, monospace;
  font-size: 11px;
}

.simple-topbar {
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 12px;
}

.tutorial-stage {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(980px, calc(100% - 36px));
  min-height: calc(100vh - 150px);
  min-height: calc(100dvh - 150px);
  margin: 0 auto;
  padding: 7vh 0 120px;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  align-items: center;
  gap: 64px;
}

.tutorial-copy h2,
.lobby-heading h2,
.modal-panel h2,
.gameover-panel h2 {
  margin: 10px 0 16px;
  font-family: Consolas, "Microsoft YaHei UI", monospace;
  font-size: 36px;
  font-weight: 500;
}

.tutorial-copy p,
.lobby-heading p,
.modal-panel p {
  margin: 0;
  color: #b2c1c1;
  font-size: 16px;
  line-height: 1.9;
}

.tutorial-ability-descriptions {
  display: grid;
  gap: 9px;
}

.tutorial-ability-descriptions > div {
  display: grid;
  min-width: 0;
  padding: 8px 0;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.tutorial-ability-descriptions b {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid currentColor;
  font: 18px/1 Consolas, monospace;
}

.tutorial-ability-descriptions span {
  color: #b2c1c1;
  font-size: 14px;
  line-height: 1.65;
}

.tutorial-ability-descriptions > div:nth-child(1) b { color: var(--lime); }
.tutorial-ability-descriptions > div:nth-child(2) b { color: var(--orange); }
.tutorial-ability-descriptions > div:nth-child(3) b { color: var(--cyan); }
.tutorial-ability-descriptions > div:nth-child(4) b { color: var(--pink); }

.tutorial-visual,
.tutorial-flow,
.tutorial-skills,
.tutorial-declare {
  display: flex;
  min-height: 260px;
  align-items: center;
  justify-content: center;
  gap: 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(12, 16, 18, 0.82);
}

.tutorial-visual--hands > div:nth-child(2) {
  transform: translateY(-24px);
}

.mini-card {
  display: inline-block;
  width: 64px;
  height: 64px;
  background-image: url("./assets/cards.png");
  image-rendering: auto;
}

.tutorial-pending {
  padding: 12px;
  border: 1px solid var(--pink);
}

.tutorial-flow > svg {
  width: 30px;
  height: 30px;
  color: var(--gold);
}

.tutorial-skill {
  padding: 16px 20px;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: Consolas, monospace;
  font-size: 26px;
}

.tutorial-skills b {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--line);
  font-family: Consolas, monospace;
  font-size: 24px;
}

.tutorial-skills b:nth-child(1) { border-color: var(--lime); color: var(--lime); }
.tutorial-skills b:nth-child(2) { border-color: var(--orange); color: var(--orange); }
.tutorial-skills b:nth-child(3) { border-color: var(--cyan); color: var(--cyan); }
.tutorial-skills b:nth-child(4) { border-color: var(--pink); color: var(--pink); }

.tutorial-declare {
  flex-direction: column;
  color: var(--lime);
  font-family: Consolas, monospace;
}

.tutorial-declare svg {
  width: 68px;
  height: 68px;
}

.tutorial-controls {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  height: 84px;
  padding: 0 clamp(18px, 4vw, 56px);
  align-items: center;
  justify-content: center;
  gap: 24px;
  border-top: 1px solid var(--line-soft);
  background: rgba(8, 11, 12, 0.94);
}

.tutorial-dots {
  display: flex;
  gap: 8px;
}

.tutorial-dots span {
  width: 18px;
  height: 3px;
  background: var(--line);
}

.tutorial-dots span.active {
  background: var(--lime);
}

.command-button.compact {
  min-width: 170px;
  padding: 0 18px;
}

.lobby-stage {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100% - 36px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

.lobby-heading {
  max-width: 680px;
  margin-bottom: 24px;
}

.lobby-heading p {
  font-size: 14px;
}

.status-dot,
.connection-badge,
.network-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 11px;
}

.status-dot::before,
.connection-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #596568;
  content: "";
}

.status-dot.online::before,
.connection-badge.connected i {
  background: var(--lime);
  box-shadow: 0 0 10px rgba(178, 218, 104, 0.7);
}

.switch-line {
  display: inline-flex;
  margin-bottom: 30px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.switch-line input {
  position: absolute;
  opacity: 0;
}

.switch-line > span {
  position: relative;
  width: 38px;
  height: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.switch-line > span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  background: var(--muted);
  content: "";
  transition: transform 140ms ease, background 140ms ease;
}

.switch-line input:checked + span::after {
  transform: translateX(18px);
  background: var(--lime);
}

.lobby-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.lobby-role {
  display: grid;
  min-height: 190px;
  padding: 24px;
  align-content: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 21, 23, 0.94);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.lobby-role:hover {
  border-color: var(--cyan);
  color: var(--text);
}

.lobby-role svg {
  width: 30px;
  height: 30px;
  color: var(--cyan);
}

.lobby-role strong {
  color: var(--text);
  font-size: 22px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.room-access {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(340px, 1.1fr);
  gap: 14px;
}

.room-code-panel,
.room-waiting,
.room-join-form {
  padding: 22px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(14, 19, 21, 0.95);
}

.room-code-panel p,
.room-waiting p {
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.room-code-value {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--lime);
  font: 700 30px/1.2 Consolas, monospace;
  letter-spacing: 0;
  outline: 0;
}

.room-code-value--loading {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 18px;
}

.room-copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.room-seat-list {
  display: grid;
  gap: 10px;
}

.room-seat-state {
  display: grid;
  grid-template-columns: 1fr auto;
  min-height: 102px;
  padding: 16px;
  align-items: start;
  border: 1px solid var(--line-soft);
  border-left: 3px solid #596568;
  background: rgba(8, 12, 13, 0.82);
}

.room-seat-state.is-connected {
  border-left-color: var(--lime);
}

.room-seat-state span,
.seat-label {
  color: var(--muted);
  font: 11px/1.4 Consolas, monospace;
}

.room-seat-state strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
}

.room-seat-state p {
  grid-column: 1 / -1;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.room-join-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 190px;
  gap: 10px;
  align-items: end;
}

.room-join-form label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.room-code-input {
  width: 100%;
  height: 56px;
  padding: 0 14px;
  border: 1px solid #576a70;
  border-radius: 3px;
  background: #080c0d;
  color: var(--text);
  font: 700 23px/1 Consolas, monospace;
  letter-spacing: 0;
  text-transform: uppercase;
  outline: none;
}

.room-code-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(100, 190, 218, 0.14);
}

.room-waiting {
  display: grid;
  min-height: 250px;
  place-items: center;
  align-content: center;
  text-align: center;
}

.room-waiting h3 {
  margin: 12px 0 0;
  font-size: 22px;
}

.waiting-symbol {
  display: grid;
  width: 58px;
  height: 58px;
  margin-top: 18px;
  place-items: center;
  border: 1px solid var(--cyan);
  color: var(--cyan);
}

.waiting-symbol svg {
  width: 25px;
  height: 25px;
}

.waiting-symbol [data-lucide="loader-circle"] {
  animation: rotate 1.2s linear infinite;
}

.advanced-link {
  margin-top: 26px;
  border-top: 1px solid var(--line-soft);
}

.advanced-link summary {
  display: inline-flex;
  padding: 14px 0;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  list-style: none;
}

.advanced-link summary::-webkit-details-marker {
  display: none;
}

.advanced-link summary svg {
  width: 15px;
  height: 15px;
}

.advanced-link[open] summary {
  color: var(--cyan);
}

.host-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.link-slot,
.guest-link {
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(14, 19, 21, 0.95);
}

.link-slot header {
  display: flex;
  margin-bottom: 14px;
  align-items: center;
  justify-content: space-between;
}

.link-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.small-button {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.code-field {
  width: 100%;
  height: 64px;
  margin: 10px 0;
  padding: 10px;
  resize: vertical;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: #080c0d;
  color: #9db2b4;
  font: 11px/1.45 Consolas, monospace;
  overflow-wrap: anywhere;
}

.code-field--input {
  border-color: #576a70;
}

.code-field--large {
  height: 110px;
}

.field-label {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.lobby-start {
  width: 240px;
  margin-top: 24px;
}

.lobby-status,
.waiting-line {
  margin-top: 16px;
  color: var(--cyan);
  font-family: Consolas, monospace;
  font-size: 12px;
}

.waiting-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.waiting-line svg,
.active-signal svg {
  animation: rotate 1.2s linear infinite;
}

/* Game table */
.game-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-rows: auto 1fr auto;
  background: #090c0d;
}

.game-topbar {
  display: grid;
  min-height: 70px;
  padding: 10px 20px;
  grid-template-columns: minmax(150px, 0.7fr) minmax(320px, 1.6fr) minmax(150px, 0.7fr);
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #0c1011;
}

.brand-compact {
  display: flex;
  flex-direction: column;
  font-family: Consolas, monospace;
}

.brand-compact b {
  font-size: 17px;
  font-weight: 500;
}

.brand-compact span {
  color: var(--gold);
  font-size: 10px;
}

.phase-readout {
  min-width: 0;
  padding-left: 18px;
  border-left: 3px solid var(--lime);
}

.phase-readout strong,
.phase-readout span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-readout strong {
  font-size: 17px;
}

.phase-readout span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.network-pill {
  height: 32px;
  padding: 0 10px;
  border: 1px solid #38677a;
  color: var(--cyan);
}

.network-pill svg {
  width: 14px;
  height: 14px;
}

.network-pill.is-reconnecting {
  border-color: #805a38;
  color: var(--orange);
}

.network-pill.is-reconnecting svg {
  animation: rotate 1.1s linear infinite;
}

.network-pill.is-syncing svg {
  animation: spin 0.8s linear infinite;
}

.turn-timer,
.probe-vote-timer {
  display: inline-flex;
  min-width: 72px;
  height: 34px;
  padding: 0 9px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid #55752f;
  background: #11190f;
  color: var(--lime);
  font-family: Consolas, monospace;
}

.turn-timer b,
.probe-vote-timer b {
  min-width: 20px;
  font-size: 17px;
  text-align: right;
}

.turn-timer small,
.probe-vote-timer small {
  color: var(--muted);
  font-size: 8px;
}

.turn-timer.is-urgent,
.probe-vote-timer.is-urgent {
  border-color: var(--danger);
  background: #251113;
  color: #ff8a91;
  animation: timer-pulse 700ms ease-in-out infinite alternate;
}

.game-workspace {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(720px, 1fr) 238px;
}

.board {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 650px;
  padding: 16px 22px;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  overflow: hidden;
  background-color: #0b0e0f;
  background-image: url("./assets/background.png");
  background-position: center;
  background-size: cover;
}

.board::before {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 10, 0.76);
  content: "";
}

.board > *:not(.effect-layer) {
  position: relative;
  z-index: 1;
}

.opponents-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.opponent-panel,
.own-panel,
.stream-panel {
  border: 1px solid var(--line-soft);
  background: rgba(12, 16, 18, 0.94);
}

.opponent-panel.is-active,
.own-panel.is-active {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(230, 199, 111, 0.22);
}

.opponent-panel > header,
.own-panel > header,
.stream-panel > header {
  display: flex;
  min-height: 31px;
  padding: 0 10px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  color: var(--lime);
  font-family: Consolas, monospace;
  font-size: 12px;
}

.opponent-panel > header span,
.own-panel > header span,
.stream-panel > header small {
  color: #718184;
  font-size: 9px;
  font-weight: 400;
}

.opponent-body {
  position: relative;
  display: grid;
  min-height: 90px;
  padding: 10px;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
}

.hand-row,
.own-hand,
.draw-stream {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.blueprint-counts {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  grid-column: 1;
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 12px;
}

.blueprint-counts span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.swatch {
  width: 8px;
  height: 8px;
}

.swatch--lime { background: var(--lime); }
.swatch--orange { background: var(--orange); }
.swatch--cyan { background: var(--cyan); }

.mini-pending {
  display: grid;
  min-height: 72px;
  padding: 4px;
  grid-column: 2;
  grid-row: 1 / span 2;
  place-items: center;
  border: 1px solid #6f4d5b;
  color: var(--pink);
  font: 9px Consolas, monospace;
}

.mini-pending > i {
  width: 34px;
  height: 34px;
  border: 1px dashed #3c4447;
}

.central-zone {
  display: grid;
  min-height: 254px;
  grid-template-columns: minmax(520px, 760px) 88px;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.stream-panel {
  width: min(100%, 760px);
}

.draw-stream {
  min-height: 94px;
  padding: 12px;
}

.ability-cost-guidance {
  display: grid;
  min-height: 48px;
  padding: 7px 12px;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #76502f;
  background: #21170f;
  color: var(--orange);
  animation: cost-guidance-pulse 1.8s ease-in-out infinite;
}

.ability-cost-guidance > svg {
  width: 24px;
  height: 24px;
}

.ability-cost-guidance > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.ability-cost-guidance b {
  font: 11px Consolas, monospace;
}

.ability-cost-guidance span {
  color: #f1d2b3;
  font-size: 13px;
  line-height: 1.35;
}

.board.is-awaiting-cost .own-hand .card.is-clickable,
.board.is-awaiting-cost .player-pending .card.is-clickable {
  border-color: var(--orange);
  animation: cost-target-pulse 1.8s ease-in-out infinite;
}

.draw-gap {
  width: var(--card-size);
  height: var(--card-size);
  border: 1px dashed #30393c;
}

.skill-bus {
  display: grid;
  padding: 8px 10px 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  border-top: 1px solid var(--line-soft);
}

.skill-control {
  position: relative;
  display: block;
  min-width: 0;
}

.skill-button {
  position: relative;
  display: grid;
  width: 100%;
  height: 44px;
  min-width: 0;
  padding: 0 7px 0 31px;
  align-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #111719;
  color: var(--text);
  cursor: pointer;
}

.skill-button::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: currentColor;
  content: "";
}

.skill-button b {
  position: absolute;
  top: 10px;
  left: 9px;
  font: 18px Consolas, monospace;
}

.skill-button span {
  display: block;
  overflow: hidden;
  color: #e9f2ef;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-lime { color: var(--lime); }
.skill-orange { color: var(--orange); }
.skill-cyan { color: var(--cyan); }
.skill-pink { color: var(--pink); }

.skill-button:hover:not(:disabled) {
  border-color: currentColor;
  background: #1c272a;
}

.skill-button:disabled {
  border-color: #30393c;
  background: #0e1213;
  color: #536063;
}

.skill-button:disabled span {
  color: #596568;
}

.skill-button.is-used {
  border-color: currentColor;
  background: #182124;
}

.skill-button.is-used span {
  color: currentColor;
}

.skill-tooltip {
  display: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 761px) {
  .skill-tooltip {
    position: absolute;
    z-index: 12;
    bottom: calc(100% + 11px);
    left: 50%;
    display: grid;
    width: min(270px, 36vw);
    min-height: 108px;
    padding: 12px 14px 13px 16px;
    align-content: start;
    gap: 5px;
    border: 1px solid currentColor;
    border-left-width: 3px;
    border-radius: 3px;
    background: #0c1214;
    box-shadow: 8px 10px 0 rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(255, 255, 255, 0.035);
    color: var(--cyan);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 7px);
    transition: opacity 130ms ease, transform 130ms ease;
  }

  .skill-tooltip::after {
    position: absolute;
    bottom: -6px;
    left: calc(50% - 5px);
    width: 10px;
    height: 10px;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    background: #0c1214;
    content: "";
    transform: rotate(45deg);
  }

  .skill-tooltip > b {
    color: currentColor;
    font: 10px/1.2 Consolas, monospace;
  }

  .skill-tooltip > strong {
    color: #edf5f2;
    font-size: 15px;
  }

  .skill-tooltip > span {
    color: #aebbbc;
    font-size: 12px;
    line-height: 1.55;
  }

  .skill-tooltip--lime { color: var(--lime); }
  .skill-tooltip--orange { color: var(--orange); }
  .skill-tooltip--cyan { color: var(--cyan); }
  .skill-tooltip--pink { color: var(--pink); }

  .skill-control:hover .skill-tooltip,
  .skill-control:focus-within .skill-tooltip {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.pending-column {
  display: grid;
  width: 84px;
  min-height: 104px;
  padding: 7px;
  place-items: center;
  border: 1px solid #725365;
  background: rgba(18, 13, 16, 0.9);
  color: var(--pink);
  font: 10px Consolas, monospace;
}

.pending-column.has-card {
  border-color: var(--pink);
}

.pending-column[data-drop-zone="pending"] {
  transition: border-color 140ms ease, background 140ms ease;
}

.pending-column[data-drop-zone="pending"]:hover {
  border-color: var(--gold);
  background: rgba(37, 27, 29, 0.95);
}

.pending-empty {
  display: grid;
  width: var(--card-size);
  height: var(--card-size);
  place-items: center;
  border: 1px dashed #4b3e43;
  color: #594b50;
}

.own-panel {
  display: grid;
  min-height: 126px;
  grid-template-columns: 1fr 128px;
}

.own-panel > header {
  grid-column: 1 / -1;
}

.own-hand {
  min-height: 90px;
  padding: 10px 18px;
  gap: 24px;
}

.unknown-blueprint {
  display: grid;
  margin: 10px;
  place-content: center;
  border-left: 1px solid var(--line-soft);
  color: var(--muted);
  font-family: Consolas, monospace;
  text-align: center;
}

.unknown-blueprint span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
}

.unknown-blueprint strong {
  margin-top: 4px;
  color: var(--cyan);
  font-size: 16px;
}

.card-slot {
  position: relative;
  width: var(--card-size);
  height: var(--card-size);
  padding: 0;
  border: 1px solid #313a3d;
  border-radius: 3px;
  background: rgba(8, 11, 12, 0.72);
}

.card-slot::before,
.card-slot::after {
  position: absolute;
  width: 9px;
  height: 9px;
  border-color: #526064;
  content: "";
}

.card-slot::before {
  top: 5px;
  left: 5px;
  border-top: 1px solid;
  border-left: 1px solid;
}

.card-slot::after {
  right: 5px;
  bottom: 5px;
  border-right: 1px solid;
  border-bottom: 1px solid;
}

.card-slot span {
  color: #3e494c;
  font: 10px Consolas, monospace;
}

.card {
  position: relative;
  display: inline-block;
  width: var(--card-size);
  height: var(--card-size);
  flex: 0 0 var(--card-size);
  padding: 0;
  border: 0;
  border-radius: 2px;
  background-color: #171d1f;
  background-image: url("./assets/cards.png");
  background-repeat: no-repeat;
  background-size: 192px 128px;
  box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.5);
  image-rendering: auto;
}

.card--hidden { background-position: 0 0; }
.card--pending { background-position: -64px 0; }
.card--core { background-position: -128px 0; }
.card--data { background-position: 0 -64px; }
.card--port { background-position: -64px -64px; }
.card--empty { background-image: none; }

.card--verified-good { --verification-color: #9eea66; }
.card--verified-bad { --verification-color: #ff5d68; }

.card--verified-good::before,
.card--verified-bad::before {
  position: absolute;
  z-index: 2;
  inset: -5px;
  border: 1px solid var(--verification-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--verification-color) 72%, transparent), inset 0 0 7px color-mix(in srgb, var(--verification-color) 22%, transparent);
  clip-path: polygon(0 8px, 8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px));
  pointer-events: none;
  content: "";
}

.card--verified-good::after,
.card--verified-bad::after {
  position: absolute;
  z-index: 2;
  inset: -2px 8px;
  border-top: 2px solid var(--verification-color);
  border-bottom: 2px solid var(--verification-color);
  filter: drop-shadow(0 0 3px var(--verification-color));
  pointer-events: none;
  content: "";
}

.card--compact {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  background-size: 126px 84px;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.45);
}

.card--compact.card--pending { background-position: -42px 0; }
.card--compact.card--core { background-position: -84px 0; }
.card--compact.card--data { background-position: 0 -42px; }
.card--compact.card--port { background-position: -42px -42px; }

.card--compact.card--verified-good::before,
.card--compact.card--verified-bad::before {
  inset: -3px;
}

button.card {
  cursor: pointer;
  transition: transform 130ms ease, filter 130ms ease, box-shadow 130ms ease;
}

button.card:hover,
button.card:focus-visible {
  z-index: 2;
  transform: translateY(-5px);
  filter: brightness(1.12);
  box-shadow: 4px 10px 0 rgba(0, 0, 0, 0.42), 0 0 0 2px var(--gold);
}

button.card.is-dragging {
  opacity: 0.55;
  transform: scale(0.96);
}

.activity-rail {
  display: grid;
  height: calc(100vh - 136px);
  height: calc(100dvh - 136px);
  min-width: 0;
  min-height: 0;
  max-height: calc(100vh - 136px);
  max-height: calc(100dvh - 136px);
  padding: 14px;
  grid-template-rows: auto auto minmax(0, 1fr);
  border-left: 1px solid var(--line);
  background: #0e1315;
  overflow: hidden;
}

.activity-rail > header {
  display: flex;
  height: 30px;
  align-items: center;
  justify-content: space-between;
  color: var(--cyan);
  font: 11px Consolas, monospace;
}

.activity-rail > header i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 10px rgba(178, 218, 104, 0.65);
}

.activity-rail > header div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-rail > header small {
  color: #617174;
  font-size: 9px;
}

.active-signal {
  display: grid;
  min-height: 76px;
  margin: 8px 0 14px;
  padding: 12px;
  align-content: center;
  gap: 8px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: #11181a;
}

.active-signal b {
  font-size: 13px;
  line-height: 1.55;
}

.active-signal span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--orange);
  font-size: 11px;
}

.activity-rail ol {
  display: grid;
  min-height: 0;
  margin: 0;
  padding: 0 7px 0 0;
  align-content: start;
  gap: 5px;
  list-style: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--cyan) #151c1e;
  scrollbar-width: thin;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}

.activity-rail ol.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.activity-rail ol::-webkit-scrollbar {
  width: 6px;
}

.activity-rail ol::-webkit-scrollbar-track {
  background: #151c1e;
}

.activity-rail ol::-webkit-scrollbar-thumb {
  background: #4b8da3;
}

.activity-rail li {
  display: grid;
  padding: 8px 0 8px 9px;
  border-left: 2px solid var(--line-soft);
  gap: 3px;
}

.activity-rail li time {
  color: #617174;
  font: 9px Consolas, monospace;
}

.activity-rail li span {
  color: #a9b8b8;
  font-size: 11px;
  line-height: 1.45;
}

.activity-rail li.log-skill { border-color: var(--cyan); }
.activity-rail li.log-win { border-color: var(--lime); }
.activity-rail li.log-failure { border-color: var(--danger); }
.activity-rail li.log-round { border-color: var(--gold); }

.action-dock {
  display: grid;
  min-height: 66px;
  padding: 10px 16px;
  grid-template-columns: minmax(190px, 0.8fr) minmax(190px, 1fr) minmax(190px, 0.8fr);
  gap: 10px;
  border-top: 1px solid var(--line);
  background: #0b0f10;
}

.declare-button {
  border-color: #845268;
  background: #2c1d24;
  color: #ffd9e8;
}

.skip-button {
  border-color: #8d6545;
  background: #312319;
  color: #f6d1ae;
}

.next-button {
  border-color: #4e816e;
  background: #1c3028;
  color: #d9fff0;
}

.cost-status {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-soft);
  color: #667579;
  font-size: 13px;
}

.cost-status.paid {
  border-color: #527a68;
  color: var(--lime);
}

/* Effects */
.fx-region {
  position: fixed;
  z-index: 45;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.fx-card {
  position: fixed;
  display: block;
  background-image: url("./assets/cards.png");
  background-repeat: no-repeat;
  border: 1px solid rgba(216, 228, 220, 0.32);
  border-radius: 2px;
  box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.46);
  transform-origin: center;
  will-change: transform, opacity, filter;
}

.fx-region .center-notice {
  position: fixed;
}

.phase-banner {
  position: fixed;
  top: 50%;
  right: 0;
  left: 0;
  min-height: 104px;
  overflow: hidden;
  transform: translateY(-50%);
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  background: rgba(7, 12, 13, 0.96);
  color: var(--cyan);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
  animation: phase-banner-in 2.1s cubic-bezier(.2,.72,.24,1) both;
}

.phase-banner::before {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: currentColor;
  box-shadow: 0 0 18px currentColor;
  content: "";
  animation: phase-banner-scan 1.4s ease-out both;
}

.phase-banner-inner {
  display: grid;
  width: min(760px, calc(100% - 48px));
  min-height: 102px;
  margin: 0 auto;
  align-content: center;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.phase-banner-inner span {
  color: currentColor;
  font: 10px Consolas, monospace;
}

.phase-banner-inner strong {
  color: #eff7f3;
  font-size: 22px;
}

.phase-banner-inner small {
  color: #93a8a6;
  font-size: 12px;
}

.phase-banner-cyan { color: var(--cyan); }
.phase-banner-lime { color: var(--lime); }

.effect-layer {
  position: absolute;
  z-index: 5;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.center-notice {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(620px, calc(100% - 48px));
  padding: 13px 18px;
  transform: translate(-50%, -50%);
  border: 1px solid currentColor;
  background: rgba(8, 12, 13, 0.96);
  color: var(--cyan);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  animation: notice-in 1.9s ease both;
}

.notice-lime { color: var(--lime); }
.notice-orange { color: var(--orange); }
.notice-cyan { color: var(--cyan); }
.notice-pink { color: var(--pink); }

.remote-skill-notice {
  position: fixed;
  z-index: 18;
  top: 84px;
  right: 18px;
  display: grid;
  width: min(310px, calc(100vw - 36px));
  min-height: 76px;
  padding: 11px 13px;
  align-content: center;
  gap: 7px;
  border: 1px solid #6b4e59;
  border-right: 3px solid var(--pink);
  border-radius: 3px;
  background: rgba(18, 12, 15, 0.97);
  box-shadow: -8px 10px 0 rgba(0, 0, 0, 0.34);
  color: var(--pink);
  animation: remote-skill-in 2.2s ease both;
}

.remote-skill-notice > b {
  color: currentColor;
  font: 9px Consolas, monospace;
}

.remote-skill-notice > div {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.remote-skill-notice strong {
  color: currentColor;
  font: 21px/1 Consolas, monospace;
}

.remote-skill-notice p {
  display: grid;
  margin: 0;
  gap: 5px;
}

.remote-skill-notice p span {
  color: #d8e3df;
  font-size: 13px;
}

.remote-skill-notice p small {
  color: currentColor;
  font-size: 12px;
  line-height: 1.4;
}

.remote-skill-a { color: var(--lime); border-color: #52693a; background: rgba(13, 18, 12, 0.97); }
.remote-skill-b { color: var(--orange); border-color: #704f35; background: rgba(20, 14, 10, 0.97); }
.remote-skill-c { color: var(--cyan); border-color: #355f70; background: rgba(9, 16, 19, 0.97); }

.effect-ghost {
  position: absolute;
  width: 64px;
  height: 64px;
  background-image: url("./assets/cards.png");
  background-size: 192px 128px;
}

.effect-card--hidden { background-position: 0 0; }
.effect-card--core { background-position: -128px 0; }
.effect-card--data { background-position: 0 -64px; }
.effect-card--port { background-position: -64px -64px; }

.dissolve-ghost {
  bottom: 80px;
  left: 50%;
  animation: dissolve 1s ease-out both;
}

.swap-ghost {
  top: 18%;
}

.swap-a {
  left: 22%;
  animation: swap-a 1.4s ease-in-out both;
}

.swap-b {
  right: 22%;
  animation: swap-b 1.4s ease-in-out both;
}

.scan-flash,
.feedback-flash {
  position: absolute;
  inset: 10% 8%;
  border: 3px solid var(--cyan);
  animation: scan-flash 0.75s ease-out both;
}

.feedback-flash.good { border-color: var(--lime); }
.feedback-flash.bad { border-color: var(--danger); }

/* Modals and toast */
.modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(3, 5, 6, 0.82);
}

.modal-panel,
.gameover-panel {
  position: relative;
  width: min(580px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111719;
  box-shadow: 12px 14px 0 rgba(0, 0, 0, 0.35);
}

.consent-panel {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 18px;
}

.unused-skill-backdrop {
  z-index: 60;
}

.probe-vote-backdrop {
  z-index: 55;
  background: rgba(3, 5, 6, 0.9);
}

.probe-vote-panel {
  width: min(720px, 100%);
  max-height: calc(100dvh - 32px);
  padding: 24px;
  overflow: auto;
  border: 1px solid #55752f;
  border-radius: 4px;
  background: #0e1415;
  box-shadow: 12px 14px 0 rgba(0, 0, 0, 0.38), inset 0 2px 0 rgba(178, 218, 104, 0.16);
}

.probe-vote-panel > header,
.probe-vote-panel > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.probe-vote-panel h2 {
  margin: 5px 0 0;
  font-size: 24px;
}

.probe-vote-panel > p {
  max-width: 620px;
  margin: 14px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.probe-candidates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.probe-candidate {
  position: relative;
  display: grid;
  min-height: 106px;
  padding: 13px;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #11191b;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.probe-candidate:hover:not(:disabled) {
  border-color: var(--cyan);
  transform: translateY(-2px);
}

.probe-candidate.is-selected {
  border-color: var(--lime);
  background: #172015;
  box-shadow: inset 3px 0 0 var(--lime);
}

.probe-candidate:disabled {
  cursor: default;
  opacity: 0.72;
}

.probe-candidate.is-selected:disabled { opacity: 1; }

.probe-kind {
  width: max-content;
  padding: 2px 6px;
  border: 1px solid #476274;
  color: var(--cyan);
  font: 10px Consolas, monospace;
}

.probe-candidate strong {
  padding-right: 48px;
  font-size: 15px;
  line-height: 1.45;
}

.probe-live-votes {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 4px;
}

.probe-live-votes i,
.probe-voter-status span {
  display: inline-flex;
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font: normal 10px Consolas, monospace;
}

.probe-live-votes i.is-confirmed,
.probe-voter-status span.is-confirmed {
  border-color: var(--lime);
  color: var(--lime);
}

.probe-vote-panel > footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.probe-voter-status {
  display: flex;
  gap: 6px;
}

.probe-voter-status span {
  min-width: 52px;
  gap: 5px;
  border-color: var(--line);
  color: var(--muted);
}

.probe-voter-status span.has-choice {
  border-color: var(--cyan);
  color: var(--cyan);
}

.probe-voter-status svg {
  width: 13px;
  height: 13px;
}

.language-backdrop {
  z-index: 70;
}

.language-panel {
  width: min(540px, 100%);
}

.language-panel > p {
  max-width: 440px;
}

.language-options {
  display: grid;
  margin-top: 24px;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.language-option {
  position: relative;
  display: grid;
  min-height: 86px;
  padding: 14px 42px 14px 16px;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #0d1214;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.language-option:hover,
.language-option.is-selected {
  border-color: var(--cyan);
  background: #132027;
}

.language-option b {
  font: 18px Consolas, "Microsoft YaHei UI", monospace;
}

.language-option span {
  color: var(--muted);
  font-size: 12px;
}

.language-option svg {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 18px;
  height: 18px;
  color: var(--cyan);
  transform: translateY(-50%);
}

.unused-skill-panel {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 18px;
}

.unused-skill-panel .modal-icon {
  border-color: var(--orange);
  color: var(--orange);
}

.unused-skill-panel .modal-actions {
  grid-column: 1 / -1;
}

.modal-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--lime);
  color: var(--lime);
}

.modal-icon svg {
  width: 26px;
  height: 26px;
}

.modal-panel h2 {
  font-size: 26px;
}

.modal-panel p {
  font-size: 14px;
}

.modal-actions {
  display: flex;
  margin-top: 22px;
  justify-content: flex-end;
  gap: 9px;
}

.consent-panel .modal-actions {
  grid-column: 1 / -1;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.privacy-status {
  display: flex;
  margin: 20px 0;
  padding: 12px 0;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
}

.privacy-status strong {
  color: var(--danger);
}

.privacy-status strong.enabled {
  color: var(--lime);
}

.gameover-panel {
  text-align: center;
}

.victory-scan {
  display: grid;
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  place-items: center;
  border: 1px solid var(--lime);
  color: var(--lime);
  animation: victory-pulse 1.6s ease-in-out infinite;
}

.victory-scan svg {
  width: 48px;
  height: 48px;
}

.gameover-panel p {
  color: var(--muted);
}

.gameover-panel .modal-actions {
  justify-content: center;
}

.toast-region {
  position: fixed;
  z-index: 60;
  top: 84px;
  right: 18px;
  display: grid;
  width: min(340px, calc(100% - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  background: #111719;
  color: var(--text);
  font-size: 13px;
  box-shadow: 8px 9px 0 rgba(0, 0, 0, 0.25);
  animation: toast-in 2.6s ease both;
}

.toast-error { border-left-color: var(--danger); }
.toast-success { border-left-color: var(--lime); }

@keyframes rotate { to { transform: rotate(360deg); } }
@keyframes timer-pulse { to { filter: brightness(1.35); } }
@keyframes notice-in {
  0% { opacity: 0; transform: translate(-50%, -45%) scale(0.97); }
  12%, 78% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -53%) scale(1); }
}
@keyframes remote-skill-in {
  0% { opacity: 0; transform: translateX(22px); }
  12%, 78% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(12px); }
}
@keyframes cost-guidance-pulse {
  0%, 100% { border-color: #76502f; box-shadow: inset 3px 0 0 rgba(232, 161, 91, 0.45); }
  50% { border-color: var(--orange); box-shadow: inset 3px 0 0 var(--orange); }
}
@keyframes cost-target-pulse {
  0%, 100% { box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(232, 161, 91, 0.35); }
  50% { box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(232, 161, 91, 0.82); }
}
@keyframes phase-banner-in {
  0% { opacity: 0; transform: translateY(-50%) scaleY(0.08); }
  13% { opacity: 1; transform: translateY(-50%) scaleY(1); }
  76% { opacity: 1; transform: translateY(-50%) scaleY(1); }
  100% { opacity: 0; transform: translateY(-50%) scaleY(0.2); }
}
@keyframes phase-banner-scan {
  0% { left: 0; opacity: 0; }
  12% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}
@keyframes dissolve {
  0% { opacity: 1; filter: saturate(1); transform: translate(-50%, 0) scale(1); }
  55% { opacity: 0.7; filter: saturate(1.8) brightness(1.35); }
  100% { opacity: 0; filter: blur(8px) saturate(0); transform: translate(-50%, -34px) scale(0.72, 1.18); }
}
@keyframes swap-a {
  0% { transform: translate(0, 0) rotate(0); }
  48% { transform: translate(240px, 110px) rotate(8deg); }
  100% { transform: translate(470px, 0) rotate(0); }
}
@keyframes swap-b {
  0% { transform: translate(0, 0) rotate(0); }
  48% { transform: translate(-240px, -40px) rotate(-8deg); }
  100% { transform: translate(-470px, 0) rotate(0); }
}
@keyframes scan-flash {
  0% { opacity: 0; transform: scale(0.96); }
  30% { opacity: 0.9; }
  100% { opacity: 0; transform: scale(1.03); }
}
@keyframes victory-pulse {
  50% { box-shadow: 0 0 28px rgba(178, 218, 104, 0.28); }
}
@keyframes toast-in {
  0% { opacity: 0; transform: translateX(16px); }
  8%, 82% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(8px); }
}

@keyframes essential-feedback-reduced {
  0%, 100% { opacity: 0; }
  10%, 84% { opacity: 1; }
}

@media (max-width: 1050px) {
  .game-workspace {
    grid-template-columns: 1fr;
  }

  .activity-rail {
    height: 280px;
    max-height: 280px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .game-topbar {
    grid-template-columns: 150px 1fr 120px;
  }
}

@media (max-width: 760px) {
  :root { --card-size: 54px; }

  .menu-stage {
    padding-top: 34px;
    align-content: start;
    gap: 24px;
  }

  .title-block h1 {
    font-size: 44px;
  }

  .mode-selector,
  .lobby-choice,
  .host-slots,
  .room-access {
    grid-template-columns: 1fr;
  }

  .room-join-form {
    grid-template-columns: 1fr;
  }

  .mode-option {
    min-height: 118px;
  }

  .menu-actions {
    grid-template-columns: 1fr 1fr 74px;
  }

  .tutorial-stage {
    padding-top: 34px;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 28px;
  }

  .tutorial-copy h2,
  .lobby-heading h2 {
    font-size: 28px;
  }

  .tutorial-visual,
  .tutorial-flow,
  .tutorial-skills,
  .tutorial-declare {
    min-height: 190px;
  }

  .game-topbar {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .brand-compact {
    display: none;
  }

  .phase-readout {
    padding-left: 10px;
  }

  .phase-readout strong { font-size: 14px; }
  .phase-readout span { font-size: 10px; }
  .network-pill { display: none; }
  .turn-timer { min-width: 62px; padding: 0 6px; }

  .probe-vote-backdrop { padding: 10px; }
  .probe-vote-panel { padding: 16px; }
  .probe-vote-panel h2 { font-size: 19px; }
  .probe-vote-panel > header { align-items: flex-start; }
  .probe-candidates { grid-template-columns: 1fr; }
  .probe-candidate { min-height: 82px; }
  .probe-vote-panel > footer { align-items: stretch; flex-direction: column; }
  .probe-vote-panel > footer .small-button { width: 100%; }

  .board {
    min-height: 690px;
    padding: 10px;
    gap: 10px;
  }

  .opponents-row {
    gap: 8px;
  }

  .opponent-panel > header {
    padding: 0 6px;
    font-size: 9px;
  }

  .opponent-body {
    min-height: 78px;
    padding: 7px 4px;
    grid-template-columns: 1fr;
  }

  .opponent-body .hand-row {
    gap: 2px;
  }

  .opponent-panel .card {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    background-size: 126px 84px;
    box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.45);
  }

  .opponent-panel .card--pending { background-position: -42px 0; }
  .opponent-panel .card--core { background-position: -84px 0; }
  .opponent-panel .card--data { background-position: 0 -42px; }
  .opponent-panel .card--port { background-position: -42px -42px; }
  .blueprint-counts { grid-column: 1; font-size: 10px; }
  .mini-pending { display: none; }

  .central-zone {
    min-height: 244px;
    grid-template-columns: minmax(0, 1fr) 68px;
    gap: 7px;
  }

  .draw-stream {
    min-height: 78px;
    padding: 8px 3px;
    gap: 3px;
  }

  .ability-cost-guidance {
    min-height: 44px;
    padding: 6px 8px;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 7px;
  }

  .ability-cost-guidance > svg {
    width: 20px;
    height: 20px;
  }

  .ability-cost-guidance span {
    font-size: 11px;
  }

  .draw-stream .card,
  .draw-gap {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .draw-stream .card {
    background-size: 138px 92px;
  }

  .pending-column {
    width: 66px;
    min-height: 94px;
    padding: 4px;
  }

  .pending-column .card {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
    background-size: 150px 100px;
  }

  .pending-column .pending-empty {
    width: 50px;
    height: 50px;
  }

  .pending-column .card--pending { background-position: -50px 0; }
  .pending-column .card--core { background-position: -100px 0; }
  .pending-column .card--data { background-position: 0 -50px; }
  .pending-column .card--port { background-position: -50px -50px; }

  .skill-bus {
    padding: 6px;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  .skill-button {
    height: 39px;
  }

  .skill-button span {
    font-size: 16px;
  }

  .skill-button b {
    top: 9px;
    font-size: 16px;
  }

  .own-panel {
    grid-template-columns: 1fr;
  }

  .own-hand {
    min-height: 76px;
    padding: 8px 4px;
    gap: 12px;
  }

  .unknown-blueprint {
    display: none;
  }

  .action-dock {
    min-height: 60px;
    padding: 8px;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 5px;
  }

  .action-dock .command-button,
  .cost-status {
    min-width: 0;
    min-height: 42px;
    padding: 0 7px;
    font-size: 11px;
  }

  .action-dock .command-button svg,
  .cost-status svg {
    display: none;
  }

  .center-notice {
    font-size: 14px;
  }
}

@media (max-width: 470px) {
  .menu-topbar,
  .simple-topbar {
    padding: 10px 14px;
  }

  .system-mark b,
  .menu-footer span:last-child {
    display: none;
  }

  .menu-actions {
    grid-template-columns: 1fr;
  }

  .menu-actions .icon-command {
    height: 44px;
    flex-direction: row;
    gap: 8px;
  }

  .opponents-row {
    grid-template-columns: 1fr 1fr;
  }

  .opponent-panel .card {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    background-size: 114px 76px;
  }

  .opponent-panel .card--pending { background-position: -38px 0; }
  .opponent-panel .card--core { background-position: -76px 0; }
  .opponent-panel .card--data { background-position: 0 -38px; }
  .opponent-panel .card--port { background-position: -38px -38px; }

  .board {
    min-height: 640px;
  }

  .own-hand { gap: 5px; }

  .consent-panel {
    grid-template-columns: 1fr;
  }

  .consent-panel .modal-actions {
    grid-column: 1;
  }

  .modal-actions {
    flex-direction: column;
  }
}

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

  .phase-banner,
  .center-notice,
  .remote-skill-notice,
  .toast {
    animation-name: essential-feedback-reduced !important;
    animation-duration: 2.1s !important;
    animation-iteration-count: 1 !important;
  }

  .remote-skill-notice { animation-duration: 3.4s !important; }
  .toast { animation-duration: 2.6s !important; }
}
