:root {
  --bg: #160c0d;
  --bg-panel: rgba(31, 17, 19, 0.9);
  --bg-panel-strong: rgba(46, 20, 24, 0.96);
  --line: rgba(255, 114, 114, 0.22);
  --line-bright: rgba(255, 112, 82, 0.5);
  --accent: #ff6644;
  --accent-soft: #ff996e;
  --accent-strong: #ff2d2d;
  --text: #f5ebe4;
  --muted: #bca6a1;
  --good: #7ee787;
  --warn: #ffb454;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(194, 58, 35, 0.2), transparent 30%),
    radial-gradient(circle at bottom right, rgba(255, 120, 30, 0.16), transparent 30%),
    linear-gradient(180deg, #120809 0%, #080506 100%);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
  min-height: 100vh;
}

.app-screen {
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

.app-screen[hidden] {
  display: none !important;
}

.home-screen,
.editor-screen,
.settings-screen {
  padding: 16px;
}

.menu-shell,
.editor-shell,
.settings-shell {
  width: min(1720px, 100%);
  height: 100%;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 98, 55, 0.16), transparent 20%),
    radial-gradient(circle at 78% 28%, rgba(255, 186, 74, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(23, 12, 14, 0.97), rgba(10, 7, 8, 0.98));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.menu-shell {
  padding: clamp(26px, 5vw, 72px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.72fr);
  gap: 28px;
  align-items: stretch;
}

.menu-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.menu-copy h1 {
  font-size: clamp(44px, 7vw, 108px);
  line-height: 0.94;
}

.menu-lead {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 1.5vw, 22px);
  line-height: 1.65;
}

.menu-actions {
  display: grid;
  gap: 14px;
  align-content: center;
}

.menu-button {
  min-height: 78px;
  border: 1px solid rgba(255, 133, 92, 0.28);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(62, 28, 24, 0.96), rgba(25, 17, 18, 0.98));
  color: var(--text);
  font: inherit;
  font-family: "Avenir Next Condensed", "DIN Alternate", "Trebuchet MS", sans-serif;
  font-size: clamp(22px, 2vw, 30px);
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.menu-button:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(255, 188, 130, 0.52);
  box-shadow: inset 0 0 0 1px rgba(255, 188, 130, 0.14);
}

.menu-button.primary {
  background:
    linear-gradient(180deg, rgba(198, 84, 47, 0.98), rgba(127, 37, 23, 0.98));
  border-color: rgba(255, 194, 122, 0.38);
}

.menu-button.subtle {
  min-height: 50px;
  padding: 0 18px;
  font-size: 16px;
  border-radius: 16px;
}

.editor-shell,
.settings-shell {
  padding: 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.editor-topbar,
.settings-topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
}

.editor-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.editor-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
}

.editor-sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.editor-panel,
.settings-card {
  border: 1px solid rgba(255, 126, 86, 0.24);
  border-radius: 24px;
  background: rgba(21, 14, 16, 0.84);
  padding: 16px;
}

.editor-panel h2,
.settings-card h2 {
  margin-top: 6px;
  margin-bottom: 10px;
}

.editor-panel.compact {
  margin-top: auto;
}

.terrain-palette {
  display: grid;
  gap: 10px;
}

.terrain-brush {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(255, 126, 86, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(51, 26, 24, 0.96), rgba(24, 17, 18, 0.98));
  color: var(--text);
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.terrain-brush:hover,
.terrain-brush.active {
  transform: translateY(-1px);
  border-color: rgba(255, 198, 122, 0.52);
  box-shadow: inset 0 0 0 1px rgba(255, 198, 122, 0.18);
}

.terrain-brush-swatch {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255, 240, 228, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.terrain-brush-copy strong,
.terrain-brush-copy span {
  display: block;
}

.terrain-brush-copy strong {
  font-family: "Avenir Next Condensed", "DIN Alternate", "Trebuchet MS", sans-serif;
  font-size: 15px;
  letter-spacing: 0.04em;
}

.terrain-brush-copy span,
.editor-terrain-copy,
.editor-hints {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.editor-hints {
  padding-left: 18px;
}

.editor-stage {
  min-width: 0;
  min-height: 0;
}

.editor-canvas-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255, 126, 86, 0.24);
  border-radius: 28px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(13, 10, 11, 0.96), rgba(18, 12, 14, 0.98));
}

#editorCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.editor-overlay-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: none;
}

.editor-chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 148, 102, 0.3);
  background: rgba(17, 12, 14, 0.82);
  color: var(--text);
  font-size: 12px;
}

