:root {
  --bg: #0b0b0b;
  --line: #1b1b1c;
  --text: #ececec;
  --dim: #4b4b4f;
  --dimmer: #333336;
  --coral: #e2694f;
  --fn: #a3aef5;
  --str: #e9a38d;
  --num: #ededed;
  --paper: #e7e5df;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 12px/1.5 var(--mono); display: flex; flex-direction: column; overflow: hidden; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }
.dim { color: var(--dim); }
.grow { flex: 1; }

/* top bar */
.bar { display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 20px; border-bottom: 1px solid var(--line); flex: none; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--coral); display: inline-block; }
.host, .tagline { font-size: 11px; letter-spacing: .02em; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 11px; border: 1px solid #2a2a2c; border-radius: 12px; font-size: 11px; color: #cfcfcf; background: #121213; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #3fb984; }

/* the work area */
.work { flex: 1; display: flex; min-height: 0; position: relative; }
.pane { flex: 1 1 0; min-width: 0; position: relative; padding: 24px 0 0 8px; display: flex; flex-direction: column; }
#editor { flex: 0 1 auto; min-height: 120px; max-height: 100%; overflow: hidden; }
.pane.has-code #editor { flex: 1; }

.cm-editor { height: 100%; background: transparent; font-family: var(--mono); font-size: 13.5px; }
.cm-editor.cm-focused { outline: none; }
.cm-scroller { font-family: var(--mono) !important; line-height: 1.95 !important; overflow: auto; }
.cm-gutters { background: transparent !important; border: 0 !important; color: var(--dimmer) !important; font-size: 11px; }
.cm-lineNumbers .cm-gutterElement { padding: 0 16px 0 14px !important; min-width: 40px; }
.cm-activeLineGutter { background: transparent !important; color: #8d8d92 !important; }
.cm-activeLine { background: transparent !important; }
.cm-content { caret-color: #fff; padding: 0 !important; }
.cm-cursor { border-left: 2px solid #f2f2f2 !important; }
.cm-selectionBackground { background: #26304f !important; }
.cm-placeholder { color: var(--dim) !important; }
.cm-line.m-bad { background: linear-gradient(90deg, #e2694f22, transparent 60%); }

.try { margin: 22px 0 0 54px; width: min(600px, calc(100% - 78px)); padding: 16px 18px 14px; border: 1px dashed #2a2a2c; border-radius: 12px; }
.try-label { font: 12px var(--sans); color: #8b8b90; margin-bottom: 8px; }
.try button { display: block; width: 100%; text-align: left; padding: 2px 0; font-size: 11.5px; line-height: 1.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; }
.try button:hover { background: #151516; }
.t-fn { color: var(--fn); } .t-str { color: var(--str); } .t-num { color: var(--num); } .t-punc { color: #8f8f96; } .t-com { color: var(--dim); } .t-label { color: var(--str); }

/* the device */
.stage { flex: 0 0 auto; width: min(40%, 520px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 34px 0 10px; min-width: 300px; }
.device-fit { flex: 1; width: 100%; min-height: 0; display: flex; align-items: center; justify-content: center; }
.device { width: 402px; height: 856px; flex: none; border-radius: 58px; background: #1b1b20; padding: 6px; position: relative; transform-origin: center; box-shadow: 0 0 0 1px #26262c, 0 30px 80px rgba(0,0,0,.5); }
.device iframe { width: 390px; height: 844px; border: 0; border-radius: 52px; background: #fff; display: block; }
.home { position: absolute; left: 50%; bottom: 14px; width: 138px; height: 5px; margin-left: -69px; border-radius: 3px; background: #fff; mix-blend-mode: difference; pointer-events: none; }
.status { display: flex; justify-content: space-between; width: 100%; max-width: 300px; height: 20px; font-size: 10.5px; color: var(--dim); margin-top: 6px; }
.status .bad { color: var(--str); }

/* the spec, folded to a strip */
.strip { flex: none; width: 44px; border-left: 1px solid var(--line); writing-mode: vertical-rl; transform: rotate(180deg); text-align: right; padding: 0 0 28px; font-size: 10.5px; letter-spacing: .12em; color: var(--dim); }
.strip:hover { color: #9b9ba1; }
.pane { order: 1; } .spec { order: 2; } .stage { order: 3; } .strip { order: 4; }
.spec { flex: 0 0 min(460px, 36%); min-width: 0; background: #0e0e0f; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.spec-head { display: flex; gap: 16px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); color: #8b8b90; font-size: 11px; }
.spec-head span { flex: 1; color: var(--text); }
.spec-head a:hover { color: var(--text); }
.spec-head button { font-size: 18px; line-height: 1; color: #8b8b90; }

.md { overflow: auto; padding: 8px 24px 60px; font: 14px/1.6 var(--sans); color: #c9c9cd; }
.md h1 { font: 500 24px var(--sans); color: #fff; margin: 24px 0 8px; letter-spacing: -.01em; }
.md h2 { font: 500 17px var(--sans); color: #fff; margin: 34px 0 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.md h3 { font: 500 14px var(--sans); color: #fff; margin: 24px 0 6px; }
.md a { color: var(--fn); }
.md code { font: 12px var(--mono); color: var(--str); background: #161617; padding: 1px 5px; border-radius: 4px; }
.md pre { position: relative; background: #121213; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow: auto; }
.md pre code { background: none; padding: 0; color: #dcdce0; font-size: 12px; line-height: 1.75; }
.md pre .run { position: absolute; top: 8px; right: 8px; font: 10.5px var(--mono); color: #0b0b0b; background: var(--paper); border-radius: 6px; padding: 3px 8px; opacity: 0; transition: opacity .15s; }
.md pre:hover .run { opacity: 1; }
.md table { border-collapse: collapse; width: 100%; font-size: 13px; margin: 10px 0; }
.md th { text-align: left; font-weight: 500; color: #8b8b90; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.md th, .md td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.md td:first-child { white-space: normal; min-width: 150px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 30px 0; }

/* bottom bar */
.foot { flex: none; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 20px 18px; min-height: 58px; gap: 20px; }
.actions { display: flex; align-items: center; gap: 6px; }
.btn { height: 30px; padding: 0 13px; border: 1px solid #2a2a2c; border-radius: 9px; font-size: 11.5px; display: inline-flex; align-items: center; gap: 8px; color: #e4e4e4; white-space: nowrap; }
.btn:hover { border-color: #3a3a3e; }
.btn.primary { background: var(--paper); color: #111; border-color: var(--paper); font-weight: 500; }
.btn[aria-disabled="true"] { color: #6a6a70; cursor: default; }
.hint { margin-left: 14px; font-size: 10.5px; white-space: nowrap; }
.links { display: flex; gap: 18px; font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.links a:hover { color: #9b9ba1; }

.pop { position: fixed; left: 20px; bottom: 62px; z-index: 20; background: var(--paper); color: #111; border-radius: 16px; padding: 16px 16px 10px; width: 232px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.pop svg { display: block; width: 200px; height: 200px; }
.pop p { font: 11.5px/1.4 var(--sans); margin: 10px 0 2px; color: #4a4a4a; text-align: center; }

.noscript { position: fixed; inset: 0; background: var(--bg); padding: 40px; font: 15px/1.6 var(--sans); z-index: 100; }
.noscript a { color: var(--fn); }

/* a phone shows only the prototype */
body.player .bar, body.player .pane, body.player .strip, body.player .foot, body.player .status, body.player .home, body.player .spec { display: none; }
body.player .stage { width: 100%; padding: 0; min-width: 0; }
body.player .device { all: unset; position: fixed; inset: 0; }
body.player .device iframe { width: 100vw; height: 100dvh; border-radius: 0; }
body.player .edit { display: flex; }
.edit { display: none; position: fixed; right: 12px; top: calc(env(safe-area-inset-top, 0px) + 10px); z-index: 30; height: 28px; padding: 0 12px; align-items: center; gap: 7px; border-radius: 14px; background: #0b0b0bcc; color: #eee; font-size: 11px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

@media (max-width: 1100px) {
  .spec { position: absolute; top: 0; right: 44px; bottom: 0; width: min(520px, calc(100% - 44px)); z-index: 5; box-shadow: -30px 0 60px rgba(0,0,0,.5); }
}
@media (max-width: 900px) {
  .tagline, .hint, .host { display: none; }
  .links a:nth-child(n+3) { display: none; }
}
