:root {
  --bg-deep: #070b12;
  --bg-sky: #0d1522;
  --bg-card: rgba(16, 24, 38, 0.85);
  --bg-card-hover: rgba(22, 34, 54, 0.95);
  --cyan: #00f0ff;
  --magenta: #ff2a8d;
  --amber: #f7c844;
  --violet: #a87ffb;
  --text-main: #e6edf5;
  --text-muted: #95a5bb;
  --text-dim: #62748c;
  --brass: #d4a359;
  --wire: #2b394d;
  --border-glass: rgba(0, 240, 255, 0.22);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--bg-deep);
  color-scheme: dark;
}

body {
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 240, 255, 0.12) 0%, transparent 60%),
    radial-gradient(circle at 85% 30%, rgba(255, 42, 141, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 15% 70%, rgba(168, 127, 251, 0.08) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-sky) 0%, var(--bg-deep) 100%);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  padding: 2rem 1rem 4rem;
}

.wrap {
  max-width: 58rem;
  margin: 0 auto;
}

/* Header & Roost Badge */
header {
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--wire);
  padding-bottom: 2rem;
  position: relative;
}

.high-wire-wire {
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--brass) 20%, var(--cyan) 50%, var(--magenta) 80%, transparent 100%);
  margin-bottom: 1.5rem;
  position: relative;
  box-shadow: 0 0 8px var(--cyan);
}

.bird-silhouette {
  position: absolute;
  top: -24px;
  right: 15%;
  font-size: 1.6rem;
  filter: drop-shadow(0 0 6px var(--amber));
  animation: perchBreeze 6s ease-in-out infinite alternate;
}

@keyframes perchBreeze {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-2px) rotate(1deg); }
  100% { transform: translateY(1px) rotate(-1deg); }
}

.telemetry-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
}

.telemetry-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 240, 255, 0.06);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  border: 1px solid rgba(0, 240, 255, 0.18);
  color: var(--cyan);
}

.telemetry-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

h1 {
  font-family: "Charter", "Georgia", "Iowan Old Style", serif;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 30%, var(--cyan) 75%, var(--magenta) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.6rem;
}

.tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 44rem;
  line-height: 1.5;
}

/* Observatory Stage */
.stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1.4rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4), 0 0 24px rgba(0, 240, 255, 0.08);
  margin-bottom: 2.5rem;
  backdrop-filter: blur(8px);
}

.stage-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.85rem;
  color: var(--amber);
  margin-bottom: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.canvas-container {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #04060a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
  cursor: crosshair;
}

#caustic-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.canvas-hint {
  position: absolute;
  bottom: 10px;
  left: 12px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.75rem;
  color: rgba(230, 237, 245, 0.6);
  pointer-events: none;
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Controls Deck */
.controls-deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.control-label {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  justify-content: space-between;
}

.control-val {
  color: var(--cyan);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 0.45rem 0.8rem;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--cyan);
  color: #fff;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn.active {
  background: var(--cyan);
  color: #070b12;
  border-color: var(--cyan);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.btn-brass {
  background: rgba(212, 163, 89, 0.12);
  border-color: var(--brass);
  color: var(--amber);
}

.btn-brass:hover {
  background: rgba(212, 163, 89, 0.25);
  border-color: var(--amber);
  color: #fff;
}

.btn-brass.active {
  background: var(--amber);
  color: #070b12;
  border-color: var(--amber);
  box-shadow: 0 0 12px rgba(247, 200, 68, 0.4);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cyan);
  cursor: pointer;
  box-shadow: 0 0 8px var(--cyan);
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* The Wire Knocker Section */
.knocker-section {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  background: linear-gradient(135deg, rgba(212, 163, 89, 0.08), rgba(255, 42, 141, 0.05));
  border: 1px solid rgba(212, 163, 89, 0.3);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  align-items: center;
}

.peck-btn {
  background: linear-gradient(180deg, #d4a359 0%, #a47633 100%);
  color: #120e06;
  font-family: "Charter", "Georgia", serif;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.9rem 1.6rem;
  border: 2px solid #f7c844;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 6px 0 #6b4d1b, 0 10px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.08s ease;
  white-space: nowrap;
}

.peck-btn:hover {
  background: linear-gradient(180deg, #e4b56c 0%, #b3823c 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #6b4d1b, 0 12px 24px rgba(0, 0, 0, 0.5);
}

.peck-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #6b4d1b, 0 4px 10px rgba(0, 0, 0, 0.3);
}

.wire-dispatch {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.wire-dispatch-title {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.75rem;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.wire-dispatch-body {
  font-family: "Charter", "Georgia", serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text-main);
  min-height: 2.8rem;
  display: flex;
  align-items: center;
}

/* Shinies Cabinet Grid */
.cabinet-heading {
  font-family: "Charter", "Georgia", serif;
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #fff;
}

.cabinet-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.4rem;
}

.shinies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
  margin-bottom: 3rem;
}

.shiny-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1.2rem;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.shiny-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.shiny-icon {
  font-size: 1.4rem;
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.shiny-title {
  font-family: "Charter", "Georgia", serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffffff;
}

.shiny-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex-grow: 1;
}

.shiny-math {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.78rem;
  color: var(--violet);
  background: rgba(168, 127, 251, 0.08);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  border-left: 2px solid var(--violet);
}

/* Footer & Navigation */
footer {
  border-top: 1px dashed var(--wire);
  padding-top: 2rem;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.4rem;
  list-style: none;
}

.nav-links a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.15s ease;
}

.nav-links a:hover {
  color: #ffffff;
  border-bottom-color: var(--cyan);
}

.colophon {
  font-style: italic;
  color: var(--text-dim);
}

@media (max-width: 600px) {
  body {
    padding: 1.2rem 0.8rem 3rem;
  }
  .knocker-section {
    grid-template-columns: 1fr;
  }
  .peck-btn {
    width: 100%;
    text-align: center;
  }
}
