:root {
  --ink: #14110e;
  --panel: #1d1915;
  --panel-2: #26211b;
  --cream: #f2e7d3;
  --cream-dim: #c9bda9;
  --amber: #e0a94a;
  --amber-soft: #8a6428;
  --red: #b5483c;
  --line: #3a322a;
  --green: #8fbf7f;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code, pre { font-family: var(--mono); }
pre {
  background: #0d0b09;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  font-size: .86rem;
  color: #d8cdb9;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; }
h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 1.02; margin: 0 0 1rem; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); margin: 2.4rem 0 .8rem; }
h3 { font-size: 1.15rem; margin: 0 0 .4rem; }
p { color: var(--cream-dim); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.2rem; }

/* top bar */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 0; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: .6rem; color: var(--cream); }
.brand strong { font-family: var(--serif); font-size: 1.35rem; letter-spacing: .18em; }
.brand span { color: var(--cream-dim); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }
.nav nav { display: flex; gap: 1.2rem; font-size: .86rem; }
.nav nav a { color: var(--cream-dim); }
.nav nav a:hover { color: var(--amber); }

/* hero */
.hero { padding: clamp(2.5rem, 7vw, 5.5rem) 0 2rem; display: grid; grid-template-columns: 1.25fr .75fr; gap: 2rem; align-items: end; }
.hero .kicker { font-family: var(--mono); font-size: .75rem; letter-spacing: .18em; text-transform: uppercase; color: var(--amber); margin-bottom: 1rem; }
.hero p.lead { font-size: 1.15rem; max-width: 46ch; }
.hero-card {
  border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(160deg, #241f19, #171310);
  padding: 1.2rem; font-size: .85rem;
}
.hero-card dl { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0; }
.hero-card dt { color: var(--cream-dim); }
.hero-card dd { margin: 0; color: var(--cream); text-align: right; }
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--green); margin-right: .4rem; vertical-align: 1px; }
.dot.wip { background: var(--amber); }
.dot.todo { background: #6d5d4c; }

.actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem; padding: .72rem 1.1rem;
  border-radius: 999px; border: 1px solid var(--line); color: var(--cream);
  font-size: .9rem; text-decoration: none; transition: .15s ease;
  background: transparent; cursor: pointer; font-family: inherit;
}
.btn:hover { border-color: var(--amber); color: var(--amber); text-decoration: none; }
.btn.primary { background: var(--amber); color: #1a1308; border-color: var(--amber); font-weight: 600; }
.btn.primary:hover { background: #f0bd65; color: #1a1308; }

/* sections */
.section { padding: 3rem 0 1rem; border-top: 1px solid var(--line); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; background: var(--panel); }
.card p { margin: .3rem 0 0; font-size: .9rem; }
.card .num { font-family: var(--mono); color: var(--amber); font-size: .72rem; letter-spacing: .1em; }

/* audio player */
.player { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: var(--panel); }
.player button { width: 3rem; height: 3rem; border-radius: 50%; border: 0; background: var(--amber); color: #1a1308; font-size: 1.2rem; cursor: pointer; }
.player .meta { color: var(--cream-dim); font-size: .85rem; }
.player audio { width: 100%; margin-top: .4rem; }

/* flow */
.flow { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-family: var(--mono); font-size: .76rem; color: var(--cream-dim); }
.flow span { border: 1px solid var(--line); border-radius: 6px; padding: .35rem .55rem; background: #1a1612; }
.flow i { color: var(--amber-soft); font-style: normal; }

/* table */
table.status { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.status th, table.status td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--line); }
table.status th { color: var(--cream-dim); font-weight: 500; font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; }

/* footer */
footer { margin-top: 3rem; border-top: 1px solid var(--line); padding: 2rem 0 3rem; font-size: .82rem; color: #8f8374; }
footer .cols { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
footer a { color: #b8a78f; }

/* ============================ emulator ============================ */
body.try { background: #0e0c0a; min-height: 100vh; }
.try-head { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.try-head .links { display: flex; gap: 1rem; font-size: .8rem; }
.try-main { max-width: 1180px; margin: 0 auto; padding: 1rem; }
.instrument {
  position: relative; border-radius: 18px; border: 1px solid #4b4034;
  background:
    radial-gradient(120% 140% at 50% 0%, #3a3128 0%, #241f19 48%, #17130f 100%);
  box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08);
  padding: 1.2rem 1.2rem 1rem;
}
.instrument::after {
  content: ""; position: absolute; inset: 8px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.04); pointer-events: none;
}
.badge { position: absolute; top: 1rem; right: 1.2rem; font-family: var(--mono); font-size: .62rem; letter-spacing: .16em; color: #8d7d68; text-transform: uppercase; }
.lcd-row { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: start; margin-bottom: 1rem; }
.lcd {
  background: #101a12; border: 1px solid #2f3f2d; border-radius: 8px;
  padding: .65rem .9rem; font-family: var(--mono); min-height: 4.6rem;
  box-shadow: inset 0 0 18px rgba(0,0,0,.65), 0 0 0 3px #0b0907;
  color: #b8d6a6;
}
.lcd .l1 { font-size: .64rem; letter-spacing: .16em; color: #7e9c72; }
.lcd .l2 { font-size: 1.15rem; letter-spacing: .08em; margin-top: .2rem; }
.lcd .l3 { font-size: .68rem; color: #83a077; margin-top: .25rem; }
.scope-wrap { border: 1px solid #3a322a; border-radius: 8px; background: #100e0b; padding: .35rem; }
canvas#scope { display: block; width: 220px; height: 64px; }
.controls { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: .7rem; margin-bottom: 1rem; }
.ctrl {
  border: 1px solid #3c3329; border-radius: 10px; padding: .55rem .7rem .6rem;
  background: linear-gradient(180deg, #27211a, #1c1813);
}
.ctrl label { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; color: #a8977f; text-transform: uppercase; }
.ctrl output { color: var(--amber); }
.ctrl input[type=range] {
  width: 100%; margin: .55rem 0 .1rem; accent-color: var(--amber); height: 22px;
}
.hint { font-size: .72rem; color: #8d7d68; text-align: center; margin-top: .4rem; }
.keyboard { position: relative; height: 190px; margin-top: .5rem; user-select: none; touch-action: none; }
.keyboard .white { position: absolute; top: 0; bottom: 0; border-radius: 0 0 6px 6px; background: linear-gradient(180deg, #f7efe0, #ded1bb); border: 1px solid #a99b85; box-shadow: inset 0 -6px 10px rgba(0,0,0,.08); cursor: pointer; }
.keyboard .white.down { background: linear-gradient(180deg, #e3cfa9, #c4ad84); transform: translateY(2px); }
.keyboard .black { position: absolute; top: 0; height: 62%; border-radius: 0 0 4px 4px; background: linear-gradient(180deg, #2a241e, #0d0b09); border: 1px solid #050403; z-index: 2; cursor: pointer; box-shadow: 0 3px 6px rgba(0,0,0,.5); }
.keyboard .black.down { background: linear-gradient(180deg, #4b3d2c, #221b14); transform: translateY(2px); }
.keyboard .key-label { position: absolute; bottom: 7px; left: 0; right: 0; text-align: center; font-family: var(--mono); font-size: .58rem; color: #9a8a72; pointer-events: none; }
.transport { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .9rem; }
.mini {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  background: #241f19; color: #c2b198; border: 1px solid #463b2f; border-radius: 6px;
  padding: .5rem .7rem; cursor: pointer;
}
.mini:hover, .mini.on { border-color: var(--amber); color: var(--amber); }
.mini.danger:hover { border-color: var(--red); color: #e58a7c; }
.spacer { flex: 1; }
.power { background: var(--amber); color: #1a1308; border-color: var(--amber); font-weight: 700; }
.power.off { background: #2a241d; color: #8d7d68; border-color: #463b2f; }
.statusline { display: flex; gap: 1rem; flex-wrap: wrap; font-family: var(--mono); font-size: .66rem; color: #8d7d68; margin-top: .8rem; }
.statusline b { color: var(--green); font-weight: 500; }
.midi-note { color: var(--amber); }
.overlay { position: absolute; inset: 0; border-radius: 18px; background: rgba(14,12,10,.82); display: flex; align-items: center; justify-content: center; z-index: 10; }
.overlay.hidden { display: none; }
.overlay .box { text-align: center; max-width: 420px; padding: 1.4rem; }
.overlay h2 { margin-top: 0; }
.overlay p { margin: .4rem 0 1rem; }

@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .controls { grid-template-columns: repeat(2, 1fr); }
  .lcd-row { grid-template-columns: 1fr; }
  canvas#scope { width: 100%; }
  .keyboard { height: 150px; }
  .try-head .links { display: none; }
}

/* lab / profiles */
.pill { display: inline-block; padding: .18rem .5rem; border-radius: 999px; font-family: var(--mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line); color: var(--cream-dim); }
.pill.wip { color: #1a1308; background: var(--amber); border-color: var(--amber); }
.pill.ok { color: #10200e; background: var(--green); border-color: var(--green); }
.pill.todo { color: var(--cream-dim); }
.lab-note { border-left: 2px solid var(--amber-soft); padding: .4rem 0 .4rem 1rem; color: var(--cream-dim); font-size: .92rem; }
.lab-note strong { color: var(--cream); }
.steps { counter-reset: step; display: grid; gap: .7rem; }
.step { display: grid; grid-template-columns: 2rem 1fr; gap: .8rem; border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; background: var(--panel); }
.step::before { counter-increment: step; content: counter(step); font-family: var(--mono); color: var(--amber); }
.step h3 { margin: 0 0 .2rem; }
.step p { margin: 0; font-size: .9rem; }
.result-table td:last-child, .result-table th:last-child { text-align: right; }
.muted { color: #8d7d68; }
