* {
  box-sizing: border-box;
}

:root {
  --bg-dark: #14110d;
  --bg-deep: #0c0907;
  --panel-strong: linear-gradient(180deg, rgba(20, 17, 14, 0.96), rgba(11, 9, 7, 0.98));
  --line: rgba(180, 155, 103, 0.22);
  --line-strong: rgba(180, 155, 103, 0.72);
  --text: #ebe0c8;
  --muted: #aea188;
  --accent: #d6b067;
  --goal: #d45573;
  --build: #82b4d9;
  --danger: #b36552;
  --shadow: rgba(0, 0, 0, 0.58);
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  color: var(--text);
  font-family: Verdana, Geneva, sans-serif;
  background:
    radial-gradient(circle at top, rgba(174, 132, 62, 0.08), transparent 36%),
    radial-gradient(circle at bottom, rgba(88, 69, 45, 0.14), transparent 34%),
    linear-gradient(180deg, #29231d, #0c0907 74%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.015) 0, rgba(255, 255, 255, 0.015) 1px, transparent 1px, transparent 4px),
    radial-gradient(circle at top left, rgba(214, 176, 103, 0.07), transparent 24%),
    radial-gradient(circle at top right, rgba(122, 128, 90, 0.05), transparent 20%);
  opacity: 0.7;
}

button,
canvas {
  font: inherit;
}

.hidden {
  display: none !important;
}

#app {
  position: relative;
  z-index: 1;
  width: min(1840px, calc(100% - 16px));
  height: 100dvh;
  margin: 0 auto;
  padding: 8px 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    var(--panel-strong),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.015) 0, rgba(255, 255, 255, 0.015) 1px, transparent 1px, transparent 4px);
  box-shadow:
    0 24px 46px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.topbar {
  padding: 10px 12px;
  display: grid;
  gap: 10px;
}

.toolbar-row,
.action-row,
.meta-strip {
  display: flex;
  align-items: center;
  gap: 8px 10px;
  flex-wrap: wrap;
}

.toolbar-row {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.title-block {
  display: grid;
  gap: 4px;
}

.title-block h1,
.stage-header h2,
.overlay-header h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-note,
.overlay-copy {
  color: var(--muted);
  font-size: 12px;
}

.overlay-score-text {
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.tool-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, 56px);
  gap: 6px;
  flex: 0 0 auto;
}

.tool-grid:not(.editor-tool-grid) .tool-button:nth-child(-n + 5) {
  grid-row: 1;
}

.tool-grid:not(.editor-tool-grid) .tool-button:nth-child(n + 6) {
  grid-row: 2;
}

.toolbar-row > .tool-grid {
  grid-column: 1;
}

.tool-grid.editor-tool-grid {
  grid-template-columns: repeat(8, 56px);
}

.action-row {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: 42px 58px;
  row-gap: 6px;
  justify-items: end;
  justify-content: flex-end;
  align-content: center;
  flex: 0 0 auto;
}

.toolbar-row > .action-row {
  grid-column: 3;
}

.topbar-logo {
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  max-height: 118px;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

.topbar-logo img {
  display: block;
  width: min(560px, 100%);
  max-height: 118px;
  object-fit: contain;
  pointer-events: none;
  transform: scale(2);
  transform-origin: center;
}

body.map-editor-active .topbar-logo {
  display: none;
}

.version-badge {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.builder-inline {
  color: var(--accent);
  font-size: 16.5px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.menu-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
  min-height: 42px;
}

.play-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 10px;
  flex-wrap: nowrap;
  width: 100%;
  min-height: 58px;
}

#menuButton,
#myMapsButton {
  width: 92px;
  min-width: 92px;
  height: 42px;
  min-height: 42px;
  padding: 0 8px;
  white-space: nowrap;
}

.sync-status {
  display: block;
  flex: 1 1 440px;
  margin-left: 0;
  max-width: none;
  text-align: center;
  white-space: nowrap;
}

.sync-status:empty {
  display: none;
}

