:root {
  --bg: #f5f6f8;
  --card: #fff;
  --ink: #2b2f36;
  --muted: #6b7280;
  --line: #dde1e6;
  --accent: #4a90d9;
  --accent-ink: #fff;
  --ok: #3f9b4a;
  --err: #c62828;
  --info-bg: #eef5fc;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181d;
    --card: #1e232a;
    --ink: #e6e8eb;
    --muted: #9aa3ad;
    --line: #333a43;
    --info-bg: #1d2a38;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand svg { width: 26px; height: 26px; color: #d32f2f; }
.langs button {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: 4px 10px; border-radius: 6px; cursor: pointer; font-weight: 600;
}
.langs button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

main { width: 100%; max-width: 860px; margin: 0 auto; padding: 24px 20px 40px; flex: 1; }
h1 { font-size: 1.6rem; margin: 0 0 4px; }
.lead { color: var(--muted); margin: 0 0 24px; }

.step, .done {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.step h2 { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; margin: 0 0 6px; }
.num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: .9rem;
}
.hint { color: var(--muted); margin: 0 0 14px; font-size: .95rem; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#code {
  font: 600 1.6rem/1 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .15em;
  width: 9.5ch; padding: 10px 12px; text-transform: uppercase;
  border: 2px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink);
}
#code:focus { outline: none; border-color: var(--accent); }
select { padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }

button.primary {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px;
  padding: 12px 20px; font: inherit; font-weight: 600; cursor: pointer;
}
button.primary:disabled { opacity: .6; cursor: progress; }
button.big { margin-top: 16px; padding: 14px 24px; font-size: 1.05rem; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }

.msg { margin: 10px 0 0; min-height: 1.2em; font-size: .95rem; }
.msg.err { color: var(--err); }
.msg.info { color: var(--ink); background: var(--info-bg); padding: 8px 12px; border-radius: 6px; }
.msg:empty { display: none; }

.course { margin-top: 14px; padding: 12px 14px; border-left: 4px solid var(--ok); background: var(--bg); border-radius: 6px; }
.course-name { font-weight: 700; font-size: 1.15rem; }
.course-meta { color: var(--muted); font-size: .9rem; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 32px 16px; border: 2px dashed var(--line); border-radius: var(--radius);
  color: var(--muted); cursor: pointer; text-align: center;
}
.drop svg { width: 36px; height: 36px; }
.drop:hover, .drop:focus, .drop.over { border-color: var(--accent); color: var(--accent); outline: none; }
#sheet-pick, #header-pick { margin-top: 12px; }
#header-row { max-width: 100%; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: var(--bg); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }

.done { text-align: center; padding: 32px 20px; }
.done svg { width: 56px; height: 56px; color: var(--ok); }
.done h2 { margin: 8px 0; }

footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 16px 20px 24px; max-width: 860px; margin: 0 auto; }
[hidden] { display: none !important; }
