/* The play screen: a slim bar, the table filling everything it can, and
   the controls in a fixed panel along the bottom. Nothing scrolls, so a
   drag on the table can never fight the page. */
body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

.topbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; padding-top: calc(6px + env(safe-area-inset-top));
  background: rgba(8, 40, 25, .92); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 14px; font-weight: 900; letter-spacing: .02em; white-space: nowrap; }
.topbar h1 b { color: var(--accent); }
.topbar .status { flex: 1; min-width: 0; display: flex; gap: 5px; justify-content: flex-end; flex-wrap: nowrap; overflow: hidden; }
.topbar .chip { font-size: 10px; padding: 3px 7px; letter-spacing: .05em; }
.topbar .btn.small { min-width: 36px; padding: 4px 8px; font-size: 17px; flex: 0 0 auto; }

#stage { flex: 1 1 auto; min-height: 0; position: relative; }
#table {
  display: block; width: 100%; height: 100%;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
#hint {
  position: absolute; left: 50%; top: 6px; transform: translateX(-50%);
  background: rgba(0, 0, 0, .6); color: var(--text); font-size: 12px; font-weight: 700;
  padding: 6px 12px; border-radius: 999px; pointer-events: none; white-space: nowrap; max-width: 94%;
  overflow: hidden; text-overflow: ellipsis;
}
#hint[hidden] { display: none; }

#controls {
  flex: 0 0 auto; display: grid; gap: 6px;
  padding: 6px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, .25); border-top: 1px solid var(--line);
}
.readout { min-height: 18px; font-size: 13px; font-weight: 700; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.readout .warn { color: var(--gold); }
.readout .warn.bad { color: var(--danger); }
.readout .warn.ok { color: var(--ok); }

.tips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.tip {
  min-height: var(--tap); border-radius: var(--radius); border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06); color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 3px 2px; font-size: 10px; font-weight: 700; line-height: 1.1; text-align: center;
  cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.tip.on { background: rgba(255, 159, 28, .18); border-color: var(--accent); color: var(--text); }
.tip .ball { position: relative; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #cfcfc4 70%, #9a9a90); flex: 0 0 auto; }
.tip .ball i { position: absolute; left: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #1a6bd6; }
.tip.on .ball i { background: var(--accent-ink); }

.sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.slider { display: block; font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.slider .lbl { display: flex; justify-content: space-between; }
.slider b { color: var(--text); }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 34px; margin: 0; background: transparent;
  touch-action: pan-y; -webkit-tap-highlight-color: transparent;
}
input[type="range"]:focus { outline: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .22); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--gold); border: 2px solid var(--gold-ink); margin-top: -10px; }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .22); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--gold); border: 2px solid var(--gold-ink); }

.secondary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.secondary .btn { padding: 4px 4px; font-size: 13px; }

#update {
  position: fixed; left: 0; right: 0; top: 0; z-index: 130; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--gold); color: var(--gold-ink); font-weight: 800; text-align: center; cursor: pointer;
}
#update[hidden] { display: none; }

#debug {
  position: absolute; left: 6px; top: 6px; z-index: 50; max-width: 60%; max-height: 90%; overflow: auto;
  background: rgba(0, 0, 0, .7); color: #9f9; font: 10px/1.3 ui-monospace, Menlo, monospace; padding: 6px; border-radius: 6px; pointer-events: none; white-space: pre-wrap;
}

/* A wide screen (a laptop, a tablet on its side): the table on the left,
   the controls in a column on the right. */
@media (min-width: 720px) and (orientation: landscape) {
  body { display: grid; grid-template-columns: 1fr minmax(300px, 380px); grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / 3; }
  #stage { grid-column: 1; grid-row: 2; }
  #controls { grid-column: 2; grid-row: 2; border-top: 0; border-left: 1px solid var(--line); align-content: start; padding-top: 12px; }
  .tips { grid-template-columns: repeat(5, 1fr); }
  .btn.big { min-height: 56px; }
}
