/*
  Designed for a 600x600 see-through waveguide display.
  Black renders as transparent, so the background stays pure black and
  content uses bright, thin elements instead of large filled areas.
  Sizes use vmin so the layout fits any square-ish viewport.
*/
:root {
  --fg: #f2f2f2;
  --dim: #8a8a8a;
  --accent: #3ee6ff;
  --good: #5cff8a;
  --warn: #ffb020;
  --bad: #ff4d5e;
  --line: #3a3a3a;
}

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

html, body {
  height: 100%;
  background: #000;
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body { display: grid; place-items: center; }

#app {
  position: relative;
  width: min(100vw, 100vh);
  height: min(100vw, 100vh);
  max-width: 600px;
  max-height: 600px;
  padding: 4vmin;
  display: flex;
  flex-direction: column;
  gap: 2.5vmin;
}

@media (min-width: 601px) and (min-height: 601px) {
  #app { padding: 24px; gap: 15px; font-size: 16px; }
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: min(4vmin, 24px);
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
}

.tabs { display: flex; gap: 1.2vmin; }
.tabs i { width: 1.6vmin; height: 1.6vmin; max-width: 10px; max-height: 10px; border-radius: 50%; border: 1px solid var(--dim); }
.tabs i.on { background: var(--accent); border-color: var(--accent); }

footer { font-size: min(3.2vmin, 19px); color: var(--dim); text-align: center; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ----- home ----- */
.home { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 3vmin; align-items: center; }
.tile {
  height: 70%;
  border: 2px solid var(--line);
  border-radius: 3vmin;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2vmin;
}
.tile b { font-size: min(13vmin, 78px); letter-spacing: 0.04em; }
.tile span { font-size: min(3.4vmin, 20px); color: var(--dim); }
.tile.focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tile.focus b { color: var(--accent); }

/* ----- main area ----- */
main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2.5vmin;
}

.hero {
  font-size: min(20vmin, 120px);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 1.5vmin;
}
.hero.sm { font-size: min(15vmin, 90px); }
.hero small { font-size: min(4.5vmin, 27px); color: var(--dim); font-weight: 500; }

.row {
  width: 100%;
  display: flex;
  justify-content: space-around;
  font-size: min(4.6vmin, 28px);
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.row b { color: var(--fg); }

.hint { font-size: min(4vmin, 24px); color: var(--dim); }
.warn { color: var(--warn) !important; }

.dots { display: flex; gap: 4vmin; }
.dot { width: 5vmin; height: 5vmin; max-width: 30px; max-height: 30px; border-radius: 50%; border: 2px solid var(--line); }
.dot.on { background: var(--fg); border-color: var(--fg); }
.dot.one.on { background: var(--accent); border-color: var(--accent); }

.badge {
  font-size: min(6vmin, 36px);
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.6vmin 3vmin;
  border: 2px solid currentColor;
  border-radius: 2vmin;
}
.badge.perfect, .badge.good { color: var(--good); }
.badge.boost { color: var(--warn); }
.badge.clash { color: var(--bad); }

.chips { display: flex; gap: 2vmin; font-size: min(4.4vmin, 26px); }
.chips span { border: 1px solid var(--line); border-radius: 1.5vmin; padding: 0.4vmin 1.8vmin; color: var(--good); }

table.grid { border-collapse: collapse; font-size: min(4.6vmin, 28px); font-variant-numeric: tabular-nums; }
table.grid th { color: var(--dim); font-weight: 500; }
table.grid td, table.grid th { padding: 0.4vmin 3.5vmin; text-align: right; }
table.grid td:first-child { color: var(--accent); text-align: left; }

.pads {
  width: 100%;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 1.4vmin;
}
.pad {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 1.4vmin;
  display: grid;
  place-items: center;
  font-size: min(4.4vmin, 26px);
  font-weight: 600;
}
.pad em { position: absolute; top: 0.4vmin; left: 1vmin; font-style: normal; font-size: min(2.4vmin, 14px); color: var(--dim); font-weight: 400; }
.pad.root { border-color: var(--accent); color: var(--accent); }

/* ----- field bar ----- */
.fields { display: flex; gap: 1.5vmin; }
.field {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 1.8vmin;
  padding: 1.2vmin 0.8vmin;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3vmin;
}
.field span { font-size: min(2.8vmin, 17px); color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.field b { font-size: min(3.8vmin, 23px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.field.focus { border-color: var(--accent); }
.field.focus span { color: var(--accent); }
.field.edit { border-width: 2px; border-color: var(--warn); }
.field.edit b::before { content: "\25B4 "; color: var(--warn); }
.field.edit b::after { content: " \25BE"; color: var(--warn); }

.toast {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  font-size: min(4vmin, 24px);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2vmin;
  padding: 0.6vmin 2.4vmin;
  pointer-events: none;
}

/* ----- live data ----- */
.live {
  color: #000;
  background: var(--good);
  border-radius: 1vmin;
  padding: 0 1.2vmin;
  font-size: 0.8em;
  margin: 0 1.5vmin;
}
.src { font-size: min(3.6vmin, 22px); color: var(--good); letter-spacing: 0.04em; }

.decks { width: 100%; display: flex; flex-direction: column; gap: 1.4vmin; }
.deck {
  display: grid;
  grid-template-columns: 5vmin 5vmin 1fr auto 8vmin 12vmin;
  align-items: center;
  gap: 1.6vmin;
  padding: 1.2vmin 1.6vmin;
  border: 1px solid var(--line);
  border-radius: 1.6vmin;
  font-size: min(4vmin, 24px);
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.deck .num { font-weight: 700; }
.deck .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
.deck .bpm { color: var(--fg); font-weight: 600; }
.deck .key { color: var(--good); }
.deck .left { text-align: right; }
.deck.playing .state { color: var(--good); }
.deck.now { border-color: var(--accent); }
.deck.now .num { color: var(--accent); }

.fields.tight { gap: 1vmin; }
.fields.tight .field span { font-size: min(2.4vmin, 14px); letter-spacing: 0.02em; }
.fields.tight .field b { font-size: min(3.4vmin, 20px); }

/* ----- MPC remote ----- */
.pads.remote .pad { font-size: min(5vmin, 30px); color: var(--dim); }
.pad.sel { border-color: var(--good); color: var(--good) !important; box-shadow: 0 0 0 2px var(--good); }
/* After .sel so a hit still flashes on the selected pad. */
.pad.lit { border-color: var(--warn); color: var(--warn) !important; box-shadow: inset 0 0 0 2px var(--warn); }

/* ----- MPC screen ----- */
canvas.mpc-screen {
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
  border-radius: 1.4vmin;
  touch-action: none;
  background: #000;
}