.settings-grid {
  align-self: center;
  width: min(940px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-card {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.settings-card input[type="range"] {
  width: 100%;
  accent-color: #ff8857;
}

.settings-card strong {
  font-family: "Avenir Next Condensed", "DIN Alternate", "Trebuchet MS", sans-serif;
  font-size: 24px;
  letter-spacing: 0.04em;
}

.shell {
  width: min(1720px, 100vw);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: end;
}

.eyebrow,
.panel-label {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--accent-soft);
}

h1,
h2 {
  margin: 0;
  font-family: "Avenir Next Condensed", "DIN Alternate", "Trebuchet MS", sans-serif;
  letter-spacing: 0.04em;
}

h1 {
  font-size: clamp(24px, 3vw, 38px);
}

h2 {
  font-size: 16px;
}

.topbar-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(64, 22, 18, 0.85), rgba(23, 13, 15, 0.95));
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.stat-card span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 5px;
  font-family: "Avenir Next Condensed", "DIN Alternate", "Trebuchet MS", sans-serif;
  font-size: clamp(14px, 1.2vw, 18px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.objective-stat {
  min-width: 180px;
}

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
}

.battlefield-frame,
.dock-group {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.battlefield-frame {
  min-height: 0;
  background:
    linear-gradient(145deg, rgba(124, 24, 19, 0.22), transparent 30%),
    linear-gradient(180deg, rgba(9, 6, 7, 0.95), rgba(16, 9, 10, 0.98));
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.hud-overlay {
  position: absolute;
  inset: 16px;
  padding-right: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 12px;
  z-index: 2;
}

#modeInfo {
  display: none;
}

.selection-card,
.tooltip-card,
.minimap-shell {
  border-radius: 18px;
  border: 1px solid rgba(255, 123, 89, 0.3);
  background: rgba(18, 13, 15, 0.82);
  backdrop-filter: blur(10px);
}

.selection-card,
.tooltip-card {
  width: min(300px, 100%);
  padding: 12px 14px;
}

.selection-card strong,
.tooltip-card strong {
  display: block;
  margin: 6px 0 4px;
  font-family: "Avenir Next Condensed", "DIN Alternate", "Trebuchet MS", sans-serif;
  font-size: 15px;
}

.selection-card span,
.tooltip-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.minimap-shell {
  position: relative;
  width: 100%;
  padding: 10px;
  min-height: 0;
}

.minimap-shell .panel-label {
  margin-bottom: 8px;
}

.announce-strip {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  width: min(46%, 520px);
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 158, 104, 0.3);
  background: rgba(30, 18, 20, 0.88);
  text-align: center;
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.03em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 4;
}

.announce-strip.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.announce-strip.good {
  border-color: rgba(126, 231, 135, 0.38);
}

.announce-strip.warn {
  border-color: rgba(255, 180, 84, 0.42);
}

.screen-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 5, 6, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 5;
}

.screen-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay-card {
  width: min(520px, 100%);
  padding: 24px;
  border-radius: 28px;
  border: 1px solid rgba(255, 132, 90, 0.26);
  background:
    linear-gradient(180deg, rgba(42, 19, 20, 0.96), rgba(20, 12, 14, 0.98));
  box-shadow: var(--shadow);
}

.overlay-card h2 {
  margin-top: 6px;
  font-size: clamp(28px, 4vw, 40px);
}

.overlay-card p:last-of-type {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.overlay-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

.overlay-btn,
.utility-btn {
  border: 1px solid rgba(255, 132, 90, 0.26);
  background: rgba(53, 27, 28, 0.96);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  font: inherit;
  cursor: pointer;
}

.overlay-btn.primary {
  background: linear-gradient(180deg, rgba(189, 76, 43, 0.98), rgba(132, 39, 25, 0.98));
  border-color: rgba(255, 187, 116, 0.34);
}

.command-dock {
  display: grid;
  grid-template-columns: minmax(210px, 0.78fr) 0.88fr 1fr 1.18fr minmax(230px, 0.92fr);
  gap: 10px;
  min-height: 198px;
}

.dock-group {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.selection-dock.selection-card {
  width: 100%;
  min-width: 0;
  justify-content: flex-end;
  align-self: stretch;
  padding: 14px;
}

.selection-dock strong {
  font-size: 17px;
}

.selection-dock span {
  display: block;
}

.minimap-dock {
  min-width: 0;
}

.minimap-dock-shell {
  flex: 1;
  display: flex;
  align-items: stretch;
}

.dock-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
  flex-shrink: 0;
}

.button-grid {
  flex: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  min-height: 62px;
  flex-shrink: 0;
}

.button-grid > .icon-btn,
.utility-grid > .icon-btn {
  flex: 0 0 auto;
}

.support-grid {
  justify-content: flex-start;
}

.build-grid,
.train-grid {
  justify-content: flex-start;
}

.subpanel-label {
  margin-top: 2px;
  flex-shrink: 0;
}

.structure-grid {
  flex: 0;
  justify-content: flex-start;
  min-height: 62px;
}

.structure-btn {
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255, 130, 87, 0.28);
  background:
    linear-gradient(180deg, rgba(56, 25, 23, 0.97), rgba(24, 18, 19, 0.98));
  border-radius: 14px;
  padding: 8px 10px;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.structure-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(255, 182, 104, 0.52);
  box-shadow: inset 0 0 0 1px rgba(255, 183, 124, 0.16);
}

