/* ============================================================================
   td.css — "Archimedes' Artillery" layout: battlefield + control dock + HUD.
   Reuses main.css design tokens (--primary, --arena-*, slider styling).
   ============================================================================ */

#app.td {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  background: var(--bg); overflow: hidden;
}
/* author display rules must not defeat the hidden attribute */
.td [hidden] { display: none !important; }

/* ---- top bar ---- */
.td-top {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px; flex-wrap: wrap;
}
.td-top .brand { display: flex; align-items: center; gap: 10px; }
.td-top .brand .mark { width: 34px; height: 34px; }
.td-top .brand-name { font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--ink); }
.td-top .genbar { display: flex; gap: 8px; flex: 1; min-width: 240px; max-width: 560px; }
.td-top .gen-field {
  display: flex; align-items: center; gap: 8px; flex: 1;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 0 14px; box-shadow: var(--sh-1);
}
.td-top .gen-field .ico { width: 17px; height: 17px; color: var(--ink-faint); }
.gen-input {
  flex: 1; border: 0; background: transparent; outline: none;
  font-family: var(--ui); font-size: 14px; color: var(--ink); padding: 11px 0;
}
.btn-gen {
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
  background: var(--primary); color: #fff; border: 0; border-radius: var(--r-pill);
  font-family: var(--ui); font-weight: 700; font-size: 13.5px; padding: 0 16px;
  cursor: pointer; box-shadow: var(--sh-1); transition: filter .15s, transform .1s;
}
.btn-gen:hover { filter: brightness(1.06); }
.btn-gen:active { transform: translateY(1px); }
.btn-gen:disabled { opacity: .5; cursor: default; }
.btn-gen .ico { width: 15px; height: 15px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 50%;
  cursor: pointer; box-shadow: var(--sh-1);
}
.icon-btn .ico { width: 19px; height: 19px; color: var(--ink-dim); }
.icon-btn .ico-off { display: none; }
.icon-btn[data-muted="1"] .ico-on { display: none; }
.icon-btn[data-muted="1"] .ico-off { display: block; }

/* ---- battlefield ---- */
.td-field-wrap {
  position: relative; flex: 1; min-height: 0; margin: 0 14px;
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--sh-2), inset 0 0 0 1px rgba(255,255,255,.04);
  background: var(--arena-bg);
}
#field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---- HUD ---- */
.hud { position: absolute; z-index: 4; pointer-events: none; font-family: var(--ui); }
.hud-tl { top: 14px; left: 16px; }
.hud-tr { top: 14px; right: 16px; text-align: right; }
.hud-score {
  font-family: var(--mono); font-weight: 700; font-size: 30px; line-height: 1;
  color: var(--cyan-core); text-shadow: 0 2px 12px rgba(55,225,255,.4);
}
.hud-combo {
  margin-top: 4px; display: inline-block; font-weight: 800; font-size: 13px;
  color: #1a1526; background: var(--gold); padding: 3px 10px; border-radius: var(--r-pill);
  box-shadow: 0 0 16px rgba(255,211,77,.6);
}
.hud-wave { font-weight: 800; font-size: 18px; color: var(--cyan-core); }
.hud-sub { font-size: 12px; color: var(--arena-ink); margin-top: 1px; }
.hud-shots { font-family: var(--mono); font-size: 11.5px; color: var(--arena-ink); margin-top: 6px; opacity: .9; }

/* ---- overlay cards ---- */
.overlay {
  position: absolute; inset: 0; z-index: 6; display: flex;
  align-items: center; justify-content: center; pointer-events: none;
  padding: 20px;
}
.ov-card {
  pointer-events: auto; text-align: center; max-width: 440px;
  background: rgba(19,17,36,.86); backdrop-filter: blur(8px);
  border: 1px solid rgba(201,198,232,.18); border-radius: var(--r-lg);
  padding: 28px 30px; box-shadow: var(--sh-3);
  animation: ovPop .32s cubic-bezier(.2,1.2,.4,1) both;
}
@keyframes ovPop { from { opacity: 0; transform: scale(.92) translateY(8px); } to { opacity: 1; transform: none; } }
.ov-card h2 { font-family: var(--display); font-weight: 700; font-size: 27px; color: var(--cyan-core); margin: 6px 0 8px; }
.ov-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); }
.ov-concept { font-size: 14.5px; line-height: 1.5; color: var(--arena-ink); margin: 0 0 16px; }
.ov-concept b { color: var(--cyan-core); }
.ov-verify {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 18px;
  font-size: 12.5px; font-weight: 600; color: var(--mint);
  background: rgba(52,226,168,.1); border: 1px solid rgba(52,226,168,.3);
  padding: 7px 13px; border-radius: var(--r-pill);
}
.ov-verify .ico { width: 15px; height: 15px; }
.ov-stars { font-size: 34px; color: var(--gold); letter-spacing: 4px; margin-bottom: 4px; text-shadow: 0 0 18px rgba(255,211,77,.5); }
.ov-card.lose h2 { color: var(--danger); }
.ov-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--primary); color: #fff; border: 0; border-radius: var(--r-pill);
  font-family: var(--ui); font-weight: 700; font-size: 15px; padding: 12px 24px;
  box-shadow: var(--sh-2); transition: filter .15s, transform .1s;
}
.ov-btn:hover { filter: brightness(1.08); }
.ov-btn:active { transform: translateY(1px); }
.ov-btn .ico { width: 17px; height: 17px; }

