:root {
  color-scheme: dark;
  font-family: 'Segoe UI Variable', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  background: #090d11;
  color: #edf2ee;
  --bg: #090d11;
  --panel-top: #151e23;
  --panel-bottom: #10171c;
  --panel-elev: #1b262c;
  --recessed: #0b1115;
  --line: rgba(132, 170, 165, 0.16);
  --line-strong: rgba(154, 198, 189, 0.28);
  --text: #edf2ee;
  --muted: #98a9a8;
  --faint: #6c7f81;
  --gold: #f2bc74;
  --gold-bright: #ffd9a1;
  --gold-deep: #c9863f;
  --mint: #74ebc2;
  --mint-bright: #b1fae0;
  --cyan: #6bd7eb;
  --danger: #f59280;
  --mono: 'Cascadia Code', 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 300px;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 68% 46% at 18% -12%, rgba(44, 128, 114, 0.22) 0%, transparent 66%),
    radial-gradient(ellipse 52% 40% at 86% -14%, rgba(226, 158, 84, 0.13) 0%, transparent 62%),
    radial-gradient(circle at 50% 110%, rgba(28, 62, 70, 0.22) 0%, transparent 58%),
    linear-gradient(180deg, #0b1015 0%, #090d11 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image: radial-gradient(rgba(165, 212, 198, 0.055) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.12) 60%, transparent 100%);
}

button, time, progress, output { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, #map:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }

/* Shell & Topbar */
.shell {
  width: min(100%, 1600px);
  padding: 0 24px 18px;
  margin: 0 auto;
}

.topbar {
  position: relative;
  min-height: 66px;
  padding-block: 9px;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(242, 188, 116, 0.28) 0%, rgba(116, 235, 194, 0.18) 38%, rgba(132, 170, 165, 0.12) 78%, transparent 100%);
}

.brand, .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand { gap: 14px; }

.brand-mark {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #3c2f21 0%, #241d17 62%, #191613 100%);
  border: 1px solid rgba(242, 188, 116, 0.42);
  border-radius: 13px;
  box-shadow:
    0 6px 18px rgba(4, 7, 10, 0.58),
    0 0 22px rgba(242, 188, 116, 0.14),
    inset 0 1px 0 rgba(255, 226, 178, 0.24);
}

.brand-mark canvas { width: 32px; height: 32px; }

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand h1 {
  font-size: 22px;
  line-height: 1.15;
  font-weight: 760;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, #fffaf0 0%, #dce4df 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #849a99;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.round-clock {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  color: #e6e4cf;
  background: linear-gradient(180deg, rgba(22, 32, 37, 0.92), rgba(13, 20, 24, 0.95));
  border: 1px solid rgba(154, 198, 189, 0.22);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 12px rgba(3, 6, 9, 0.36);
}

