/* Clapperboard — Studio Game Art & Diegetic Hollywood Director Console UI (Topology #6) */
:root {
  --brass-bright: #f4c85b;
  --brass-mid: #d69c2f;
  --brass-dark: #865712;
  --mahogany-bg: rgba(34, 20, 14, 0.84);
  --mahogany-deep: rgba(20, 12, 8, 0.92);
  --console-slate: rgba(24, 28, 36, 0.86);
  --amber-glow: #ffae2b;
  --crimson-rec: #f23c3c;
  --emerald-ok: #29d67a;
  --ivory-text: #fdf7eb;
  --muted-cream: #dec9a6;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background-color: #140c08;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ivory-text);
}

/* Full-bleed Studio Soundstage Background */
#app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-image:
    radial-gradient(circle at 50% 24%, rgba(255, 196, 86, 0.14), rgba(14, 9, 6, 0.56) 76%),
    url('background.png');
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

/* Top Diegetic Brass & Mahogany Bezel */
.console-top-bezel {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: max(env(safe-area-inset-top, 8px), 8px) 10px 8px;
  background: linear-gradient(180deg, rgba(46, 28, 18, 0.94) 0%, rgba(26, 15, 10, 0.90) 100%);
  border-bottom: 3px solid var(--brass-mid);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 232, 175, 0.35);
}

/* Physical Toggle Switch at Top Bezel */
.physical-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 9, 6, 0.85);
  border: 1.5px solid var(--brass-mid);
  border-radius: 999px;
  padding: 3px 8px 3px 4px;
  cursor: pointer;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.8);
}

.toggle-lever-track {
  position: relative;
  width: 44px;
  height: 22px;
  background: linear-gradient(180deg, #1b120d, #322117);
  border-radius: 999px;
  border: 1px solid rgba(244, 200, 91, 0.55);
}

.toggle-lever-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff2c2, #e09f2d 65%, #7c4d0b 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,0.75);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.physical-toggle-wrap.cut-mode .toggle-lever-knob {
  transform: translateX(22px);
  background: radial-gradient(circle at 35% 30%, #ffd0d0, #f23c3c 65%, #7e1111 100%);
}

.toggle-state-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.6px;
  color: var(--brass-bright);
  white-space: nowrap;
}

.physical-toggle-wrap.cut-mode .toggle-state-label {
  color: #ff7b7b;
}

/* Brass Telemetry Pills */
.bezel-telemetry-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brass-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(18, 12, 8, 0.88);
  border: 1.5px solid rgba(244, 200, 91, 0.65);
  border-radius: 10px;
  padding: 4px 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 3px 6px rgba(0,0,0,0.45);
  white-space: nowrap;
}

.brass-pill-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted-cream);
  letter-spacing: 0.4px;
}

.brass-pill-val {
  font-size: 12px;
  font-weight: 900;
  color: var(--brass-bright);
}

.icon-pill-btn {
  min-width: 34px;
  height: 32px;
  border-radius: 9px;
  border: 1.5px solid var(--brass-mid);
  background: linear-gradient(180deg, #4b311e 0%, #29190f 100%);
  color: var(--brass-bright);
  font-weight: 900;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  cursor: pointer;
  box-shadow: 0 3px 0 #140b06, inset 0 1px 0 rgba(255,255,255,0.28);
}

.icon-pill-btn:active {
  transform: translateY(2px) scale(0.95);
}

/* Main Viewport Content Container */
#view-stage {
  position: relative;
  flex: 1;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.screen-view {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 10px;
  overflow: hidden;
}

.screen-view.active {
  display: flex;
}

/* Topology #6 Hub: Diegetic Hollywood Director Console */
.hub-layout {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  gap: 8px;
}

/* Live Soundstage Monitor Window (keeps background + live crane visible) */
.monitor-window-frame {
  position: relative;
  flex: 1;
  min-height: 155px;
  border-radius: 16px;
  border: 2.5px solid var(--brass-mid);
  background: rgba(14, 10, 8, 0.36);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.65),
    inset 0 0 24px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 240, 190, 0.4);
  overflow: hidden;
  cursor: pointer;
}

#hub-preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.monitor-corner-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(18, 12, 8, 0.88);
  border: 1px solid rgba(244, 200, 91, 0.65);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.6px;
  color: var(--ivory-text);
}

.rec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--crimson-rec);
  box-shadow: 0 0 8px var(--crimson-rec);
  animation: pulseRec 1.1s infinite alternate;
}

@keyframes pulseRec {
  from { opacity: 0.45; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1.15); }
}

