/* shadcn/ui 풍 디자인 층 (https://ui.shadcn.com 참고, zinc 무채색)
   base.css · app.css · wash.css 뒤에 불러와서 토큰과 공통 컴포넌트 모양만 덮어쓴다. 마크업·스크립트는 그대로. */

:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa; --panel: #ffffff; --panel-2: #f4f4f5;
  --line: #e4e4e7; --line-2: #d4d4d8;
  --ink: #09090b; --ink-2: #52525b; --ink-3: #71717a;
  --accent: #18181b; --accent-soft: #f4f4f5; --button: #18181b;
  --ring: #a1a1aa;
  --good: #15803d; --warn: #b45309; --bad: #dc2626; --purple: #7c3aed;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05);
  --header: rgba(255, 255, 255, .9); --glow: transparent;
  --radius: 12px;
  --sans: "Pretendard", "Geist", -apple-system, BlinkMacSystemFont, "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090b; --panel: #0f0f11; --panel-2: #18181b;
  --line: #27272a; --line-2: #3f3f46;
  --ink: #fafafa; --ink-2: #a1a1aa; --ink-3: #8b8b94;
  --accent: #fafafa; --accent-soft: #27272a; --button: #fafafa;
  --ring: #52525b;
  --good: #4ade80; --warn: #fbbf24; --bad: #f87171; --purple: #c4b5fd;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --header: rgba(9, 9, 11, .9); --glow: transparent;
}

body { background: var(--bg); font-size: 14px; letter-spacing: -.01em; }
body:has(main.wash) { background: transparent; }

/* 헤더 */
header.top { background: var(--header); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 12px 24px; }
.brand h1 { font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.brand-caption { color: var(--ink-3); font-weight: 400; }

/* 카드 */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card > h2, .card-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.card .hint, .hint { color: var(--ink-3); }

/* 버튼: default(검정) · outline */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 8px;
  background: var(--button); border: 1px solid var(--button); color: var(--panel);
  font: 500 14px var(--sans); box-shadow: var(--shadow); transition: opacity .15s, background .15s;
}
.btn:hover:not(:disabled) { filter: none; opacity: .9; }
.btn.ghost { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--panel-2); opacity: 1; }
.btn.wide { height: 40px; border-radius: 8px; font-size: 14px; }
.btn:disabled { opacity: .5; }

/* 입력 */
input[type=text], input[type=number], select {
  height: 36px; min-height: 36px; padding: 0 12px; border-radius: 8px;
  background: transparent; border: 1px solid var(--line); color: var(--ink);
  font: 14px var(--sans); box-shadow: var(--shadow);
}
select { padding-right: 28px; }
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible, a:focus-visible {
  outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent);
}
label.field { font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
input[type=checkbox] { accent-color: var(--accent); }
input::file-selector-button { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; font: 500 13px var(--sans); }

/* 칩 = 토글 그룹 아이템 */
.chips { gap: 6px; }
.chip {
  height: 32px; padding: 0 12px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-2);
  font: 500 13px var(--sans); box-shadow: var(--shadow); transition: background .15s, color .15s;
}
.chip:hover { background: var(--panel-2); color: var(--ink); border-color: var(--line); }
.chip[aria-pressed="true"] { background: var(--panel-2); color: var(--ink); border-color: var(--line-2); font-weight: 600; }

/* 세그먼트(탭처럼 붙은 토글 그룹) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--panel-2); border-radius: 10px; }
.segmented .chip { border: 0; box-shadow: none; background: transparent; height: 30px; }
.segmented .chip[aria-pressed="true"] { background: var(--panel); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
:root[data-theme="dark"] .segmented .chip[aria-pressed="true"] { background: var(--line); }

/* 탭 (장비 · 캐릭터 상태 · 세수) */
.content nav.tabs, nav.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--panel-2); border: 0; border-radius: 10px; margin: 0 0 16px; }
nav.tabs button { height: 32px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font: 500 14px var(--sans); }
nav.tabs button[aria-selected="true"], .content nav.tabs button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); margin: 0; }
:root[data-theme="dark"] nav.tabs button[aria-selected="true"] { background: var(--line); }

