:root {
  --bg: #f6f7f9; --card: #fff; --fg: #15171c; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2563eb; --up: #16a34a; --down: #dc2626; --warn: #b45309;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111318; --card: #1a1d24; --fg: #e8eaee; --muted: #9aa1ad; --line: #2a2e37;
    --accent: #60a5fa; --up: #4ade80; --down: #f87171; --warn: #fbbf24; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; }
a { color: inherit; text-decoration: none; }
h1 { font-size: 1.25rem; margin: 0 0 4px; } h2 { font-size: 1rem; margin: 0; }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.top nav a { margin-left: 16px; color: var(--muted); }
.brand { font-weight: 700; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 80px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; }
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 10px 0; }
.season { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 12px; }
.season img, .noimg { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--line); flex: none; }
.hero { display: flex; gap: 12px; } .hero img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 18px; }
.card .bar { margin-top: 0; }
.small { font-size: .85rem; } .muted { color: var(--muted); }
.clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up { color: var(--up); } .down { color: var(--down); } .warn { color: var(--warn); }
.chip { font-size: .75rem; padding: 1px 8px; border-radius: 99px; color: #fff; background: var(--c); }
.unit { display: inline-block; padding: 0 6px; margin: 1px 2px 1px 0; border-radius: 6px; background: var(--line); font-size: .85rem; }
.unit.bad { background: none; color: var(--down); border: 1px dashed var(--down); }

/* 초상화 */
.faces { display: inline-flex; flex-wrap: wrap; gap: 3px; vertical-align: middle; }
img.face { width: 40px; height: 40px; border-radius: 7px; object-fit: cover; background: var(--line); display: block;
  -webkit-touch-callout: none; user-select: none; }
.bar img.face { width: 32px; height: 32px; }
.decks .faces { flex-wrap: nowrap; }
.decks.stats img.face { width: 32px; height: 32px; border-radius: 6px; }
.decks.stats .faces { gap: 2px; }
.cloud img.face { width: 48px; height: 48px; }

/* 덱 칸 */
.slot-btn { aspect-ratio: 1; padding: 0; overflow: hidden; border-radius: 9px; background: var(--bg);
  border: 1px dashed var(--line); color: var(--muted); display: grid; place-items: center; }
.slot-btn img.face, .pick-slots img.face { width: 100%; height: 100%; border-radius: 0; }
.slot-btn .unit.bad { border: 0; font-size: .75rem; }
.plus { font-size: 1.4rem; line-height: 1; }

/* 니케 고르기 */
dialog.pick { display: none; flex-direction: column; gap: 8px; height: 88vh; }
dialog.pick[open] { display: flex; }
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pick-slots { display: grid; grid-template-columns: repeat(5, 44px); gap: 4px; }
.pick-slots button { width: 44px; height: 44px; padding: 0; overflow: hidden; border-radius: 8px;
  background: var(--bg); color: var(--muted); border: 2px solid var(--line); display: grid; place-items: center; }
.pick-slots button.on { border-color: var(--accent); }
.pick-q { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 4px; }
.filters button { background: var(--bg); color: var(--fg); border: 1px solid var(--line); padding: 2px 8px;
  min-width: 34px; height: 32px; font-size: .85rem; }
.filters button img { width: 20px; height: 22px; display: block; margin: 0 auto; }
.filters button.on { border-color: var(--accent); background: var(--accent); color: #fff; }
.pick-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 8px 6px; align-content: start; }
.pick-grid button { background: none; color: var(--fg); padding: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pick-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--line); }
.pick-grid span { font-size: .68rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: keep-all; }
.pick-grid button.used img { opacity: .35; }
.chart { position: relative; height: 220px; }
table.decks { width: 100%; border-collapse: collapse; margin-top: 6px; }
.decks td, .decks th { padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: top; text-align: left; }
.decks th { font-size: .8rem; color: var(--muted); font-weight: 500; }
.decks .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.decks .slot { width: 1.5em; color: var(--muted); }
.decks tr[data-act] { cursor: pointer; }
.total { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin-top: 8px; }
.shot img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; display: block; background: var(--line); }
.actions { display: flex; justify-content: flex-end; gap: 14px; margin-top: 8px; }
button { font: inherit; border: 0; border-radius: 8px; padding: 6px 14px; background: var(--accent); color: #fff; cursor: pointer; }
button.link { background: none; color: var(--accent); padding: 0; }
button.danger, .link.danger { color: var(--down); }
details summary { cursor: pointer; }
.cloud { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cloud a { display: block; }

dialog { width: min(640px, 100vw - 16px); max-height: 92vh; border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; background: var(--card); color: var(--fg); }
dialog::backdrop { background: #0008; }
dialog label { display: block; margin: 8px 0; font-size: .85rem; color: var(--muted); flex: 1; }
input, textarea, select { width: 100%; font: inherit; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin-top: 2px; }
fieldset.deck { border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; padding: 6px 8px 8px; }
fieldset.deck legend { font-size: .8rem; color: var(--muted); }
.units { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
fieldset .row input { flex: 1; } fieldset .row input:first-child { flex: 0 0 9em; }
img.full { width: 100%; border-radius: 8px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(40px); opacity: 0;
  background: var(--fg); color: var(--bg); padding: 8px 16px; border-radius: 99px; transition: .25s; pointer-events: none; }
#toast.on { opacity: 1; transform: translateX(-50%); }
.top nav button { margin-left: 16px; color: var(--muted); }
.login { max-width: 360px; padding-top: 18vh; }
.login button { width: 100%; margin-top: 8px; padding: 10px; }
.login label { display: block; color: var(--muted); font-size: .85rem; margin: 12px 0 4px; }
pre.shape { max-height: 60vh; overflow: auto; font-size: .75rem; background: var(--bg); border-radius: 8px; padding: 8px; margin: 8px 0; }
button:disabled { opacity: .5; cursor: default; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.stats div { background: var(--bg); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.stats span { display: block; font-size: .75rem; color: var(--muted); }
.stats b { font-variant-numeric: tabular-nums; font-size: .95rem; }
.nk-filter { flex-wrap: nowrap; } .nk-filter input { flex: 1; min-width: 0; } .nk-filter select { width: auto; }
.nk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; margin-top: 10px; }
.nk { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 2px 6px; min-width: 0;
  background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; }
.nk img, .nk .noface { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--line); }
.nk-g { font-size: .7rem; color: var(--warn); line-height: 1.2; }
.nk-name { font-size: .78rem; width: 100%; text-align: center; }
.nk-cp { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
dialog h3 { font-size: .9rem; margin: 14px 0 0; }
.eq td { font-size: .85rem; }