.monitor-wind-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(18, 12, 8, 0.88);
  border: 1px solid rgba(244, 200, 91, 0.65);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 800;
  color: var(--brass-bright);
  white-space: nowrap;
}

/* Z-Depth Interlocked Scene Dossier Card */
.dossier-card {
  position: relative;
  margin-top: 22px;
  padding: 12px 12px 10px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(44, 27, 17, 0.90) 0%, rgba(24, 14, 9, 0.93) 100%);
  border: 2px solid rgba(244, 200, 91, 0.72);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 240, 200, 0.32);
  overflow: visible;
}

.watermark-number {
  position: absolute;
  right: 12px;
  bottom: 2px;
  font-size: 72px;
  font-weight: 900;
  line-height: 1;
  color: rgba(255, 220, 145, 0.07);
  pointer-events: none;
  z-index: 0;
}

.z-interlock-sprite {
  position: absolute;
  top: -34px;
  right: 12px;
  width: 78px;
  height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.72));
  z-index: 3;
  pointer-events: none;
  animation: floatHero 2.8s ease-in-out infinite alternate;
}

@keyframes floatHero {
  from { transform: translateY(0px) rotate(-3deg); }
  to { transform: translateY(-6px) rotate(4deg); }
}

.dossier-header {
  position: relative;
  z-index: 2;
  padding-right: 78px;
}

.dossier-kicker {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: var(--brass-bright);
  text-transform: uppercase;
}

.dossier-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--ivory-text);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.dossier-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-cream);
  margin-top: 2px;
}

/* Stage Selector Ribbon (All 15 Stages Unlocked Immediately) */
.stage-ribbon {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 7px 2px 5px;
  scrollbar-width: none;
}
.stage-ribbon::-webkit-scrollbar {
  display: none;
}

.stage-chip {
  flex: 0 0 auto;
  min-width: 44px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1.5px solid rgba(244, 200, 91, 0.45);
  background: rgba(16, 10, 6, 0.85);
  color: var(--muted-cream);
  font-size: 11px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
}

.stage-chip.selected {
  background: linear-gradient(180deg, #f7cf65 0%, #c9881d 100%);
  color: #1c1008;
  border-color: #fff2be;
  box-shadow: 0 3px 8px rgba(244, 200, 91, 0.45);
}

.dossier-actions {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

/* Glossy 3D Game Buttons (.btn-3d) */
.btn-3d {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 245, 210, 0.55);
  border-bottom: 4px solid #754408;
  background: linear-gradient(180deg, #ffd86b 0%, #e0961f 55%, #b86f0d 100%);
  color: #1f1105;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.55);
  cursor: pointer;
  white-space: nowrap;
  max-width: 100%;
  transition: transform 0.08s ease;
}

.btn-3d:active {
  transform: translateY(2px) scale(0.95);
  border-bottom-width: 2px;
}

.btn-3d.crimson {
  background: linear-gradient(180deg, #ff7070 0%, #df2c2c 55%, #a81818 100%);
  border-color: rgba(255, 215, 215, 0.6);
  border-bottom-color: #5c0909;
  color: #ffffff;
  text-shadow: 0 1.5px 2px rgba(0, 0, 0, 0.6);
}

.btn-3d.teal {
  background: linear-gradient(180deg, #5ef2b8 0%, #17b57c 55%, #0c8256 100%);
  border-color: rgba(215, 255, 238, 0.6);
  border-bottom-color: #064a30;
  color: #062317;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-3d.brass-dark {
  background: linear-gradient(180deg, #5b3e29 0%, #382315 55%, #24150c 100%);
  border-color: rgba(244, 200, 91, 0.55);
  border-bottom-color: #100804;
  color: var(--brass-bright);
  text-shadow: 0 1.5px 2px rgba(0, 0, 0, 0.8);
}

/* Flagship 2D Physics Game Arena (78% Interactive Canvas + Compact Top Strip) */
.arena-hud-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 40px;
  padding: 0 8px;
  border-radius: 11px;
  background: rgba(20, 12, 8, 0.88);
  border: 1.5px solid rgba(244, 200, 91, 0.6);
  margin-bottom: 6px;
}

.arena-stat-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.arena-stat-pill {
  font-size: 11px;
  font-weight: 900;
  color: var(--ivory-text);
  white-space: nowrap;
}

.arena-stat-pill span {
  color: var(--brass-bright);
}

.combo-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffae2b, #c96d08);
  color: #1b0d03;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.arena-canvas-wrap {
  position: relative;
  flex: 1;
  width: 100%;
  border-radius: 16px;
  border: 2.5px solid var(--brass-mid);
  background: rgba(12, 8, 5, 0.45);
  box-shadow: 0 10px 24px rgba(0,0,0,0.65), inset 0 0 18px rgba(0,0,0,0.65);
  overflow: hidden;
}

#arena-canvas, #drill-canvas, #sandbox-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.arena-bottom-controls {
  display: grid;
  grid-template-columns: 1fr 1.55fr 1fr;
  gap: 7px;
  margin-top: 6px;
}

/* Pre-Start Rules / Stage Clear Overlay inside Arena */
.canvas-overlay-card {
  position: absolute;
  inset: 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(36, 21, 13, 0.94), rgba(18, 10, 6, 0.96));
  border: 2px solid var(--brass-bright);
  box-shadow: 0 14px 32px rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
  z-index: 10;
}

.canvas-overlay-card.hidden {
  display: none;
}

.overlay-hero-img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.7));
  margin-bottom: 6px;
}

