/* DoppelDraft demo. Identity: paper and ink, a deep pine "ink" and a
   vermilion "pen", with an offset second outline (the double) on cards. */
:root {
  --paper: #f5efe3;
  --paper-2: #fbf8f1;
  --ink: #18241f;
  --ink-2: #44514b;
  --pine: #0f6b5f;
  --pine-2: #0b5249;
  --pen: #b8381a;
  --pen-soft: #f3d9cc;
  --line: #18241f;
  --hair: #d8cfbd;
  --mark: #f0c24b;
  --shadow: #18241f;
  --focus: #b8381a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14201c; --paper-2: #1b2a25; --ink: #efe8da; --ink-2: #bfc8c1; --pine: #5cc5b1; --pine-2: #7fd6c4;
    --pen: #ff8a66; --pen-soft: #4a2a20; --line: #efe8da; --hair: #33443d; --mark: #d9a92e; --shadow: #000; --focus: #ff8a66;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14201c; --paper-2: #1b2a25; --ink: #efe8da; --ink-2: #bfc8c1; --pine: #5cc5b1; --pine-2: #7fd6c4;
  --pen: #ff8a66; --pen-soft: #4a2a20; --line: #efe8da; --hair: #33443d; --mark: #d9a92e; --shadow: #000; --focus: #ff8a66;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); overflow-x: hidden; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .5rem; font-weight: 700; }
h1 { font-size: clamp(2rem, 5.2vw, 3.4rem); letter-spacing: -.01em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .8rem; }
a { color: var(--pine); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.sr, .offscreen { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hint { color: var(--ink-2); font-size: .92rem; }

/* header */
.top { border-bottom: 2px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: center; gap: 12px; min-height: 60px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); margin-right: auto; }
.mark-back { fill: var(--pine); }
.mark-front { fill: none; stroke: var(--pen); stroke-width: 3; }
.word { font-family: var(--serif); font-size: 1.4rem; font-weight: 700; letter-spacing: -.01em; }
.word span { color: var(--pen); font-style: italic; }
.badge { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--mark); color: #18241f; padding: 4px 10px; border: 2px solid var(--line); border-radius: 999px; }

/* buttons */
.btn { font: inherit; font-weight: 650; cursor: pointer; border-radius: 10px; padding: 10px 16px; border: 2px solid var(--line); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; transition: transform .08s, box-shadow .08s; }
.btn.primary { background: var(--pine); color: #fff; box-shadow: 3px 3px 0 var(--shadow); }
:root[data-theme="dark"] .btn.primary { color: #0d1714; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0d1714; } }
.btn.primary:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--shadow); }
.btn.primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.small { padding: 6px 12px; font-size: .9rem; min-height: 40px; }

/* hero */
.hero { padding: 48px 0 24px; border-bottom: 2px solid var(--line); background:
  linear-gradient(transparent 31px, var(--hair) 32px) 0 0 / 100% 32px; }
.hero-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 40px; align-items: start; }
.kicker { font-family: var(--mono); font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--pen); font-weight: 700; }
.lede { font-size: 1.12rem; max-width: 40em; background: var(--paper); }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li { counter-increment: s; background: var(--paper-2); border: 2px solid var(--line); border-radius: 14px; padding: 14px 16px 14px 58px; position: relative; box-shadow: 5px 5px 0 var(--pine); }
.steps li::before { content: counter(s); position: absolute; left: 14px; top: 12px; width: 32px; height: 32px; border-radius: 50%; background: var(--pen); color: #fff; font-weight: 800; display: grid; place-items: center; font-family: var(--serif); }
.note { margin-top: 28px; font-size: .95rem; background: var(--paper-2); border-left: 4px solid var(--pen); padding: 12px 14px; max-width: 60em; }

/* app */
.app { padding: 28px 0 56px; }
.app:focus { outline: none; }
.voicebar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-bottom: 18px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--paper-2); }
.voice-desc { margin: 0; flex: 1 1 260px; color: var(--ink-2); font-size: .95rem; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
label, legend { font-weight: 650; font-size: .95rem; }
input[type="text"], textarea, select { font: inherit; color: var(--ink); background: var(--paper); border: 2px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%; min-height: 44px; }
.field.inline select { width: auto; max-width: 70vw; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #6b746f; }
fieldset { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }

.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
[role="tab"] { font: inherit; font-weight: 650; background: transparent; color: var(--ink-2); border: 2px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; padding: 10px 14px; cursor: pointer; white-space: nowrap; min-height: 44px; margin-bottom: -2px; }
[role="tab"][aria-selected="true"] { color: var(--ink); background: var(--paper-2); border-color: var(--line); border-bottom: 2px solid var(--paper-2); }
[role="tab"]:hover { color: var(--ink); }
.count { display: inline-block; min-width: 1.4em; font-size: .78rem; background: var(--pen); color: #fff; border-radius: 999px; padding: 0 6px; margin-left: 4px; }
.count:empty { display: none; }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: start; }
.card { background: var(--paper-2); border: 2px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: 5px 5px 0 var(--shadow); }
.card + .card { margin-top: 18px; }
.empty { box-shadow: none; border-style: dashed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.samples, .history { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 16px; }
.sample { box-shadow: 4px 4px 0 var(--pine); }
.sample-head, .draft-head { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.sample-head h3 { margin-right: auto; }
.sample-text { white-space: pre-wrap; margin: 6px 0 0; font-family: var(--serif); font-size: 1.02rem; }
.tag { font-size: .75rem; font-weight: 700; color: var(--pen); border: 1.5px solid var(--pen); border-radius: 999px; padding: 1px 8px; }

.profile { position: sticky; top: 76px; box-shadow: 6px 6px 0 var(--pen); }
.traits { margin: 0 0 8px; display: grid; gap: 10px; }
.trait { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 10px; border-top: 1px solid var(--hair); padding-top: 8px; }
.trait dt { font-weight: 700; font-size: .92rem; }
.trait dd { margin: 0; }
.meter { margin: 12px 0; }
.meter-top { display: flex; justify-content: space-between; gap: 8px; font-size: .92rem; }
.meter-label { font-weight: 700; }
.bar { display: block; height: 12px; border: 2px solid var(--line); border-radius: 999px; background: var(--paper); overflow: hidden; margin-top: 4px; }
.bar.small { height: 10px; width: 80px; display: inline-block; vertical-align: middle; margin: 0 8px 0 0; }
.fill { display: block; height: 100%; background: var(--pine); }
.fill.low { background: var(--pen); }
.habits { margin: 0; padding-left: 1.1em; }
.habits li { margin: 2px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-block; border: 1.5px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .9rem; background: var(--paper); }
.chip.pick { cursor: pointer; padding: 0; overflow: hidden; position: relative; }
.chip.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip.pick span { display: block; padding: 8px 14px; font-weight: 600; }
.chip.pick input:checked + span { background: var(--ink); color: var(--paper); }
.chip.pick input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }

.sliders { display: grid; gap: 6px; }
.slider { display: grid; grid-template-columns: 6.5em minmax(0, 1fr) 9.5em; align-items: center; gap: 10px; }
.slider output { font-size: .88rem; color: var(--ink-2); }
input[type="range"] { accent-color: var(--pine); width: 100%; min-height: 32px; }

.flag { font-size: .9rem; font-weight: 600; background: var(--mark); color: #18241f; border: 2px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.pair { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 18px; }
.draft-text { white-space: pre-wrap; word-wrap: break-word; font-family: var(--serif); font-size: 1.04rem; line-height: 1.6; margin: 10px 0 0; }
.draft.mine { box-shadow: 6px 6px 0 var(--pine); }
.draft.generic { box-shadow: none; border-style: dashed; color: var(--ink-2); }
.why { box-shadow: none; }
.why .row { margin-top: 12px; }

.score-head { display: flex; gap: 16px; align-items: center; margin-bottom: 10px; }
.score { width: 92px; height: 92px; border-radius: 50%; border: 3px solid var(--line); background: var(--mark); color: #18241f; display: grid; place-content: center; text-align: center; flex: none; box-shadow: 4px 4px 0 var(--pine); }
.score .num { font-family: var(--serif); font-size: 2rem; font-weight: 800; line-height: 1; }
.score .of { font-size: .8rem; }
.cmp { width: 100%; border-collapse: collapse; font-size: .93rem; }
.cmp th, .cmp td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--hair); vertical-align: top; }
.cmp thead th { border-top: 0; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.cmp td.m { white-space: nowrap; }
.pct { font-variant-numeric: tabular-nums; }

.hist-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.hist { box-shadow: 4px 4px 0 var(--pine); }

.foot { border-top: 2px solid var(--line); padding: 26px 0 40px; font-size: .93rem; color: var(--ink-2); }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, calc(100% + 40px)); visibility: hidden; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-weight: 600; transition: transform .2s; max-width: calc(100vw - 32px); z-index: 20; }
.toast.on { transform: translate(-50%, 0); visibility: visible; }

@media (max-width: 899px) {
  .hero-grid, .cols { grid-template-columns: 1fr; }
  .profile { position: static; order: -1; }
  .hero { padding-top: 30px; }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .slider { grid-template-columns: 5.5em minmax(0, 1fr); }
  .slider output { grid-column: 2; margin-top: -6px; }
  .trait { grid-template-columns: 1fr; gap: 2px; }
  .badge { font-size: .68rem; padding: 3px 8px; }
  .top { position: static; }
  .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border-bottom: 0; }
  [role="tab"] { border: 2px solid var(--line); border-radius: 10px; margin: 0; white-space: normal; }
  [role="tab"][aria-selected="true"] { background: var(--ink); color: var(--paper); border-bottom: 2px solid var(--line); }
  .top-row { gap: 8px; }
  .word { font-size: 1.2rem; }
  .card { box-shadow: 3px 3px 0 var(--shadow); padding: 14px; }
  .cmp thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cmp tr { display: block; border-top: 1px solid var(--hair); padding: 8px 0; }
  .cmp th, .cmp td { display: block; border: 0; padding: 2px 0; }
  .cmp td::before { content: attr(data-l) ": "; color: var(--ink-2); font-size: .82rem; }
  .score { width: 76px; height: 76px; }
}