.ov-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ov-chip {
  cursor: pointer; background: rgba(108,92,231,.16); color: var(--cyan-core);
  border: 1px solid rgba(139,123,255,.4); border-radius: var(--r-pill);
  font-family: var(--ui); font-weight: 600; font-size: 13px; padding: 8px 14px;
  transition: background .15s;
}
.ov-chip:hover { background: rgba(108,92,231,.32); }

/* proof theater */
.ov-card.proof { text-align: left; min-width: 340px; }
.proof-head { font-family: var(--mono); font-size: 13px; color: var(--cyan); margin-bottom: 12px; }
.proof-lines { font-family: var(--mono); font-size: 13px; line-height: 1.9; }
.proof-line { color: var(--arena-ink); opacity: 0; animation: lineIn .25s forwards; }
.proof-line.ok { color: var(--mint); }
.proof-line.bad { color: var(--danger); }
@keyframes lineIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

/* ---- control dock ---- */
.td-dock {
  display: grid; grid-template-columns: 250px 1fr 210px; gap: 20px;
  padding: 14px 20px 16px; background: var(--surface);
  border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(60,40,120,.06);
}
.dock-label { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.weapon-tabs { display: flex; gap: 8px; margin: 8px 0 6px; flex-wrap: wrap; }
.weapon-tab {
  display: flex; align-items: center; gap: 7px; cursor: pointer;
  background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--r-md);
  padding: 8px 11px; font-family: var(--ui); transition: border-color .15s, background .15s;
}
.weapon-tab .w-glyph { font-size: 17px; font-weight: 700; color: var(--wc); }
.weapon-tab .w-name { font-weight: 700; font-size: 13px; color: var(--ink-dim); }
.weapon-tab.active { border-color: var(--wc); background: #fff; box-shadow: var(--sh-1); }
.weapon-tab.active .w-name { color: var(--ink); }
.weapon-role { font-size: 12.5px; color: var(--ink-dim); margin: 2px 0 10px; line-height: 1.4; }
.sniper-toggle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-dim); cursor: pointer; }
.sniper-toggle input { accent-color: var(--primary); width: 15px; height: 15px; }
.sniper-toggle i { color: var(--accent-d); font-style: normal; font-weight: 700; }

.dock-handles { min-width: 0; }
.formula {
  font-family: var(--mono); font-size: 17px; font-weight: 600; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 14px; margin: 6px 0 10px;
  /* no overflow clipping here — the "shell trajectory" ::before label sits above the box */
}
.formula .lhs { color: var(--primary); }
.td .formula::before { content: "shell trajectory"; background: var(--surface); }

/* ---- header quick links ---- */
.top-links { display: flex; gap: 8px; align-items: center; }
.chip-link {
  font-family: var(--ui); font-weight: 700; font-size: 12px; cursor: pointer;
  color: var(--ink-dim); text-decoration: none; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 8px 13px; box-shadow: var(--sh-1); transition: color .15s, border-color .15s;
}
.chip-link:hover { color: var(--primary-d); border-color: var(--primary-2); }