.overlay-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--brass-bright);
  margin-bottom: 4px;
}

.overlay-desc {
  font-size: 12px;
  line-height: 1.35;
  color: var(--ivory-text);
  max-width: 280px;
  margin-bottom: 10px;
}

.overlay-btn-row {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 280px;
}

.overlay-btn-row .btn-3d {
  flex: 1;
}

/* Gaffer Rig 3D Customizer Cards */
.rig-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  flex: 1;
  align-content: start;
}

.rig-card {
  position: relative;
  margin-top: 16px;
  padding: 36px 10px 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(44, 27, 17, 0.90), rgba(22, 13, 8, 0.94));
  border: 2px solid rgba(244, 200, 91, 0.48);
  text-align: center;
  box-shadow: 0 8px 18px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}

.rig-card.equipped {
  border-color: var(--emerald-ok);
  box-shadow: 0 0 16px rgba(41, 214, 122, 0.35);
}

.rig-card img {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  width: 62px;
  height: 62px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,0.7));
}

.rig-card-title {
  font-size: 13px;
  font-weight: 900;
  color: var(--ivory-text);
  white-space: nowrap;
}

.rig-card-perk {
  font-size: 10px;
  font-weight: 700;
  color: var(--brass-bright);
}

/* Diegetic Bottom Bezel with 4 Mechanical 3D Push-Buttons */
.console-bottom-bezel {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 7px 8px max(env(safe-area-inset-bottom, 8px), 8px);
  background: linear-gradient(180deg, rgba(38, 22, 14, 0.95) 0%, rgba(18, 10, 6, 0.98) 100%);
  border-top: 3px solid var(--brass-mid);
  box-shadow: 0 -6px 18px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255, 232, 175, 0.35);
}

.mech-push-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 46px;
  padding: 5px 4px;
  border-radius: 10px;
  border: 1.5px solid rgba(244, 200, 91, 0.45);
  border-bottom: 4px solid #0e0704;
  background: linear-gradient(180deg, #4b301e 0%, #2a190f 100%);
  color: var(--muted-cream);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.4px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22);
  transition: transform 0.08s ease;
}

.mech-push-btn .led-bar {
  width: 18px;
  height: 3px;
  border-radius: 99px;
  background: rgba(255,255,255,0.2);
  margin-bottom: 2px;
}

.mech-push-btn.active {
  background: linear-gradient(180deg, #f4c85b 0%, #bf7f17 100%);
  color: #1c0f05;
  border-color: #fff2be;
  border-bottom-color: #694105;
}

.mech-push-btn.active .led-bar {
  background: #ff2a2a;
  box-shadow: 0 0 6px #ff2a2a;
}

.mech-push-btn:active {
  transform: translateY(2px) scale(0.95);
}

/* Modal Dialog (Trophies & Soundstage Settings) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 5, 3, 0.82);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 100;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-panel {
  width: 100%;
  max-width: 400px;
  max-height: 86vh;
  overflow-y: auto;
  border-radius: 18px;
  background: linear-gradient(180deg, #311d12 0%, #190e08 100%);
  border: 2.5px solid var(--brass-bright);
  padding: 14px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.88);
}

.relic-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(12, 7, 4, 0.72);
  border: 1px solid rgba(244, 200, 91, 0.35);
  margin-bottom: 8px;
}

.relic-row img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.65));
}

.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(18, 10, 6, 0.85);
  border: 1px solid rgba(244, 200, 91, 0.45);
  border-radius: 10px;
  padding: 6px 10px;
  margin-bottom: 6px;
}

.slider-row label {
  font-size: 11px;
  font-weight: 800;
  color: var(--brass-bright);
  white-space: nowrap;
}

.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--brass-bright);
}