.sync-status.quick-play-sync-status {
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

.sync-status.community-map-sync-status {
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.15;
}

.delay-button-row,
.direction-button-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.delay-button,
.direction-button {
  min-height: 34px;
  min-width: 42px;
  padding: 0 10px;
  border-radius: 10px;
}

.delay-button.active,
.direction-button.active {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(90, 74, 48, 0.98), rgba(44, 36, 24, 1));
  box-shadow:
    inset 0 0 0 1px rgba(214, 176, 103, 0.22),
    0 10px 18px rgba(0, 0, 0, 0.18);
}

.harpoon-delay-popup,
.drive-direction-popup {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  padding: 8px;
  border: 1px solid rgba(180, 155, 103, 0.24);
  border-radius: 14px;
  background: rgba(18, 15, 12, 0.94);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, calc(-100% - 12px));
  pointer-events: auto;
}

.harpoon-delay-popup.popup-below,
.drive-direction-popup.popup-below {
  transform: translate(-50%, 12px);
}

.tool-button,
.primary-button,
.secondary-button {
  border: 1px solid rgba(180, 155, 103, 0.24);
  color: var(--text);
  background: linear-gradient(180deg, rgba(60, 52, 44, 0.96), rgba(24, 20, 17, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 18px rgba(0, 0, 0, 0.2);
}

.tool-button {
  position: relative;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.tool-button svg {
  width: 34px;
  height: 34px;
  display: block;
}

.tool-tips-tool-button {
  text-align: center;
  color: var(--accent);
}

.tool-tips-tool-label {
  display: block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.08;
  text-transform: uppercase;
}

.tool-hotkey-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(214, 176, 103, 0.92);
  color: #17120d;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}

.tool-button.active {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(74, 63, 49, 0.98), rgba(32, 27, 22, 1));
  box-shadow:
    inset 0 0 0 1px rgba(214, 176, 103, 0.22),
    0 12px 20px rgba(0, 0, 0, 0.24);
}

.tool-button:hover,
.primary-button:hover,
.secondary-button:hover {
  border-color: rgba(180, 155, 103, 0.42);
}

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  cursor: pointer;
}

.primary-button {
  background: linear-gradient(180deg, rgba(102, 82, 47, 0.98), rgba(60, 47, 28, 1));
}

#startButton {
  width: 58px;
  min-width: 58px;
  height: 58px;
  min-height: 58px;
  margin-right: 10px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#startButton.running-toggle {
  border-color: rgba(179, 101, 82, 0.48);
  background: linear-gradient(180deg, rgba(116, 54, 44, 0.98), rgba(66, 31, 28, 1));
}

.danger-button {
  border-color: rgba(179, 101, 82, 0.34);
}

button:disabled {
  opacity: 0.44;
  cursor: not-allowed;
}

.stage-panel {
  min-height: 0;
  padding: 10px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}

.stage-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: nowrap;
  min-width: 0;
}

.stage-title-row h2 {
  flex: 0 1 auto;
  max-width: min(42vw, 620px);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-title-row h2.editable-title {
  cursor: text;
}

.stage-title-row h2.editable-title:hover,
.stage-title-row h2.editable-title:focus-visible {
  color: var(--accent);
}

.level-title-input {
  width: min(520px, calc(100vw - 96px));
  max-width: 100%;
  min-height: 42px;
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  background: rgba(12, 9, 7, 0.88);
  color: var(--text);
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: 0;
  text-transform: none;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.level-hint {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
  padding-top: 4px;
}

.stage-pills {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.player-map-completion-status {
  flex: 1 1 520px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-left: clamp(20px, 4vw, 76px);
  min-width: 230px;
  color: #f0b0a4;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: center;
  text-transform: uppercase;
}

.player-map-completion-status .completion-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: #d84f4f;
  box-shadow: 0 0 0 3px rgba(216, 79, 79, 0.16), 0 0 14px rgba(216, 79, 79, 0.5);
}

.player-map-completion-status.is-complete {
  color: #bceab6;
}

.player-map-completion-status.is-complete .completion-dot {
  background: #4fc36b;
  box-shadow: 0 0 0 3px rgba(79, 195, 107, 0.16), 0 0 14px rgba(79, 195, 107, 0.48);
}

.status-pill {
  appearance: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(180, 155, 103, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-pill {
  cursor: pointer;
}

.editor-pill:not(:disabled):hover {
  border-color: rgba(180, 155, 103, 0.42);
  background: rgba(255, 255, 255, 0.08);
}

.editor-pill:disabled {
  opacity: 1;
  cursor: default;
}

.muted-pill {
  color: var(--muted);
}

.mute-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: transparent;
}

.mute-button:hover {
  opacity: 0.82;
}

.mute-icon {
  display: inline-block;
  line-height: 0;
}

.mute-icon-svg {
  width: 31px;
  height: 31px;
  display: block;
  overflow: visible;
}

.mute-icon-circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
}

.mute-icon-speaker-shape {
  fill: currentColor;
}

.mute-icon-wave {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mute-icon-slash {
  display: none;
  fill: none;
  stroke: var(--danger);
  stroke-width: 3;
  stroke-linecap: round;
}

.mute-button.muted {
  color: var(--muted);
}

.mute-button.muted .mute-icon-wave {
  opacity: 0.14;
}

.mute-button.muted .mute-icon-slash {
  display: block;
}

.canvas-shell {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(241, 236, 228, 0.96), rgba(225, 219, 207, 0.96)),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.015) 0, rgba(0, 0, 0, 0.015) 1px, transparent 1px, transparent 5px);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.06),
    inset 0 18px 28px rgba(255, 255, 255, 0.18);
}

#gameCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 18px;
  background: #f6f1e7;
  touch-action: none;
}

.stage-footer {
  display: none;
}

.status-text {
  display: block;
  color: var(--muted);
  font-size: 19.2px;
  line-height: 1.4;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  pointer-events: none;
  max-width: min(540px, calc(100% - 32px));
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(180, 155, 103, 0.28);
  background: rgba(18, 15, 12, 0.92);
  color: var(--text);
  font-size: 13px;
  text-align: center;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.3);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(7, 6, 5, 0.74);
  backdrop-filter: blur(10px);
}

.overlay-panel {
  position: relative;
  width: min(1220px, 100%);
  height: min(860px, calc(100dvh - 32px));
  max-height: min(860px, calc(100dvh - 32px));
  min-height: 0;
  padding: 18px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
}

.player-map-completion-overlay .overlay-panel {
  position: relative;
  width: min(560px, 100%);
  height: auto;
  max-height: calc(100dvh - 32px);
  padding: 22px;
  grid-template-rows: auto auto;
  gap: 16px;
}

.player-map-completion-overlay .overlay-header {
  align-items: flex-start;
  padding-right: 96px;
}

.player-map-completion-overlay .overlay-header-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  justify-self: auto;
}

.player-map-completion-overlay .overlay-actions {
  justify-content: stretch;
}

.player-map-completion-overlay .overlay-actions button {
  flex: 1 1 190px;
}

.player-map-completion-overlay .level-list {
  display: none;
}

#confirmOverlay {
  z-index: 130;
}

#introGuideOverlay {
  z-index: 135;
  padding: 0;
}

.welcome-splash-overlay {
  z-index: 132;
  padding: 0;
  background: rgba(7, 6, 5, 0.84);
  backdrop-filter: blur(10px);
}

.welcome-splash-logo {
  display: block;
  width: min(1500px, 96vw);
  max-height: 84dvh;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.5));
  transform-origin: center;
  animation: welcomeSplashZoom 2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes welcomeSplashZoom {
  0% {
    opacity: 0;
    transform: scale(0.16);
  }

  10% {
    opacity: 1;
  }

  84% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.intro-guide-panel {
  width: 100vw;
  height: 100dvh;
  max-height: none;
  padding: clamp(12px, 2vmin, 24px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(10px, 1.6vmin, 18px);
  justify-items: center;
  align-items: center;
  border-radius: 0;
}

.intro-guide-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 0;
  object-fit: contain;
  border-radius: 8px;
}

.intro-guide-panel .primary-button {
  min-width: 150px;
}

.game-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 6, 5, 0.74);
  backdrop-filter: blur(10px);
}

