:root {
  --bg: #0d1017;
  --panel: #161a24;
  --panel-2: #12151c;
  --line: #262c3a;
  --text: #e6e8ee;
  --muted: #8d97ab;
  --accent: #e8734a;
  --danger: #cc0000;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  line-height: 1.65;
}

main { max-width: 1100px; margin: 0 auto; padding: 0 20px 60px; }

.site-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 20px 24px;
}
.site-header h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -0.02em; }
.tagline { margin: 0; color: var(--muted); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}
.panel h2 { margin: 0 0 12px; font-size: 17px; }

.notice {
  background: rgba(232, 115, 74, 0.08);
  border-left: 3px solid var(--accent);
  padding: 12px 14px;
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  color: #d8dde8;
}

form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

input[type="email"], input[type="text"] {
  flex: 1 1 260px;
  min-width: 0;
  padding: 11px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button {
  padding: 11px 20px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.55; cursor: default; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 400; padding: 6px 12px; font-size: 13px; }
button.danger { background: transparent; border: 1px solid var(--danger); color: #ff6b6b; }

.error { color: #ff7676; font-size: 14px; margin: 10px 0 0; }
.warn { color: #e0b050; font-size: 13px; }
.dev-hint { color: #6aa84f; font-family: ui-monospace, monospace; font-size: 13px; }

/* 결과 */
.score-row {
  display: flex;
  gap: 20px;
  align-items: stretch;
  flex-wrap: wrap;
  margin: 28px 0 16px;
}
.score-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 34px;
  text-align: center;
  min-width: 150px;
}
.score-value { font-size: 46px; font-weight: 700; line-height: 1; }
.score-label { color: var(--muted); font-size: 13px; margin-top: 6px; }
.summary {
  flex: 1 1 320px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 22px;
  font-size: 14px;
}
.summary p { margin: 0 0 8px; }
.summary ul { margin: 0; padding-left: 18px; color: var(--muted); }
.summary strong { color: var(--text); }

/* 진단 이력 */
.history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
}
.history-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--line);
}
.history-table td {
  padding: 10px 10px 10px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.history-table tr:last-child td { border-bottom: 0; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions button { margin-left: 6px; }
.muted { color: var(--muted); font-size: 13px; }
.delta-up { color: #ff7676; font-weight: 600; }
.delta-down { color: #6aa84f; font-weight: 600; }

/* 변화 배너 */
.delta-banner {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
  margin: 28px 0 0;
  background: var(--panel);
}
.delta-banner.worse { border-left-color: var(--danger); }
.delta-banner.better { border-left-color: #6aa84f; }
.delta-banner.same { border-left-color: var(--muted); }
.delta-headline { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.delta-group { margin-top: 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta-label { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 20px; color: #fff; }
.delta-label.bad { background: var(--danger); }
.delta-label.good { background: #6aa84f; }
.chip {
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
}

/* 그래프 */
.graph-wrap {
  display: grid;
  grid-template-columns: 1fr 280px;
  grid-template-rows: auto 1fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
}
.graph-toolbar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex-wrap: wrap;
}
#type-filters { display: flex; gap: 14px; flex-wrap: wrap; }
.filter { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); cursor: pointer; }
.filter .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

#graph { height: 520px; min-width: 0; }

.inspector {
  border-left: 1px solid var(--line);
  padding: 16px;
  overflow-y: auto;
  max-height: 520px;
  font-size: 13px;
  background: var(--panel);
}
.inspector h3 { margin: 0 0 2px; font-size: 15px; word-break: break-all; }
.node-type { color: var(--muted); margin: 0 0 12px; font-size: 12px; }
.inspector table { width: 100%; border-collapse: collapse; }
.inspector th {
  text-align: left;
  color: var(--muted);
  font-weight: 400;
  vertical-align: top;
  padding: 5px 8px 5px 0;
  white-space: nowrap;
}
.inspector td { padding: 5px 0; word-break: break-word; }
.inspector a { color: var(--accent); }
.placeholder { color: var(--muted); }

/* 권장 조치 */
.actions { margin-top: 28px; }
.actions h2 { font-size: 17px; }
#recommendations { list-style: none; padding: 0; margin: 0; }
.rec {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  font-size: 14px;
}
.badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  margin-right: 8px;
  vertical-align: 1px;
}

.danger-zone { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }
.fine-print { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}

/* 로그인 */
.login-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0 14px;
}
.provider-google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.provider-google:hover { background: #f1f3f4; }

/* 계정 연동 */
.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px 0 10px;
}
.link-info { display: flex; flex-direction: column; gap: 2px; }
.link-desc { color: var(--muted); font-size: 13px; }
.btn-link {
  display: inline-block;
  padding: 9px 16px;
  background: #24292f;
  color: #fff;
  border: 1px solid #444c56;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-link:hover { background: #30363d; }
.linked-ok { color: #6aa84f; font-weight: 600; font-size: 14px; white-space: nowrap; }

/* 약관·방침 문서 페이지 */
.doc { max-width: 820px; }
.doc .panel { padding: 22px 26px; }
.doc h2 { font-size: 16px; color: var(--accent); }
.doc h3 { font-size: 14px; margin: 20px 0 8px; }
.doc p, .doc li { font-size: 14px; }
.doc ol, .doc ul { padding-left: 20px; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--accent); }

.breadcrumb { margin: 0 0 18px; font-size: 13px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }

.summary-list { list-style: none; padding: 0; }
.summary-list li {
  padding: 9px 0 9px 22px;
  position: relative;
  border-bottom: 1px solid var(--line);
}
.summary-list li:last-child { border-bottom: 0; }
.summary-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #6aa84f;
  font-weight: 700;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
  display: block;
  overflow-x: auto;
}
.doc-table th, .doc-table td {
  border: 1px solid var(--line);
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
}
.doc-table thead th { background: var(--panel-2); color: var(--muted); font-weight: 600; white-space: nowrap; }
.doc-table tbody th { background: var(--panel-2); color: var(--muted); font-weight: 400; white-space: nowrap; }

.site-footer a { color: var(--muted); }

@media (max-width: 780px) {
  .graph-wrap { grid-template-columns: 1fr; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); max-height: none; }
  #graph { height: 380px; }
}
