/* ImagineX brand tokens. Mirror of public/css/styles.css on the website:
   Comic Book Pop Art — electric blue, hot pink, sunshine yellow, comic red,
   black on cream, 4px black borders, hard offset shadows. */
:root {
  --primary-blue: #0066FF;
  --primary-blue-dark: #0047AB;
  --secondary-pink: #FF1493;
  --accent-yellow: #FFD700;
  --comic-red: #FF3131;
  --text-black: #000000;
  --text-gray: #333333;
  --bg-white: #FFFFFF;
  --bg-cream: #FFFEF2;
  --shadow: 4px 4px 0px rgba(0, 0, 0, 1);
  --shadow-hover: 6px 6px 0px rgba(0, 0, 0, 1);
  --border-radius: 8px;
  --border-width: 4px;
  --on-primary: #FFFFFF;
  --on-secondary: #FFFFFF;
  --on-tertiary: #000000;
  --font-display: 'Bangers', 'Bebas Neue', Impact, sans-serif;
  --font-heading: 'Bebas Neue', 'Oswald', Impact, sans-serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-body);
  background: linear-gradient(to bottom, #0a2342 0%, #05182e 50%, #020d1a 100%);
}

#aquarium-container {
  width: 100%;
  height: 100%;
  position: relative;
}

#aquarium-container canvas {
  display: block;
}

/* Aquarium Logo (top-left corner) */
#aquarium-logo {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.5s ease-in;
}

#aquarium-logo.visible {
  opacity: 0.85;
}

#aquarium-logo img {
  height: 30px;
  max-width: 220px;
  object-fit: contain;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

#aquarium-logo:hover {
  opacity: 1;
}

/* Loading screen */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--accent-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s ease-out;
}

/* Halftone dot pattern overlay */
#loading-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.35) 2px, transparent 2px);
  background-size: 12px 12px;
  pointer-events: none;
  z-index: 1;
}

/* Dashed border frame */
#loading-screen::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  border: 8px dashed #000000;
  border-radius: 12px;
  pointer-events: none;
  z-index: 1;
}

#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
  color: white;
  max-width: 500px;
  position: relative;
  z-index: 2;
}

.loading-content .splash-logo {
  width: auto;
  max-width: 80vw;
  object-fit: contain;
  height: 150px;
  margin-bottom: 0.5rem;
  animation: float 3s ease-in-out infinite;
}

.loading-content h1 {
  font-family: var(--font-display);
  font-size: 4.5rem;
  margin-bottom: 0.5rem;
  animation: float 3s ease-in-out infinite;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-black);
  text-shadow: 3px 3px 0px var(--accent-yellow), 6px 6px 0px var(--primary-blue);
}

.loading-content .subtitle {
  font-size: 1rem;
  margin: 2rem auto 0;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  display: inline-block;
  padding: 12px 30px;
  background: var(--primary-blue);
  color: var(--on-primary);
  border: 4px solid #000000;
  box-shadow: 6px 6px 0 #000000;
  transform: rotate(1.5deg);
  font-family: var(--font-heading);
}

.progress-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
  margin: 1.5rem 0 1rem 0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary-blue);
  border-radius: 10px;
  transition: width 0.3s ease-out;
  box-shadow: 0 0 10px rgba(0, 102, 255, 0.5);
  animation: shimmer 2s infinite;
}

.progress-text {
  font-size: 0.9rem;
  color: var(--on-tertiary);
}

