/* ============================================================
   SALMON COUNTING — styles.css
   Museum / Science-Center Kiosk Interactive
   Aesthetic: sonar-cone · dark navy · white typography
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* --clr-bg:          #02030a; */
  --clr-bg: #06101c;
  --clr-bg-mid:      #050816;
  --clr-bg-surface:  #080f20;
  --clr-text:        #ffffff;
  --clr-text-dim:    #b0cce0;
  --clr-text-muted:  #6688aa;
  --clr-accent:      #9edaff;
  --clr-accent-glow: rgba(158, 218, 255, 0.35);
  --clr-secondary:   #5ed1ff;
  --clr-border:      rgba(255, 255, 255, 0.25);

  --font-ui:   'Segoe UI', 'SF Pro Display', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono: 'Courier New', 'Courier', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-xl: 36px;

  --shadow-deep: 0 8px 40px rgba(0, 0, 0, 0.6);

  --trans-screen: 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  --trans-fast:   0.12s ease;

  /* Cone-beam CSS approximation used as background for non-canvas screens */
  --cone-bg: radial-gradient(
    ellipse 100% 75% at 50% 110%,
    #5ed1ff  0%,
    #3189ff  8%,
    #1b3f9b 28%,
    #090d36 55%,
    #02030a 75%
  );
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: none;
}

html {
  height: 100%;
  overscroll-behavior: none;
}

body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--clr-bg);
  font-family: var(--font-ui);
  color: var(--clr-text);
  overscroll-behavior: none;
  touch-action: none;
}

/* ── Screen layer system ───────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--trans-screen);
  z-index: 1;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  z-index: 2;
}

/* ============================================================
   ATTRACT SCREEN
   ============================================================ */
.screen-attract {
  background: var(--clr-bg);
  flex-direction: column;
  cursor: pointer;
}

#attract-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.attract-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 55% 50% at 50% 50%,
    transparent 30%,
    rgba(2, 3, 10, 0.45) 70%,
    rgba(2, 3, 10, 0.75) 100%
  );
  pointer-events: none;
}

.attract-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  padding: 48px 64px;
}

.attract-title {
  font-size: clamp(44px, 8vw, 100px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-shadow: 0 0 40px rgba(158, 218, 255, 0.4), 0 2px 0 rgba(0, 0, 0, 0.4);
  line-height: 1;
  text-transform: uppercase;
}

.attract-subtitle {
  font-size: clamp(18px, 2.8vw, 30px);
  color: var(--clr-text-dim);
  letter-spacing: 0.04em;
  font-weight: 400;
}

.attract-cta {
  margin-top: 16px;
}

.cta-pulse {
  display: inline-block;
  font-size: clamp(20px, 3vw, 36px);
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 18px 52px;
  border: 3px solid #ffffff;
  border-radius: var(--radius-xl);
  animation: cta-glow 2.2s ease-in-out infinite;
}

@keyframes cta-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.3), 0 0 20px rgba(255, 255, 255, 0.08);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 0 14px rgba(255, 255, 255, 0), 0 0 50px rgba(255, 255, 255, 0.15);
    opacity: 0.75;
  }
}

/* ============================================================
   INTRO SCREEN
   ============================================================ */
.screen-intro {
  background: var(--cone-bg);
}

.intro-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 48px 40px;
  max-width: 820px;
  width: 100%;
  text-align: center;
}

.intro-title {
  font-size: clamp(24px, 3.8vw, 46px);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.intro-text {
  font-size: clamp(14px, 1.8vw, 20px);
  color: var(--clr-text-dim);
  line-height: 1.6;
  max-width: 680px;
}

.intro-text strong {
  color: #ffffff;
  font-weight: 700;
}

/* ============================================================
   BUTTONS — shared base
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: var(--radius-md);
  transition:
    transform var(--trans-fast),
    box-shadow var(--trans-fast),
    background var(--trans-fast),
    opacity var(--trans-fast);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:active,
.btn.pressed {
  transform: scale(0.96);
}

/* White outline — primary CTA (START, REPLAY) */
.btn-outline {
  background: transparent;
  color: #ffffff;
  border: 3px solid #ffffff;
  font-size: clamp(18px, 2.4vw, 26px);
  padding: 18px 64px;
  text-transform: uppercase;
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.08);
}

.btn-outline:active,
.btn-outline.pressed {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.18);
}

.btn-large {
  min-width: 240px;
  min-height: 68px;
}