/* ---- tutor "Archimedes" ---- */
.tutor {
  position: absolute; left: 16px; bottom: 14px; z-index: 5; max-width: 380px;
  background: rgba(19,17,36,.88); backdrop-filter: blur(6px);
  border: 1px solid rgba(52,226,168,.45); border-radius: var(--r-md);
  padding: 11px 30px 11px 14px; font-family: var(--ui); font-size: 13px; line-height: 1.45;
  color: var(--cyan-core); box-shadow: var(--sh-2);
  animation: ovPop .3s cubic-bezier(.2,1.2,.4,1) both;
}
.tutor-x {
  position: absolute; top: 5px; right: 7px; width: 20px; height: 20px;
  background: none; border: 0; cursor: pointer; border-radius: 50%;
  color: var(--mint); font-size: 16px; line-height: 1; padding: 0;
}
.tutor-x:hover { background: rgba(52,226,168,.18); }
.tutor b {
  display: block; margin-bottom: 3px; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--mint);
}
.tutor b::before { content: "🦉 "; }

/* ---- understanding map (victory card) ---- */
.ov-map {
  text-align: left; margin: 0 0 18px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(201,198,232,.16);
  border-radius: var(--r-md); padding: 13px 16px;
}
.map-title {
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--cyan); margin-bottom: 8px;
}
.map-row {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 13.5px; padding: 3px 0; color: var(--arena-ink);
}
.map-row span { flex: 1; font-weight: 700; color: var(--cyan-core); }
.map-row i { font-style: normal; font-size: 11.5px; opacity: .75; }
.map-row b { font-family: var(--mono); color: var(--mint); min-width: 44px; text-align: right; }
.map-note { font-size: 12.5px; color: var(--arena-ink); margin: 8px 0 0; line-height: 1.45; }
.map-note b { color: var(--gold); }

/* ---- formation callout (wave intro) ---- */
.ov-form {
  font-size: 13px; color: var(--cyan-core); margin: 0 0 14px;
  background: rgba(160,123,255,.12); border: 1px solid rgba(160,123,255,.35);
  border-radius: var(--r-pill); padding: 7px 14px; display: inline-block;
}
.ov-form b { color: #cdb3ff; }

/* ---- shield/immunity callout (wave intro) ---- */
.ov-immune {
  font-size: 13px; color: #ffc2d0; margin: 0 0 14px;
  background: rgba(255,91,127,.10); border: 1px solid rgba(255,91,127,.35);
  border-radius: var(--r-pill); padding: 7px 14px; display: inline-block;
}
.ov-immune b { color: #ff9ab0; }
.handles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 18px; }
.expr-input {
  width: 100%; box-sizing: border-box; font-family: var(--mono); font-size: 16px;
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink); outline: none;
}
.expr-input:focus { border-color: var(--primary); }
.dock-err { color: var(--danger-d); font-size: 12.5px; font-weight: 600; margin: 6px 0 0; }

.dock-fire { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.fire-btn {
  display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer;
  background: linear-gradient(180deg, var(--accent-2), var(--accent-d)); color: #fff; border: 0;
  border-radius: var(--r-md); padding: 13px; box-shadow: var(--sh-2);
  transition: filter .15s, transform .1s;
}
.fire-btn:hover { filter: brightness(1.06); }
.fire-btn:active { transform: translateY(2px); }
.fire-btn:disabled { opacity: .45; cursor: default; filter: grayscale(.3); }
.fire-label { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: .04em; }
.fire-sub { font-size: 11px; opacity: .85; }
.fire-hint { font-size: 11.5px; color: var(--ink-faint); text-align: center; margin: 0; line-height: 1.35; }

/* ---- slider reuse (mirror main.css panel sliders, compact) ---- */
.slider-field { display: flex; flex-direction: column; gap: 3px; }
.slider-top { display: flex; justify-content: space-between; align-items: baseline; }
.s-label { font-size: 12px; font-weight: 600; color: var(--ink-dim); }
.s-desc { font-size: 10.5px; color: var(--ink-faint); margin: 1px 0 0; line-height: 1.3; }
.s-value { font-family: var(--mono); font-size: 12.5px; font-weight: 700; color: var(--primary-d); }
.slider-field input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) var(--fill, 50%), var(--surface-3) var(--fill, 50%));
  outline: none; cursor: pointer;
}
.slider-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--primary); box-shadow: var(--sh-1); cursor: grab;
}
.slider-field input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  border: 2px solid var(--primary); box-shadow: var(--sh-1); cursor: grab;
}

/* ---- responsive ---- */
@media (max-width: 820px) {
  .td-dock { grid-template-columns: 1fr; gap: 12px; }
  .dock-fire { flex-direction: row; align-items: center; }
  .fire-btn { flex: 1; flex-direction: row; justify-content: center; gap: 8px; }
  .td-top .genbar { order: 3; max-width: none; }
}