.loading-content .loading-footer {
  color: var(--on-tertiary);
  opacity: 0.7;
  opacity: 0.7;
  margin-top: 0.5rem;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes shimmer {
  0% { opacity: 1; }
  50% { opacity: 0.8; }
  100% { opacity: 1; }
}

/* Status toasts (connection, restores, errors). Positioned from JS. */
.status-message {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.3;
  max-width: 320px;
  padding: 12px 18px;
  color: var(--text-black);
  background: var(--bg-white);
  border: var(--border-width) solid var(--text-black);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.status-success { background: var(--accent-yellow); }
.status-info    { background: var(--bg-white); }
.status-warning { background: var(--secondary-pink); color: var(--bg-white); }
.status-error   { background: var(--comic-red); color: var(--bg-white); }

/* Keyboard shortcuts info */
.shortcuts {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-cream);
  color: var(--text-black);
  padding: 14px 18px;
  border: var(--border-width) solid var(--text-black);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 100;
}

.shortcuts.visible {
  opacity: 1;
}

.shortcuts p {
  margin: 5px 0;
}

.shortcuts kbd {
  display: inline-block;
  min-width: 2.2em;
  text-align: center;
  background: var(--accent-yellow);
  color: var(--text-black);
  border: 2px solid var(--text-black);
  box-shadow: 2px 2px 0 var(--text-black);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-heading);
  font-size: 13px;
  letter-spacing: 1px;
  margin-right: 8px;
}

/* Loading screen footer */
.loading-footer {
  color: white;
  font-size: 0.7rem;
  opacity: 0.7;
  padding-bottom: 1px;
  border-bottom: 2px solid #ffd700;
  display: inline-block;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
}

/* Fullscreen button */
.fullscreen-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--primary-blue);
  color: var(--bg-white);
  border: var(--border-width) solid var(--text-black);
  box-shadow: var(--shadow);
  padding: 10px 18px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 16px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 100;
}

.fullscreen-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-hover);
}

/* Pairing overlay: the brand's yellow halftone card, code in the display face */
#pairing-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-yellow);
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.35) 2px, transparent 2px);
  background-size: 12px 12px;
}
#pairing-overlay[hidden] { display: none; }
.pairing-card {
  background: var(--bg-cream);
  border: 6px solid var(--text-black);
  box-shadow: 12px 12px 0 var(--text-black);
  border-radius: 12px;
  padding: 48px 64px;
  text-align: center;
  max-width: 820px;
  width: calc(100vw - 80px);
}
.pairing-logo { height: 64px; width: auto; max-width: 70%; object-fit: contain; margin-bottom: 20px; }
.pairing-eyebrow {
  font-family: var(--font-heading);
  font-size: 28px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-black);
  margin: 0 0 10px;
}
.pairing-code {
  font-family: var(--font-display);
  font-size: clamp(96px, 16vw, 200px);
  line-height: 1;
  letter-spacing: 0.12em;
  color: var(--primary-blue);
  text-shadow: 6px 6px 0 var(--text-black);
  margin: 10px 0 18px;
  white-space: nowrap;
}
.pairing-help { font-family: var(--font-body); font-weight: 700; font-size: 20px; color: var(--text-black); margin: 0 0 8px; }
.pairing-status { font-family: var(--font-body); font-weight: 800; font-size: 20px; color: var(--primary-blue-dark); margin: 0; min-height: 1.4em; }
.pairing-error { font-family: var(--font-body); font-weight: 800; font-size: 16px; color: var(--comic-red); margin: 8px 0 0; min-height: 1.4em; }

/* QR card for visitors' phones */
#qr-card {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  width: 200px;
  background: var(--bg-cream);
  border: var(--border-width) solid var(--text-black);
  box-shadow: var(--shadow-hover);
  border-radius: var(--border-radius);
  padding: 12px 12px 10px;
  text-align: center;
  transform: rotate(-1.5deg);
}
#qr-card[hidden] { display: none; }
.qr-title { font-family: var(--font-heading); font-size: 22px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-black); margin: 0 0 8px; }
.qr-image svg { width: 100%; height: auto; display: block; border: 3px solid var(--text-black); border-radius: 6px; background: #fff; }
.qr-url { font-family: var(--font-body); font-weight: 800; font-size: 13px; color: var(--primary-blue-dark); margin: 8px 0 0; word-break: break-all; }