/* Ghost — secondary action (Return to Start) */
.btn-ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: clamp(14px, 1.6vw, 18px);
  padding: 14px 36px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.btn-ghost:active,
.btn-ghost.pressed {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}


/* ============================================================
   GAME SCREEN
   ============================================================ */
.screen-game {
  background: var(--clr-bg);
  align-items: stretch;
  justify-content: stretch;
}

.game-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 14px;
  gap: 10px;
}

/* ── Game middle row ─────────────────────────────────────── */
.game-middle {
  display: flex;
  flex: 1;
  gap: 10px;
  min-height: 0;
}

/* ── Sonar sidebars ──────────────────────────────────────── */
.sonar-sidebar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sonar-sidebar-left {
  width: 130px;
  gap: 16px;
  justify-content: center;
  padding-left: 2px;
}

.sonar-sidebar-right {
  width: 80px;
  gap: 28px;
  align-items: center;
  justify-content: center;
}

/* ── Sensor rows ─────────────────────────────────────────── */
.sensor-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.sensor-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--clr-accent);
  flex-shrink: 0;
  margin-top: 4px;
  box-shadow: 0 0 6px rgba(158, 218, 255, 0.55);
}

.sensor-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sensor-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--clr-accent);
  text-transform: uppercase;
}

.sensor-value {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.sensor-value-highlight {
  color: #00ff88;
}

/* ── Signal scale (right sidebar) ────────────────────────── */
.signal-scale-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.signal-scale-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--clr-accent);
  text-transform: uppercase;
}

.signal-scale-bar-wrap {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.signal-scale-bar {
  width: 14px;
  height: 110px;
  background: linear-gradient(
    to bottom,
    #9eedff 0%,
    #5ed1ff 18%,
    #3189ff 48%,
    #1b3f9b 78%,
    #060d24 100%
  );
  border-radius: 3px;
}

.signal-scale-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 8px;
  color: var(--clr-text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ── Gain ────────────────────────────────────────────────── */
.gain-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.gain-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--clr-accent);
  text-transform: uppercase;
}

.gain-value {
  font-size: 18px;
  font-weight: 700;
  color: #00ff88;
  font-variant-numeric: tabular-nums;
}

/* ── Active fish badge ───────────────────────────────────── */
.active-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--clr-text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.active-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00ff88;
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.7);
  flex-shrink: 0;
}

/* ── Game header ─────────────────────────────────────────── */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 0 6px;
  height: 64px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.timer-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  padding: 4px 22px;
  min-width: 100px;
}

.timer-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--clr-text-muted);
  font-weight: 600;
}

.timer-value {
  font-size: 38px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.timer-value.urgent {
  color: #ff6b4a;
  text-shadow: 0 0 20px rgba(255, 107, 74, 0.5);
  animation: urgent-blink 0.5s step-end infinite;
}

@keyframes urgent-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

.game-title-center {
  font-size: clamp(13px, 1.8vw, 20px);
  font-weight: 700;
  color: var(--clr-accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
}

/* ── Canvas / sonar display ──────────────────────────────── */
.canvas-wrapper {
  flex: 1;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 60px rgba(94, 209, 255, 0.08),
    inset 0 0 80px rgba(0, 0, 0, 0.4);
  min-height: 0;
}

/* ── Signal history mini-chart ───────────────────────────── */
#signal-history-canvas {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 190px;
  height: 80px;
  border: 1px solid rgba(94, 209, 255, 0.28);
  border-radius: var(--radius-sm);
  pointer-events: none;
}

.sonar-bg-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}

#noise-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  pointer-events: none;
  opacity: 0.12;
}

.canvas-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: rgba(255, 255, 255, 0.35);
  border-style: solid;
  pointer-events: none;
}

.canvas-corner-tl { top: 6px; left: 6px;   border-width: 2px 0 0 2px; }
.canvas-corner-tr { top: 6px; right: 6px;  border-width: 2px 2px 0 0; }
.canvas-corner-bl { bottom: 6px; left: 6px;   border-width: 0 0 2px 2px; }
.canvas-corner-br { bottom: 6px; right: 6px;  border-width: 0 2px 2px 0; }

.noise-overlay {
  position: absolute;
  inset: 0;
  background: url('assets/images/noise.png') repeat;
  mix-blend-mode: darken;
  opacity: 0.26;
  pointer-events: none;
}

.scanline-overlay {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.03) 3px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  border-radius: var(--radius-md);
}

