/* ============================================================
   Tokens. Four themes share one layout: fresh (default), mono, punch, glow.
   ============================================================ */
:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display-weight: 750;
  --display-tracking: -0.035em;
  --bg: #f6f9f8;
  --surface: #ffffff;
  --text: #0f1614;
  --muted: #5a6763;
  --line: #dde5e2;
  --accent: #0a8a5f;
  --accent-soft: #e2f4ec;
  --btn-bg: #0a8a5f;
  --btn-text: #ffffff;
  --ok: #0a8a5f;
  --bad: #c0271f;
  --radius: 14px;
  --radius-sm: 10px;
  --border-w: 1px;
  --shadow: 0 1px 2px rgba(15, 22, 20, 0.05);
  --wrap: 820px;
}
[data-theme="mono"] {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --display-weight: 700;
  --display-tracking: -0.04em;
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #111111;
  --muted: #666666;
  --line: #cfcfcf;
  --accent: #6d28d9;
  --accent-soft: #efe7ff;
  --btn-bg: #111111;
  --btn-text: #ffffff;
  --ok: #18794e;
  --bad: #c0271f;
  --radius: 0px;
  --radius-sm: 0px;
  --border-w: 1px;
  --shadow: none;
}
[data-theme="punch"] {
  --font: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --font-display: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --display-weight: 900;
  --display-tracking: -0.04em;
  --bg: #fffdf5;
  --surface: #ffffff;
  --text: #0c0c0c;
  --muted: #4d4d4d;
  --line: #0c0c0c;
  --accent: #2b4bff;
  --accent-soft: #ffe14d;
  --btn-bg: #2b4bff;
  --btn-text: #ffffff;
  --ok: #0a7a3c;
  --bad: #d0221a;
  --radius: 6px;
  --radius-sm: 4px;
  --border-w: 2px;
  --shadow: 4px 4px 0 var(--line);
}
[data-theme="glow"] {
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display-weight: 750;
  --display-tracking: -0.025em;
  --bg: #f4f3ff;
  --surface: rgba(255, 255, 255, 0.72);
  --text: #1a1838;
  --muted: #615f80;
  --line: rgba(90, 84, 200, 0.18);
  --accent: #5648f0;
  --accent-soft: rgba(86, 72, 240, 0.1);
  --btn-bg: linear-gradient(120deg, #5648f0, #d94a9a);
  --btn-text: #ffffff;
  --ok: #12805a;
  --bad: #c22a4a;
  --radius: 20px;
  --radius-sm: 12px;
  --border-w: 1px;
  --shadow: 0 8px 30px rgba(70, 60, 180, 0.1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1412;
    --surface: #141d1a;
    --text: #e8f0ed;
    --muted: #93a39d;
    --line: #25312d;
    --accent: #4fd39f;
    --accent-soft: #13291f;
    --btn-bg: #4fd39f;
    --btn-text: #06140e;
    --ok: #4fd39f;
    --bad: #ff8a80;
    --shadow: none;
  }
  [data-theme="mono"] {
    --bg: #0c0c0d;
    --surface: #141416;
    --text: #ececec;
    --muted: #9a9a9a;
    --line: #333336;
    --accent: #b99cff;
    --accent-soft: #241a3d;
    --btn-bg: #ececec;
    --btn-text: #0c0c0d;
    --ok: #6fd39a;
    --bad: #ff8a80;
  }
  [data-theme="punch"] {
    --bg: #0e0e10;
    --surface: #19191d;
    --text: #f7f7f2;
    --muted: #b3b3ad;
    --line: #f7f7f2;
    --accent: #8ea0ff;
    --accent-soft: #ffe14d;
    --btn-bg: #ffe14d;
    --btn-text: #0c0c0c;
    --ok: #6fe39f;
    --bad: #ff8a80;
  }
  [data-theme="glow"] {
    --bg: #0d0c1c;
    --surface: rgba(34, 31, 68, 0.6);
    --text: #eeecff;
    --muted: #a5a2c8;
    --line: rgba(160, 150, 255, 0.2);
    --accent: #a59cff;
    --accent-soft: rgba(140, 130, 255, 0.14);
    --btn-bg: linear-gradient(120deg, #6a5cff, #e0559f);
    --btn-text: #ffffff;
    --ok: #6fe3b5;
    --bad: #ff8fa8;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  }
}

/* ============================================================
   Layout
   ============================================================ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
}
a { color: var(--accent); }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }

header.site { background: var(--surface); border-bottom: var(--border-w) solid var(--line); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand {
  font-family: var(--font-display); font-weight: var(--display-weight); font-size: 22px;
  letter-spacing: var(--display-tracking); color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand span { color: var(--accent); }
header.site nav { display: flex; gap: 20px; }
header.site nav a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; }
header.site nav a:hover { color: var(--text); }

main { flex: 1; padding-block: 48px 80px; }
.hero { padding-block: 16px 8px; }
h1, h2, .brand { text-wrap: balance; }
h1 {
  font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking);
  font-size: clamp(32px, 6.5vw, 50px); line-height: 1.1; margin: 0 0 14px;
}
h2 {
  font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking);
  font-size: 24px; line-height: 1.25; margin: 56px 0 14px;
}
h3 { font-size: 16px; font-weight: 650; margin: 22px 0 4px; }
p { margin: 0 0 12px; }
.lede { color: var(--muted); font-size: 19px; line-height: 1.5; margin-bottom: 32px; max-width: 58ch; }
.muted { color: var(--muted); font-size: 14px; }
.prose p, .prose li { max-width: 68ch; }

/* ---- converter box ---- */
.tool {
  background: var(--surface); border: var(--border-w) solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius-sm); padding: 44px 16px; text-align: center;
  transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 40px; height: 40px; color: var(--accent); margin-bottom: 10px; }
.drop p { margin: 0; }
.drop .big { font-size: 19px; font-weight: 650; margin-bottom: 4px; }
.drop .muted { margin-top: 12px; }
.drop input[type=file] { display: none; }

button, .button {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none;
  border: var(--border-w) solid var(--line); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 16px; display: inline-block; line-height: 1.3;
}
button:hover, .button:hover { border-color: var(--accent); }
button.primary { background: var(--btn-bg); border-color: transparent; color: var(--btn-text); padding-inline: 22px; }
button.primary:disabled { opacity: .6; cursor: default; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; box-shadow: none; }
button.icon { border: 0; background: none; padding: 0 6px; font-size: 20px; line-height: 1; color: var(--muted); box-shadow: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.options { display: flex; flex-wrap: wrap; gap: 14px 24px; margin-top: 20px; }
.opt { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); min-width: 160px; }
.opt-checkbox { flex-direction: row; align-items: center; gap: 8px; color: var(--text); align-self: end; padding-bottom: 9px; }
.opt select, .opt input[type=number] {
  font: inherit; color: var(--text); background: var(--bg);
  border: var(--border-w) solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; width: 100%;
}
.opt input[type=range] { accent-color: var(--accent); width: 100%; }
.opt input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.opt output { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }

.list { list-style: none; margin: 20px 0 0; padding: 0; }
.list:empty { display: none; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 15px; }
.list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .size { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.status { color: var(--muted); max-width: 50%; text-align: right; }
.status.done { color: var(--ok); }
.status.error { color: var(--bad); }
#results li .name { font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.actions[hidden], .options[hidden] { display: none; }
#notice { color: var(--bad); font-size: 14px; margin: 14px 0 0; }
#notice:empty { display: none; }

ol.steps { padding-left: 22px; margin: 0 0 12px; }
ol.steps li { margin-bottom: 6px; padding-left: 4px; }

/* ---- tool cards ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.grid a {
  display: block; height: 100%; padding: 14px 16px; text-decoration: none; color: var(--text); font-weight: 650;
  background: var(--surface); border: var(--border-w) solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.grid a:hover { border-color: var(--accent); }
.grid a small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; margin-top: 2px; }

.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 24px; margin: 0; padding: 0; list-style: none; }
.points li { color: var(--muted); font-size: 15px; }
.points li strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 2px; }

/* ---- footer ---- */
footer.site { background: var(--surface); border-top: var(--border-w) solid var(--line); padding-block: 44px 32px; font-size: 14px; }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 28px 24px; }
.foot-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 8px; }
.foot-grid ul { list-style: none; margin: 0; padding: 0; }
.foot-grid li a { color: var(--text); text-decoration: none; line-height: 2; }
.foot-grid li a:hover { color: var(--accent); text-decoration: underline; }
.foot-base {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted);
}