.round-clock time {
  font: 650 15.5px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.round-clock canvas { width: 18px; height: 18px; }

.round-clock.warn {
  color: #ffd09b;
  border-color: rgba(245, 146, 128, 0.55);
  background: linear-gradient(180deg, rgba(58, 30, 26, 0.92), rgba(35, 19, 18, 0.95));
  box-shadow: 0 0 18px rgba(245, 146, 128, 0.22), inset 0 1px 0 rgba(255, 208, 155, 0.18);
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid rgba(138, 174, 170, 0.22);
  border-radius: 10px;
  padding: 0 14px;
  background: linear-gradient(180deg, #222e34 0%, #192227 100%);
  color: #eaf0ec;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(224, 246, 238, 0.07), 0 2px 8px rgba(3, 6, 9, 0.3);
  transition: transform 0.14s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.button:hover:not(:disabled) {
  background: linear-gradient(180deg, #2b3a41 0%, #202c32 100%);
  border-color: rgba(164, 208, 199, 0.42);
  box-shadow: inset 0 1px 0 rgba(235, 255, 248, 0.12), 0 4px 14px rgba(3, 6, 9, 0.42);
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button.subtle {
  background: linear-gradient(180deg, rgba(28, 38, 43, 0.88) 0%, rgba(19, 27, 31, 0.94) 100%);
}

.button.primary {
  background: linear-gradient(180deg, #f8cc89 0%, #e49f50 100%);
  border-color: rgba(255, 224, 173, 0.72);
  color: #1f140b;
  font-weight: 750;
  letter-spacing: 0.02em;
  box-shadow:
    0 6px 20px rgba(228, 159, 80, 0.28),
    0 2px 6px rgba(4, 7, 10, 0.48),
    inset 0 1px 0 rgba(255, 246, 226, 0.65);
}

.button.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffd89b 0%, #eda95b 100%);
  border-color: #ffe7bf;
  box-shadow:
    0 8px 24px rgba(242, 188, 116, 0.38),
    0 3px 8px rgba(4, 7, 10, 0.5),
    inset 0 1px 0 rgba(255, 250, 236, 0.78);
}

.button.primary:disabled {
  background: linear-gradient(180deg, #222b30 0%, #1a2125 100%);
  border-color: rgba(132, 160, 160, 0.16);
  color: #7c8d8f;
  box-shadow: none;
  transform: none;
}

.icon-button {
  font-family: system-ui, sans-serif;
  width: 38px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.sound-toggle .sound-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-toggle .speaker-body {
  fill: currentColor;
  fill-opacity: 0.22;
}

.sound-toggle .sound-wave {
  stroke: var(--mint);
}

.sound-toggle .sound-mute-x {
  display: none;
  stroke: var(--danger);
}

.sound-toggle.muted {
  color: var(--muted);
}

.sound-toggle.muted .sound-wave {
  display: none;
}

.sound-toggle.muted .sound-mute-x {
  display: block;
}

.question {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(154, 198, 189, 0.45);
  border-radius: 50%;
  color: var(--mint);
  font-size: 11px;
  font-weight: 700;
}

/* Account Strip */
.connection-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8e9c9a;
  flex: none;
}

.online .connection-dot {
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(116, 235, 194, 0.18), 0 0 10px rgba(116, 235, 194, 0.75);
}

.connecting .connection-dot {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 188, 116, 0.2);
}

.account-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 12px;
  padding: 6px 13px;
  color: #d6e7de;
  background: linear-gradient(90deg, rgba(22, 46, 42, 0.75) 0%, rgba(17, 29, 32, 0.85) 55%, rgba(19, 27, 32, 0.9) 100%);
  border: 1px solid rgba(116, 235, 194, 0.24);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(177, 250, 224, 0.08), 0 6px 18px rgba(4, 7, 10, 0.34);
  font-size: 13px;
}

.account-strip > span {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  min-width: 0;
  overflow-wrap: anywhere;
}

#accountLabel {
  color: #f0f8f3;
  font-weight: 650;
  letter-spacing: 0.02em;
}

#connectionText {
  color: #9ec8b9;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(11, 20, 22, 0.56);
  border: 1px solid rgba(116, 235, 194, 0.16);
}

.account-strip .button {
  min-height: 30px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 8px;
  flex: none;
}

/* Main Layout & Panels */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(304px, 344px);
  gap: 16px;
  margin-top: 12px;
  height: clamp(640px, calc(100dvh - 100px), 890px);
}

.multiplayer .layout {
  margin-top: 0;
  height: clamp(640px, calc(100dvh - 144px), 870px);
}

.panel {
  position: relative;
  min-width: 0;
  background: linear-gradient(180deg, var(--panel-top) 0%, var(--panel-bottom) 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow:
    0 14px 36px rgba(3, 6, 10, 0.52),
    0 2px 8px rgba(3, 6, 10, 0.36),
    inset 0 1px 0 rgba(215, 244, 236, 0.075);
}

/* Map Panel */
.map-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.map-header {
  min-height: 64px;
  padding: 11px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(27, 38, 44, 0.55) 0%, rgba(16, 23, 28, 0.25) 100%);
}

.map-header h2 {
  font-size: 19px;
  font-weight: 720;
  letter-spacing: 0.03em;
  line-height: 1.2;
  color: #f3f7f4;
}

.map-header p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  line-height: 1.3;
}

