:root {
  --bg: #f4f3ee;          /* warm cream */
  --panel: #fbfaf6;       /* card surface */
  --panel-2: #f0eee6;     /* inset surface */
  --border: #e0ddd1;
  --border-strong: #d2cec0;
  --text: #1c1b18;        /* near-black ink */
  --muted: #6f6c62;
  --accent: #fb651e;      /* orange */
  --accent-ink: #ffffff;
  --ink: #1c1b18;         /* black buttons */
  --hot: #fdf0e8;         /* masked-column tint */
  --hot-border: #fb651e;
  --radius: 12px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  background: rgba(244, 243, 238, 0.85); backdrop-filter: blur(8px);
}
.brand { font-family: var(--sans); font-weight: 600; font-size: 17px; display: flex; gap: 10px; align-items: center; letter-spacing: -0.2px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 6px; background: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-mark svg { width: 17px; height: 17px; }
.badge {
  font-size: 12.5px; color: var(--muted); border: 1px solid var(--border-strong);
  background: var(--panel); padding: 6px 13px; border-radius: 999px; white-space: nowrap;
}

main { max-width: 880px; margin: 0 auto; padding: 18px 22px 90px; }

/* ---- Hero ---- */
.hero { text-align: center; padding: 56px 0 40px; }
.hero h1 {
  font-family: var(--serif); font-weight: 400; letter-spacing: -0.5px;
  font-size: clamp(34px, 6.4vw, 62px); line-height: 1.04; margin: 0 auto 22px;
  font-optical-sizing: auto;
}
.hero h1 em { font-style: italic; }
.hero p {
  color: var(--muted); max-width: 620px; margin: 0 auto; font-size: 16.5px;
}
.hero p strong { color: var(--text); font-weight: 600; }

/* ---- Cards ---- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-top: 18px;
}
.step {
  font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: 0.8px;
  color: var(--accent); text-transform: uppercase; margin-bottom: 16px;
}
.step .muted { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ---- Dropzone ---- */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 40px 20px;
  text-align: center; cursor: pointer; transition: 0.15s; background: var(--bg);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--hot); }
.drop-icon { width: 38px; height: 38px; color: var(--muted); margin-bottom: 6px; }
.dropzone:hover .drop-icon, .dropzone.over .drop-icon { color: var(--accent); }
.drop-text { margin-top: 4px; font-weight: 500; font-size: 15px; }
.drop-sub { margin-top: 6px; font-size: 13px; color: var(--muted); }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.filename { margin-top: 14px; font-size: 13.5px; color: var(--text); font-weight: 500; }
.sheetrow { margin-top: 12px; font-size: 14px; color: var(--muted); }
.sheetrow select { font: inherit; background: var(--panel); color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; margin-left: 6px; }

/* ---- Columns ---- */
.selectall { display: inline-flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--muted); margin-bottom: 14px; cursor: pointer; }
.columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.col {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  transition: 0.12s;
}
.col:hover { border-color: var(--accent); }
.col:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.col input { accent-color: var(--accent); width: 16px; height: 16px; pointer-events: none; }
.col.on { background: var(--hot); border-color: var(--accent); }
.col.on .colname { color: #9a3a12; font-weight: 600; }
.colname { font-weight: 500; font-size: 14px; }
.colsample { color: var(--muted); font-size: 12px; margin-left: auto; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }

/* ---- Passphrase + actions ---- */
.passrow { display: flex; gap: 8px; }
.passrow input {
  flex: 1; background: var(--bg); border: 1px solid var(--border-strong); color: var(--text);
  padding: 13px 15px; border-radius: 10px; font-size: 15px; font-family: var(--sans);
}
.passrow input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--hot); }
.hint { font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.hint strong { color: var(--text); font-weight: 600; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
button { font: inherit; cursor: pointer; border-radius: 10px; padding: 12px 22px; font-weight: 500; font-size: 14.5px; border: 1px solid transparent; transition: 0.14s; white-space: nowrap; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
/* Mask / Unmask act as a matched pair: the action you click becomes active. */
.action-btn { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.action-btn:hover:not(:disabled) { border-color: var(--ink); }
.action-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.action-btn.active:hover:not(:disabled) { background: #000; }
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border-strong); padding: 12px 16px; }
.ghost:hover { border-color: var(--ink); color: var(--ink); }

.status { margin-top: 16px; font-size: 14px; min-height: 20px; }
.status.ok { color: #2f7d4f; }
.status.err { color: #c0392b; }

.progress { margin-top: 16px; }
.progress-track { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.1s; }
.progress-text { font-size: 12px; color: var(--muted); margin-top: 7px; }

.download {
  display: inline-block; margin-top: 18px; background: var(--accent); color: var(--accent-ink);
  padding: 13px 24px; border-radius: 10px; font-weight: 600; font-size: 14.5px; text-decoration: none;
}
.download:hover { filter: brightness(0.95); }

/* ---- Preview table ---- */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 9px 13px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--panel-2); color: var(--muted); font-weight: 600; position: sticky; top: 0; }
td { font-family: ui-monospace, 'SF Mono', Menlo, monospace; color: var(--text); }
tr:last-child td { border-bottom: none; }
th.hot, td.hot { background: var(--hot); color: #9a3a12; }
th.hot { box-shadow: inset 0 -2px 0 var(--hot-border); }

/* ---- Info section ---- */
.info { margin-top: 44px; }
.info h2 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 0 0 18px; letter-spacing: -0.3px; }
.info ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.info li {
  background: var(--panel); padding: 16px 18px; color: var(--muted); font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.info li:last-child { border-bottom: none; }
.info li strong { color: var(--text); font-weight: 600; }

/* ---- FAQ ---- */
.faq { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.faq details { border-bottom: 1px solid var(--border); }
.faq details:last-child { border-bottom: none; }
.faq summary {
  list-style: none; cursor: pointer; padding: 16px 18px; font-weight: 500; font-size: 15px;
  color: var(--text); display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; color: var(--accent); font-size: 20px; line-height: 1; flex-shrink: 0; transition: transform 0.18s;
}
.faq details[open] summary::after { content: '\2013'; }
.faq summary:hover { color: var(--accent); }
.faq p { margin: 0; padding: 0 18px 17px; color: var(--muted); font-size: 14px; }

.legal { max-width: 720px; margin: 0 auto; padding: 24px 0 20px; }
.legal h1 { font-family: var(--serif); font-weight: 400; font-size: 38px; letter-spacing: -0.5px; margin: 16px 0 6px; }
.legal h2 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 28px 0 8px; }
.legal p, .legal li { color: var(--muted); font-size: 15px; line-height: 1.65; }
.legal strong { color: var(--text); }
.legal a { color: var(--accent); }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 8px; }
.legal code { background: var(--panel-2); padding: 1px 6px; border-radius: 5px; font-size: 13px; color: var(--text); }
.legal .updated { color: var(--muted); font-size: 13px; margin-top: 0; }

footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 32px 20px; border-top: 1px solid var(--border); margin-top: 36px; }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 14px 18px; }
  .badge { font-size: 11.5px; white-space: normal; }
  .hero { padding: 36px 0 28px; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions button { width: 100%; }
}