@media (max-width: 520px) {
  main { padding-block: 32px 56px; }
  .tool { padding: 14px; }
  .drop { padding: 32px 12px; }
  h2 { margin-top: 44px; }
}

/* ============================================================
   Theme: mono (monospace headings, square, grayscale + violet)
   ============================================================ */
[data-theme="mono"] .brand { text-transform: lowercase; font-size: 18px; }
[data-theme="mono"] .brand::before { content: "~/"; color: var(--muted); font-weight: 400; }
[data-theme="mono"] h1 { font-size: clamp(28px, 5.6vw, 42px); line-height: 1.15; }
[data-theme="mono"] h2 { font-size: 19px; letter-spacing: -0.02em; }
[data-theme="mono"] h2::before { content: "# "; color: var(--accent); }
[data-theme="mono"] .drop .big::before { content: "> "; color: var(--accent); }
[data-theme="mono"] .drop .big, [data-theme="mono"] button, [data-theme="mono"] .button,
[data-theme="mono"] .grid a, [data-theme="mono"] .foot-title, [data-theme="mono"] header.site nav a,
[data-theme="mono"] .opt span { font-family: var(--font-display); letter-spacing: -0.01em; }
[data-theme="mono"] .grid a small { font-family: var(--font); letter-spacing: 0; }
[data-theme="mono"] .grid { gap: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
[data-theme="mono"] .grid a { border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
[data-theme="mono"] .grid a:hover { background: var(--accent-soft); }
[data-theme="mono"] button.link { font-family: inherit; }

/* ============================================================
   Theme: punch (bold, hard edges)
   ============================================================ */
[data-theme="punch"] .brand { text-transform: uppercase; font-size: 20px; }
[data-theme="punch"] .brand span { color: #0c0c0c; background: var(--accent-soft); padding: 0 6px; margin-left: 2px; }
[data-theme="punch"] h1 { font-size: clamp(38px, 8vw, 64px); line-height: 1; text-transform: uppercase; }
[data-theme="punch"] h2 { text-transform: uppercase; font-size: 22px; letter-spacing: -0.02em; }
[data-theme="punch"] h2::after { content: ""; display: block; width: 48px; height: 6px; background: var(--accent-soft); margin-top: 6px; }
[data-theme="punch"] .lede { color: var(--text); font-weight: 500; }
[data-theme="punch"] .drop { border-style: dashed; border-width: 3px; }
[data-theme="punch"] .drop.over { background: var(--accent-soft); color: #0c0c0c; }
[data-theme="punch"] button:not(.link):not(.icon),
[data-theme="punch"] .button { box-shadow: 3px 3px 0 var(--line); border-color: var(--line); text-transform: uppercase; font-size: 13px; letter-spacing: .03em; font-weight: 800; }
[data-theme="punch"] button:not(.link):not(.icon):hover,
[data-theme="punch"] .button:hover,
[data-theme="punch"] .grid a:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--line); border-color: var(--line); }
[data-theme="punch"] .grid a { font-weight: 800; }
[data-theme="punch"] .grid a:hover { background: var(--accent-soft); color: #0c0c0c; }
[data-theme="punch"] .grid a:hover small { color: #0c0c0c; }
[data-theme="punch"] .foot-title { color: var(--text); }

/* ============================================================
   Theme: glow (soft, gradient, glassy)
   ============================================================ */
[data-theme="glow"] body {
  background:
    radial-gradient(60vw 50vh at 10% -5%, rgba(120, 100, 255, 0.22), transparent 70%),
    radial-gradient(50vw 45vh at 100% 5%, rgba(235, 90, 160, 0.16), transparent 70%),
    radial-gradient(60vw 50vh at 50% 110%, rgba(80, 180, 255, 0.14), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
[data-theme="glow"] header.site,
[data-theme="glow"] footer.site { background: transparent; }
[data-theme="glow"] header.site { border-bottom-color: transparent; }
[data-theme="glow"] .brand span {
  background: linear-gradient(120deg, #5648f0, #d94a9a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
[data-theme="glow"] .hero, [data-theme="glow"] .tool-head { text-align: center; }
[data-theme="glow"] .hero .lede, [data-theme="glow"] .tool-head .lede { margin-inline: auto; }
[data-theme="glow"] .tool, [data-theme="glow"] .grid a { -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
[data-theme="glow"] .drop { background: var(--accent-soft); border-color: transparent; outline: 2px dashed var(--line); outline-offset: -8px; }
[data-theme="glow"] .drop.over { outline-color: var(--accent); }
[data-theme="glow"] button, [data-theme="glow"] .button { border-radius: 999px; }
[data-theme="glow"] button.primary { box-shadow: 0 6px 18px rgba(110, 80, 240, 0.35); }
[data-theme="glow"] .grid a:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(70, 60, 180, 0.18); }
@media (prefers-color-scheme: dark) {
  [data-theme="glow"] .brand span { background-image: linear-gradient(120deg, #a59cff, #ff8cc6); }
}