.map-return canvas { width: 16px; height: 16px; }

.viewport {
  position: relative;
  flex: 1;
  min-height: 360px;
  isolation: isolate;
  overflow: hidden;
  border-block: 1px solid rgba(132, 174, 168, 0.14);
  background: #091014;
}

.viewport::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 42px rgba(3, 7, 10, 0.62);
}

#map {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  touch-action: none;
  cursor: grab;
  outline-offset: -4px;
}

#map:focus-visible { outline-offset: -4px; }
#map.dragging { cursor: grabbing; }
#map.clickable { cursor: pointer; }
#map.targetable { cursor: crosshair; }

.coord {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  display: flex;
  gap: 7px;
  align-items: center;
  pointer-events: none;
  background: rgba(11, 18, 22, 0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(134, 182, 174, 0.24);
  border-radius: 9px;
  padding: 6px 10px;
  color: #b7cbc7;
  font: 600 12px/1 var(--mono);
  box-shadow: 0 4px 14px rgba(3, 6, 9, 0.45), inset 0 1px 0 rgba(215, 245, 236, 0.08);
}

.coord-cross {
  color: var(--mint);
  font: 14px/1 system-ui, sans-serif;
  text-shadow: 0 0 8px rgba(116, 235, 194, 0.5);
}

.compass {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 40px;
  padding: 6px 0 7px;
  text-align: center;
  color: #a9c2be;
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
  background: rgba(11, 18, 22, 0.72);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(134, 182, 174, 0.22);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(3, 6, 9, 0.42);
}

.compass i {
  width: 14px;
  height: 22px;
  display: block;
  margin: 4px auto 0;
  background: linear-gradient(110deg, #b8f2de 48%, #47605c 50%);
  clip-path: polygon(50% 0, 100% 100%, 50% 74%, 0 100%);
  filter: drop-shadow(0 0 4px rgba(116, 235, 194, 0.25));
}

.map-tools {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  background: rgba(11, 18, 22, 0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(134, 182, 174, 0.24);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(3, 6, 9, 0.5);
}

.map-tools .button {
  width: 34px;
  min-height: 34px;
  border-radius: 8px;
  color: #dce9e3;
  background: rgba(28, 41, 46, 0.75);
  border-color: rgba(134, 182, 174, 0.16);
  box-shadow: none;
}

.map-tools .button:hover:not(:disabled) {
  background: rgba(42, 62, 68, 0.92);
  border-color: rgba(116, 235, 194, 0.42);
  color: var(--mint-bright);
  transform: none;
}

.branch-button {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 2;
  max-width: calc(100% - 88px);
  overflow: hidden;
  text-overflow: ellipsis;
  color: #d6fff0;
  background: linear-gradient(180deg, rgba(28, 74, 65, 0.94) 0%, rgba(19, 52, 47, 0.96) 100%);
  border-color: rgba(116, 235, 194, 0.52);
  box-shadow: 0 6px 20px rgba(4, 10, 12, 0.55), 0 0 18px rgba(116, 235, 194, 0.22);
}

.branch-button:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(35, 92, 80, 0.98) 0%, rgba(23, 64, 57, 0.98) 100%);
  border-color: var(--mint);
}

.map-notice {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 170px);
  width: max-content;
  padding: 9px 16px;
  border-radius: 10px;
  background: rgba(14, 22, 26, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(154, 198, 189, 0.34);
  box-shadow: 0 10px 28px rgba(3, 6, 10, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #edf3ee;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
}

.map-notice.good {
  border-color: rgba(116, 235, 194, 0.52);
  background: rgba(14, 34, 31, 0.92);
  color: #c7fae5;
  box-shadow: 0 10px 28px rgba(3, 6, 10, 0.6), 0 0 20px rgba(116, 235, 194, 0.14);
}

.map-notice.risk {
  border-color: rgba(245, 146, 128, 0.58);
  background: rgba(42, 20, 19, 0.92);
  color: #ffd8cb;
  box-shadow: 0 10px 28px rgba(3, 6, 10, 0.6), 0 0 20px rgba(245, 146, 128, 0.16);
}

.cell-tooltip {
  position: absolute;
  z-index: 4;
  left: 0;
  top: 0;
  width: max-content;
  max-width: min(300px, calc(100% - 16px));
  padding: 9px 12px;
  border: 1px solid rgba(154, 198, 189, 0.6);
  border-radius: 9px;
  background: rgba(11, 20, 24, 0.97);
  box-shadow: 0 8px 22px rgba(3, 6, 10, 0.62);
  color: #edf3ee;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.targeting {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: linear-gradient(90deg, rgba(24, 54, 49, 0.92) 0%, rgba(18, 39, 38, 0.94) 100%);
  border-bottom: 1px solid rgba(116, 235, 194, 0.28);
  color: #d3f7ea;
  font-size: 13px;
  min-height: 48px;
}

.targeting > span {
  flex: 1;
  font-weight: 500;
}

.targeting .button {
  min-height: 31px;
  padding-inline: 10px;
  border-radius: 8px;
}

.shapes {
  display: flex;
  gap: 4px;
  padding: 2px;
  background: rgba(10, 19, 20, 0.55);
  border-radius: 9px;
  border: 1px solid rgba(116, 235, 194, 0.18);
}

.shapes .button {
  min-height: 28px;
  min-width: 32px;
  padding-inline: 8px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.shapes .button[aria-pressed="true"] {
  background: rgba(116, 235, 194, 0.18);
  border-color: rgba(116, 235, 194, 0.55);
  color: var(--mint-bright);
}

.map-footer {
  min-height: 46px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(12, 18, 22, 0.55);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.legend > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #a9b9b7;
}

.swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

.swatch.stone {
  border: 1px solid #769399;
  background: linear-gradient(135deg, #567077 0%, #34484d 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.swatch.empty {
  border: 1px solid #59696b;
  background: #0d1417;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.7);
}

.swatch.rare {
  border: 1px solid #b9a3f7;
  background: linear-gradient(135deg, #6e579f 0%, #443568 100%);
  box-shadow: 0 0 8px rgba(185, 163, 247, 0.35);
}

/* Right Dock */
.dock {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.dock .panel {
  padding: 12px 14px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  min-height: 22px;
}

.section-head h2 {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #eef4f0;
  white-space: nowrap;
}

.section-head span {
  color: var(--muted);
  font-size: 11px;
}

.pill-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(11, 17, 21, 0.72);
  border: 1px solid rgba(132, 170, 165, 0.18);
  color: #a9bcba !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mint-tag {
  color: var(--mint) !important;
  border-color: rgba(116, 235, 194, 0.25);
  background: rgba(20, 44, 40, 0.65);
}

.section-head .round-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(15, 22, 26, 0.85);
  border: 1px solid rgba(242, 188, 116, 0.24);
  color: #e2cfa9;
  font-weight: 600;
}

.round-status::before {
  content: '';
  border-radius: 50%;
  width: 7px;
  height: 7px;
  background: #e2b87d;
  box-shadow: 0 0 8px rgba(242, 188, 116, 0.55);
}

.section-head .round-status.active {
  border-color: rgba(116, 235, 194, 0.34);
  background: rgba(17, 42, 38, 0.75);
  color: var(--mint-bright);
}

.round-status.active::before {
  background: var(--mint);
  box-shadow: 0 0 10px rgba(116, 235, 194, 0.85);
}

.section-head .round-status.done {
  border-color: rgba(132, 160, 160, 0.2);
  color: #93a3a4;
}

.round-status.done::before {
  background: #7d8e91;
  box-shadow: none;
}

/* Primary Stat Readouts */
.primary-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 8px 11px 9px;
  border: 1px solid rgba(136, 174, 170, 0.18);
  background: linear-gradient(155deg, #1b262c 0%, #11181d 100%);
  border-radius: 11px;
  box-shadow: inset 0 1px 0 rgba(220, 245, 238, 0.06);
  overflow: hidden;
}

.stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, transparent, rgba(242, 188, 116, 0.6), transparent);
}

.stat-pending::before {
  background: linear-gradient(90deg, transparent, rgba(116, 235, 194, 0.72), transparent);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #aebfbd;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.25;
}

.stat-label canvas, .secured canvas { width: 16px; height: 16px; }

.stat-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.stat strong {
  font-size: 26px;
  font-weight: 760;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: #f6f8f5;
}

.stat small {
  font-size: 11.5px;
  color: var(--muted);
}

.mint {
  color: var(--mint) !important;
  text-shadow: 0 0 18px rgba(116, 235, 194, 0.32);
}

/* Vault Secured Bar */
.secured {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 11px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(242, 188, 116, 0.09) 0%, rgba(16, 23, 28, 0.72) 100%);
  border: 1px solid rgba(242, 188, 116, 0.2);
  color: #d6dcd5;
  font-size: 12.5px;
}

.secured > span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 550;
}