.game-menu-card {
  position: relative;
  width: min(430px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  padding: 4px 12px 16px;
  border: 1px solid rgba(180, 155, 103, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(35, 30, 25, 0.98), rgba(18, 15, 12, 0.99)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0, rgba(255, 255, 255, 0.018) 1px, transparent 1px, transparent 5px);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
}

.game-menu-header {
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -22px;
  padding-bottom: 0;
}

.game-menu-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.game-menu-icon {
  display: block;
  width: 194px;
  height: 194px;
  object-fit: contain;
}

.game-menu-close-button {
  top: 8px;
  right: 8px;
}

.game-menu-actions {
  display: grid;
  gap: 10px;
  margin-top: -8px;
}

.game-menu-actions .secondary-button {
  width: 100%;
  min-height: 46px;
}

.game-menu-footer {
  display: flex;
  justify-content: center;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(180, 155, 103, 0.16);
}

.game-menu-version {
  color: var(--muted);
}

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

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

.corner-close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  left: auto;
  z-index: 4;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
}

.game-menu-card .game-menu-close-button {
  top: 8px;
  right: 8px;
}

#levelsOverlay .overlay-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}

#levelsOverlay .overlay-heading {
  min-width: 0;
}

#levelsOverlay .overlay-score-text {
  justify-self: center;
  margin: 0;
}

#levelsOverlay .overlay-header-actions {
  justify-self: end;
}

.player-map-completion-overlay .overlay-header {
  display: flex;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 12px;
}

.overlay-copy {
  margin: 6px 0 0;
}

.level-list {
  min-height: 0;
  max-height: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: start;
  overflow: auto;
  padding-right: 4px;
}

.level-list,
.player-maps-list,
.tool-tips-list,
.game-menu-card {
  scrollbar-width: auto;
  scrollbar-color: #d8ccb9 rgba(24, 20, 16, 0.82);
}

.level-list::-webkit-scrollbar,
.player-maps-list::-webkit-scrollbar,
.tool-tips-list::-webkit-scrollbar,
.game-menu-card::-webkit-scrollbar {
  width: 18px;
}

.level-list::-webkit-scrollbar-track,
.player-maps-list::-webkit-scrollbar-track,
.tool-tips-list::-webkit-scrollbar-track,
.game-menu-card::-webkit-scrollbar-track {
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      transparent calc(50% - 2px),
      rgba(94, 82, 69, 0.42) calc(50% - 2px),
      rgba(94, 82, 69, 0.42) calc(50% + 2px),
      transparent calc(50% + 2px)
    );
}

.level-list::-webkit-scrollbar-thumb,
.player-maps-list::-webkit-scrollbar-thumb,
.tool-tips-list::-webkit-scrollbar-thumb,
.game-menu-card::-webkit-scrollbar-thumb {
  min-height: 54px;
  border-radius: 999px;
  border: 3px solid rgba(93, 82, 71, 0.96);
  background: linear-gradient(180deg, #f6f1e7 0%, #e2d5c3 48%, #bfa58b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.46),
    0 2px 8px rgba(0, 0, 0, 0.18);
}

.level-list::-webkit-scrollbar-thumb:hover,
.player-maps-list::-webkit-scrollbar-thumb:hover,
.tool-tips-list::-webkit-scrollbar-thumb:hover,
.game-menu-card::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #fbf7ef 0%, #eadfce 48%, #c6ad95 100%);
}

.level-section {
  border: 1px solid rgba(180, 155, 103, 0.18);
  border-radius: 18px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(40, 34, 28, 0.92), rgba(19, 16, 13, 0.94));
}

