:root {
  --bg: #0b0b0b;
  --fg: #ffa500;
  --muted: #c78b2b;
  --link: #4cc9f0;
  --link-hover: #72eaff;
  --panel: #141414;
  --chip: #1d1d1d;
  --good: #42aa00;
}

* {
  box-sizing: border-box;
}

body {
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  background: var(--bg);
  color: var(--fg);
  margin: 0;
}

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 12px 80px;
}

header h1 {
  margin: 0 0 8px;
}

.sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 900px;
  text-align: center;
}

.controls {
  width: min(1100px, 95vw);
  background: var(--panel);
  padding: 12px;
  border-radius: 12px;
  display: grid;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  border: 1px solid #222;
}

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.bar {
  position: relative;
  height: 10px;
  flex: 1;
  background: #1a1a1a;
  border-radius: 999px;
  overflow: hidden;
}

.bar > span {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--good), #8ef0b0);
}

.chip {
  background: var(--chip);
  border: 1px solid #222;
  border-radius: 999px;
  padding: 6px 10px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 0.9rem;
  white-space: nowrap;
}

.countdown-chip {
  gap: 12px;
}

.alarm-wrapper {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.alarm-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  cursor: pointer;
  border: 1px solid #262626;
  background: #101010;
  color: #bbb;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.icon-btn:hover {
  background: #181818;
  color: #fff;
}

.alarm-btn {
  font-size: 1rem;
}

.alarm-active {
  background: rgba(66, 170, 0, 0.18);
  color: var(--good);
  box-shadow: 0 0 0 2px rgba(66, 170, 0, 0.35);
}

.alarm-summary {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: var(--good);
}

.alarm-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: #111;
  border: 1px solid #272727;
  border-radius: 14px;
  padding: 14px 16px;
  width: min(320px, 90vw);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 50;
}

.alarm-title {
  margin: 0;
  font-size: 0.9rem;
  color: #f3ad48;
}

.alarm-choices {
  display: flex;
  gap: 8px;
}

.alarm-choice {
  flex: 1;
  border: 1px solid #2c2c2c;
  border-radius: 10px;
  background: #141414;
  color: #eee;
  padding: 8px 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.alarm-choice:hover {
  background: #1a1a1a;
}

.alarm-choice.selected {
  border-color: var(--fg);
  background: rgba(255, 140, 0, 0.15);
}

.alarm-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.alarm-toggle {
  flex: 1 1 120px;
  border: 1px solid #2c2c2c;
  border-radius: 10px;
  padding: 8px 10px;
  background: #141414;
  color: #eee;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.alarm-toggle:hover {
  background: #1a1a1a;
}

.alarm-toggle.active {
  border-color: var(--fg);
  color: var(--fg);
}

.alarm-note {
  margin: 0;
  font-size: 0.8rem;
  color: #f59f0b;
}

.alarm-footer {
  display: flex;
  justify-content: flex-end;
}

.alarm-clear {
  border: 1px solid #2c2c2c;
  border-radius: 10px;
  padding: 6px 10px;
  background: #151515;
  color: #f3ad48;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.alarm-clear:hover {
  background: #1c1c1c;
}

.alarm-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: transparent;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 8000;
}

.alarm-overlay.show {
  opacity: 1;
  animation: alarm-flash 0.8s steps(1, end) infinite;
}

@keyframes alarm-flash {
  0% {
    background: rgba(0, 0, 0, 0.96);
  }
  50% {
    background: rgba(255, 140, 0, 0.95);
  }
  100% {
    background: rgba(0, 0, 0, 0.96);
  }
}

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

.btn {
  cursor: pointer;
  border: 1px solid #262626;
  background: #101010;
  color: #eee;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 600;
}

.btn:hover {
  background: #151515;
}

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

.template-row {
  display: flex;
  gap: 8px;
}

.text {
  width: 100%;
  background: #0f0f0f;
  color: #ddd;
  border: 1px solid #262626;
  border-radius: 10px;
  padding: 8px 10px;
}

.grid {
  width: min(1100px, 95vw);
  display: grid;
  gap: 10px 12px;
}

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

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

.tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #0f0f0f;
  border: 1px solid #1f1f1f;
  border-radius: 10px;
}

.tile.claimed {
  opacity: 0.75;
  color: var(--good);
  border-color: var(--good);
  background: rgba(66, 170, 0, 0.15);
}

.tile input[type="checkbox"] {
  transform: scale(1.2);
  cursor: pointer;
  accent-color: var(--fg);
}

.map-link {
  color: var(--link);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.map-link:hover {
  color: var(--link-hover);
}

.edit-link {
  color: #aaa;
  background: transparent;
  border: none;
  cursor: pointer;
}

.edit-link:hover {
  color: #ddd;
}

.num {
  color: #e0e0e0;
  font-weight: 600;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.edit-pop {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: #101010;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  gap: 6px;
  z-index: 20;
  width: min(480px, 80vw);
}

.footer {
  margin-top: 18px;
  color: #999;
  font-size: 0.9rem;
  text-align: center;
  padding: 0 12px;
}

/* Responsive behavior: small screens (default grid-5), hide link/edit */
@media (max-width: 1023px) {
  .map-link,
  .edit-link,
  .edit-pop {
    display: none !important;
  }
}

/* Large screens: additional grid sizing and a denser control layout if desired */
@media (min-width: 1024px) {
  .controls {
    grid-template-columns: 1fr auto auto auto;
  }
}

.pumpkin-wave-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  transition: background 1.1s ease;
}

.pumpkin-wave-overlay.phase-blackout {
  background: rgba(0, 0, 0, 0.85);
}

.pumpkin-wave-overlay.phase-message {
  background: rgba(0, 0, 0, 0.95);
}

.pumpkin-wave-particles {
  position: absolute;
  inset: 0;
}

.pumpkin-wave-pumpkin {
  position: absolute;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 18px rgba(255, 130, 0, 0.45));
  opacity: 0;
}

.pumpkin-wave-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90vw;
  max-width: 1200px;
  transform: translate(-50%, -50%) scale(0.05);
  opacity: 0;
  transition: transform 1.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.8s ease-out;
  filter: drop-shadow(0 0 36px rgba(255, 140, 30, 0.65));
}

.pumpkin-wave-center.reveal {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.pumpkin-wave-center.fade-out {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.05);
  transition-duration: 0.8s;
}

.pumpkin-wave-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -40%);
  color: #ff7a18;
  font-family: "Creepster", "Nosifer", "Cinzel Decorative", "Copperplate", cursive;
  font-size: clamp(2.5rem, 8vw, 6rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0;
  text-shadow: 0 0 30px rgba(255, 120, 20, 0.75), 0 0 60px rgba(255, 90, 0, 0.6);
  transition: opacity 1.4s ease-out, transform 1.4s ease-out;
  pointer-events: none;
}

.pumpkin-wave-message.visible {
  opacity: 1;
  transform: translate(-50%, -50%);
}