.secured b {
  font-size: 17px;
  font-weight: 740;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--gold-bright);
  text-shadow: 0 0 14px rgba(242, 188, 116, 0.25);
}

.secured small {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}

/* Vein Reserve Meter */
.reserve {
  margin-top: 9px;
}

.reserve > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11.5px;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: #cad8d4;
}

progress {
  display: block;
  width: 100%;
  height: 6px;
  appearance: none;
  border: 1px solid rgba(134, 178, 172, 0.16);
  border-radius: 999px;
  overflow: hidden;
  background: #0b1115;
  accent-color: var(--mint);
}

progress::-webkit-progress-bar { background: #0b1115; }
progress::-webkit-progress-value {
  background: linear-gradient(90deg, #3c9b84 0%, #74ebc2 65%, #b5fbe3 100%);
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(116, 235, 194, 0.45);
  transition: width 0.25s ease;
}
progress::-moz-progress-bar {
  background: linear-gradient(90deg, #3c9b84 0%, #74ebc2 100%);
  border-radius: 999px;
}

.status-detail {
  color: #a4b5b3;
  min-height: 24px;
  line-height: 1.35;
  font-size: 11.5px;
  padding: 6px 9px;
  margin: 8px 0 9px;
  border-radius: 8px;
  background: rgba(10, 16, 20, 0.62);
  border: 1px solid rgba(132, 170, 165, 0.12);
}

.status-detail.warn {
  color: #ffcab8;
  background: rgba(54, 24, 21, 0.68);
  border-color: rgba(245, 146, 128, 0.38);
}

#mainAction {
  width: 100%;
  min-height: 40px;
  font-size: 13.5px;
  border-radius: 10px;
}

/* Toolbelt */
.toolbelt {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.tool {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  min-height: 54px;
  border: 1px solid rgba(138, 178, 172, 0.22);
  border-radius: 10px;
  background: linear-gradient(180deg, #1d292f 0%, #141d22 100%);
  color: #e9f0ec;
  font: 12px/1.2 inherit;
  padding: 5px 2px 4px;
  box-shadow: inset 0 1px 0 rgba(220, 248, 238, 0.07), 0 3px 8px rgba(3, 6, 10, 0.34);
  transition: transform 0.14s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.tool-label {
  font-size: 10.5px;
  font-weight: 550;
  line-height: 1.15;
}

.tool:hover:not(:disabled) {
  background: linear-gradient(180deg, #25363d 0%, #1a272d 100%);
  border-color: rgba(140, 218, 198, 0.48);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(220, 248, 238, 0.12), 0 6px 14px rgba(3, 6, 10, 0.42);
}

.tool[aria-pressed="true"] {
  background: linear-gradient(180deg, #1e3b36 0%, #142826 100%);
  border-color: rgba(116, 235, 194, 0.72);
  color: #e6fff5;
  box-shadow:
    inset 0 0 0 1px rgba(116, 235, 194, 0.25),
    0 0 16px rgba(116, 235, 194, 0.18),
    0 4px 12px rgba(3, 6, 10, 0.4);
}

.tool[aria-pressed="true"]::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 24%;
  right: 24%;
  height: 2px;
  border-radius: 2px;
  background: var(--mint);
  box-shadow: 0 0 6px var(--mint);
}

.tool:disabled {
  background: rgba(10, 15, 19, 0.62);
  color: #627274;
  border-color: rgba(120, 154, 154, 0.11);
  box-shadow: inset 0 2px 5px rgba(2, 5, 8, 0.55);
  transform: none;
}

.tool:disabled canvas { opacity: 0.48; filter: grayscale(0.32); }
.tool canvas { width: 23px; height: 23px; }

.tool-count {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 16px;
  height: 14px;
  padding: 0 3.5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(9, 15, 19, 0.82);
  border: 1px solid rgba(138, 178, 172, 0.2);
  font: 650 9.5px/1 var(--mono);
  color: #d6e4de;
}

.tool[aria-pressed="true"] .tool-count {
  background: rgba(116, 235, 194, 0.18);
  border-color: rgba(116, 235, 194, 0.45);
  color: var(--mint-bright);
}

.tool:disabled .tool-count {
  background: transparent;
  border-color: transparent;
  color: #546467;
}

/* Crew List */
.crew-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 98px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2f4346 transparent;
  display: grid;
  gap: 4px;
}

.crew-list li {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: 27px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(11, 17, 21, 0.58);
  border: 1px solid rgba(132, 170, 165, 0.11);
  font-size: 12px;
  color: #dce8e0;
}

.crew-list .player-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--player-color);
  box-shadow: 0 0 8px var(--player-color);
}

.crew-list li.offline { opacity: 0.48; }

.crew-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
}

.crew-location {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(24, 36, 40, 0.85);
  border: 1px solid rgba(132, 170, 165, 0.15);
  color: #a8c1b9;
  font: 600 10.5px/1.1 var(--mono);
  white-space: nowrap;
}

/* Log Panel */
.log-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 112px;
  overflow: hidden;
}

.log {
  display: grid;
  align-content: start;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #2f4346 transparent;
}

.log li {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(11, 17, 21, 0.52);
  border: 1px solid rgba(132, 170, 165, 0.09);
  border-left: 2.5px solid rgba(132, 170, 165, 0.35);
  color: #d0dbd5;
  font-size: 11.5px;
  line-height: 1.3;
}

.log .good {
  color: #c2f4de;
  border-left-color: var(--mint);
  background: linear-gradient(90deg, rgba(25, 58, 50, 0.42), rgba(11, 17, 21, 0.55));
}

.log .risk {
  color: #ffcab8;
  border-left-color: var(--danger);
  background: linear-gradient(90deg, rgba(64, 28, 25, 0.44), rgba(11, 17, 21, 0.55));
}

.log canvas { width: 17px; height: 17px; flex: none; }

.log time {
  margin-left: auto;
  font: 10.5px/1 var(--mono);
  color: var(--faint);
  white-space: nowrap;
}

.log .log-empty {
  justify-content: center;
  text-align: center;
  min-height: 82px;
  border: 1px solid rgba(132, 170, 165, 0.14);
  border-left-width: 1px;
  border-radius: 10px;
  background: rgba(10, 15, 19, 0.55);
  color: #829696;
  padding: 12px;
}

/* Mobile sticky action bar */
.mobile-actions { display: none; }

/* Dialogs */
.dialog {
  color: #edf2ee;
  background: linear-gradient(180deg, #172127 0%, #10171c 100%);
  width: min(650px, calc(100vw - 28px));
  max-height: 85dvh;
  padding: 0;
  border: 1px solid rgba(154, 198, 189, 0.28);
  border-top-color: rgba(242, 188, 116, 0.42);
  border-radius: 18px;
  box-shadow:
    0 28px 80px rgba(2, 5, 8, 0.8),
    0 0 40px rgba(42, 110, 100, 0.12),
    inset 0 1px 0 rgba(255, 232, 196, 0.14);
  overflow: hidden;
}

.dialog::backdrop {
  background: rgba(4, 8, 11, 0.76);
  backdrop-filter: blur(8px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(28, 39, 45, 0.96) 0%, rgba(19, 28, 33, 0.96) 100%);
  border-bottom: 1px solid rgba(138, 178, 172, 0.18);
  z-index: 2;
}

.dialog-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dialog-eyebrow {
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.16em;
  color: var(--gold);
  opacity: 0.85;
}

.dialog-head h2 {
  font-size: 19px;
  font-weight: 720;
  letter-spacing: 0.03em;
}

.dialog-body {
  padding: 18px 20px 22px;
  font-size: 13.5px;
  color: #c3d0cd;
  line-height: 1.62;
  overflow-y: auto;
  max-height: calc(85dvh - 76px);
  scrollbar-width: thin;
  scrollbar-color: #2f4346 transparent;
}

.manual-section {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(11, 17, 21, 0.56);
  border: 1px solid rgba(132, 170, 165, 0.14);
  margin-bottom: 12px;
}

.manual-section:last-child { margin-bottom: 0; }

.manual-section.danger-section {
  background: linear-gradient(180deg, rgba(46, 22, 20, 0.42), rgba(16, 17, 20, 0.55));
  border-color: rgba(245, 146, 128, 0.24);
}

.dialog-body h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gold-bright);
  font-size: 14.5px;
  font-weight: 700;
  margin: 0 0 8px;
}