/* 테마 스위치도 같은 세그먼트 모양 */
.theme-switch { background: var(--panel-2); border: 0; border-radius: 10px; padding: 3px; }
.theme-switch button { border: 0; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.theme-switch button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); border: 0; }

/* 스위치 */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: 500; user-select: none; }
.switch input { appearance: none; -webkit-appearance: none; margin: 0; flex-shrink: 0; width: 36px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
:root[data-theme="dark"] .switch input::after { background: #09090b; }
:root[data-theme="dark"] .switch input:not(:checked)::after { background: #a1a1aa; }
.switch input:checked::after { transform: translateX(16px); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }

/* 배지 */
.pill, .badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2); font: 500 12px var(--sans); }

/* 접기 */
details.more { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }
details.more > summary { font-size: 13px; font-weight: 500; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 6px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "›"; display: inline-block; width: 10px; transition: transform .15s; color: var(--ink-3); }
details.more[open] > summary::before { transform: rotate(90deg); }
details.more > summary:hover { color: var(--ink); }

/* 알림 (Alert) */
.note { border: 1px solid var(--line); border-left-width: 1px; border-radius: 8px; padding: 10px 12px; background: var(--panel); color: var(--ink-2); font-size: 13px; }
.note.ok { border-color: color-mix(in srgb, var(--good) 35%, var(--line)); }
.note.warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: color-mix(in srgb, var(--warn) 5%, var(--panel)); color: var(--ink); }
.note.bad { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: color-mix(in srgb, var(--bad) 5%, var(--panel)); color: var(--ink); }

/* 표 */
.scroll { border: 1px solid var(--line); border-radius: 10px; }
table.data th { background: var(--panel-2); color: var(--ink-3); font-weight: 500; font-size: 12px; }
table.data th, table.data td { border-bottom-color: var(--line); }
table.data tbody tr:hover td { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
table.data tr.ex td { background: color-mix(in srgb, var(--q3) 6%, transparent); }

/* 통계 */
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.stat .k { color: var(--ink-3); font-size: 12px; font-weight: 500; }
.stat .v { font-family: var(--sans); font-weight: 700; letter-spacing: -.02em; }
.summary .stat:first-child { background: var(--panel); border-color: var(--line); }
.summary .stat:first-child .v { color: var(--ink); }

/* 목표 칸 */
.goal { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.goal:hover { background: var(--panel-2); }
.goal.sel { background: var(--panel-2); border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.selection { background: var(--panel-2); color: var(--ink); border-radius: 8px; font-weight: 500; }

/* 진행 막대 */
.bar { height: 6px; background: var(--panel-2); border-radius: 999px; }
.bar > i { background: var(--accent); border-radius: 999px; }

/* 업로드 */
.drop { border: 1px dashed var(--line-2); border-radius: 10px; background: var(--panel); }
.drop.over { border-color: var(--ink); background: var(--panel-2); }

/* 장비 탭 강조색: 검정 강조 대신 은은한 회색 */
table.seq tr.cur td { background: var(--panel-2); }
table.seq tr.cur td:first-child { box-shadow: inset 2px 0 0 var(--ink); }
table.chars tr.main td { background: var(--panel-2); }
.acct-list button[aria-current="true"] { border-color: var(--ink); background: var(--panel-2); }
.results button .i, .spec, a { color: var(--ink); }

/* 헤더: 테마 전환은 오른쪽 끝 */
header.top .brand { display: flex; align-items: center; }
header.top .theme-switch { margin-left: auto; flex-shrink: 0; }
.app-ver { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; margin-left: 4px; vertical-align: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--ink-3); font: 500 11px var(--mono); letter-spacing: 0; }
