:root {
  --bg: #0c0c0e;
  --panel: #141417;
  --panel-2: #1b1b20;
  --text: #f1efe9;
  --muted: #8e8c86;
  --line: rgba(255, 255, 255, .08);
  --accent: #e8c27a;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: 'Inter', system-ui, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
}
* { box-sizing: border-box; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; background: radial-gradient(900px 500px at 85% -10%, rgba(232, 194, 122, .12), transparent 70%), radial-gradient(700px 400px at 0% 10%, rgba(124, 92, 255, .08), transparent 70%); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
code { font: 13px ui-monospace, 'Cascadia Code', Consolas, monospace; background: var(--panel-2); padding: 2px 6px; border-radius: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: #1a1408; font-weight: 600; cursor: pointer; transition: filter .2s, transform .2s; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn--ghost:hover { border-color: rgba(255,255,255,.25); filter: none; }
.btn--sm { padding: 8px 14px; font-size: 13px; border-radius: 8px; }
.btn--full { width: 100%; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 16px; display: grid; place-items: center; transition: border-color .2s; }
.icon-btn:hover { border-color: rgba(255,255,255,.25); }

/* Top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; padding: 14px clamp(16px, 3vw, 40px); background: rgba(12, 12, 14, .8); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand b { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 12px; }
.brand__mark { width: 34px; height: 34px; border-radius: 10px; background: conic-gradient(from 210deg, var(--accent), #7c5cff, #22d3ee, var(--accent)); animation: spin 12s linear infinite; }
@keyframes spin { to { filter: hue-rotate(360deg); } }
.tabs { display: flex; padding: 4px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 7px 16px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 500; transition: background .2s, color .2s; }
.tabs button.is-active { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset; }
.search { margin-left: auto; display: flex; align-items: center; gap: 10px; width: min(420px, 40vw); padding: 0 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); transition: border-color .2s; }
.search:focus-within { border-color: rgba(232, 194, 122, .5); }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; flex-shrink: 0; }
.search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: 14px var(--font); padding: 10px 0; outline: none; }

/* Intro */
.intro { padding: 56px clamp(16px, 3vw, 40px) 20px; }
.intro h1 { font: 400 clamp(40px, 5.5vw, 72px)/1 var(--serif); letter-spacing: -.01em; }
.intro h1 em { color: var(--accent); }
.intro p { color: var(--muted); margin-top: 12px; max-width: 560px; font-size: 16px; }

.view { display: none; padding: 20px clamp(16px, 3vw, 40px) 80px; }
.view.is-active { display: block; animation: rise .5s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* Filters */
.filters { display: grid; gap: 12px; margin-bottom: 18px; }
.filters__row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.filters__label { width: 64px; flex-shrink: 0; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.filters__right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fav-filter, #sort { border: 1px solid var(--line); background: var(--panel); padding: 7px 14px; border-radius: 999px; font: 13px var(--font); color: var(--muted); cursor: pointer; transition: all .2s; }
.fav-filter:hover, #sort:hover { color: var(--text); }
.fav-filter.is-active { background: var(--accent); color: #1a1408; border-color: var(--accent); }
#sort { outline: none; }
#sort option { background: var(--panel); color: var(--text); }
.count { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
#group-chips { margin-bottom: 10px; }
.sub { font: 400 34px var(--serif); margin: 34px 0 16px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sub small { font: 13px var(--font); color: var(--muted); }
.card__row-r { display: flex; align-items: center; gap: 10px; }
.star { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: none; font-size: 17px; color: var(--muted); cursor: pointer; transition: transform .3s cubic-bezier(.34,1.56,.64,1), color .2s, border-color .2s; }
.star:hover { color: var(--accent); transform: scale(1.12); }
.star.is-on { color: var(--accent); border-color: rgba(232, 194, 122, .5); }

/* Styles tab */
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.pal, .fpair { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
.pal__strip { display: flex; height: 130px; }
.pal__strip button { flex: 1; border: 0; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px; transition: flex .35s var(--ease); }
.pal__strip button span { font: 11px ui-monospace, Consolas, monospace; opacity: 0; transition: opacity .2s; }
.pal__strip button:hover { flex: 2.2; }
.pal__strip button:hover span { opacity: 1; }
.pal__meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; }
.pal__meta b { display: block; font-size: 15px; }
.pal__meta small { color: var(--muted); font-size: 12px; }
.fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.fpair { display: flex; flex-direction: column; }
.fpair__d { padding: 22px 18px 6px; font-size: 34px; line-height: 1.1; font-weight: 700; }
.fpair__b { padding: 0 18px 16px; color: var(--muted); font-size: 15px; flex: 1; }
.fpair .pal__meta { border-top: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 1px solid var(--line); background: var(--panel); padding: 7px 14px; border-radius: 999px; font-size: 13px; color: var(--muted); cursor: pointer; transition: all .2s; }
.chips button:hover { color: var(--text); }
.chips button.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chips button span { opacity: .55; margin-left: 4px; }

/* Grid of templates */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 24px; }
.card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; transition: transform .45s var(--ease), border-color .3s, box-shadow .45s; animation: rise .6s var(--ease) both; animation-delay: calc(var(--i) * 70ms); }
.card:hover { transform: translateY(-4px); border-color: rgba(255,255,255,.16); box-shadow: 0 30px 60px -30px rgba(0,0,0,.8); }
.thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--panel-2); cursor: pointer; }
.thumb iframe { position: absolute; top: 0; left: 0; width: 1440px; height: 900px; border: 0; transform-origin: 0 0; transform: scale(var(--s, .3)); pointer-events: none; }
.thumb::after { content: "Preview"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(12, 12, 14, .55); backdrop-filter: blur(2px); font-weight: 600; letter-spacing: .04em; opacity: 0; transition: opacity .3s; }
.thumb:hover::after { opacity: 1; }
.thumb__badge { position: absolute; top: 12px; left: 12px; z-index: 2; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; background: rgba(12,12,14,.75); backdrop-filter: blur(8px); border: 1px solid var(--line); }
.card__body { flex: 1; display: flex; flex-direction: column; padding: 18px 20px 20px; }
.card__row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card h2 { font: 400 30px/1 var(--serif); }
.card__cat { color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.card p { color: var(--muted); font-size: 14px; margin: 10px 0 14px; }
.swatches { display: flex; }
.swatches i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--panel); margin-left: -5px; }
.swatches i:first-child { margin-left: 0; }
.swatches--lg i { width: 28px; height: 28px; margin-left: -7px; border-color: var(--panel); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-size: 12px; padding: 3px 9px; border-radius: 6px; background: var(--panel-2); color: var(--muted); }
.card__actions { display: flex; gap: 8px; margin-top: auto; padding-top: 18px; }
.card__actions .btn { flex: 1; }
.empty { color: var(--muted); padding: 60px 0; text-align: center; }

/* Snippets */
.anim-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.anim-head p { color: var(--muted); max-width: 640px; }
.snippets { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 18px; }
.snippet { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
.snippet__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.snippet h3 { font-size: 16px; font-weight: 600; }
.snippet__links { display: flex; gap: 6px; }
.snippet p { color: var(--muted); font-size: 13.5px; margin: 6px 0 12px; }
.snippet pre { flex: 1; margin: 0; padding: 14px; border-radius: 10px; background: #0a0a0c; border: 1px solid var(--line); font: 12.5px/1.6 ui-monospace, 'Cascadia Code', Consolas, monospace; color: #d7d3c8; overflow-x: auto; white-space: pre; }
.snippet pre .t { color: #e8c27a; } .snippet pre .a { color: #8fb8ff; } .snippet pre .s { color: #a5d6a7; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: var(--bg); animation: rise .35s var(--ease); }
.modal[hidden] { display: none; }
.modal__bar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.modal__title b { font: 400 24px/1 var(--serif); margin-right: 10px; }
.modal__title small { color: var(--muted); }
.devices { display: flex; gap: 4px; margin: 0 auto; padding: 4px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.devices button { width: 38px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; cursor: pointer; color: var(--muted); }
.devices button.is-active { background: var(--panel-2); color: var(--text); }
.devices svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.modal__actions { display: flex; gap: 8px; align-items: center; }
.modal__body { flex: 1; min-height: 0; display: flex; }
.stage { flex: 1; min-width: 0; display: flex; justify-content: center; padding: 16px; background: repeating-conic-gradient(#101013 0 25%, #0d0d10 0 50%) 0 0 / 24px 24px; }
.stage__frame { width: 100%; height: 100%; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 30px 80px -20px rgba(0,0,0,.8); transition: width .5s var(--ease); background: #fff; }
.stage__frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.info { width: 340px; flex-shrink: 0; overflow-y: auto; padding: 22px; border-left: 1px solid var(--line); background: var(--panel); transition: margin-right .4s var(--ease); }
.info.is-hidden { margin-right: -340px; }
.info > p { color: var(--muted); font-size: 14px; }
.info dl { margin: 20px 0; display: grid; gap: 6px; }
.info dt { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 12px; }
.info dd { font-size: 14px; }
.use { padding: 18px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.use h3 { font: 400 22px var(--serif); margin-bottom: 12px; }
.use label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.use input { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 14px var(--font); outline: none; }
.use input:focus { border-color: rgba(232, 194, 122, .5); }
.use pre { margin: 12px 0; padding: 12px; border-radius: 8px; background: #0a0a0c; font: 12px/1.5 ui-monospace, Consolas, monospace; color: var(--accent); white-space: pre-wrap; word-break: break-all; }
.hint { font-size: 12px; color: var(--muted); margin-top: 12px; }
.hint code { font-size: 11px; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 200; transform: translate(-50%, 20px); opacity: 0; padding: 10px 18px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px; transition: opacity .3s, transform .3s var(--ease); pointer-events: none; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .top { flex-wrap: wrap; }
  .search { width: 100%; order: 3; }
  .grid, .snippets { grid-template-columns: 1fr; }
  .info { position: absolute; right: 0; top: 57px; bottom: 0; z-index: 2; }
  .devices { display: none; }
  .modal__title small { display: none; }
}

/* ===== v3 features ===== */
.top .icon-btn { flex-shrink: 0; }
.link-btn { border: 0; background: none; color: var(--accent); font: 500 13px var(--font); cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* Shortlist bar */
.shortlist { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 16px; border-radius: 14px; border: 1px solid rgba(232, 194, 122, .35); background: linear-gradient(90deg, rgba(232, 194, 122, .12), rgba(232, 194, 122, .03)); animation: rise .4s var(--ease); }
.shortlist[hidden] { display: none; }
.shortlist__text { flex: 1; min-width: 220px; }
.shortlist__text b { display: block; font-size: 14px; color: var(--accent); }
.shortlist__text small { color: var(--muted); font-size: 13px; }
.shortlist input { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 13px var(--font); outline: none; width: 210px; }
.shortlist input:focus { border-color: rgba(232, 194, 122, .5); }

/* Customiser */
.cz { margin: 18px 0; padding: 16px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.cz__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.cz__head h3 { font: 400 22px var(--serif); }
.cz__colors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cz__c { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; transition: border-color .2s; }
.cz__c.is-changed { border-color: rgba(232, 194, 122, .5); }
.cz__c input { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 7px; background: none; cursor: pointer; flex-shrink: 0; }
.cz__c input::-webkit-color-swatch-wrapper { padding: 0; }
.cz__c input::-webkit-color-swatch { border: 1px solid rgba(255,255,255,.15); border-radius: 7px; }
.cz__c span { font-size: 12px; line-height: 1.25; min-width: 0; }
.cz__c small { display: block; color: var(--muted); font: 11px ui-monospace, Consolas, monospace; }
.cz__font { display: grid; gap: 6px; margin: 12px 0; font-size: 12px; color: var(--muted); }
.cz__font select { width: 100%; min-width: 0; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 13px var(--font); outline: none; }
.cz__palettes > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
#cz-pals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
#cz-pals button { display: flex; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; cursor: pointer; transition: transform .2s; }
#cz-pals button:hover { transform: scale(1.08); }
#cz-pals i { flex: 1; }
.info .use { margin-bottom: 8px; }

/* Launch checklist */
.launch-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.launch-proj { display: flex; gap: 8px; flex-wrap: wrap; }
.launch-proj select, .launch-proj input { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: 13px var(--font); outline: none; }
.launch-proj .btn:disabled { opacity: .35; cursor: not-allowed; }
.launch-progress { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.launch-progress__bar { flex: 1; height: 10px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.launch-progress__bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #7c5cff, #22d3ee); transition: width .6s var(--ease); }
.launch-progress b { font-size: 14px; white-space: nowrap; }
.launch-groups { columns: 3 320px; column-gap: 18px; }
.lg { break-inside: avoid; margin-bottom: 18px; padding: 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.lg h3 { font: 400 24px var(--serif); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; }
.lg h3 small { font: 12px var(--font); color: var(--muted); }
.lg__item { display: flex; gap: 10px; align-items: flex-start; padding: 7px 4px; border-radius: 8px; cursor: pointer; font-size: 14px; transition: background .2s; }
.lg__item:hover { background: var(--panel-2); }
.lg__item input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.lg__item.is-done span { color: var(--muted); text-decoration: line-through; }

/* Help overlay */
.help { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); animation: rise .3s var(--ease); }
.help[hidden] { display: none; }
.help__card { width: min(420px, 92vw); padding: 26px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.help__card h3 { font: 400 30px var(--serif); margin-bottom: 14px; }
.help__card dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin-bottom: 20px; align-items: center; }
.help__card dd { color: var(--muted); font-size: 14px; }
kbd { display: inline-block; min-width: 24px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); border-bottom-width: 2px; background: var(--panel-2); font: 12px ui-monospace, Consolas, monospace; text-align: center; }

@media (max-width: 900px) {
  .top .icon-btn { display: none; }
  .shortlist input { width: 100%; }
}