.level-section-title {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.level-section-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.campaign-level-card {
  position: relative;
  min-height: 132px;
}

.campaign-level-card .level-button {
  width: 100%;
  height: 100%;
  padding-right: 76px;
}

.campaign-level-edit-button {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 54px;
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  z-index: 1;
}

.level-button {
  text-align: left;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(180, 155, 103, 0.18);
  background: linear-gradient(180deg, rgba(55, 48, 40, 0.94), rgba(21, 18, 15, 0.96));
  color: var(--text);
  cursor: pointer;
  min-height: 132px;
}

.level-button.active {
  border-color: var(--line-strong);
}

.level-button.locked {
  opacity: 0.42;
}

.level-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.level-button h3 {
  margin: 0;
  font-size: 18px;
}

.level-medals {
  min-height: 25px;
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.level-medals.empty {
  opacity: 0;
}

.level-meta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.level-score-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.level-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.level-score-row span {
  color: var(--muted);
}

.level-score-row strong {
  color: var(--text);
}

.player-maps-panel {
  width: min(1180px, 100%);
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.player-maps-panel .overlay-copy {
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.tool-tips-panel {
  width: min(760px, 100%);
  height: auto;
  max-height: calc(100dvh - 32px);
  grid-template-rows: auto minmax(0, 1fr);
}

.tool-tips-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding-right: 4px;
}

.tool-tip-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 10px;
  border: 1px solid rgba(180, 155, 103, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(45, 38, 31, 0.94), rgba(20, 17, 14, 0.96));
}

.tool-tip-icon {
  position: relative;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(180, 155, 103, 0.24);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(60, 52, 44, 0.96), rgba(24, 20, 17, 0.98));
}

.tool-tip-icon svg {
  width: 34px;
  height: 34px;
}

.tool-tip-copy h3 {
  margin: 0;
  color: var(--accent);
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tool-tip-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.player-maps-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid rgba(180, 155, 103, 0.18);
  padding-bottom: 10px;
}

#playerMapsOverlay.map-creator-mode .player-maps-tabs,
#playerMapsOverlay.map-creator-mode .player-maps-controls {
  display: none !important;
}

#playerMapsOverlay.map-creator-mode .player-maps-list {
  grid-row: 2 / 5;
}