.structure-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.structure-btn.active {
  border-color: rgba(255, 198, 122, 0.68);
  box-shadow: inset 0 0 0 1px rgba(255, 198, 122, 0.24);
}

.structure-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 180, 130, 0.22);
  background:
    linear-gradient(180deg, rgba(88, 41, 31, 0.96), rgba(30, 19, 20, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 214, 194, 0.08),
    inset 0 -8px 18px rgba(0, 0, 0, 0.18);
}

.structure-btn svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.structure-btn.repair .structure-icon,
.structure-btn.repair svg {
  color: #8ce7b0;
}

.structure-btn.sell .structure-icon,
.structure-btn.sell svg {
  color: #ffb985;
}

.structure-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.structure-title {
  font-family: "Avenir Next Condensed", "DIN Alternate", "Trebuchet MS", sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.structure-value {
  font-family: "Avenir Next Condensed", "DIN Alternate", "Trebuchet MS", sans-serif;
  font-size: 17px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.command-btn {
  width: 100%;
  border: 1px solid rgba(255, 120, 79, 0.22);
  background:
    linear-gradient(180deg, rgba(60, 29, 26, 0.95), rgba(29, 19, 20, 0.96));
  border-radius: 16px;
  padding: 10px 12px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.command-btn:hover:not(:disabled),
.utility-btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-bright);
  background:
    linear-gradient(180deg, rgba(94, 35, 25, 0.95), rgba(36, 22, 20, 0.98));
}

.utility-btn.active {
  border-color: rgba(255, 187, 116, 0.46);
  box-shadow: inset 0 0 0 1px rgba(255, 187, 116, 0.2);
  background:
    linear-gradient(180deg, rgba(94, 35, 25, 0.98), rgba(42, 20, 18, 0.98));
}

.command-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.command-btn .btn-name,
.command-btn .btn-cost {
  display: block;
}

.command-btn .btn-name {
  font-family: "Avenir Next Condensed", "DIN Alternate", "Trebuchet MS", sans-serif;
  font-size: 13px;
}

.command-btn .btn-cost {
  margin-top: 3px;
  font-size: 11px;
  color: var(--accent-soft);
}

.command-btn .btn-meta {
  display: -webkit-box;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.command-btn.active {
  border-color: rgba(255, 177, 106, 0.65);
  box-shadow: inset 0 0 0 1px rgba(255, 177, 106, 0.3);
}

.icon-btn {
  width: 62px;
  min-width: 62px;
  height: 62px;
  min-height: 62px;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  position: relative;
  z-index: 1;
  isolation: isolate;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: var(--text);
  border: 1px solid rgba(255, 126, 86, 0.24);
  background:
    linear-gradient(180deg, rgba(59, 28, 25, 0.96), rgba(26, 18, 19, 0.98));
  border-radius: 14px;
  padding: 8px;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.icon-btn > *,
.icon-btn * {
  pointer-events: none !important;
}

.command-btn.icon-btn,
.structure-btn.icon-btn {
  width: 62px;
  min-width: 62px;
  height: 62px;
  min-height: 62px;
}

.utility-btn.icon-btn {
  width: 54px;
  min-width: 54px;
  height: 54px;
  min-height: 54px;
  padding: 7px;
  border-radius: 12px;
}

.overlay-btn.icon-btn {
  width: 68px;
  min-width: 68px;
  height: 68px;
  min-height: 68px;
  padding: 10px;
  border-radius: 18px;
}

.overlay-btn.icon-btn.primary {
  background: linear-gradient(180deg, rgba(189, 76, 43, 0.98), rgba(132, 39, 25, 0.98));
  border-color: rgba(255, 187, 116, 0.34);
}

.icon-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(255, 185, 111, 0.52);
  background:
    linear-gradient(180deg, rgba(92, 35, 26, 0.98), rgba(37, 22, 20, 0.98));
  box-shadow: inset 0 0 0 1px rgba(255, 188, 130, 0.14);
}

.icon-btn:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.icon-btn.active {
  border-color: rgba(255, 198, 122, 0.68);
  box-shadow: inset 0 0 0 1px rgba(255, 198, 122, 0.24);
}

.btn-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--accent-soft);
  pointer-events: none;
}

