:root {
  --game-bg: #0b1120;
  --game-ink: #e2e8f0;
  --game-accent: #38bdf8;
  --game-banner-bg: rgba(15, 23, 42, 0.88);
  --tt-panel-bg: #111827;
  --tt-card-bg: #1e293b;
  --tt-border: #334155;
  --tt-muted: #94a3b8;
  --tt-hit: #22c55e;
  --tt-fail: #ef4444;
  --tt-warn: #f59e0b;
}

.tt-app {
  background: #0b1120;
  color: #e2e8f0;
}

.tt-app .instruction-banner {
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid #1e293b;
  font-size: 0.92rem;
  padding: 4px 12px;
}

.tt-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 70fr) minmax(320px, 30fr);
  gap: 10px;
  padding: 8px 12px 12px;
  overflow: hidden;
}

.tt-stage-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  border: 1px solid var(--tt-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.45);
}

.tt-canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tt-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.tt-live-hud {
  position: absolute;
  top: 8px;
  left: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}

.tt-live-pill {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #334155;
  color: #f8fafc;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Sidebar */
.tt-sidebar {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.tt-card {
  background: var(--tt-card-bg);
  border: 1px solid var(--tt-border);
  border-radius: 12px;
  padding: 10px 12px;
}

.tt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tt-card-title {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

.tt-card-header .tt-card-title {
  margin-bottom: 0;
}

.tt-mode-badge {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.75rem;
  font-weight: 700;
}

.tt-preset-grid,
.tt-rubber-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tt-rubber-btn-wide {
  grid-column: 1 / -1;
}

.tt-preset-btn,
.tt-rubber-btn {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 9px;
  padding: 8px 9px;
  min-height: 40px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.tt-preset-btn:hover,
.tt-rubber-btn:hover {
  background: #1e293b;
  border-color: #64748b;
}

.tt-preset-btn:active,
.tt-rubber-btn:active {
  transform: scale(0.97);
}

.tt-preset-btn.active,
.tt-rubber-btn.active {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.45);
}

/* Sliders */
.tt-sliders-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

.tt-slider-full {
  grid-column: 1 / -1;
}

.tt-slider-row {
  min-width: 0;
}

.tt-slider-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  font-size: 0.79rem;
  margin-bottom: 2px;
}

.tt-slider-val {
  font-weight: 700;
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tt-angle-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

.tt-angle-sub {
  font-size: 0.74rem;
  color: #cbd5e1;
  background: #0f172a;
  padding: 1px 6px;
  border-radius: 4px;
}

.tt-range {
  width: 100%;
  height: 26px;
  margin: 0;
  accent-color: #38bdf8;
  cursor: pointer;
  touch-action: pan-y;
}

.tt-aim-status {
  margin: 6px 0 0;
  font-size: 0.76rem;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.tt-aim-status.aim-error {
  color: #f87171;
  font-weight: 700;
}

.tt-divider {
  border: 0;
  border-top: 1px solid #334155;
  margin: 8px 0;
}

/* Buttons & Checkboxes */
.tt-actions-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.tt-btn {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  padding: 9px 12px;
  min-height: 42px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  border: 1px solid transparent;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.tt-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.tt-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tt-btn-primary {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
}

.tt-btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
}

.tt-btn-secondary {
  flex: 0 0 auto;
  background: #0f172a;
  color: #cbd5e1;
  border-color: #475569;
}

.tt-btn-secondary:hover {
  background: #1e293b;
}

.tt-toggles-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: #e2e8f0;
}

.tt-check-label {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 6px 8px;
  min-height: 34px;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}

.tt-check-label input {
  accent-color: #38bdf8;
  cursor: pointer;
  margin: 0;
}

/* Scoreboard */
.tt-verdict {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
  background: #0f172a;
  color: #cbd5e1;
  border: 1px solid #334155;
}

.tt-verdict[data-state="HIT"] {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border-color: #22c55e;
}

.tt-verdict[data-state="NET"],
.tt-verdict[data-state="OWN_HALF"],
.tt-verdict[data-state="OUT"] {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: #ef4444;
}

.tt-verdict[data-state="RUNNING"] {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  border-color: #0284c7;
}

.tt-coaching-hint {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.1);
  border-left: 3px solid #38bdf8;
  color: #e2e8f0;
  font-size: 0.8rem;
  line-height: 1.38;
}

.tt-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.tt-compare-col {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 6px 8px;
}

.tt-compare-header {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 3px;
  margin-bottom: 4px;
}

.tt-metric-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  font-size: 0.76rem;
  margin-bottom: 3px;
}

.tt-metric-line:last-child {
  margin-bottom: 0;
}

.tt-metric-name {
  color: #94a3b8;
}

.tt-metric-val {
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tt-summary-rows {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 6px 8px;
}

.tt-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 0.78rem;
  margin-bottom: 3px;
}

.tt-summary-item:last-child {
  margin-bottom: 0;
}

/* Mobile & Tablet (< 900px): Canvas stays pinned at top, controls scroll smoothly below */
@media (max-width: 900px) {
  .tt-app .instruction-banner {
    display: none;
  }

  .tt-workspace {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 8px 10px;
    overflow: hidden;
  }

  .tt-stage-panel {
    flex: 0 0 clamp(175px, 33dvh, 240px);
    border-radius: 10px;
  }

  .tt-sidebar {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 12px);
  }

  .tt-card {
    padding: 8px 10px;
  }

  .tt-live-pill {
    font-size: 0.72rem;
    padding: 2px 7px;
  }

  /* Leave room for the verdict badge drawn in the canvas top-right corner */
  .tt-live-hud {
    right: 150px;
    gap: 4px;
  }
}

@media (max-width: 420px) {
  .tt-preset-btn {
    font-size: 0.74rem;
    padding: 6px 7px;
  }

  .tt-sliders-grid {
    grid-template-columns: 1fr;
  }
}