.player-maps-tab {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(180, 155, 103, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.player-maps-tab.active {
  border-color: var(--line-strong);
  background: rgba(214, 176, 103, 0.15);
  color: var(--accent);
}

#playerMapsMineTab {
  margin-left: auto;
}

.player-maps-controls {
  grid-row: 3;
  min-height: 36px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 12px;
}

.player-maps-search {
  display: flex;
  align-items: flex-end;
  flex: 1 1 auto;
  gap: 12px;
}

.player-maps-search label {
  display: grid;
  gap: 6px;
  width: min(320px, 100%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.player-maps-search input {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(180, 155, 103, 0.24);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(12, 9, 7, 0.82);
  color: var(--text);
  font: inherit;
}

.player-maps-refresh-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border: 0;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  background: transparent;
  box-shadow: none;
  font-size: 18px;
  line-height: 1;
}

.player-maps-refresh-button:hover,
.player-maps-refresh-button:focus-visible {
  background: transparent;
  box-shadow: none;
}

.player-maps-refresh-button img {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  pointer-events: none;
}

#playerMapsOverlay.player-maps-locked .player-maps-tabs,
#playerMapsOverlay.player-maps-locked .player-maps-controls {
  opacity: 0.38;
  filter: grayscale(1);
  pointer-events: none;
}

.player-maps-locked-card {
  min-height: 320px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(180, 155, 103, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(57, 56, 54, 0.84), rgba(22, 21, 20, 0.96)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 2px, transparent 2px, transparent 12px);
  color: rgba(232, 226, 215, 0.72);
  text-align: center;
}

.player-maps-locked-content {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 24px;
}

.player-maps-locked-content p {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.player-map-card.is-slot-locked {
  opacity: 0.48;
  filter: grayscale(1);
  cursor: default;
}

.player-map-slot-lock-message {
  margin: auto 0 0;
  color: rgba(232, 226, 215, 0.82);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.player-maps-sign-in-button {
  min-width: 170px;
}

.player-maps-list {
  grid-row: 4;
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 12px;
  align-content: start;
  padding-right: 4px;
}

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

.player-maps-footer-actions {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.player-maps-footer-actions .secondary-button {
  min-width: 190px;
}

.player-map-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  min-height: 258px;
  padding: 12px;
  border: 1px solid rgba(180, 155, 103, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(55, 48, 40, 0.94), rgba(21, 18, 15, 0.96));
  color: var(--text);
  cursor: pointer;
}

.player-map-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.player-map-card-header h3 {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-map-card:hover,
.player-map-card:focus-visible {
  border-color: var(--line-strong);
}

.player-map-card.placeholder {
  background:
    linear-gradient(180deg, rgba(42, 37, 31, 0.82), rgba(18, 15, 12, 0.9)),
    repeating-linear-gradient(135deg, rgba(214, 176, 103, 0.08) 0, rgba(214, 176, 103, 0.08) 2px, transparent 2px, transparent 10px);
}

.player-map-card.is-published {
  border-color: rgba(85, 204, 111, 0.85);
  box-shadow:
    0 0 0 2px rgba(85, 204, 111, 0.38),
    0 14px 28px rgba(0, 0, 0, 0.22);
}

.player-map-card h3 {
  margin: 0;
  font-size: 18px;
}

.map-creator-card .player-map-card-header h3 {
  font-size: 14px;
  line-height: 38px;
}

.player-map-thumbnail {
  position: relative;
  width: 100%;
  aspect-ratio: 20 / 9;
  margin: 0 0 12px;
  overflow: hidden;
  border: 1px solid rgba(180, 155, 103, 0.2);
  border-radius: 6px;
  background: #f6f1e7;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.player-map-card-header + .player-map-thumbnail {
  margin-top: 12px;
}

.player-map-thumbnail svg {
  display: block;
  width: 100%;
  height: 100%;
}

.player-map-thumbnail-empty {
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(52, 45, 37, 0.94), rgba(26, 22, 18, 0.96)),
    repeating-linear-gradient(135deg, rgba(214, 176, 103, 0.08) 0, rgba(214, 176, 103, 0.08) 2px, transparent 2px, transparent 10px);
  color: rgba(241, 211, 138, 0.72);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.player-map-publish-toggle-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(180, 155, 103, 0.38);
  border-radius: 8px;
  background: rgba(42, 34, 22, 0.72);
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.player-map-publish-toggle-button.is-unpublish {
  border-color: rgba(179, 101, 82, 0.38);
  background: rgba(42, 25, 22, 0.72);
  color: #d9b2a9;
}

.player-map-publish-toggle-button:not(:disabled):hover,
.player-map-publish-toggle-button:not(:disabled):focus-visible {
  border-color: var(--line-strong);
  color: #f2d38b;
}

.player-map-publish-toggle-button.is-unpublish:not(:disabled):hover,
.player-map-publish-toggle-button.is-unpublish:not(:disabled):focus-visible {
  border-color: rgba(179, 101, 82, 0.72);
  color: #f0d1c9;
}

.player-map-publish-toggle-button:disabled {
  opacity: 0.34;
  cursor: not-allowed;
}

.player-map-meta,
.player-map-action,
.player-map-empty {
  color: var(--muted);
  font-size: 13px;
}

.player-map-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.player-map-meta-row span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-map-meta-row span:last-child {
  flex: 0 0 auto;
  white-space: nowrap;
}

.player-map-creator-meta-row {
  margin-top: 10px;
}

.player-map-status-inline.is-published {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.player-map-meta {
  margin: 10px 0 0;
  line-height: 1.45;
}

.player-map-like-count {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid rgba(214, 176, 103, 0.58);
  border-radius: 999px;
  background: rgba(21, 18, 15, 0.82);
  color: #f1d38a;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
}

.player-map-unlike-control {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  margin-top: 10px;
  padding: 0 10px;
  border: 1px solid rgba(179, 101, 82, 0.38);
  border-radius: 8px;
  background: rgba(42, 25, 22, 0.72);
  color: #f0d1c9;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.player-map-unlike-control:hover,
.player-map-unlike-control:focus-visible {
  border-color: rgba(179, 101, 82, 0.72);
  color: #ffe4dc;
}

.player-map-status-muted {
  text-transform: none;
}

#playerMapLikeButton.is-liked {
  border-color: rgba(214, 176, 103, 0.86);
  background: linear-gradient(180deg, rgba(112, 88, 45, 0.98), rgba(69, 52, 26, 1));
  color: #fff0b8;
  box-shadow:
    inset 0 0 0 1px rgba(255, 239, 184, 0.18),
    0 10px 18px rgba(0, 0, 0, 0.24);
}

#playerMapLikeButton.is-liked:disabled {
  opacity: 1;
  cursor: default;
}

.confirm-panel {
  width: min(560px, 100%);
  padding: 22px;
  display: grid;
  gap: 16px;
}

.confirm-panel h2 {
  margin: 0;
  color: var(--accent);
  font-size: 24px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.confirm-message {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-line;
}

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

#confirmOverlay.map-test-completed-dialog .confirm-panel {
  width: min(420px, 100%);
  justify-items: stretch;
  text-align: center;
}

#confirmOverlay.map-test-completed-dialog .confirm-panel h2 {
  font-size: 26px;
}

#confirmOverlay.map-test-completed-dialog .confirm-actions {
  flex-direction: row-reverse;
  justify-content: stretch;
}

#confirmOverlay.map-test-completed-dialog .confirm-actions button {
  flex: 1 1 170px;
}

.player-map-action {
  margin: auto 0 0;
  padding-top: 18px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.player-map-empty {
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(180, 155, 103, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(40, 34, 28, 0.92), rgba(19, 16, 13, 0.94));
}

.scoreboard-card,
.score-card {
  border: 1px solid rgba(180, 155, 103, 0.18);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(40, 34, 28, 0.92), rgba(19, 16, 13, 0.94));
}

.scoreboard-empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.scoreboard-table {
  display: grid;
  gap: 8px;
}

.scoreboard-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1.6fr) minmax(140px, 1fr) minmax(120px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
}

