:root {
  --bg: #0b0c0f;
  --panel: #12141a;
  --panel-2: #181b22;
  --line: #2a2e38;
  --text: #ece7dc;
  --muted: #9a958c;
  --accent: #c4a574;
  --red: #e25c5c;
  --ok: #7cb89a;
  --warn: #d4a017;
  --term: #0c100e;
  --term-fg: #b6e0c2;
  --term-prompt: #d7c39a;
  --term-h: 250px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --topbar: #101218;
  --sidebar: #0e1015;
  --topo-bg: #0f1116;
  --syslog-bg: #0a0c10;
  --syslog-fg: #9a958c;
  --msg: #e6e1d6;
  --caption: #d8d3c8;
  --chip: #1e1b16;
  --ok-bg: #14201a;
  --ok-line: #2e5c45;
  --bad-bg: #241414;
  --bad-line: #6a2a2a;
  --reveal-bg: #1e1b16;
  --reveal-line: #6a5a3a;
  --active: #1e1b16;
  --study-bg: linear-gradient(180deg, #1c1914 0%, #151318 100%);
  --study-line: #5a4a32;
  --scroll: #3a3f4c;
  --trace-bg: #16131a;
  --trace-line: #4a3a28;
  --if-bg: #1c1810;
  --if-fg: #f4ead4;
  --if-line: #c4a574;
  --brand-ink: #1a140c;
  --box: #1b1e26;
  --box-line: #5a6470;
  --box-root: #241e14;
  --on-box: #f4ead4;
  --on-box-dim: #c8c2b6;
  --on-metal: #d8dee6;
  color-scheme: dark;
  font-family: "IBM Plex Sans KR", "IBM Plex Sans", "Malgun Gothic", sans-serif;
}
html[data-theme="light"] {
  --bg: #f4f0e7;
  --panel: #fffdf8;
  --panel-2: #f3ebe0;
  --line: #c9bba6;
  --text: #16130f;
  --muted: #3d3830;
  --accent: #6a3d0e;
  --red: #b32626;
  --ok: #1f6b4a;
  --warn: #8a5a00;
  --shadow: 0 16px 40px rgba(40, 30, 10, 0.12);
  --topbar: #fffdf8;
  --sidebar: #f6f1e6;
  --topo-bg: #e9e1d2;
  --syslog-bg: #efe7d8;
  --syslog-fg: #2e2a24;
  --msg: #1c1914;
  --caption: #2a261f;
  --chip: #f3eadc;
  --ok-bg: #dceee4;
  --ok-line: #6aa888;
  --bad-bg: #f8e4e4;
  --bad-line: #d09090;
  --reveal-bg: #f4ead8;
  --reveal-line: #c4a574;
  --active: #e4c078;
  --study-bg: linear-gradient(180deg, #fff8ec 0%, #f4ebe0 100%);
  --study-line: #8a6230;
  --scroll: #b5aa98;
  --trace-bg: #fff8ec;
  --trace-line: #c4b08a;
  --if-bg: #fffdf8;
  --if-fg: #16130f;
  --if-line: #6a3d0e;
  --brand-ink: #fff8ee;
  --box: #fffdf8;
  --box-line: #8a6a38;
  --box-root: #f3e6cc;
  --on-box: #16130f;
  --on-box-dim: #3d3830;
  --on-metal: #e8edf2;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app {
  height: 100%;
  display: grid;
  grid-template-columns: 232px 280px minmax(380px, 1fr) 300px;
  grid-template-rows: auto minmax(0, 1fr) var(--term-h);
  grid-template-areas:
    "top top top top"
    "side ticket topo work"
    "side term term term";
}

.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  flex-wrap: wrap;
  min-height: 52px;
  min-width: 0;
  overflow: visible;
  z-index: 8;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--brand-ink); flex: 0 0 auto;
}
.brand-mark svg { display: block; }
.brand strong { font-size: 15px; letter-spacing: 0; font-weight: 700; word-break: keep-all; }
.brand-sub { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.top-status {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 12px; font-family: "IBM Plex Mono", Consolas, monospace;
}
.hdr-actions, .top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.hdr-actions .ghost-btn, .top-actions .ghost-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.sep { width: 1px; height: 12px; background: var(--line); }
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
}
.pulse-dot.hot {
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(226, 92, 92, 0.55);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 7px rgba(226, 92, 92, 0); }
}

.sidebar {
  grid-area: side;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  overflow: auto;
  padding: 14px 10px 18px 12px;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: 99px;
  border: 2px solid var(--sidebar);
}
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.sidebar { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }

.side-label {
  font-size: 13px; letter-spacing: 0; font-weight: 800;
  color: var(--text); margin: 0 6px 10px; word-break: keep-all;
}
.scenario-list { display: flex; flex-direction: column; gap: 4px; }
.lv-head {
  font-size: 12px; color: var(--text); margin: 12px 6px 6px;
  letter-spacing: 0; font-weight: 800; word-break: keep-all;
}
.lv-head:first-child { margin-top: 0; }
.lv-pill {
  display: inline-block; min-width: 22px; text-align: center;
  color: var(--accent); font-size: 11px; font-family: "IBM Plex Mono", monospace;
  margin-right: 8px;
}
.sc-btn {
  text-align: left; background: transparent; border: 0;
  border-radius: 6px; padding: 8px 10px; color: var(--text);
  font-size: 13px; font-weight: 500; width: 100%; line-height: 1.4; word-break: keep-all;
}
.sc-btn:hover { background: var(--panel-2); }
.sc-btn.active {
  background: var(--active); color: var(--text); font-weight: 700;
  box-shadow: inset 3px 0 0 var(--accent);
}
html[data-theme="light"] .sc-btn.active {
  background: #e4c078;
  color: #1a0e04;
}
html[data-theme="dark"] .sc-btn.active {
  background: #2c261c;
  color: #f6efe2;
}
.sc-btn.done { color: var(--ok); }
.sc-btn.done .lv-pill { color: var(--ok); }

.ticket-panel, .topo-panel, .work-panel, .term-panel {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-width: 0;
  min-height: 0;
}
.ticket-panel { grid-area: ticket; display: flex; flex-direction: column; }
.topo-panel { grid-area: topo; }
.work-panel { grid-area: work; }
.term-panel { grid-area: term; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  font-size: 13px; letter-spacing: 0; font-weight: 700; color: var(--text); word-break: keep-all;
}
.panel-head > span:first-child { min-width: 0; }
.modal-card .panel-head .ghost-btn {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
  min-height: 44px;
  min-width: 72px;
  position: relative;
  z-index: 3;
}
.badge {
  background: var(--active); color: var(--accent); border-radius: 4px;
  padding: 2px 7px; font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
}
.badge.p1 { background: var(--bad-bg); color: var(--red); }
.ticket-body { padding: 16px; overflow: auto; flex: 1; min-height: 0; }
.ticket-body::-webkit-scrollbar,
.work-panel::-webkit-scrollbar,
.term-output::-webkit-scrollbar,
.syslog::-webkit-scrollbar { width: 8px; height: 8px; }
.ticket-body::-webkit-scrollbar-thumb,
.work-panel::-webkit-scrollbar-thumb,
.term-output::-webkit-scrollbar-thumb,
.syslog::-webkit-scrollbar-thumb {
  background: var(--scroll); border-radius: 99px;
}
.ticket-body h1 { font-size: 18px; margin: 0 0 8px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; word-break: keep-all; }
.muted { color: var(--muted); }
.ticket-id {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 11px; color: var(--accent); margin: 0 0 10px;
  letter-spacing: 0.04em;
}
.ticket-from {
  font-size: 12px; color: var(--muted); margin: 0 0 12px;
}
.ticket-from strong { color: var(--text); font-weight: 600; }
.ticket-msg {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 15px;
  font-size: 13px; line-height: 1.7; color: var(--msg);
  white-space: pre-wrap; position: relative; overflow-wrap: anywhere;
}
.ticket-msg::before {
  content: "고객 메시지";
  display: block; font-size: 12px; letter-spacing: 0; font-weight: 700;
  color: var(--muted); margin-bottom: 8px;
}

