/* Lexicon-Jong 화면 — 종알종알 v0.31+ 팔레트와 같은 규칙
   어두운 회색 바탕 · 흰색과 회색 두 단계 · 빨강은 경고(오류 · 위험)에만
   글꼴: Pretendard · Geist Mono (SIL OFL-1.1, public/fonts/OFL-*.txt) */
@font-face { font-family: "Pretendard"; font-weight: 400; font-style: normal; font-display: swap; src: local("Pretendard Regular"), local("Pretendard-Regular"), url("/fonts/Pretendard-Regular.otf") format("opentype"); }
@font-face { font-family: "Pretendard"; font-weight: 600; font-style: normal; font-display: swap; src: local("Pretendard SemiBold"), local("Pretendard-SemiBold"), url("/fonts/Pretendard-SemiBold.otf") format("opentype"); }
@font-face { font-family: "Geist Mono"; font-weight: 100 900; font-style: normal; font-display: swap; src: url("/fonts/GeistMono-Variable.ttf") format("truetype"); }
:root {
  --bg: #141414; --panel: #1A1A1A; --panel2: #202020; --line: #262626; --line2: #2E2E2E;
  --text: #EDEDED; --soft: #BDBDBD; --dim: #7A7A7A; --mute: #4A4A4A;
  --accent: #EDEDED; --on-accent: #141414; --warn: #FF453A; --warn-soft: #FF6B61;
  --mono: "Geist Mono", "Pretendard", ui-monospace, monospace;
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; word-break: keep-all; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
.num, .mono, code { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
code { font-size: .92em; color: var(--soft); }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: #2E2E2E; border-radius: 6px; border: 2px solid var(--bg); } ::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid rgba(237,237,237,.7); outline-offset: 1px; }

/* 버튼 */
.btn { font: inherit; font-weight: 500; cursor: pointer; background: transparent; color: var(--text); border: 1px solid var(--line2); border-radius: 6px; padding: .5em .95em; white-space: nowrap; }
.btn:hover { border-color: #444; background: rgba(255,255,255,.03); }
.btn.primary { background: rgba(237,237,237,.08); border-color: rgba(237,237,237,.55); }
.btn.primary:hover { background: rgba(237,237,237,.14); }
.btn.solid { background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 600; }
.btn.solid:hover { background: #fff; }
.btn.danger { color: var(--warn-soft); border-color: rgba(255,69,58,.45); }
.btn.danger:hover { background: rgba(255,69,58,.08); }
.btn.sm { padding: .28em .65em; font-size: 12.5px; }
.btn.link { border: 0; padding: 0; color: var(--dim); background: none; }
.btn.link:hover { color: var(--text); }
.btn:disabled { opacity: .45; cursor: default; }

/* 입력칸 */
input, select, textarea { font: inherit; color: var(--text); background: #101010; border: 1px solid var(--line2); border-radius: 6px; padding: 7px 9px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(237,237,237,.6); }
input[type=checkbox] { accent-color: #EDEDED; width: auto; }
input[type=file] { padding: 5px; color: var(--dim); font-size: 13px; }
input[type=file]::file-selector-button { font: inherit; font-weight: 500; color: var(--text); background: #222; border: 1px solid var(--line2); border-radius: 5px; padding: 4px 10px; margin-right: 10px; cursor: pointer; }
input[type=file]::file-selector-button:hover { background: #2a2a2a; }
.wide { grid-column: 1 / -1; }
input[type=date], input[type=time] { color-scheme: dark; }
textarea { width: 100%; resize: vertical; line-height: 1.55; }
textarea.code { font-family: var(--mono); font-size: 12.5px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--soft); }
.fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.fields .grow { flex: 1 1 180px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--soft); font-size: 13px; }

/* 윗줄 · 탭 */
.top { position: sticky; top: 0; z-index: 10; background: rgba(20,20,20,.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.bar { max-width: 1320px; margin: 0 auto; padding: 12px 18px 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { font-size: 18px; font-weight: 600; }
.ver { font-size: 11px; font-weight: 600; color: var(--dim); margin-left: 4px; }
.sp { flex: 1; }
.who { color: var(--dim); font-size: 13px; }
.cat { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 13px; }
.cat select { min-width: 190px; }
.tabs { max-width: 1320px; margin: 0 auto; padding: 0 18px; display: flex; gap: 2px; overflow-x: auto; }
.tabs button { font: inherit; font-weight: 600; background: none; border: 0; color: var(--dim); padding: 12px 14px 11px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--soft); }
.tabs button.on { color: var(--text); border-bottom-color: var(--text); }

main { max-width: 1320px; margin: 0 auto; padding: 18px 18px 80px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.card + .card { margin-top: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > .card + .card { margin-top: 0; }
#editor { display: flex; flex-direction: column; gap: 14px; }
#editor > .card + .card, #editor > .teams { margin-top: 0; }
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.card h2 small, .card h3 small { color: var(--dim); font-weight: 400; font-size: 12.5px; }
.card h3 { font-size: 14px; font-weight: 600; }
.note { color: var(--dim); font-size: 12.5px; line-height: 1.6; margin: 4px 0 12px; }
.note b { color: var(--soft); font-weight: 600; }
.empty { color: var(--dim); text-align: center; padding: 28px 10px; font-size: 13px; line-height: 1.7; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 14px; align-items: start; }
.grid2 > .card + .card { margin-top: 0; }
details.more { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
details.more > summary { cursor: pointer; color: var(--soft); font-weight: 600; font-size: 13px; }
details.more[open] > summary { margin-bottom: 10px; }

/* 표 */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--dim); font-weight: 600; font-size: 12px; }
td.r, th.r { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(255,255,255,.025); }
tr.on td { background: rgba(237,237,237,.06); }
.tight td, .tight th { padding: 6px 6px; }

/* 칩 · 숫자 타일 */
.chip { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: transparent; color: var(--dim); box-shadow: inset 0 0 0 1px #3A3A3A; white-space: nowrap; }
.chip.locked { color: var(--text); box-shadow: inset 0 0 0 1px #8a8a8a; }
.chip.done { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.chip.bad { color: var(--warn-soft); box-shadow: inset 0 0 0 1px rgba(255,69,58,.6); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.tile .k { color: var(--dim); font-size: 12px; }
.tile .v { font: 600 24px/1.2 var(--mono); margin-top: 2px; }

/* 매치업 화면 */
.mlayout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 980px) { .mlayout { grid-template-columns: 1fr; } }
.side { position: sticky; top: 112px; max-height: calc(100vh - 130px); display: flex; flex-direction: column; }
@media (max-width: 980px) { .side { position: static; max-height: none; } }
.datenav { display: flex; align-items: center; gap: 6px; }
.datenav input { flex: 1; }
.mlist { overflow-y: auto; margin: 12px -6px 0; padding: 0 6px; }
.dayhead { font-size: 12px; color: var(--dim); font-weight: 600; margin: 14px 2px 6px; display: flex; gap: 6px; }
.dayhead:first-child { margin-top: 0; }
.dayhead.today { color: var(--text); }
.mcard { display: block; width: 100%; text-align: left; font: inherit; color: inherit; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; margin-bottom: 6px; }
.mcard:hover { border-color: #3a3a3a; }
.mcard.on { border-color: rgba(237,237,237,.7); background: #242424; }
.mcard .vs { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.mcard .vs i { font-style: normal; color: var(--dim); font-weight: 400; font-size: 12px; }
.mcard .meta { display: flex; gap: 8px; align-items: center; color: var(--dim); font-size: 12px; margin-top: 4px; }
.mcard .meta .t { font-family: var(--mono); color: var(--soft); }

.mhead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mhead .title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.mhead .title i { font-style: normal; color: var(--dim); font-weight: 400; margin: 0 8px; font-size: 16px; }
.steps { display: flex; gap: 6px; align-items: center; color: var(--dim); font-size: 12.5px; flex-wrap: wrap; }
.steps b { font-weight: 600; color: var(--mute); }
.steps b em { font-style: normal; font-family: var(--mono); display: inline-flex; width: 17px; height: 17px; border-radius: 50%; box-shadow: inset 0 0 0 1px currentColor; align-items: center; justify-content: center; font-size: 10.5px; margin-right: 4px; vertical-align: 1px; }
.steps b.done { color: var(--soft); }
.steps b.now { color: var(--text); }
.warnbox { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: rgba(255,69,58,.07); border: 1px solid rgba(255,69,58,.35); font-size: 13px; }
.warnbox b { color: var(--warn-soft); }
.warnbox ul { margin: 6px 0 0; padding-left: 18px; color: var(--soft); line-height: 1.6; }
.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 14px; margin-top: 14px; }
.team { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.team .th { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.team .th h3 { font-size: 17px; }
.team .th .al { color: var(--dim); font-size: 12px; }
.lineup td .al { color: var(--dim); font-size: 12px; }
.lineup td.pos { font-family: var(--mono); color: var(--soft); font-size: 12px; width: 56px; }
.lineup tr.sub td { color: var(--soft); }
textarea.lineup { min-height: 170px; font-size: 13.5px; }
.bars { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.brow { display: grid; grid-template-columns: 130px 1fr 60px; gap: 10px; align-items: center; font-size: 13px; }
.brow .track { height: 8px; background: #262626; border-radius: 4px; overflow: hidden; }
.brow .track i { display: block; height: 100%; background: #EDEDED; border-radius: 4px; }
.brow .track i.b { background: #7A7A7A; }
.brow .n { font-family: var(--mono); text-align: right; }

/* 연동 토큰 */
.secret { margin-top: 12px; padding: 12px; border-radius: 8px; background: rgba(237,237,237,.06); border: 1px solid rgba(237,237,237,.35); }
.secret code { display: block; color: var(--text); font-size: 13px; word-break: break-all; margin: 6px 0 8px; user-select: all; }
pre.out { background: #101010; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; font: 12.5px/1.6 var(--mono); color: var(--soft); margin: 12px 0 0; max-height: 360px; overflow: auto; }

/* 알림 */
#toast { position: fixed; right: 18px; bottom: 18px; z-index: 50; max-width: min(460px, 90vw); padding: 11px 14px; border-radius: 8px; background: #262626; border: 1px solid #3a3a3a; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,.4); opacity: 0; transform: translateY(8px); transition: .18s; pointer-events: none; white-space: pre-wrap; }
#toast.show { opacity: 1; transform: none; }
#toast.bad { border-color: rgba(255,69,58,.6); color: #FFB3AE; }

/* 로그인 */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login form { width: min(380px, 94vw); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 28px 24px 24px; }
.login h1 { font-size: 22px; margin-bottom: 4px; }
.login p { color: var(--dim); font-size: 13.5px; margin: 0 0 14px; line-height: 1.6; }
.login label { display: block; font-size: 12.5px; font-weight: 600; color: var(--soft); margin: 12px 0 5px; }
.login input { width: 100%; font-size: 16px; padding: 11px 12px; border-radius: 8px; }
.login .btn { width: 100%; margin-top: 18px; padding: 12px; font-size: 15.5px; }
.login .err { color: var(--warn-soft); font-size: 13.5px; min-height: 20px; margin-top: 10px; }
.login .help { color: var(--dim); font-size: 12px; line-height: 1.6; margin-top: 10px; }
.credit { text-align: center; color: #5a5a5a; font-size: 11.5px; padding: 18px; }
@media (max-width: 600px) {
  .bar { padding: 10px 12px 0; gap: 8px; }
  .cat select { min-width: 0; max-width: 46vw; }
  .tabs { padding: 0 6px; }
  main { padding: 12px 10px 60px; }
  .mhead .title { font-size: 19px; }
  .brow { grid-template-columns: 96px 1fr 44px; }
}