.icon-btn[data-art="sprite"] .btn-icon {
  width: 40px;
  height: 40px;
}

.utility-btn.icon-btn .btn-icon {
  width: 24px;
  height: 24px;
}

.overlay-btn.icon-btn .btn-icon {
  width: 28px;
  height: 28px;
}

.icon-btn .btn-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
  stroke: none;
  pointer-events: none;
}

.icon-btn .btn-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.34));
}

.btn-body {
  display: none;
  pointer-events: none;
}

.icon-btn .btn-name {
  display: block;
  margin: 0;
  font-family: "Avenir Next Condensed", "DIN Alternate", "Trebuchet MS", sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.icon-btn .btn-cost {
  display: block;
  margin: 0;
  font-family: "Avenir Next Condensed", "DIN Alternate", "Trebuchet MS", sans-serif;
  font-size: 16px;
  letter-spacing: 0.03em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn .btn-meta {
  display: -webkit-box;
  margin: 0;
  font-size: 10px;
  line-height: 1.35;
  color: var(--muted);
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.utility-btn.icon-btn .btn-name,
.overlay-btn.icon-btn .btn-name {
  font-size: 11px;
}

.utility-btn.icon-btn .btn-cost,
.overlay-btn.icon-btn .btn-cost {
  font-size: 13px;
}

.utility-btn.icon-btn .btn-meta,
.overlay-btn.icon-btn .btn-meta {
  display: none;
}

.command-btn[data-family="build"] .btn-icon {
  color: #ffd676;
}

.command-btn[data-family="train"] .btn-icon {
  color: #91d3ff;
}

.command-btn[data-family="support"] .btn-icon {
  color: #ffb985;
}

.structure-btn.repair .btn-icon,
.utility-btn.audio.active .btn-icon {
  color: #8ce7b0;
}

.structure-btn.sell .btn-icon,
.utility-btn.restart .btn-icon,
.overlay-btn.restart .btn-icon {
  color: #ffcf7c;
}

.utility-btn.pause .btn-icon,
.overlay-btn.resume .btn-icon {
  color: #9fd6ff;
}

.utility-btn.audio .btn-icon {
  color: #ffb985;
}

.utility-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  min-height: 54px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.utility-btn {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 12px;
  position: relative;
  z-index: 2;
}

.ui-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  max-width: min(260px, calc(100vw - 24px));
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 164, 108, 0.3);
  background: rgba(24, 16, 18, 0.96);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.ui-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

#minimap {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  background: linear-gradient(180deg, #241113, #130d0f);
  border: 1px solid rgba(255, 112, 82, 0.16);
  cursor: pointer;
}

@media (max-width: 1240px), (max-height: 900px) {
  .shell {
    padding: 8px;
    gap: 8px;
  }

  .topbar-stats {
    gap: 8px;
  }

  .stat-card {
    padding: 8px 10px;
  }

  .hud-overlay {
    inset: 12px;
    padding-right: 0;
  }

  .command-dock {
    min-height: 178px;
    grid-template-columns: minmax(190px, 0.72fr) 0.88fr 1fr 1.18fr minmax(200px, 0.86fr);
  }

  .dock-group {
    padding: 12px;
    gap: 8px;
  }

  .command-btn.icon-btn,
  .structure-btn.icon-btn {
    width: 56px;
    min-width: 56px;
    height: 56px;
    min-height: 56px;
    padding: 7px;
  }

  .utility-btn.icon-btn {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
  }

  .overlay-btn.icon-btn {
    width: 62px;
    min-width: 62px;
    height: 62px;
    min-height: 62px;
  }

  .btn-icon {
    width: 26px;
    height: 26px;
  }

  .utility-btn.icon-btn .btn-icon {
    width: 21px;
    height: 21px;
  }

  .overlay-btn.icon-btn .btn-icon {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 980px) {
  .menu-shell,
  .editor-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .menu-actions {
    align-content: start;
  }

  .editor-layout {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .editor-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .editor-panel {
    flex: 1 1 220px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

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

  .command-dock {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: 168px;
  }

  .announce-strip {
    width: min(58%, 460px);
  }
}