.dialog-body h3::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: var(--gold);
  box-shadow: 0 0 8px rgba(242, 188, 116, 0.65);
}

.danger-section h3 { color: #ffb9a7; }
.danger-section h3::before { background: var(--danger); box-shadow: 0 0 8px rgba(245, 146, 128, 0.65); }

.steps { padding-left: 20px; margin: 4px 0 0; }
.steps li { margin: 5px 0; }

.manual { margin: 6px 0 0; }
.manual > div {
  display: grid;
  grid-template-columns: minmax(132px, 1fr) minmax(0, 2.25fr);
  gap: 6px 14px;
  border-top: 1px solid rgba(132, 170, 165, 0.14);
  padding: 8px 0;
}
.manual > div:first-child { border-top: 0; padding-top: 2px; }
.manual dt { color: #eef4f0; font-weight: 650; }
.manual dd { margin: 0; color: #b7c6c4; }

.confirm { max-width: 430px; }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 20px 18px;
}

/* Login Dialog */
.login-dialog { max-width: 448px; }

.login-head-brand {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.login-crest {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(150deg, #3c2f21 0%, #201a15 100%);
  border: 1px solid rgba(242, 188, 116, 0.44);
  box-shadow: 0 4px 14px rgba(3, 6, 9, 0.5), 0 0 18px rgba(242, 188, 116, 0.16);
}

.login-crest canvas { width: 28px; height: 28px; }

.login-lead {
  color: #9eb2b0;
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: #d6e4dc;
  font-size: 12.5px;
  font-weight: 600;
}

.login-dialog input {
  min-width: 0;
  width: 100%;
  border: 1px solid rgba(138, 180, 174, 0.28);
  background: #0b1216;
  color: #edf5ef;
  padding: 11px 13px;
  font: inherit;
  border-radius: 10px;
  box-shadow: inset 0 2px 5px rgba(2, 5, 8, 0.55);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-dialog input::placeholder { color: #5b7072; }

.login-dialog input:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: inset 0 2px 5px rgba(2, 5, 8, 0.55), 0 0 0 3px rgba(242, 188, 116, 0.18);
}

#uid { font-family: var(--mono); letter-spacing: 0.04em; }

.login-status {
  color: #ffc2ad;
  font-size: 12.5px;
  padding: 8px 11px;
  border-radius: 9px;
  background: rgba(68, 28, 24, 0.52);
  border: 1px solid rgba(245, 146, 128, 0.34);
}
.login-status:empty { display: none; }

.login-submit {
  margin-top: 2px;
  min-height: 44px;
  font-size: 14px;
}

.noscript-note {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(24, 34, 39, 0.8);
  border: 1px solid var(--line);
}

/* Responsive Breakpoints */
@media (max-width: 980px) {
  .shell { padding-inline: 16px; }
  .layout { gap: 14px; grid-template-columns: minmax(0, 1fr) 280px; }
  .dock { gap: 12px; }
  .dock .panel { padding: 13px; }
}

@media (max-width: 720px) {
  .shell { padding: 0 10px 20px; }
  .topbar { min-height: 62px; padding-block: 9px; gap: 7px 6px; }
  .brand { gap: 9px; }
  .brand-mark { width: 37px; height: 37px; border-radius: 10px; }
  .brand-mark canvas { width: 26px; height: 26px; }
  .brand h1 { font-size: 18px; letter-spacing: 0.04em; }
  .brand-sub { display: none; }
  .header-actions { gap: 6px; }
  .header-actions .button { min-height: 34px; }
  .header-actions .icon-button { width: 34px; }
  .round-clock { min-height: 34px; padding: 0 10px; gap: 5px; }
  .round-clock time { font-size: 13.5px; }
  .round-clock canvas { width: 15px; height: 15px; }
  #helpOpen > span:last-child { display: none; }
  #helpOpen .question { display: grid; }
  #helpOpen { width: 34px; padding-inline: 5px; }
  #loginOpen { padding-inline: 10px; font-size: 12px; }
  .account-strip { padding: 7px 10px; font-size: 12px; gap: 6px; margin: 10px 0; }
  #connectionText { font-size: 11px; padding: 2px 7px; }
  .layout, .multiplayer .layout { display: flex; flex-direction: column; height: auto; min-height: 0; margin-top: 10px; gap: 12px; }
  .map-panel { height: clamp(430px, 64svh, 640px); }
  .map-header { min-height: 58px; padding: 10px 12px; }
  .map-header h2 { font-size: 17px; }
  .map-header p { font-size: 11px; }
  .map-return { padding-inline: 10px; gap: 5px; min-height: 34px; font-size: 12px; }
  .viewport { min-height: 0; }
  .coord { top: 8px; left: 8px; padding: 4px 8px; font-size: 11px; }
  .compass { top: 8px; right: 8px; width: 34px; padding: 4px 0 5px; }
  .compass i { height: 18px; width: 12px; }
  .map-tools { right: 8px; bottom: 8px; }
  .map-tools .button { min-height: 38px; width: 38px; }
  .map-notice { max-width: calc(100% - 104px); font-size: 12px; top: 8px; padding: 6px 10px; }
  .branch-button { left: 8px; bottom: 8px; }
  .legend { gap: 6px 12px; }
  .map-footer { min-height: 40px; padding: 7px 11px; gap: 6px 8px; font-size: 11px; }
  .targeting { gap: 6px; padding: 7px 10px; font-size: 12px; }
  .dock { display: flex; flex-direction: column; }
  .focused .tools-panel { order: -1; }
  .crew-panel { order: 0; }
  .focused .shell { padding-bottom: 84px; }
  .mobile-actions {
    position: fixed;
    inset: auto 0 0;
    display: flex;
    z-index: 4;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(12, 20, 24, 0.92);
    backdrop-filter: blur(14px);
    padding: 10px 14px max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(134, 182, 174, 0.28);
    box-shadow: 0 -8px 28px rgba(2, 5, 8, 0.65);
  }
  .mobile-actions > div {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    color: #b5c6c2;
  }
  .mobile-actions b {
    display: inline-block;
    font-size: 18px;
    font-weight: 740;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--mint);
    margin-inline: 2px;
  }
  .mobile-actions .button { min-height: 38px; padding-inline: 18px; }
  .log { max-height: 180px; }
  .manual > div { grid-template-columns: 1fr; gap: 2px; }
}

@media (max-width: 355px) {
  .round-clock { padding-inline: 6px; }
  #helpOpen { padding-inline: 4px; }
  .map-footer #mapControls { display: none; }
  .compass { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
