/* Chromacord
   The chrome is a neutral proofing gray on purpose: the only saturated color
   on the page should be the color in the message you are making. */

@font-face {
  font-family: 'Recursive';
  src: url('../fonts/recursive-latin-casl.woff2') format('woff2-variations');
  font-weight: 300 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Recursive';
  src: url('../fonts/recursive-latin-ext-casl.woff2') format('woff2-variations');
  font-weight: 300 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: 'JetBrains Mono NL'; src: url('../fonts/jetbrains-mono-nl-regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'JetBrains Mono NL'; src: url('../fonts/jetbrains-mono-nl-bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'JetBrains Mono NL'; src: url('../fonts/jetbrains-mono-nl-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'JetBrains Mono NL'; src: url('../fonts/jetbrains-mono-nl-bolditalic.woff2') format('woff2'); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  color-scheme: dark;
  --page: #1b1b1b;
  --surface: #222222;
  --raised: #2b2b2b;
  --raised-2: #353535;
  --line: rgb(255 255 255 / 0.075);
  --line-2: rgb(255 255 255 / 0.14);
  --text: #ededed;
  --text-2: #b8b8b8;
  --text-3: #8a8a8a;
  --primary: #f0f0f0;
  --primary-hover: #ffffff;
  --on-primary: #171717;
  --ok: #52c487;
  --warn: #e8ab3f;
  --bad: #f2706c;
  --r1: 6px;
  --r2: 10px;
  --r3: 16px;
  --ui: 'Recursive', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono NL', ui-monospace, 'Cascadia Mono', 'DejaVu Sans Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Discord themes. Classic colors and code block surfaces as Discord draws
   them (values collected by Rebane, see Credits). */
[data-theme='ash'] {
  --ansi-30: hsl(0 0% 0%);
  --ansi-31: hsl(0.863 78.531% 65.294%);
  --ansi-32: hsl(141.064 40.517% 45.49%);
  --ansi-33: hsl(37.573 100% 40.392%);
  --ansi-34: hsl(212.695 81.463% 59.804%);
  --ansi-35: hsl(315.349 89.583% 62.353%);
  --ansi-36: hsl(183.976 95.402% 34.118%);
  --ansi-37: hsl(230 4.286% 72.549%);
  --chat-base: hsl(231.429 6.542% 20.98%);
  --chat-code: hsl(234.935 85.556% 64.706% / 0.0784);
  --chat-border: hsl(240 4% 60.784% / 0.2);
  --chat-text: hsl(0 0% 100%);
  --chat-name: #f2f3f5;
  --chat-muted: #959ba4;
  --chat-sel: rgb(255 255 255 / 0.24);
  --tok-bg: rgb(255 255 255 / 0.09);
  --tok-text: #a9adb5;
}
[data-theme='light'] {
  --ansi-30: hsl(0 0% 0%);
  --ansi-31: hsl(0 74.869% 62.549%);
  --ansi-32: hsl(142.041 46.226% 41.569%);
  --ansi-33: hsl(36.875 100% 37.647%);
  --ansi-34: hsl(212.514 80.995% 56.667%);
  --ansi-35: hsl(315.375 74.766% 58.039%);
  --ansi-36: hsl(184.049 100% 31.961%);
  --ansi-37: hsl(230 4.286% 72.549%);
  --chat-base: hsl(0 0% 98.431%);
  --chat-code: hsl(234.935 85.556% 64.706% / 0.0392);
  --chat-border: hsl(240 4% 60.784% / 0.4);
  --chat-text: hsl(232.5 6.897% 22.745%);
  --chat-name: #1f2024;
  --chat-muted: #5f6168;
  --chat-sel: rgb(0 0 0 / 0.16);
  --tok-bg: rgb(0 0 0 / 0.07);
  --tok-text: #5f6168;
}
[data-theme='dark'] {
  --ansi-30: hsl(0 0% 0%);
  --ansi-31: hsl(358.421 69.725% 57.255%);
  --ansi-32: hsl(146.316 67.857% 32.941%);
  --ansi-33: hsl(36.201 100% 35.098%);
  --ansi-34: hsl(211.176 80.315% 50.196%);
  --ansi-35: hsl(315.6 64.103% 54.118%);
  --ansi-36: hsl(184.832 100% 29.216%);
  --ansi-37: hsl(230 4.286% 72.549%);
  --chat-base: hsl(240 7.143% 10.98%);
  --chat-code: hsl(234.935 85.556% 64.706% / 0.0784);
  --chat-border: hsl(240 4% 60.784% / 0.2);
  --chat-text: hsl(240 3.846% 89.804%);
  --chat-name: #eeeef0;
  --chat-muted: #8f9198;
  --chat-sel: rgb(255 255 255 / 0.22);
  --tok-bg: rgb(255 255 255 / 0.08);
  --tok-text: #9a9ca3;
}
[data-theme='onyx'] {
  --ansi-30: hsl(0 0% 0%);
  --ansi-31: hsl(355.636 64.706% 50%);
  --ansi-32: hsl(151.406 100% 25.098%);
  --ansi-33: hsl(35.273 100% 32.353%);
  --ansi-34: hsl(209.151 100% 41.569%);
  --ansi-35: hsl(315.672 55.372% 47.451%);
  --ansi-36: hsl(184.889 100% 26.471%);
  --ansi-37: hsl(230 4.286% 72.549%);
  --chat-base: hsl(240 12.5% 3.137%);
  --chat-code: hsl(234.935 85.556% 64.706% / 0.0784);
  --chat-border: hsl(240 4% 60.784% / 0.239);
  --chat-text: hsl(240 4.545% 82.745%);
  --chat-name: #e3e3e6;
  --chat-muted: #85868c;
  --chat-sel: rgb(255 255 255 / 0.22);
  --tok-bg: rgb(255 255 255 / 0.08);
  --tok-text: #8f9096;
}

/* Text styles, shared by the editor, previews, the codes view and the guide */
.a-b { font-weight: 700; }
.a-i { font-style: italic; }
.a-u { text-decoration-line: underline; }
.a-s { text-decoration-line: line-through; }
.a-u.a-s { text-decoration-line: underline line-through; }
.a-f30 { color: var(--ansi-30); } .a-g40 { background-color: var(--ansi-30); }
.a-f31 { color: var(--ansi-31); } .a-g41 { background-color: var(--ansi-31); }
.a-f32 { color: var(--ansi-32); } .a-g42 { background-color: var(--ansi-32); }
.a-f33 { color: var(--ansi-33); } .a-g43 { background-color: var(--ansi-33); }
.a-f34 { color: var(--ansi-34); } .a-g44 { background-color: var(--ansi-34); }
.a-f35 { color: var(--ansi-35); } .a-g45 { background-color: var(--ansi-35); }
.a-f36 { color: var(--ansi-36); } .a-g46 { background-color: var(--ansi-36); }
.a-f37 { color: var(--ansi-37); } .a-g47 { background-color: var(--ansi-37); }

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 400 15px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ol, ul, table, figure { margin: 0; }
img, svg { display: block; }
a { color: inherit; text-decoration-color: rgb(255 255 255 / 0.35); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: currentColor; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
code, kbd { font-family: var(--mono); font-size: 0.88em; }
code { background: var(--raised); border-radius: 4px; padding: 0.08em 0.35em; }
kbd { display: inline-block; min-width: 1.7em; padding: 0.1em 0.45em; border-radius: 5px; background: var(--raised-2); box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.35); text-align: center; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
::selection { background: rgb(255 255 255 / 0.22); }

.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#i-more circle { fill: currentColor; stroke: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 8px 12px; border-radius: var(--r1); }
.skip:focus { top: 12px; }

.page { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ---------------------------------------------------------------- header */

.top { display: flex; align-items: center; gap: 16px; padding: 20px 0 24px; }
.brand a { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand span {
  font-size: 24px; line-height: 1; font-weight: 820; letter-spacing: -0.015em;
  font-variation-settings: 'CASL' 1;
}
.tagline { color: var(--text-3); font-size: 14px; padding-top: 3px; }
.top-nav { margin-left: auto; display: flex; gap: 2px; }
.top-nav a { padding: 8px 12px; border-radius: var(--r1); color: var(--text-2); text-decoration: none; font-size: 14px; }
.top-nav a:hover { background: var(--raised); color: var(--text); }


/* ---------------------------------------------------------------- studio */

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 348px;
  grid-template-areas: 'work panel' 'out panel' 'codes panel' '. panel';
  grid-template-rows: auto auto auto 1fr;
  column-gap: 24px;
  row-gap: 12px;
  align-items: start;
}
.work { grid-area: work; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.outbar { grid-area: out; }
.codes { grid-area: codes; }
.panel { grid-area: panel; }

.toolbar { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; }
.tool-group { display: flex; align-items: center; gap: 2px; }
.tool-group.end { margin-left: auto; gap: 8px; }
.tool {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px;
  color: var(--text-2); transition: background-color 120ms, color 120ms;
}
.tool:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.tool[aria-pressed='true'] { background: var(--raised-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.tool:disabled { opacity: 0.32; }
.glyph { font: 600 16px/1 var(--mono); }
.g-b { font-weight: 800; }
.g-i { font-style: italic; }
.g-u { text-decoration: underline; text-underline-offset: 3px; }
.g-s { text-decoration: line-through; }
.tool-label { font-size: 13px; color: var(--text-3); }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--raised); border-radius: 10px; }
.seg button {
  height: 30px; padding: 0 12px; border-radius: 7px; font-size: 13px; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked='true'] { background: var(--raised-2); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.3); }
.themes .dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.28); }

/* The message, drawn the way Discord draws a code block */
.chat { background: var(--chat-base); border-radius: var(--r3); padding: 18px 20px 22px 16px; border: 1px solid var(--line); transition: background-color 200ms; }
.msg { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; }
.avatar img { width: 40px; height: 40px; border-radius: 50%; }
.msg-head { display: flex; align-items: baseline; gap: 8px; line-height: 22px; }
.msg-name { color: var(--chat-name); font-weight: 600; font-size: 16px; }
.msg-time { color: var(--chat-muted); font-size: 12px; }
.code { margin-top: 6px; background: var(--chat-code); border: 1px solid var(--chat-border); border-radius: 4px; transition: border-color 150ms; }
.code:focus-within { border-color: color-mix(in srgb, var(--chat-text) 45%, transparent); }
.editor {
  position: relative;
  min-height: calc(18px * 11 + 16px);
  padding: 8px;
  outline: none;
  font: 400 14px/18px var(--mono);
  color: var(--chat-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
  caret-color: var(--chat-text);
  font-variant-ligatures: none;
}
.editor[data-empty='true']::before { content: attr(data-placeholder); position: absolute; color: var(--chat-muted); pointer-events: none; }
.editor ::selection, .editor::selection { background: var(--chat-sel); }
::highlight(chromacord-selection) { background-color: var(--chat-sel); }

.editor.develop span { animation: develop 900ms var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms + 150ms); }
@keyframes develop {
  from { filter: grayscale(1) brightness(0.8); opacity: 0.35; }
  to { filter: none; opacity: 1; }
}

/* ------------------------------------------------------------- out bar */

.outbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.meter { flex: 1 1 220px; min-width: 0; }
.meter-text { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.meter-text #count { color: var(--text); font-weight: 600; }
.meter-note { color: var(--text-3); margin-left: 6px; }
.meter-track { height: 4px; max-width: 300px; margin-top: 7px; border-radius: 2px; background: var(--raised); overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--text-3); border-radius: 2px; transition: width 220ms var(--ease), background-color 220ms; }
.meter[data-state='near'] .meter-fill, .meter[data-state='nitro'] .meter-fill { background: var(--warn); }
.meter[data-state='near'] .meter-note, .meter[data-state='nitro'] .meter-note { color: var(--warn); }
.meter[data-state='over'] .meter-fill { background: var(--bad); }
.meter[data-state='over'] .meter-note, .meter[data-state='over'] #count { color: var(--bad); }

.out-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn {
  height: 38px; padding: 0 14px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--raised); color: var(--text); border: 1px solid var(--line); font-size: 14px; font-weight: 520;
  transition: background-color 120ms, color 120ms, border-color 120ms; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--raised-2); }
.btn:disabled { opacity: 0.45; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.quiet:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.btn.quiet[aria-expanded='true'] { color: var(--text); background: var(--raised); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { color: var(--text); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: transparent; font-weight: 650; }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.full { width: 100%; }

.split { display: inline-flex; }
.split #copy { border-radius: 9px 0 0 9px; padding: 0 16px; position: relative; overflow: hidden; isolation: isolate; min-width: 158px; }
.split-more { border-radius: 0 9px 9px 0; padding: 0 10px; border-left: 1px solid rgb(0 0 0 / 0.14) !important; }
.copy-label { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 8px; }
#copy.sweep::after {
  content: ''; position: absolute; inset: 0; z-index: 0; background: var(--sweep);
  animation: sweep 520ms var(--ease) both;
}
#copy.sweep .copy-label {
  color: #fff; background: rgb(0 0 0 / 0.55); border-radius: 6px; padding: 3px 9px 3px 7px; margin: -3px -9px -3px -7px;
  animation: label-in 300ms 180ms var(--ease) both;
}
@keyframes sweep { from { transform: translateX(-101%); } to { transform: translateX(0); } }
@keyframes label-in { from { opacity: 0; transform: scale(0.92); } }

/* --------------------------------------------------------------- codes */

.codes { background: var(--chat-base); border: 1px solid var(--line); border-radius: var(--r3); padding: 14px 16px 16px; }
.codes-summary { font-size: 13px; color: var(--chat-muted); margin-bottom: 10px; }
.codes-body {
  margin: 0; max-height: 380px; overflow: auto;
  font: 400 13px/21px var(--mono); color: var(--chat-text); white-space: pre-wrap; overflow-wrap: anywhere;
}
.tok {
  font-size: 11px; line-height: 1; padding: 2px 4px; margin: 0 1px; border-radius: 4px;
  background: var(--tok-bg); color: var(--tok-text); font-style: normal; font-weight: 400; text-decoration: none;
  vertical-align: 1px; cursor: help;
}
.tok:hover { color: var(--chat-text); }
.tok-esc { font-size: 9px; letter-spacing: 0.03em; opacity: 0.7; margin-right: 1px; }
.fence { color: var(--chat-muted); }

/* --------------------------------------------------------------- panel */

.panel {
  position: sticky; top: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3);
  padding: 16px; max-height: calc(100vh - 32px); overflow: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--raised-2) transparent;
}
.target { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.target-label { font-size: 13px; color: var(--text-3); }
.target[hidden] + .tabs { margin-top: -4px; }
.target .seg { flex: 0 1 auto; }

.tabs { display: flex; gap: 20px; margin: 14px -16px 18px; padding: 0 16px; border-bottom: 1px solid var(--line); }
[role='tab'] { padding: 10px 0 9px; color: var(--text-3); font-weight: 560; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
[role='tab']:hover { color: var(--text-2); }
[role='tab'][aria-selected='true'] { color: var(--text); border-bottom-color: var(--text); }

.group + .group, .group + .btn, .btn + .group { margin-top: 22px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel h2 { font-size: 14px; font-weight: 640; letter-spacing: 0; }
.group-title { margin-bottom: 10px; }
.panel h3 { font-size: 13px; font-weight: 560; color: var(--text-2); }
.hint { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.subhead { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 0 8px; }
.empty { font-size: 12.5px; color: var(--text-3); }
.link { font-size: 12.5px; color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; border-radius: 4px; }
.link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.link .icon { width: 14px; height: 14px; }

.swatches { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.swatches:empty { display: none; }
.sw {
  position: relative; aspect-ratio: 1; border-radius: 8px; background: var(--c);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.09);
  transition: transform 120ms var(--ease);
}
.sw:hover { transform: translateY(-1px); }
.sw:active { transform: scale(0.95); }
.sw[aria-pressed='true'] { outline: 2px solid var(--text); outline-offset: 2px; }
.sw-code { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font: 600 10px/1 var(--mono); color: var(--label, #fff); opacity: 0.85; pointer-events: none; }

.picker { display: flex; align-items: center; gap: 8px; }
.well { position: relative; width: 44px; height: 38px; flex: none; border-radius: 9px; background: var(--c, #ff8a3d); box-shadow: inset 0 0 0 1px var(--line-2); cursor: pointer; overflow: hidden; }
.well input { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); opacity: 0; cursor: pointer; }
.well:focus-within { outline: 2px solid var(--text); outline-offset: 2px; }
.hex {
  flex: 1; min-width: 0; height: 38px; padding: 0 10px; border-radius: 9px;
  background: var(--page); border: 1px solid var(--line-2); font: 400 13px/1 var(--mono); text-transform: lowercase;
}
.hex:focus { outline: none; border-color: var(--text-2); }
.hex[aria-invalid='true'] { border-color: var(--bad); }
.field-error { font-size: 12.5px; color: var(--bad); margin-top: 6px; }

.select { position: relative; display: inline-flex; align-items: center; }
.select select {
  appearance: none; height: 30px; padding: 0 28px 0 10px; border-radius: 8px;
  background: var(--raised); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); cursor: pointer;
}
.select select:hover { color: var(--text); }
.select .icon { position: absolute; right: 8px; width: 14px; height: 14px; pointer-events: none; color: var(--text-3); }

.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.mode {
  height: 52px; border-radius: 9px; background: var(--raised); color: var(--text-2); font-size: 13px; font-weight: 520;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent;
}
.mode:hover { color: var(--text); background: var(--raised-2); }
.mode[aria-checked='true'] { color: var(--text); border-color: var(--text-2); background: var(--raised-2); }
.mode-bar { width: 48px; height: 6px; border-radius: 3px; background: var(--bar); }
.mode-hint { margin-top: 8px; min-height: 2.9em; }

.stops { display: flex; flex-wrap: wrap; gap: 8px; }
.stop { position: relative; }
.stop label { display: block; width: 38px; height: 38px; border-radius: 9px; background: var(--c); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12); cursor: pointer; overflow: hidden; position: relative; }
.stop label:focus-within { outline: 2px solid var(--text); outline-offset: 2px; }
.stop input { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); opacity: 0; cursor: pointer; }
.stop-x {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--raised-2); color: var(--text); display: none; place-items: center; box-shadow: 0 0 0 2px var(--surface);
}
.stop-x .icon { width: 12px; height: 12px; stroke-width: 2.4; }
.stop:hover .stop-x, .stop:focus-within .stop-x { display: grid; }
@media (hover: none) { .stop-x { display: grid; } }
.add-stop { width: 38px; height: 38px; border-radius: 9px; border: 1px dashed var(--line-2); color: var(--text-3); display: grid; place-items: center; }
.add-stop:hover { color: var(--text); border-color: var(--text-3); }

.check { display: flex; align-items: center; gap: 9px; margin-top: 14px; font-size: 13.5px; color: var(--text-2); cursor: pointer; width: fit-content; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }

.presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 8px; }
.presets:not(.all) .extra { display: none; }
.preset { display: flex; flex-direction: column; gap: 6px; padding: 6px; margin: -2px; border-radius: 9px; text-align: left; }
.preset:hover { background: var(--raised); }
.preset-bar { height: 20px; border-radius: 6px; background: var(--bar); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08); }
.preset-name { font-size: 12.5px; color: var(--text-2); }
.preset:hover .preset-name { color: var(--text); }

.pane-intro { margin-bottom: 12px; }
.templates { display: flex; flex-direction: column; gap: 10px; }
.tpl {
  text-align: left; padding: 10px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line);
  transition: border-color 120ms, background-color 120ms;
}
.tpl:hover { border-color: var(--line-2); background: var(--raised-2); }
.tpl-name { display: block; font-size: 13.5px; font-weight: 600; margin: 0 2px 8px; }
.mini {
  display: block; padding: 8px 10px; border-radius: 6px; background: var(--chat-base);
  font: 400 11px/15px var(--mono); color: var(--chat-text); white-space: pre; overflow: hidden; max-height: 84px;
  -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent);
}

