@font-face { font-family: Digital7; src: url(../fonts/digital-7.ttf); }

:root {
  --bg: #161618;
  --panel: #232326;
  --btn: #303035;
  --btn-hi: #3c3c42;
  --line: #45454c;
  --text: #d8d6d2;
  --dim: #8a8a90;
  --orange: #e47828;
  --red: #e0342c;
  --lcd-bg: #1f2a1c;
  --lcd-fg: #b6f07a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font: 600 13px/1.2 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
}

#deck {
  position: fixed; inset: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas: "bar" "wave" "platter" "controls";
  gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}

.bar { grid-area: bar; display: flex; gap: 8px; align-items: center; }
#wave { grid-area: wave; width: 100%; height: 56px; border-radius: 8px; background: #0e0e10; display: block; }
#platterWrap { grid-area: platter; min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; }
#platter { display: block; touch-action: none; cursor: grab; }
#platter.grab { cursor: grabbing; }
#controls { grid-area: controls; display: flex; flex-direction: column; gap: 8px; }

/* Poziomo / desktop: plyta po lewej, sterowanie po prawej */
@media (orientation: landscape) and (min-width: 640px) {
  #deck {
    grid-template-columns: 1fr minmax(300px, 420px);
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "bar bar" "wave wave" "platter controls";
  }
  #controls { justify-content: center; }
}
@media (orientation: landscape) and (max-height: 500px) {
  #wave { height: 40px; }
  #controls { gap: 6px; }
  .btn { height: 36px; }
}

.row { display: flex; gap: 8px; align-items: center; min-width: 0; }

.btn {
  appearance: none; border: 1px solid var(--line); border-radius: 8px;
  background: linear-gradient(#38383e, #2a2a2f); color: var(--text);
  font: inherit; letter-spacing: .06em;
  height: 44px; padding: 0 12px; min-width: 52px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  text-decoration: none; cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 2px 4px rgba(0,0,0,.4);
}
.btn:active, .btn.down { background: linear-gradient(#2a2a2f, #333338); box-shadow: 0 1px 3px rgba(0,0,0,.6) inset; }
.btn.small { height: 34px; min-width: 40px; padding: 0 10px; }
.btn.big { flex: 1.4; }
.row > .btn:not(.small) { flex: 1; }
.btn.on { color: #fff; border-color: var(--orange); }

.led { width: 8px; height: 8px; border-radius: 50%; background: #4a2c18; box-shadow: 0 0 0 1px rgba(0,0,0,.5); flex: none; }
.btn.on .led { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.led.red { background: #4a1c1a; }
.btn.on .led.red { background: var(--red); box-shadow: 0 0 8px var(--red); }
#btnRec.on, #btnMic.on { border-color: var(--red); }
#btnMic.on .led { animation: blink .8s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }

.btn.cut { flex: 0 0 auto !important; width: 84px; height: 56px; font-size: 15px; border-color: #5a3a24; }
.btn.cut.down { background: var(--orange); color: #1a1a1a; border-color: var(--orange); }

.lcd {
  flex: 1; min-width: 0; height: 38px; border-radius: 6px; padding: 0 10px;
  background: var(--lcd-bg); color: var(--lcd-fg);
  box-shadow: 0 1px 4px rgba(0,0,0,.7) inset;
  font: 22px/38px Digital7, monospace; letter-spacing: .04em;
  display: flex; justify-content: space-between; gap: 10px; white-space: nowrap;
}
.lcd #sampleName { overflow: hidden; text-overflow: ellipsis; }
.lcd #lcdInfo { opacity: .7; }
.lcd.mini { flex: 0 0 auto; width: 56px; justify-content: center; height: 34px; line-height: 34px; }

.lbl { flex: 0 0 auto; width: 92px; color: var(--dim); font-size: 11px; letter-spacing: .08em; cursor: pointer; }
.lbl b { color: var(--text); font-weight: 600; display: block; font-size: 13px; }

.fader {
  --v: .5;
  position: relative; flex: 1; min-width: 80px; height: 44px;
  touch-action: none; cursor: pointer;
}
.fader::before {
  content: ""; position: absolute; left: 14px; right: 14px; top: 50%; height: 4px; margin-top: -2px;
  border-radius: 2px; background: #0c0c0e; box-shadow: 0 1px 0 rgba(255,255,255,.06);
}
.fader.center::after {
  content: ""; position: absolute; left: 50%; top: 8px; bottom: 8px; width: 1px; background: var(--line);
}
.fader .knob {
  position: absolute; top: 6px; bottom: 6px; width: 28px;
  left: calc(var(--v) * (100% - 28px));
  border-radius: 5px; border: 1px solid #55555c;
  background: linear-gradient(90deg, #4a4a50, #6a6a72 45%, #e47828 48%, #e47828 52%, #6a6a72 55%, #4a4a50);
  box-shadow: 0 2px 5px rgba(0,0,0,.6);
  z-index: 1;
}
.xfader { height: 56px; }
.xfader .knob { top: 8px; bottom: 8px; width: 34px; left: calc(var(--v) * (100% - 34px)); }

select {
  flex: 1; min-width: 0; height: 44px; border-radius: 8px; padding: 0 10px;
  background: var(--btn); color: var(--text); border: 1px solid var(--line);
  font: inherit; touch-action: manipulation;
}

#start {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,10,12,.92);
  cursor: pointer;
}
#start.hidden { display: none; }
.start-box { text-align: center; padding: 24px; }
.start-title { font: 40px Digital7, monospace; color: var(--orange); letter-spacing: .08em; }
.start-tap { margin: 18px 0 14px; font-size: 16px; letter-spacing: .2em; }
.start-hint { color: var(--dim); font-weight: 500; line-height: 1.5; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(30,30,34,.95); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 16px; z-index: 20; max-width: calc(100% - 32px); text-align: center;
}
