:root {
  --bg: #eef1f4; --surface: #ffffff; --ink: #1f2731; --muted: #5d6875; --line: #d3d9e0;
  --red: #a83232; --red-ink: #ffffff; --soul: #2d7f7a; --gold: #b7861f; --tag: #f6ecd9; --tag-ink: #3a2a14;
  --focus: #2d63c8; --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a2027; --surface: #232b34; --ink: #e6eaee; --muted: #9aa5b1; --line: #36414d;
    --red: #e06464; --red-ink: #1a1012; --soul: #5cc2ba; --gold: #e0b04a; --tag: #3b3122; --tag-ink: #f3e3c6;
    --focus: #7aa7ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a2027; --surface: #232b34; --ink: #e6eaee; --muted: #9aa5b1; --line: #36414d;
  --red: #e06464; --red-ink: #1a1012; --soul: #5cc2ba; --gold: #e0b04a; --tag: #3b3122; --tag-ink: #f3e3c6;
  --focus: #7aa7ff; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 Rubik, system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  padding-bottom: 96px;
}
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 12px; }
h3 { font-size: 1rem; font-weight: 500; margin-bottom: 8px; }
p { margin: 0; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.small { font-size: .875rem; color: var(--muted); }
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.head { border-bottom: 1px solid var(--line); background: var(--surface); }
.head-in { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding-top: 20px; padding-bottom: 18px; }
.lede { color: var(--muted); margin-top: 6px; max-width: 60ch; }
select, input[type=text] {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; min-height: 42px;
}
#lang { flex: none; }

.intro { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; margin: 24px 0; }
.promo, .filebox, .group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }

/* promo codes as butcher shop tags hanging from a string */
.tags { display: flex; gap: 18px; flex-wrap: wrap; padding: 14px 4px 10px; }
.tag {
  position: relative; background: var(--tag); color: var(--tag-ink);
  border-radius: 6px 6px 6px 6px; padding: 14px 16px 12px 34px; min-width: 150px;
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 14px 100%, 0 50%);
  transform: rotate(-2deg); transform-origin: 0 50%;
  display: flex; align-items: center; gap: 12px;
}
.tag:nth-child(2) { transform: rotate(1.5deg); }
.tag::before { content: ""; position: absolute; left: 14px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px rgba(0,0,0,.18); }
.code { font-size: 1.7rem; font-weight: 700; letter-spacing: .14em; }
.tag button { margin-left: auto; }
.promo .small + .small { margin-top: 6px; }

.steps { margin: 0 0 14px; padding-left: 20px; color: var(--muted); }
.steps li { margin: 2px 0; }
.pick { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.btn {
  font: inherit; font-weight: 500; cursor: pointer; border: 0; border-radius: 8px; min-height: 42px; padding: 9px 16px;
  background: var(--red); color: var(--red-ink); display: inline-flex; align-items: center;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.mini { min-height: 34px; padding: 5px 10px; font-size: .875rem; }
.btn:disabled { opacity: .55; cursor: default; }
.msg { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--bg); }
.msg.err { color: var(--red); }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--line); margin-bottom: 16px; scrollbar-width: thin; }
.tabs button {
  font: inherit; background: none; border: 0; color: var(--muted); padding: 10px 14px; cursor: pointer; white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -2px; display: inline-flex; gap: 8px; align-items: center;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--red); font-weight: 500; }
.badge { background: var(--red); color: var(--red-ink); border-radius: 999px; font-size: .75rem; padding: 0 7px; line-height: 1.5; }
.panel { display: grid; gap: 16px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-weight: 500; font-size: .95rem; }
.field input, .field select { width: 100%; }
.field .was { font-size: .8rem; color: var(--muted); min-height: 1.2em; }
.field.changed input, .field.changed select { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.field.bad input { border-style: dashed; }
.soul label::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--soul); margin-right: 7px; vertical-align: 1px; }

.islands { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin: 12px 0; }
.islands button {
  font: inherit; min-height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer;
}
.islands button.on { background: color-mix(in srgb, var(--soul) 22%, var(--surface)); border-color: var(--soul); }
.islands button.sel { background: var(--soul); color: var(--surface); font-weight: 700; }
.islands button.orig { text-decoration: underline; text-underline-offset: 3px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 10px 0 14px; flex-wrap: wrap; }
.seg button { font: inherit; border: 0; background: var(--surface); color: var(--ink); padding: 9px 14px; cursor: pointer; min-height: 42px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }

.sw { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.sw:first-child { border-top: 0; }
.sw .txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sw .txt b { font-weight: 500; }
.sw.changed .txt b::after { content: " •"; color: var(--red); }
.toggle { appearance: none; flex: none; width: 48px; height: 28px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; margin-top: 2px; transition: background .15s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); transition: transform .15s; }
.toggle:checked { background: var(--soul); }
.toggle:checked::after { transform: translateX(20px); }

.mythic { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.card { border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 8px; padding: 12px; display: grid; gap: 10px; background: var(--surface); }
.card.changed { border-color: var(--red); border-left-color: var(--red); }
.card .nm { font-weight: 500; overflow-wrap: anywhere; }
.card .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card select { min-width: 84px; }

.bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(20, 30, 40, .12); }
.bar-in { display: flex; gap: 10px; align-items: center; padding-top: 12px; padding-bottom: 12px; }
#count { margin-right: auto; font-weight: 500; }
.foot { margin: 28px 0 12px; }

@media (max-width: 760px) {
  .intro { grid-template-columns: 1fr; }
  .head-in { flex-direction: column; }
  h1 { font-size: 1.35rem; }
  .bar-in { flex-wrap: wrap; }
  #count { width: 100%; }
  #save { flex: 1; justify-content: center; }
  .seg { display: flex; }
  .seg button { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