/* ---------------------------------------------------------------- guide */

.guide { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; margin-top: 112px; }
.guide h2, .credits h2 { font-size: 30px; line-height: 1.15; font-weight: 760; letter-spacing: -0.015em; font-variation-settings: 'CASL' 0.6; margin-bottom: 24px; }
.guide h3 { font-size: 18px; font-weight: 650; margin-bottom: 12px; }
.steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: 16px; max-width: 62ch; }
.steps li { counter-increment: step; position: relative; padding-left: 44px; color: var(--text-2); }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; background: var(--raised);
  display: grid; place-items: center; font: 600 13px/1 var(--mono); color: var(--text);
}
.steps strong { color: var(--text); font-weight: 620; }
.faq-title { margin-top: 48px; }
.faq { max-width: 64ch; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 14px 32px 14px 0; position: relative; font-weight: 560; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ''; position: absolute; right: 6px; top: 50%; width: 9px; height: 9px; margin-top: -6px;
  border-right: 1.8px solid var(--text-3); border-bottom: 1.8px solid var(--text-3); transform: rotate(45deg); transition: transform 160ms var(--ease);
}
.faq details[open] summary::after { transform: rotate(225deg); margin-top: -1px; }
.faq details p { color: var(--text-2); padding: 0 0 16px; }