.scoreboard-row span:nth-child(3),
.scoreboard-row span:nth-child(4) {
  text-align: right;
}

.scoreboard-row-header {
  background: rgba(214, 176, 103, 0.12);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
}

.score-group {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.score-group h3 {
  margin: 0;
  color: var(--accent);
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.score-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
}

.score-line strong {
  color: var(--text);
}

.score-line.muted {
  color: var(--muted);
}

.score-line.total-formula {
  border: 1px solid rgba(180, 155, 103, 0.18);
}

.score-total {
  margin-top: 8px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(214, 176, 103, 0.12);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-total-with-medals {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.score-medal-requirements {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.score-medal-requirements:empty {
  display: none;
}

.score-note {
  margin: 14px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.score-note.accent {
  color: var(--accent);
}

.score-earned-medal {
  margin: 12px auto 0;
  width: fit-content;
  color: var(--accent);
  font-size: 72px;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  padding: 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #0c0907;
  isolation: isolate;
}

body.auth-locked #app {
  opacity: 0;
  pointer-events: none;
  user-select: none;
  visibility: hidden;
}

.auth-demo-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-demo-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 5, 5, 0.24), rgba(5, 5, 5, 0.36)),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.38));
  pointer-events: none;
}

.auth-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #0c0907;
}

.auth-card {
  position: relative;
  z-index: 2;
  width: min(470px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(180, 155, 103, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(35, 30, 25, 0.98), rgba(18, 15, 12, 0.99)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0, rgba(255, 255, 255, 0.018) 1px, transparent 1px, transparent 5px);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
}

.auth-intro {
  display: block;
  margin-bottom: 18px;
}

.auth-intro > div {
  width: 100%;
}

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

.auth-title-image {
  display: block;
  width: calc(100% + 24px);
  max-width: none;
  aspect-ratio: 2 / 1;
  margin: -42px -12px -20px;
  object-fit: cover;
  object-position: center;
}

.auth-eyebrow,
.account-summary,
.auth-message {
  margin: 0;
}

.auth-eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-card h2 {
  margin: 4px 0 8px;
  font-size: 28px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-summary,
.auth-message {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.account-summary p {
  margin: 0;
}

.account-summary p:first-child {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(214, 176, 103, 0.34);
  border-radius: 8px;
  color: #f7e7bf;
  background: rgba(214, 176, 103, 0.12);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.account-summary ul {
  margin: 10px 0;
  padding-left: 0;
  list-style: none;
}

.account-summary li + li {
  margin-top: 7px;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.feature-list li span:first-child {
  color: #9bd07a;
  font-weight: 700;
}

.account-summary-cta {
  color: #f2deae;
  font-weight: 700;
}

.auth-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.auth-badge {
  padding: 6px 8px;
  border: 1px solid rgba(180, 155, 103, 0.2);
  border-radius: 8px;
  color: #eadcc4;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.tab-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(180, 155, 103, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.tab-button,
.auth-primary,
.auth-choice-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.tab-button {
  background: transparent;
}

.tab-button.active {
  border-color: rgba(180, 155, 103, 0.34);
  background: rgba(214, 176, 103, 0.14);
  color: var(--accent);
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-form input {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid rgba(180, 155, 103, 0.28);
  border-radius: 8px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  font: inherit;
}

.auth-form input:focus {
  outline: 2px solid rgba(214, 176, 103, 0.34);
  outline-offset: 2px;
}

.auth-warning-note {
  margin: 0;
  color: #f2cf7c;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.auth-warning-note span {
  display: block;
}

.auth-primary {
  background: linear-gradient(180deg, rgba(102, 82, 47, 0.98), rgba(60, 47, 28, 1));
}

.auth-large-cta {
  width: 100%;
  min-height: 50px;
  margin-top: 16px;
  font-weight: 700;
}

.auth-form-panel {
  max-height: 420px;
  opacity: 1;
  overflow: hidden;
  transition:
    max-height 260ms ease,
    opacity 220ms ease,
    margin-top 220ms ease,
    visibility 220ms ease;
}

.auth-form-panel.is-collapsed {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.auth-form-panel.is-expanded {
  max-height: 420px;
}

#loginForm.auth-form-panel.is-expanded {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(180, 155, 103, 0.18);
}

.auth-bottom-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(180, 155, 103, 0.18);
}

.auth-bottom-choice {
  display: grid;
  gap: 7px;
  align-content: end;
}

.auth-bottom-choice p {
  min-height: 32px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
}

.auth-choice-button {
  width: 100%;
  min-height: 36px;
  color: var(--text);
  border-color: rgba(180, 155, 103, 0.24);
  background: linear-gradient(180deg, rgba(102, 82, 47, 0.98), rgba(60, 47, 28, 1));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 18px rgba(0, 0, 0, 0.2);
}

.auth-choice-button:hover {
  border-color: rgba(180, 155, 103, 0.42);
}

.auth-message {
  min-height: 20px;
  margin-top: 12px;
}

.auth-message.error {
  color: var(--danger);
}

.auth-message.success {
  color: var(--accent);
}

@media (max-width: 980px) {
  #app {
    width: calc(100% - 12px);
    padding: 6px 0;
    gap: 8px;
  }

  .topbar,
  .stage-panel {
    padding: 8px;
  }

  .toolbar-row {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .toolbar-row > .tool-grid,
  .toolbar-row > .topbar-logo,
  .toolbar-row > .action-row {
    grid-column: 1;
  }

  .topbar-logo {
    order: -1;
    width: min(360px, 100%);
    max-height: 96px;
  }

  .topbar-logo img {
    max-height: 96px;
  }

  .action-row {
    justify-items: center;
    width: 100%;
  }

  .sync-status {
    text-align: center;
  }

  .menu-action-row,
  .play-action-row {
    justify-content: center;
  }

  .menu-action-row {
    flex-wrap: wrap;
  }

  .play-action-row {
    flex-wrap: wrap;
  }

  .tool-grid {
    grid-template-columns: repeat(5, 50px);
    justify-content: center;
  }

  .tool-button {
    width: 50px;
    height: 50px;
  }

  .tool-button svg {
    width: 30px;
    height: 30px;
  }

  .tool-hotkey-badge {
    top: 3px;
    left: 3px;
    min-width: 16px;
    height: 16px;
    font-size: 9px;
  }

  .primary-button,
  .secondary-button {
    min-height: 38px;
    padding: 0 12px;
  }

  .overlay-panel {
    padding: 14px;
  }

  .level-hint {
    font-size: 11px;
  }

  .status-text {
    font-size: 20px;
  }

  .scoreboard-row {
    grid-template-columns: 52px minmax(0, 1fr) 108px 96px;
    gap: 8px;
    padding: 10px;
    font-size: 12px;
  }

  .player-map-grid {
    grid-template-columns: 1fr;
  }

  .player-maps-tabs {
    flex-wrap: wrap;
  }
}

/* FC BUILD V6: use SVG as the primary playfield so build parts are always visible. */
.fc-stage-svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 20 / 9;
  border-radius: 18px;
  background: #f6f1e7;
  touch-action: none;
  user-select: none;
}