.topo-panel { display: flex; flex-direction: column; background: var(--topo-bg); }
.topo-wrap { flex: 1; min-height: 0; }
#topo { width: 100%; height: 100%; display: block; }
.legend { display: flex; gap: 10px; align-items: center; font-size: 11px; letter-spacing: 0; text-transform: none; }
.lg { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.lg.up { background: var(--ok); }
.lg.warn { background: var(--warn); }
.lg.loop { background: var(--red); }
.lg.down { background: #5a5e68; }
.node { cursor: pointer; }
.node.selected .chassis, .node.selected .metal { stroke: var(--accent); stroke-width: 1.8; }
.node .chassis { fill: #1b1e26; stroke: #4a5060; stroke-width: 1.2; }
.node.warn .chassis, .node.warn .metal { stroke: var(--warn); }
.node.bad .chassis, .node.bad .metal { stroke: var(--red); }
.node .label { fill: var(--text); font-size: 13px; font-weight: 700; font-family: "IBM Plex Sans", "Malgun Gothic", sans-serif; }
.node .role { fill: var(--muted); font-size: 11px; font-family: "IBM Plex Sans", "Malgun Gothic", sans-serif; }

.metal { fill: #2a313c; stroke: #6a7380; stroke-width: 1.15; }
.metal-top { fill: #3d4654; stroke: #7a8490; stroke-width: 0.8; }
.bezel { fill: #101318; stroke: #2c333c; stroke-width: 0.5; }
.ear { fill: #3a424c; stroke: #6a7380; stroke-width: 0.6; }
.rj45 { fill: #0b0d10; stroke: #4a5560; stroke-width: 0.55; }
.sfp { fill: #0b0d10; stroke: #5a6570; stroke-width: 0.6; }
.vent { fill: #1a1f26; }
.hdd { fill: #1a1f26; stroke: #4a5560; stroke-width: 0.5; }
.mode-btn { fill: #2a313c; stroke: #6a7380; stroke-width: 0.7; }
.fw-stripe { fill: #c45a3a; }
.fw-top { fill: #4a3228; stroke: #c45a3a; }
.metal.hub { fill: #323028; stroke: #6a6458; }
.pc-bezel { fill: #1c2028; stroke: #5a6270; stroke-width: 1.1; }
.pc-screen { fill: #132018; stroke: #1e3a2a; stroke-width: 0.6; }
.pc-screen.dead { fill: #12141a; }
.pc-stand { fill: #2a313c; stroke: #4a5560; stroke-width: 0.5; }
.pc-base { fill: #2a313c; stroke: #4a5560; stroke-width: 0.5; }
.cloud-body { fill: #1b2430; stroke: #5a738c; stroke-width: 1.3; }
.glabel { fill: var(--text); font-size: 13px; font-weight: 700; font-family: "IBM Plex Sans", "Malgun Gothic", sans-serif; }
.grole { fill: var(--muted); font-size: 12px; font-weight: 500; font-family: "IBM Plex Sans", "Malgun Gothic", sans-serif; }
.gmini { fill: var(--on-metal); font-size: 7px; font-family: "IBM Plex Sans", sans-serif; }
.led-on { fill: #3ee07a; }
.led-on.act { animation: ledact 1.4s infinite; }
.led-dim { fill: #2a323c; }
.led-off { fill: #14181e; }
.led-warn { fill: #e0b33a; filter: drop-shadow(0 0 2px rgba(224,179,58,.7)); }
.led-err { fill: #e25c5c; filter: drop-shadow(0 0 2px rgba(226,92,92,.8)); animation: ledblink 0.5s infinite; }
.led.sys.led-on { filter: drop-shadow(0 0 3px rgba(62,224,122,.85)); }
@keyframes ledact {
  0%, 70%, 100% { opacity: 1; }
  85% { opacity: 0.25; }
}
@keyframes ledblink {
  50% { opacity: 0.2; }
}
.lsw.root .metal { stroke: var(--accent); fill: #2a261c; }
.lsw.bad .metal { stroke: var(--red); }
.lsw.warn .metal { stroke: var(--warn); }
.lsw.root .cloud-body, .lsw.root .pc-bezel { stroke: var(--accent); }
.lsw.bad .cloud-body, .lsw.bad .pc-bezel { stroke: var(--red); }
.lsw.warn .cloud-body, .lsw.warn .pc-bezel { stroke: var(--warn); }
.link { fill: none; stroke-width: 2.4; stroke: var(--ok); }
.link.warn { stroke: var(--warn); }
.link.down { stroke: #5a5e68; stroke-dasharray: 5 5; }
.link.loop {
  stroke: var(--red);
  stroke-dasharray: 7 5;
  animation: dash 0.8s linear infinite;
}
@keyframes dash { to { stroke-dashoffset: -24; } }

.syslog-wrap { border-top: 1px solid var(--line); background: var(--syslog-bg); flex: 0 0 auto; }
.syslog-head {
  padding: 8px 12px 4px;
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 700;
  color: var(--text);
  word-break: keep-all;
}
.syslog {
  height: 78px; overflow: auto;
  background: transparent; padding: 4px 12px 8px;
  font: 12px/1.55 "IBM Plex Mono", Consolas, monospace; color: var(--syslog-fg);
}
.syslog div { white-space: nowrap; }
.syslog .err { color: var(--red); }
.syslog .warn { color: var(--warn); }
.syslog .empty { white-space: normal; color: var(--muted); }

.work-panel { overflow: auto; padding-bottom: 14px; }
.checklist { list-style: none; margin: 0; padding: 8px 14px; }
.checklist li {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12px; color: var(--muted); margin: 7px 0; line-height: 1.4;
}
.checklist li.done { color: var(--ok); }
.box {
  width: 12px; height: 12px; border: 1px solid #4a5060; border-radius: 2px;
  flex: 0 0 12px; margin-top: 2px;
}
.checklist li.done .box { background: var(--ok); border-color: var(--ok); }
.hint-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 14px 8px;
}
.hint-text { font-size: 12px; line-height: 1.55; padding: 0 14px 8px; color: var(--caption); }
.trace-card {
  background: var(--trace-bg); border: 1px solid var(--trace-line);
  border-radius: 8px; padding: 12px 13px;
}
.trace-kicker {
  font-size: 12px; letter-spacing: 0; font-weight: 700;
  color: var(--accent); margin-bottom: 8px; word-break: keep-all;
}
.trace-lead { margin: 0 0 8px; color: var(--caption); }
.trace-list { margin: 0; padding-left: 16px; }
.trace-list li { margin: 5px 0; color: var(--text); }
.trace-notes { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.trace-notes p { margin: 6px 0; color: var(--caption); }
.trace-more { margin: 10px 0 0; font-size: 11px; color: var(--muted); }
.ghost-btn, .primary-btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px;
  font-size: 12px;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }
.result-box {
  margin: 8px 14px 0; padding: 12px;
  border-radius: 8px; font-size: 12px; line-height: 1.55;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.result-box.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--text); }
.result-box.bad { background: var(--bad-bg); border-color: var(--bad-line); }
.result-box.revealed { background: var(--reveal-bg); border-color: var(--reveal-line); color: var(--text); }
.hidden { display: none !important; }
.app-hidden { display: none !important; }

.explain-steps { margin: 10px 0 8px; padding-left: 18px; color: inherit; }
.explain-steps li { margin: 6px 0; }
.lesson { color: var(--accent); margin: 10px 0 0; }
.sol-cmds {
  background: #0c100e; color: var(--term-fg);
  padding: 10px 12px; border-radius: 6px; font-size: 11px;
  overflow: auto; margin-top: 8px;
  font-family: "IBM Plex Mono", Consolas, monospace;
}

.gate {
  position: fixed; inset: 0; z-index: 30;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(196, 165, 116, 0.16), transparent 58%),
    var(--bg);
  display: grid; place-items: center;
  padding: 24px;
  overflow: auto;
  overflow-x: hidden;
}
.gate::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(196, 165, 116, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(196, 165, 116, 0.08) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 18%, #000 12%, transparent 72%);
  pointer-events: none;
}
html[data-theme="light"] .gate {
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(138, 98, 14, 0.12), transparent 58%),
    var(--bg);
}
html[data-theme="light"] .gate::before {
  background-image:
    linear-gradient(rgba(106, 61, 14, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(106, 61, 14, 0.08) 1px, transparent 1px);
}
.gate-inner { width: min(980px, 100%); max-width: 100%; min-width: 0; position: relative; z-index: 1; }
.gate-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 28px;
}
.gate-brand { margin-bottom: 0; min-width: 0; flex: 1 1 auto; }
.gate-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.gate-bar .contact-open {
  background: #c4782a;
  color: #fff8ee;
  border-color: #a35e18;
  font-weight: 800;
  text-decoration: none;
}
html[data-theme="light"] .gate-bar .contact-open {
  background: #8a4a10;
  border-color: #6a380c;
  color: #fffdf8;
}
.theme-toggle { flex: 0 0 auto; white-space: nowrap; }
.gate-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  gap: 28px;
  align-items: center;
  margin-bottom: 22px;
  min-width: 0;
}
.gate-hero-copy { min-width: 0; }
.gate-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  word-break: keep-all;
}
.gate-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4.4vw, 42px);
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.03em;
  word-break: keep-all;
}
.gate-lead {
  margin: 0;
  color: var(--caption);
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
}
.gate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.gate-chips li {
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  word-break: keep-all;
}
.gate-stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 14px 12px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.gate-rack {
  color: var(--accent);
}
.gate-rack-label {
  display: block;
  margin: 0 0 6px 10px;
  font-size: 11px;
  font-weight: 700;
  font-family: "IBM Plex Mono", Consolas, monospace;
  letter-spacing: 0.06em;
}
.gate-rack svg { display: block; }
.gate-rack .port-dead {
  color: var(--red);
  animation: portblink 1.6s ease-in-out infinite;
}
@keyframes portblink {
  50% { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
  .gate-rack .port-dead { animation: none; }
}
.gate-term {
  margin-top: 8px;
  background: var(--term);
  color: var(--term-fg);
  border-radius: 8px;
  padding: 10px 12px;
  font: 12px/1.55 "IBM Plex Mono", Consolas, monospace;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}
.gate-term .gprompt { color: var(--term-prompt); }
.gate-term .gwarn { color: var(--accent); margin-top: 4px; }
.gate-cta {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 12px;
  margin: 0 0 28px;
}
.study-launch {
  width: 100%;
  text-align: left;
  background: var(--study-bg);
  border: 1px solid var(--study-line);
  border-radius: 14px;
  padding: 20px 20px 18px;
  margin: 0;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.study-launch:hover { border-color: var(--accent); }
.study-kicker {
  display: block;
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  word-break: keep-all;
}
.study-launch strong { display: block; font-size: 22px; margin-bottom: 8px; }
.study-launch span:nth-of-type(2) {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  flex: 1;
}
.study-launch em {
  display: inline-block;
  margin-top: 14px;
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}
.gate-sec {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  word-break: keep-all;
}
.gate-note {
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  word-break: keep-all;
}
.gate-topics {
  margin: 28px 0 8px;
  padding: 20px 18px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.gate-topics h2 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.4;
  word-break: keep-all;
}
.gate-topics > p {
  margin: 0 0 16px;
  color: var(--caption);
  font-size: 14px;
  line-height: 1.65;
  word-break: keep-all;
}
.gate-topics ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.gate-topics li {
  margin: 0;
  padding: 12px 13px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  word-break: keep-all;
}
.gate-topics li strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 14px;
}
.track-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.track-card {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 16px 14px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 108px;
}
.track-card:hover { border-color: var(--accent); }
.track-ico {
  width: 42px; height: 42px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--chip);
  border: 1px solid var(--line);
  color: var(--accent);
  flex: 0 0 auto;
}
.track-card[data-track="server"] .track-ico { color: var(--ok); }
.track-card[data-track="fw"] .track-ico { color: var(--red); }
.track-copy { min-width: 0; }
.track-copy strong { display: block; font-size: 16px; margin-bottom: 4px; }
.track-copy span { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; }
.track-copy em { display: block; margin-top: 8px; font-style: normal; font-size: 11px; color: var(--accent); letter-spacing: 0.04em; }

.term-panel { display: flex; flex-direction: column; background: var(--term); position: relative; }
.term-resizer {
  height: 7px; cursor: ns-resize; flex: 0 0 7px;
  touch-action: none;
  background: linear-gradient(to bottom, #1c211e, #141a16);
  border-bottom: 1px solid #243028;
  user-select: none;
}
.term-resizer:hover, .term-resizer.dragging { background: var(--accent); }
.term-tabs {
  display: flex; gap: 4px; padding: 6px 10px; background: #0f1612;
  border-bottom: 1px solid #1c2a22; overflow: auto;
}
.term-tabs::-webkit-scrollbar { height: 6px; }
.tab {
  background: transparent; border: 1px solid #2a4034; color: #8aae96;
  border-radius: 4px; padding: 3px 10px; font-size: 11px;
  font-family: "IBM Plex Mono", Consolas, monospace;
}
.tab.active { background: #173226; color: var(--term-fg); border-color: #3d6a50; }
.term { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.term-output {
  flex: 1; overflow: auto; padding: 10px 14px;
  font: 13px/1.5 "IBM Plex Mono", Consolas, monospace;
  color: var(--term-fg); white-space: pre-wrap;
}
.term-input-row {
  display: flex; gap: 8px; align-items: center; padding: 8px 12px;
  border-top: 1px solid #1c2a22;
}
.prompt { font: 13px "IBM Plex Mono", Consolas, monospace; color: var(--term-prompt); white-space: nowrap; }
.term-input-row input {
  flex: 1; background: transparent; border: 0; outline: none; padding: 0;
  font: 13px "IBM Plex Mono", Consolas, monospace; color: var(--term-fg);
}

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: grid; place-items: center; z-index: 80;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-card {
  width: min(560px, 100%);
  max-height: min(640px, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px));
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.modal-card .panel-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  flex-wrap: nowrap;
}
.help-body { padding: 16px 18px 20px; line-height: 1.65; font-size: 14px; }
.help-body ol { padding-left: 18px; }
code {
  background: var(--panel-2); padding: 1px 6px; border-radius: 4px;
  font-family: "IBM Plex Mono", Consolas, monospace; font-size: 12px;
}

.learn {
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg);
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "top top"
    "nav main";
}
.learn-top {
  grid-area: top;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  min-height: 52px;
  min-width: 0;
  overflow: visible;
  z-index: 8;
}
.learn-top .brand { min-width: 0; flex: 1; overflow: hidden; }
.learn-top .brand div { min-width: 0; }
.learn-top .brand strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}
.learn-top .brand-sub {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.learn-nav-btn { display: none; }
.learn-nav-mask { display: none; }
.learn-nav {
  grid-area: nav;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  padding: 12px 8px 20px;
  min-width: 0;
}
.learn-nav::-webkit-scrollbar { width: 8px; }
.learn-nav::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 99px; }
.learn-cat {
  font-size: 17px;
  letter-spacing: 0;
  font-weight: 800;
  color: var(--text);
  margin: 18px 8px 6px;
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--line);
}
.learn-cat:first-child { margin-top: 4px; }
.learn-item {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: 6px;
  padding: 6px 10px; font-size: 13px; font-weight: 500;
  color: var(--text);
  line-height: 1.4; word-break: keep-all; overflow-wrap: break-word;
}
.learn-item:hover { background: var(--panel-2); }
.learn-item.active {
  background: var(--active);
  color: var(--text);
  font-weight: 800;
  box-shadow: inset 3px 0 0 var(--accent);
}
html[data-theme="light"] .learn-cat { color: #1a140c; }
html[data-theme="light"] .learn-item { color: #12100c; }
html[data-theme="light"] .learn-item.active {
  background: #e4c078;
  color: #1a0e04;
}
html[data-theme="dark"] .learn-item.active {
  background: #2c261c;
  color: #f6efe2;
}
.learn-main {
  grid-area: main;
  display: grid;
  grid-template-rows: minmax(220px, 1.1fr) minmax(180px, auto);
  min-width: 0; min-height: 0;
}
.learn-anim {
  background: var(--topo-bg);
  border-bottom: 1px solid var(--line);
  display: grid; place-items: center;
  min-height: 0;
  overflow: auto;
  padding: 8px;
}
.learn-anim svg { width: min(100%, 860px); height: auto; max-height: 420px; }
.learn-caption {
  padding: 16px 22px 20px;
  overflow: auto;
  background: var(--panel);
}
.learn-caption h2 { font-size: 20px; margin: 0 0 8px; font-weight: 800; word-break: keep-all; }
.learn-caption p { margin: 0; font-size: 15px; line-height: 1.7; color: var(--caption); overflow-wrap: anywhere; }
.learn-caption .lesson { margin-top: 10px; }
.learn-dots { display: flex; gap: 6px; margin-bottom: 10px; }
.learn-dots i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--scroll); display: block;
}
.learn-dots i.on { background: var(--accent); }
.learn-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ghost-btn:disabled, .primary-btn:disabled {
  opacity: 0.35; cursor: default;
}
.ghost-btn:disabled:hover { border-color: var(--line); color: inherit; }

.lbox { fill: var(--panel); stroke: var(--line); stroke-width: 1.4; }
.lbox.hi { stroke: var(--accent); stroke-width: 2.2; fill: var(--active); }
.lsw.root .lbox { stroke: var(--accent); fill: var(--box-root); }
.lsw.bad .lbox { stroke: var(--red); }
.lsw.warn .lbox { stroke: var(--warn); }
.llabel { fill: var(--on-box); font-size: 13px; font-weight: 700; font-family: "IBM Plex Sans", "Malgun Gothic", sans-serif; }
.lrole { fill: var(--on-box-dim); font-size: 12px; font-family: "IBM Plex Sans", "Malgun Gothic", sans-serif; }
.lrow { fill: var(--panel); stroke: var(--line); stroke-width: 1.5; }
.lrow.hi { fill: var(--active); stroke: var(--accent); stroke-width: 2.2; }
.lrow-h {
  fill: var(--text); font-size: 15px; font-weight: 800;
  font-family: "IBM Plex Sans", "Malgun Gothic", sans-serif;
}
.lrow-b {
  fill: var(--muted); font-size: 13px; font-weight: 500;
  font-family: "IBM Plex Sans", "Malgun Gothic", sans-serif;
}
html[data-theme="dark"] .lrow.hi { fill: #2c261c; }
html[data-theme="light"] .lrow-h { fill: #12100c; }
html[data-theme="light"] .lrow-b { fill: #3a3530; }
.lnk { fill: none; stroke: var(--ok); stroke-width: 2.6; }
.lnk.warn { stroke: var(--warn); }
.lnk.down { stroke: #5a5e68; stroke-dasharray: 5 5; }
.lnk.loop {
  stroke: var(--red);
  stroke-dasharray: 8 6;
  animation: dash 0.7s linear infinite;
}
.lnk.blk {
  stroke: var(--warn);
  stroke-dasharray: 7 7;
  stroke-width: 2.2;
}
.tag {
  font-size: 14px; font-weight: 700; font-family: "IBM Plex Sans", "Malgun Gothic", sans-serif;
  fill: var(--text);
  paint-order: stroke;
  stroke: var(--topo-bg);
  stroke-width: 4px; stroke-linejoin: round;
}
.tag.err { fill: var(--red); }
.bubble {
  fill: var(--chip); stroke: var(--study-line); stroke-width: 1;
}
.note {
  fill: var(--caption); font-size: 13px; font-family: "IBM Plex Sans", "Malgun Gothic", sans-serif;
  paint-order: stroke; stroke: var(--topo-bg); stroke-width: 3px; stroke-linejoin: round;
}
.logln { fill: var(--on-box); font-size: 11px; font-family: "IBM Plex Mono", Consolas, monospace; }
.logln.hi { fill: var(--red); font-weight: 600; }
.vlan10 { fill: #7cb89a; }
.vlan20 { fill: #c4a574; }
.pkt-dot { filter: drop-shadow(0 0 4px rgba(226,92,92,.6)); }
.shield { fill: #173226; stroke: var(--ok); }
.drop { fill: none; stroke: var(--red); stroke-width: 2.4; }

.if-tag { pointer-events: none; }
.if-chip {
  fill: var(--if-bg);
  stroke: var(--if-line);
  stroke-width: 1.5;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
.if-label {
  fill: var(--if-fg);
  font-size: 12px;
  font-weight: 600;
  font-family: "IBM Plex Mono", Consolas, "Malgun Gothic", monospace;
  pointer-events: none;
}
.mob-tabs {
  display: none;
  grid-area: tabs;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
}
.mob-tabs button {
  flex: 1;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 11px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.mob-tabs button.on {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

@media (max-width: 1200px) {
  #app {
    grid-template-columns: 210px 1fr 260px;
    grid-template-areas:
      "top top top"
      "side topo work"
      "ticket term term";
  }
  .learn {
    grid-template-columns: 200px 1fr;
  }
}
@media (max-width: 860px) {
  html, body {
    height: var(--vh, 100dvh);
    overflow: hidden;
  }
  html.is-gate, body.is-gate {
    height: auto;
    min-height: var(--vh, 100dvh);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #app {
    height: var(--vh, 100dvh);
    margin-top: var(--vv-top, 0px);
  }
  .learn {
    height: var(--vh, 100dvh);
    top: var(--vv-top, 0px);
    bottom: auto;
  }
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr) var(--term-h);
    grid-template-areas:
      "top"
      "tabs"
      "main"
      "term";
  }
  .topbar, .learn-top {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    position: relative;
    z-index: 8;
    padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  }
  .topbar .brand, .learn-top .brand {
    min-width: 0;
    width: auto;
    flex: 1 1 auto;
    overflow: hidden;
  }
  .topbar .brand-mark, .learn-top .brand-mark { width: 22px; height: 22px; border-radius: 5px; }
  .topbar .brand > div { display: none; }
  .topbar .brand { flex: 0 0 auto; width: auto; }
  .learn-top .brand strong {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .learn-top .brand-sub { display: none; }
  .top-status { display: none; }
  .top-actions, .hdr-actions {
    display: flex;
    flex-wrap: nowrap;
    width: auto;
    margin: 0;
    margin-left: auto;
    gap: 4px;
    flex: 0 0 auto;
  }
  .hdr-actions { grid-template-columns: none; }
  .top-actions { grid-template-columns: none; }
  .topbar .ghost-btn, .learn-top .ghost-btn, .hdr-actions .ghost-btn {
    padding: 5px 7px;
    font-size: 12px;
    font-weight: 700;
    min-height: 32px;
    width: auto;
    white-space: nowrap;
  }
  .gate-bar .ghost-btn { width: auto; min-width: 64px; padding: 10px 12px; }
  .modal-card .panel-head .ghost-btn {
    min-height: 44px;
    min-width: 64px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 700;
  }
  .hint-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .hint-row .ghost-btn { width: 100%; }
  .learn {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "top"
      "main";
    overflow: hidden;
  }
  .learn-nav-btn { display: inline-flex; align-items: center; justify-content: center; }
  .learn-nav {
    position: absolute;
    grid-area: main;
    z-index: 6;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(88vw, 320px);
    max-height: none;
    border-right: 1px solid var(--line);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    padding-top: 12px;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .learn.nav-open .learn-nav { transform: none; box-shadow: var(--shadow); }
  .learn-nav-mask {
    position: absolute;
    grid-area: main;
    z-index: 5;
    inset: 0;
    background: rgba(0,0,0,.45);
  }
  .learn.nav-open .learn-nav-mask { display: block; }
  .learn-item { padding: 10px 12px; font-size: 14px; min-height: 44px; }
  .learn-main {
    grid-template-rows: minmax(120px, 38%) minmax(0, 1fr);
  }
  .learn-anim { padding: 4px; }
  .learn-anim svg { max-height: 100%; width: 100%; }
  .learn-caption {
    padding: 12px 14px 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .learn-caption h2 { font-size: 16px; }
  .learn-caption p { font-size: 14px; }
  .learn-controls {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: var(--panel);
    padding-top: 8px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    margin-top: auto;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
  }
  .learn-controls .ghost-btn {
    min-height: 36px;
    width: 100%;
    flex: none;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 4px;
    white-space: nowrap;
  }
  .learn-controls #learnLab { grid-column: 1 / -1; }
  .mob-tabs {
    display: flex;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .mob-tabs button {
    min-height: 40px;
    font-size: 13px;
  }
  .sidebar, .ticket-panel, .topo-panel, .work-panel {
    grid-area: main;
    display: none;
    border-right: 0;
    min-height: 0;
    height: 100%;
  }
  #app.pane-side .sidebar { display: block; }
  #app.pane-ticket .ticket-panel { display: flex; }
  #app.pane-topo .topo-panel { display: flex; }
  #app.pane-work .work-panel { display: block; overflow: auto; }
  .legend { flex-wrap: wrap; }
  .syslog div { white-space: pre-wrap; overflow-wrap: anywhere; }
  .syslog { height: 96px; }
  .term-panel { min-height: 0; }
  .term-resizer { height: 14px; flex-basis: 14px; }
  .term-tabs { padding-left: max(10px, env(safe-area-inset-left)); }
  .term-output { font-size: 13px; padding: 8px 12px; }
  .term-input-row {
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  }
  .term-input-row input { font-size: 16px; min-height: 24px; }
  .prompt { font-size: 12px; max-width: 42%; overflow: hidden; text-overflow: ellipsis; }
  .gate {
    padding: max(16px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
    place-items: start stretch;
    align-content: start;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .gate-inner { padding-bottom: 12px; }
  .gate-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 18px;
    padding-right: 0;
  }
  .gate-bar .brand-sub { display: none; }
  .gate-bar .ghost-btn,
  .gate-bar .theme-toggle {
    position: static;
    top: auto;
    right: auto;
    width: auto;
    min-width: 56px;
    min-height: 40px;
    z-index: auto;
    flex: 0 0 auto;
  }
  .gate-bar .contact-open {
    min-width: 52px;
    font-size: 14px;
  }
  .gate-hero {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
  }
  .gate-hero h1 { font-size: 26px; }
  .gate-lead { font-size: 15px; }
  .gate-cta { grid-template-columns: 1fr; margin-bottom: 22px; }
  .contact-launch {
    margin: 0;
    min-height: 88px;
    padding: 16px 14px;
  }
  .contact-launch strong { font-size: 20px; }
  .study-launch, .donate-launch {
    padding: 16px 14px;
    min-height: 0;
  }
  .study-launch strong, .donate-launch strong { font-size: 18px; }
  .study-launch em { margin-top: 10px; }
  .track-grid { grid-template-columns: 1fr; }
  .gate-topics ul { grid-template-columns: 1fr; }
  .track-card { padding: 14px; min-height: 72px; }
  .sc-btn { padding: 12px 10px; font-size: 14px; min-height: 44px; }
  .hint-row { padding: 8px 14px; }
  .hint-row .ghost-btn { min-height: 44px; padding: 10px 10px; }
  .work-panel { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .modal-card { width: 100%; }
  .help-body, .donate-card { font-size: 15px; padding-left: 14px; padding-right: 14px; }
  .donate-copy { min-height: 44px; padding: 12px 10px; }
  :root { --term-h: 180px; }
}
@media (hover: none) {
  .ghost-btn:hover,
  html[data-theme="light"] .ghost-btn:hover {
    border-color: var(--line); color: inherit;
  }
  .track-card:hover { border-color: var(--line); }
  .study-launch:hover { border-color: var(--study-line); }
  .donate-launch:hover { filter: none; }
  .contact-launch:hover { filter: none; }
  .sc-btn:hover, .learn-item:hover { background: transparent; }
  .sc-btn.active:hover { background: var(--active); }
  .learn-item.active:hover { background: var(--active); }
}

.donate-btn {
  background: #c4782a;
  color: #fff8ee;
  border: 1px solid #a35e18;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.donate-btn:hover { filter: brightness(1.08); color: #fff8ee; border-color: #c4782a; }
html[data-theme="light"] .donate-btn {
  background: #8a4a10;
  border-color: #6a380c;
  color: #fffdf8;
}
html[data-theme="light"] .ghost-btn {
  background: #fffdf8;
  border-color: #c9bba6;
  color: #16130f;
}
html[data-theme="light"] .ghost-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.donate-launch {
  width: 100%;
  text-align: left;
  background: linear-gradient(180deg, #3a2412 0%, #2a1a10 100%);
  border: 1px solid #c4782a;
  border-radius: 14px;
  padding: 20px 20px 18px;
  margin: 0;
  color: #fff4e6;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
html[data-theme="light"] .donate-launch {
  background: linear-gradient(180deg, #fff6ea 0%, #f4e2c8 100%);
  border-color: #8a4a10;
  color: #16130f;
}
.donate-launch .study-kicker { color: #f0c48a; }
html[data-theme="light"] .donate-launch .study-kicker { color: #8a4a10; }
.donate-launch strong { display: block; font-size: 22px; margin-bottom: 8px; }
.donate-launch span:last-child {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.92;
  flex: 1;
}
.donate-card { padding: 8px 18px 20px; }
.donate-card p { margin: 0 0 12px; line-height: 1.65; font-size: 14px; }
.donate-uses {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.donate-uses li {
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
}
.donate-links { display: flex; flex-direction: column; gap: 8px; }
.donate-link {
  display: block;
  text-align: center;
  text-decoration: none;
  background: #c4782a;
  color: #fff8ee !important;
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 700;
}
.donate-link.secondary {
  background: var(--panel-2);
  color: var(--text) !important;
  border: 1px solid var(--line);
}
.donate-account {
  margin-top: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 13px;
}
.donate-who {
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}
.donate-acc-no { letter-spacing: 0.02em; }
.donate-copy {
  display: block;
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}
.donate-copy:hover { filter: brightness(1.08); }
.donate-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--warn);
  line-height: 1.5;
}
.donate-cta {
  margin-top: 14px;
  padding: 12px 13px;
  border-radius: 8px;
  border: 1px dashed var(--accent);
  background: var(--chip);
  font-size: 13px;
  line-height: 1.5;
}
.donate-cta button { margin-top: 8px; }

.contact-launch {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px 18px 16px;
  text-align: left;
  text-decoration: none;
  box-sizing: border-box;
  background: linear-gradient(180deg, #2a2418 0%, #181510 100%);
  border: 2px solid var(--accent);
  border-radius: 14px;
  color: var(--text);
  min-height: 96px;
}
html[data-theme="light"] .contact-launch {
  background: linear-gradient(180deg, #fff8ec 0%, #f4ebe0 100%);
}
.contact-launch .study-kicker { color: var(--accent); }
.contact-launch strong {
  display: block;
  font-size: 22px;
  margin-bottom: 6px;
  color: var(--text);
}
.contact-launch span:last-child {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.contact-launch:hover { filter: brightness(1.06); }
.contact-card { padding: 8px 18px 20px; }
.contact-card p { margin: 0 0 12px; line-height: 1.65; font-size: 14px; }
.contact-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.contact-card select,
.contact-card textarea,
.contact-card input {
  width: 100%;
  box-sizing: border-box;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: 14px/1.5 inherit;
}
.contact-card textarea { resize: vertical; min-height: 120px; }
.contact-card select { min-height: 44px; }
.contact-card input { min-height: 44px; }
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.contact-actions .donate-btn,
.contact-actions .ghost-btn {
  min-height: 46px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.contact-status {
  min-height: 1.4em;
  margin: 10px 0 0 !important;
  font-size: 13px !important;
  color: var(--warn) !important;
}
.contact-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

#donateNag { z-index: 90; }
.nag-card {
  width: min(440px, 100%);
  padding: 0 0 18px;
}
.nag-log {
  margin: 0 0 14px;
  padding: 12px 16px;
  background: var(--term);
  color: var(--term-fg);
  font: 12px/1.55 "IBM Plex Mono", Consolas, monospace;
  border-bottom: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
}
.nag-log .gprompt { color: var(--term-prompt); margin-right: 6px; }
.nag-log .gwarn { color: var(--warn); }
.nag-card h2 {
  margin: 0 18px 10px;
  font-size: 20px;
  line-height: 1.35;
  word-break: keep-all;
}
.nag-card p {
  margin: 0 18px 10px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--caption);
}
.nag-card p strong { color: var(--text); }
.nag-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 18px 0;
}
.nag-actions .donate-btn,
.nag-actions .ghost-btn {
  width: 100%;
  min-height: 46px;
  font-size: 15px;
  font-weight: 700;
}
@media (max-width: 860px) {
  .nag-card h2 { font-size: 18px; }
}
