@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

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

body {
  background: #111114;
  color: #00ffcc;
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  user-select: none;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

/* === 12-COLUMN GRID OVERLAY === */
#grid-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  pointer-events: none;
  opacity: 0.15;
  transition: opacity 0.6s, opacity 0.6s;
}

#grid-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(0, 255, 204, 0.3) 0px,
    transparent 1px,
    transparent calc(100% / 12)
  );
}

#grid-overlay.locked {
  opacity: 0.35;
}

#grid-overlay.locked::before {
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 215, 0, 0.4) 0px,
    transparent 1px,
    transparent calc(100% / 12)
  );
}

#grid-overlay.break {
  opacity: 0.05;
}

/* === HEADER HUD === */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(0, 255, 204, 0.2);
}

#state-label {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 3px;
  text-shadow: 0 0 10px #00ffcc, 0 0 20px #00ffcc;
}

#state-label.locked {
  color: #ffd700;
  text-shadow: 0 0 10px #ffd700, 0 0 20px #ffd700;
}

#state-label.break {
  color: #ff8c69;
  text-shadow: 0 0 10px #ff8c69;
}

#bpm-display {
  font-size: 14px;
  color: #ff00ff;
  text-shadow: 0 0 6px #ff00ff;
}

#sync-label {
  font-size: 14px;
  color: #00ffcc;
}

#sync-value {
  color: #ff00ff;
  font-variant-numeric: tabular-nums;
}

/* === MAIN 12-COLUMN GRID === */
#main-grid {
  position: absolute;
  top: 48px;
  bottom: 120px;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  z-index: 1;
}

.grid-cell {
  border-right: 1px solid rgba(0, 255, 204, 0.08);
  transition: background 0.05s;
}

.grid-cell.pulse {
  background: rgba(0, 255, 204, 0.06);
}

.grid-cell.beat-1,
.grid-cell.beat-3 {
  border-bottom: 2px solid rgba(0, 255, 204, 0.3);
}

.grid-cell.beat-2,
.grid-cell.beat-4 {
  border-bottom: 2px solid rgba(255, 0, 255, 0.3);
}

#main-grid.locked .grid-cell {
  border-right-color: rgba(255, 215, 0, 0.15);
}

/* === ESPRESSO MACHINE === */
#espresso-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  z-index: 5;
  pointer-events: none;
}

#espresso-canvas {
  width: 220px;
  height: 280px;
}

/* === SYNC METER === */
#sync-meter-track {
  position: absolute;
  top: 56px;
  left: 20px;
  right: 20px;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  z-index: 10;
  overflow: hidden;
}

#sync-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff0066, #ff00ff, #00ffcc);
  border-radius: 3px;
  transition: width 0.15s ease-out;
  box-shadow: 0 0 8px rgba(0, 255, 204, 0.5);
}

/* === OSCILLOSCOPE === */
#oscilloscope {
  position: absolute;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 60px;
  z-index: 5;
  border: 1px solid rgba(0, 255, 204, 0.15);
  border-radius: 4px;
}

/* === KNOBS === */
#knobs {
  position: absolute;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 40px;
  z-index: 8;
  pointer-events: auto;
}

.knob-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.knob-canvas {
  cursor: ns-resize;
  border: none;
  outline: none;
}

.knob-wrapper label {
  font-size: 10px;
  letter-spacing: 1px;
  color: rgba(0, 255, 204, 0.6);
  text-transform: uppercase;
}

.knob-wrapper span {
  font-size: 13px;
  color: #00ffcc;
  font-variant-numeric: tabular-nums;
  min-width: 50px;
  text-align: center;
  text-shadow: 0 0 6px rgba(0, 255, 204, 0.4);
}

/* === DRIFT WARNING === */
#drift-warning {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 70px);
  font-size: 36px;
  font-weight: bold;
  color: #ff3300;
  letter-spacing: 6px;
  z-index: 20;
  text-shadow: 0 0 20px #ff3300, 0 0 40px #ff3300;
  animation: driftPulse 0.3s infinite alternate;
}

@keyframes driftPulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

.hidden {
  display: none !important;
}

/* === SHIP BAR === */
#ship-area {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
  padding: 0 20px;
}

#ship-bar-track {
  width: 100%;
  height: 18px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(0, 255, 204, 0.1);
}

#ship-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(0, 255, 204, 0.6), #00ffcc);
  border-radius: 4px;
  transition: width 0.2s ease-out;
  box-shadow: 0 0 12px rgba(0, 255, 204, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#ship-col-markers {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent calc(100% / 12 - 1px),
    rgba(0, 0, 0, 0.5) calc(100% / 12 - 1px),
    rgba(0, 0, 0, 0.5) calc(100% / 12)
  );
}

#ship-btn {
  font-family: inherit;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 4px;
  padding: 8px 40px;
  background: transparent;
  color: #00ffcc;
  border: 2px solid #00ffcc;
  border-radius: 4px;
  cursor: pointer;
  text-shadow: 0 0 8px #00ffcc;
  box-shadow: 0 0 12px rgba(0, 255, 204, 0.3);
  transition: all 0.2s;
}

#ship-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
}

#ship-btn:not(:disabled):hover {
  background: rgba(0, 255, 204, 0.15);
  box-shadow: 0 0 20px rgba(0, 255, 204, 0.6);
}

/* === BREAK ROOM === */
#breakroom {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 60%, #3d1f00 0%, #1a0a00 60%, #0a0500 100%);
}

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

#breakroom-text {
  position: relative;
  z-index: 2;
  font-size: 42px;
  letter-spacing: 8px;
  color: #ffd700;
  text-shadow: 0 0 20px #ffd700, 0 0 40px rgba(255, 215, 0, 0.5);
}

#reset-btn {
  position: relative;
  z-index: 2;
  margin-top: 30px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 3px;
  padding: 8px 30px;
  background: transparent;
  color: #ff8c69;
  border: 1px solid #ff8c69;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
}

#reset-btn:hover {
  background: rgba(255, 140, 105, 0.15);
  box-shadow: 0 0 16px rgba(255, 140, 105, 0.4);
}

/* === START OVERLAY === */
#start-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

#start-overlay h1 {
  font-size: 28px;
  letter-spacing: 6px;
  color: #00ffcc;
  text-shadow: 0 0 15px #00ffcc;
  margin-bottom: 16px;
  text-align: center;
}

#start-overlay p {
  font-size: 14px;
  color: rgba(0, 255, 204, 0.5);
  margin-bottom: 40px;
}

#start-btn {
  font-family: inherit;
  font-size: 20px;
  letter-spacing: 6px;
  padding: 14px 50px;
  background: transparent;
  color: #00ffcc;
  border: 2px solid #00ffcc;
  border-radius: 4px;
  cursor: pointer;
  text-shadow: 0 0 10px #00ffcc;
  box-shadow: 0 0 20px rgba(0, 255, 204, 0.3);
  transition: all 0.2s;
}

#start-btn:hover {
  background: rgba(0, 255, 204, 0.12);
  box-shadow: 0 0 30px rgba(0, 255, 204, 0.5);
}

/* === RESPONSIVE === */
@media (max-width: 700px) {
  #knobs { gap: 20px; }
  #oscilloscope { width: 90%; }
  #start-overlay h1 { font-size: 20px; }
}