/* ── Counting buttons ────────────────────────────────────── */
.game-controls {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
}

.btn-count {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  min-height: 84px;
  gap: 14px;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #ffffff;
}

.count-arrow-text {
  font-size: clamp(20px, 3vw, 32px);
  font-weight: 300;
  opacity: 0.65;
  flex-shrink: 0;
  line-height: 1;
}

.btn-count-left  { --btn-color: var(--clr-upstream,   #ffffff); --btn-rgb: var(--clr-upstream-rgb,   255,255,255); }
.btn-count-right { --btn-color: var(--clr-downstream, #cc2200); --btn-rgb: var(--clr-downstream-rgb, 204, 34,  0); }

.btn-count::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.08);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.btn-count.pressed::after {
  opacity: 1;
}

/* DOWNSTREAM: count on left, arrow on right */
.btn-count-right {
  flex-direction: row;
}

.btn-count-right:active,
.btn-count-right.pressed {
  background: rgba(var(--btn-rgb), 0.15);
  box-shadow: 0 0 30px rgba(var(--btn-rgb), 0.18);
}

/* UPSTREAM: arrow on left, count on right */
.btn-count-left {
  flex-direction: row;
}

.btn-count-left:active,
.btn-count-left.pressed {
  background: rgba(var(--btn-rgb), 0.15);
  box-shadow: 0 0 30px rgba(var(--btn-rgb), 0.18);
}

.count-arrow {
  height: clamp(26px, 4vw, 42px);
  width: auto;
  flex-shrink: 0;
  display: block;
}

.count-label {
  font-size: clamp(13px, 1.8vw, 20px);
  font-weight: 700;
  letter-spacing: 0.08em;
  flex: 1;
  text-align: center;
}

.count-value {
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 56px;
  text-align: center;
  line-height: 1;
}

@keyframes count-bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.count-value.bump {
  animation: count-bump 0.18s ease-out;
}

/* ============================================================
   RESULTS SCREEN
   ============================================================ */
.screen-results {
  background: var(--cone-bg);
  align-items: flex-start;
  overflow: hidden;
}

.results-scroll {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  justify-content: center;
  touch-action: pan-y;
}

.results-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 44px 40px;
  max-width: 900px;
  width: 100%;
}

.results-title {
  font-size: clamp(28px, 5vw, 60px);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Two-column UPSTREAM / DOWNSTREAM grid */
.results-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  width: 100%;
}

.results-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.results-col-title {
  font-size: clamp(14px, 1.8vw, 20px);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #ffffff;
  text-align: center;
  padding-bottom: 14px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
  margin-bottom: 2px;
  text-transform: uppercase;
}

.results-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.results-label {
  font-size: clamp(14px, 1.7vw, 18px);
  color: var(--clr-text-dim);
  white-space: nowrap;
}

.results-value {
  font-size: clamp(20px, 2.8vw, 34px);
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.results-message {
  font-size: clamp(14px, 1.8vw, 19px);
  color: var(--clr-text-dim);
  text-align: center;
  line-height: 1.6;
  max-width: 640px;
}

.results-thanks {
  font-size: clamp(16px, 2.2vw, 22px);
  color: #ffffff;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.04em;
}

.results-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  padding-bottom: 16px;
}

/* ============================================================
   DEBUG OVERLAY
   ============================================================ */
.debug-overlay {
  position: fixed;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.88);
  color: #00ff88;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid rgba(0, 255, 136, 0.25);
  z-index: 9999;
  line-height: 1.9;
  pointer-events: none;
  min-width: 220px;
}

.debug-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #00ff88;
  border-bottom: 1px solid rgba(0, 255, 136, 0.2);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

/* ============================================================
   RESPONSIVE — tablet / smaller kiosk panels
   ============================================================ */
@media (max-width: 640px) {
  .results-columns {
    grid-template-columns: 1fr;
  }

  .btn-count {
    padding: 10px 14px;
    min-height: 68px;
    gap: 8px;
  }

  .game-layout {
    padding: 8px;
    gap: 8px;
  }
}

@media (max-height: 540px) {
  .game-header {
    height: 50px;
  }

  .game-layout {
    gap: 6px;
    padding: 8px;
  }

  .btn-count {
    min-height: 60px;
  }

  .timer-value {
    font-size: 28px;
  }
}

/* ============================================================
   PRINT — disable, this is a kiosk
   ============================================================ */
@media print {
  body { display: none; }
}