.lede { color: var(--text-2); max-width: 60ch; }
.guide-side .lede { margin-bottom: 18px; }
.cheat { width: 100%; border-collapse: collapse; font-size: 14px; }
.cheat th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--text-3); padding: 0 12px 8px 0; border-bottom: 1px solid var(--line); }
.cheat td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--text-2); }
.cheat td:first-child { white-space: nowrap; }
.cheat code { background: none; padding: 0; color: var(--text); }
.cheat .sample { text-align: right; padding-right: 0; color: var(--chat-text); }
.cheat .sample span { font: 400 13px/18px var(--mono); }
.cheat .sample span[class*='a-g'] { display: inline-block; width: 12px; height: 16px; margin-left: 2px; border-radius: 2px; vertical-align: middle; }
.cheat tbody { background: var(--chat-base); }
.cheat td:first-child { padding-left: 12px; }
.cheat td.sample { padding-right: 12px; }
.note { font-size: 14px; color: var(--text-3); margin-top: 14px; }
.note code { color: var(--text-2); }

/* -------------------------------------------------------------- credits */

.credits { margin-top: 112px; }
.credits .lede { margin: -12px 0 28px; }
.credit-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; border-top: 1px solid var(--line); padding-top: 24px; }
.credit h3 { font-size: 18px; font-weight: 680; margin-bottom: 8px; font-variation-settings: 'CASL' 0.6; }
.credit p { color: var(--text-2); font-size: 14.5px; }
.credit-links { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.credit-links a { color: var(--text); font-weight: 520; }
.fonts-note { margin-top: 40px; font-size: 13px; color: var(--text-3); }

.foot { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-top: 88px; padding: 24px 0 40px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-3); }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-links a { color: var(--text-2); }

