:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
  --bg: #100f17;
  --panel: rgba(29, 27, 42, .94);
  --panel-2: #252236;
  --line: #3f3a58;
  --text: #f7f5ff;
  --muted: #aaa4be;
  --accent: #bb8cff;
  --accent-2: #78d7ff;
  --good: #7de5ad;
  --warn: #ffd276;
  --danger: #ff8d9a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -10%, rgba(123, 79, 184, .25), transparent 32rem),
    var(--bg);
  color: var(--text);
}
button, input, select { font: inherit; }
button { min-height: 44px; cursor: pointer; }
button:disabled { opacity: .42; cursor: not-allowed; }
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 980px; margin: 0 auto; padding: 24px 18px 12px;
}
.eyebrow { margin: 0 0 4px; color: var(--accent-2); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(24px, 5vw, 34px); }
h2 { margin: 0; font-size: 19px; }
h3 { margin: 24px 0 10px; font-size: 15px; color: #ddd7ef; }
p { color: var(--muted); }
.status-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 16px currentColor; }
.status-dot.online { background: var(--good); }
main { max-width: 980px; margin: 0 auto; padding: 0 14px 60px; }
.panel {
  margin: 12px 0; padding: 18px; border: 1px solid rgba(125, 113, 161, .25);
  border-radius: 20px; background: var(--panel); box-shadow: 0 16px 48px rgba(0,0,0,.18);
}
.field-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
label > span, .cost-box > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, select {
  width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 12px;
  padding: 0 12px; background: #171521; color: var(--text); outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(187, 140, 255, .13); }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 36px; }
.input-suffix b { position: absolute; right: 13px; top: 13px; color: var(--muted); }
.cost-box { min-height: 70px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #171521; }
.cost-box strong { font-size: 15px; }
.cost-box em { font-style: normal; color: var(--accent-2); }
.setup-heading { margin-bottom: 14px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.section-heading p { margin: 6px 0 0; font-size: 12px; line-height: 1.5; }
.pill { flex: 0 0 auto; border-radius: 999px; padding: 6px 10px; background: #312b48; color: #ddd5f3; font-size: 12px; font-weight: 800; }
.board-wrap { max-width: 520px; margin: 8px auto 0; }
#board-svg { width: 100%; display: block; touch-action: manipulation; }
.board-halo { fill: url(#board-glow); stroke: rgba(170, 144, 227, .12); stroke-width: 1; }
.outer-polygon { fill: rgba(20,18,30,.55); stroke: #55506b; stroke-width: 2; }
.link-fill { fill: rgba(157, 106, 232, .24); stroke: none; }
.link-lines { fill: none; stroke: #bc94f4; stroke-width: 3.2; stroke-linejoin: round; filter: drop-shadow(0 0 5px rgba(188,148,244,.38)); }
.board-node { cursor: pointer; }
.board-node .node-hit { fill: transparent !important; stroke: none !important; pointer-events: all; }
.board-node circle { fill: #252234; stroke: #656078; stroke-width: 2; transition: .15s ease; }
.board-node text { fill: #d8d4e4; font-weight: 800; font-size: 17px; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.board-node.assigned circle { fill: #f2eafc; stroke: #d4b2ff; }
.board-node.assigned text { fill: #2a2140; }
.board-node.locked circle { fill: #686574; stroke: #d1ceda; stroke-width: 3; }
.board-node.locked text { fill: #fff; }
.board-node:hover circle { transform: scale(1.05); transform-origin: center; }
.board-actions, .primary-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.primary-actions { grid-template-columns: 1fr 1fr; }
button { border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 800; }
.secondary, .wide-secondary { background: #302c40; color: #e9e5f2; }
.wide-secondary { width: 100%; margin-top: 9px; }
.danger-text { color: var(--danger); }
.primary { background: linear-gradient(135deg, #a66be9, #7e54d5); color: #fff; }
.primary.alt { background: linear-gradient(135deg, #3d98c7, #4d6ec7); }
.score-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.score-strip div, .metric-card { border-radius: 14px; padding: 12px; background: #171521; border: 1px solid rgba(125,113,161,.22); }
.score-strip span, .metric-card span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.score-strip strong { font-size: 20px; }
.message { min-height: 22px; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.message.error { color: var(--danger); }
.message.busy { color: var(--warn); }
.hidden { display: none; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 14px; }
.metric-card strong { display: block; font-size: 19px; }
.metric-card small { display: block; margin-top: 5px; color: var(--muted); }
.profile-list { display: grid; gap: 8px; margin-top: 14px; }
.profile-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; border-radius: 12px; background: var(--panel-2); }
.profile-row b { color: var(--accent-2); }
.scroll-hint { display: none; }
.table-scroll { overflow-x: auto; border-radius: 12px; border: 1px solid rgba(125,113,161,.22); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 580px; background: #171521; }
th, td { padding: 10px 11px; border-bottom: 1px solid rgba(125,113,161,.17); text-align: right; white-space: nowrap; font-size: 12px; }
th:first-child, td:first-child { text-align: left; }
th { color: #c9c2db; background: #211e2e; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tr.recommended { background: rgba(125,229,173,.08); }
.badge-exact { color: var(--good); }
.badge-sample { color: var(--warn); }
.result-note { margin: 9px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
footer { padding: 0 20px 32px; text-align: center; color: #777184; font-size: 11px; }
@media (max-width: 700px) {
  .app-header { padding-top: max(18px, env(safe-area-inset-top)); }
  main { padding-left: 10px; padding-right: 10px; }
  .panel { padding: 15px; border-radius: 17px; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .score-strip { grid-template-columns: 1fr 1fr; }
  .score-strip div:last-child { grid-column: 1 / -1; }
  .board-actions { grid-template-columns: repeat(3, 1fr); }
  .scroll-hint { display: block; margin: 8px 2px 6px; color: var(--muted); font-size: 11px; text-align: right; }
}
@media (max-width: 360px) {
  .metric-card:nth-child(n+3) { grid-column: 1 / -1; }
  .profile-row { display: grid; grid-template-columns: 58px 1fr; align-items: center; }
  .profile-row > span { white-space: nowrap; }
  .profile-row > strong { text-align: right; }
  .profile-row > small { grid-column: 2; text-align: right; }
  .board-actions button { padding-inline: 6px; font-size: 14px; white-space: nowrap; }
}
