:root {
  color-scheme: dark;
  --bg: #101312;
  --panel: #171c1a;
  --panel-strong: #202824;
  --text: #f2f6f0;
  --muted: #aeb8ad;
  --accent: #f0c44d;
  --accent-strong: #ffdd6e;
  --danger: #ff775f;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  padding: 18px;
}

.login-panel {
  display: grid;
  min-height: calc(100vh - 36px);
  place-items: center;
}

.login-form {
  width: min(100%, 360px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-form h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0;
}

.login-form p {
  margin: 6px 0 18px;
  color: var(--muted);
}

.code-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.code-field input {
  width: 100%;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #0d100f;
  color: var(--text);
  font: inherit;
  font-size: 1.15rem;
  padding: 0 12px;
}

.code-field input:focus {
  border-color: var(--accent);
  outline: none;
}

.primary-button {
  width: 100%;
  min-height: 42px;
  margin-top: 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #151006;
  cursor: pointer;
  font-weight: 800;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.login-error {
  color: var(--danger) !important;
  font-weight: 750;
}

.map-panel {
  width: min(100%, 1280px);
  margin: 0 auto;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 14px;
}

.map-toolbar h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2rem);
  font-weight: 750;
  letter-spacing: 0;
}

.map-toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.ghost-button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
}

.ghost-button:hover {
  border-color: rgba(240, 196, 77, 0.7);
}

.toolbar-actions {
  display: flex;
  gap: 10px;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  align-items: start;
}

.map-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #0a0d0c;
  box-shadow: var(--shadow);
}

.timer-panel {
  position: sticky;
  top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.timer-panel-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.timer-panel-header h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.timer-panel-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.timer-list {
  display: grid;
  gap: 1px;
  background: rgba(255, 255, 255, 0.07);
}

.timer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 50px;
  border: 0;
  background: var(--panel);
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.timer-row:hover,
.timer-row:focus-visible {
  background: var(--panel-strong);
  outline: none;
}

.timer-row-name {
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-row-time {
  min-width: 64px;
  border-radius: 8px;
  background: rgba(240, 196, 77, 0.11);
  color: var(--accent-strong);
  padding: 6px 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  text-align: center;
}

.timer-row.is-low .timer-row-time {
  background: rgba(255, 119, 95, 0.13);
  color: var(--danger);
}

.map-image {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

.markers-layer {
  position: absolute;
  inset: 0;
}

.map-marker {
  position: absolute;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  box-shadow:
    0 0 0 4px rgba(240, 196, 77, 0.2),
    0 0 24px rgba(240, 196, 77, 0.5);
  cursor: pointer;
  transition:
    transform 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.map-marker::before {
  content: "";
  position: absolute;
  inset: -12px;
  border: 2px solid rgba(240, 196, 77, 0.42);
  border-radius: inherit;
  animation: pulse 1.8s ease-out infinite;
}

.map-marker::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: inherit;
  background: #1b1300;
}

.map-marker:hover,
.map-marker:focus-visible {
  background: var(--accent-strong);
  box-shadow:
    0 0 0 5px rgba(255, 221, 110, 0.23),
    0 0 32px rgba(255, 221, 110, 0.72);
  outline: none;
}

.map-marker:active {
  transform: translate(-50%, -50%) scale(0.9);
}

.map-marker.is-low {
  background: var(--danger);
  box-shadow:
    0 0 0 4px rgba(255, 119, 95, 0.2),
    0 0 24px rgba(255, 119, 95, 0.5);
}

.marker-timer {
  position: absolute;
  left: 50%;
  bottom: 42px;
  min-width: 56px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(16, 19, 18, 0.9);
  color: var(--text);
  padding: 5px 8px;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.marker-name {
  position: absolute;
  left: 50%;
  top: 41px;
  transform: translateX(-50%);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  pointer-events: none;
}

.placement-readout {
  margin-top: 12px;
  border: 1px solid rgba(240, 196, 77, 0.32);
  border-radius: 8px;
  background: rgba(240, 196, 77, 0.08);
  color: var(--text);
  padding: 10px 12px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.88rem;
}

body.is-placing .map-frame {
  cursor: crosshair;
}

@keyframes pulse {
  from {
    opacity: 0.8;
    transform: scale(0.8);
  }

  to {
    opacity: 0;
    transform: scale(1.45);
  }
}

@media (max-width: 680px) {
  .page-shell {
    padding: 10px;
  }

  .map-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
  }

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

  .timer-panel {
    position: static;
  }

  .ghost-button {
    width: 100%;
  }

  .map-marker {
    width: 28px;
    height: 28px;
  }

  .marker-timer {
    bottom: 35px;
    min-width: 50px;
    font-size: 0.72rem;
  }
}