/* -------------------------------------------------- menus, toasts, dialogs */

.menu {
  position: fixed; z-index: 60; min-width: 248px; max-width: calc(100vw - 16px); padding: 6px;
  background: var(--raised); border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 16px 48px rgb(0 0 0 / 0.45); animation: pop 140ms var(--ease);
}
.menu-item { display: grid; grid-template-columns: 1fr auto; column-gap: 16px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--raised-2); outline: none; }
.menu-label { font-size: 14px; }
.menu-hint { grid-column: 1; font-size: 12.5px; color: var(--text-3); }
.menu-item kbd { grid-row: 1; grid-column: 2; font-size: 11px; color: var(--text-3); background: none; box-shadow: none; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 11px;
  background: var(--primary); color: var(--on-primary); font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 32px rgb(0 0 0 / 0.4); animation: toast-in 200ms var(--ease);
}
.toast.warn { background: #3a2a10; color: #ffd89a; box-shadow: inset 0 0 0 1px rgb(232 171 63 / 0.4), 0 10px 32px rgb(0 0 0 / 0.4); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity 160ms, transform 160ms; }
.toast-action { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; padding: 2px 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

dialog {
  width: min(560px, calc(100vw - 32px)); padding: 0; border-radius: var(--r3);
  background: var(--surface); color: var(--text); border: 1px solid var(--line-2); box-shadow: 0 24px 64px rgb(0 0 0 / 0.5);
}
dialog[open] { animation: pop 160ms var(--ease); }
dialog::backdrop { background: rgb(0 0 0 / 0.6); }
.dialog-body { padding: 22px; display: grid; gap: 14px; }
.dialog-body h2 { font-size: 19px; font-weight: 680; }
.dialog-body p { color: var(--text-2); font-size: 14.5px; }
.dialog-body textarea {
  width: 100%; resize: vertical; min-height: 150px; padding: 10px 12px; border-radius: 10px;
  background: var(--page); border: 1px solid var(--line-2); font: 400 13px/1.5 var(--mono); color: var(--text);
}
.dialog-body textarea:focus { outline: none; border-color: var(--text-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.keys { width: 100%; border-collapse: collapse; font-size: 14px; }
.keys td { padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--text-2); }
.keys td:last-child { text-align: right; }

/* ----------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .studio { grid-template-columns: minmax(0, 1fr) 316px; column-gap: 18px; }
  .guide { grid-template-columns: 1fr; gap: 56px; }
}

@media (max-width: 900px) {
  .page { padding: 0 16px; }
  .top { flex-wrap: wrap; row-gap: 4px; }
  .tagline { order: 3; width: 100%; padding: 0; }
  .studio { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'work' 'panel' 'codes' 'out'; grid-template-rows: none; }
  .panel { position: static; max-height: none; overflow: visible; }
  .outbar {
    position: sticky; bottom: 0; z-index: 20; margin: 0 -16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--page) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }
  .meter-track { max-width: none; }
  .toasts { bottom: 96px; }
  .guide { margin-top: 64px; }
  .credits { margin-top: 72px; }
  .credit-list { grid-template-columns: 1fr; gap: 28px; }
  .swatches { gap: 8px; }
}

@media (max-width: 560px) {
  .top-nav a { padding: 8px; }
  .top-nav a:last-child { display: none; }
  .tool-group.end { margin-left: 0; width: 100%; justify-content: space-between; }
  .tool-label { display: none; }
  .themes { flex: 1; }
  .themes button { flex: 1; justify-content: center; padding: 0 6px; }
  .chat { padding: 14px 12px 16px 10px; margin: 0 -6px; }
  .msg { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
  .avatar img { width: 32px; height: 32px; }
  .editor { min-height: calc(18px * 8 + 16px); }
  #share span, #codes-toggle span { display: none; }
  #share, #codes-toggle { width: 40px; padding: 0; }
  .outbar { row-gap: 10px; }
  .out-actions { gap: 4px; width: 100%; }
  .split { flex: 1; }
  .split #copy { min-width: 0; flex: 1; }
  .guide h2, .credits h2 { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
