:root {
  --steel: #0f1318; --steel2: #1a2030; --steel3: #232e42; --steel4: #2e3d58;
  --accent: #f5b800; --accent2: #ffd040; --accent-ink: #1a1000;
  --text: #e8edf4; --text2: #a9b4c4; --text3: #7a879a;
  --border: rgba(255, 255, 255, 0.09);
  --panel-w: 360px; --topbar-h: 56px;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--steel); color: var(--text);
  font-family: 'Barlow', system-ui, sans-serif; font-size: 15px; line-height: 1.45;
  overflow: hidden; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
h2 {
  margin: 0 0 10px; font-family: 'Barlow Condensed', sans-serif; font-weight: 600;
  font-size: 13px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--text2);
}

/* ---------- loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 40%, #1c2433 0%, var(--steel) 70%);
  transition: opacity 0.7s ease, visibility 0.7s;
}
#loader.done { opacity: 0; visibility: hidden; }
.loader-inner { width: min(320px, 80vw); text-align: center; }
.logo-mark { width: 92px; color: var(--accent); display: block; margin: 0 auto 10px; }
.logo-word {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 38px;
  letter-spacing: 4px; color: var(--accent); line-height: 1;
}
.logo-sub {
  margin-top: 6px; font-family: 'Barlow Condensed', sans-serif; font-weight: 600;
  font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--text3);
}
.bar { margin: 26px auto 10px; height: 4px; border-radius: 2px; background: var(--steel3); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width 0.25s ease; }
.loader-msg { font-size: 13px; color: var(--text3); min-height: 1.4em; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 20;
  display: flex; align-items: center; gap: 22px; padding: 0 18px;
  background: rgba(15, 19, 24, 0.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; flex-shrink: 0; }
.brand-mark { width: 34px; color: var(--accent); }
.brand-word {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 22px;
  letter-spacing: 2px; color: var(--accent); white-space: nowrap;
}
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: none; cursor: pointer; white-space: nowrap;
  padding: 16px 12px 13px; border-bottom: 3px solid transparent; margin-bottom: -2px;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: 16px; letter-spacing: 1px;
  color: var(--text2);
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:disabled { cursor: default; color: var(--text3); }
.soon {
  font-size: 10px; letter-spacing: 1px; text-transform: uppercase; vertical-align: 2px;
  margin-left: 4px; padding: 1px 5px; border-radius: 3px; background: var(--steel3); color: var(--text3);
}

/* ---------- stage ---------- */
.stage { position: fixed; inset: var(--topbar-h) 0 0 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.view-tools {
  position: absolute; left: 16px; top: 14px; display: flex; gap: 6px; flex-wrap: wrap;
  max-width: calc(100% - var(--panel-w) - 48px);
}
.view-tools button {
  background: rgba(15, 19, 24, 0.72); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 13px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); touch-action: manipulation;
}
.view-tools button:hover { border-color: var(--accent); }
.hint {
  position: absolute; left: 16px; bottom: 16px; font-size: 12.5px; color: #fff;
  background: rgba(15, 19, 24, 0.6); padding: 6px 11px; border-radius: 999px;
  transition: opacity 0.6s; pointer-events: none;
}
.hint.gone { opacity: 0; }

/* ---------- options panel ---------- */
.panel {
  position: absolute; top: 14px; right: 14px; bottom: 14px; width: var(--panel-w);
  background: rgba(20, 26, 38, 0.94); border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.sheet-handle { display: none; }
.panel-body { overflow-y: auto; padding: 18px 18px 22px; overscroll-behavior: contain; }
.opt { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.opt-row h2 { margin: 0; }
.opt-row + .note, .opt-row + #opt-colors { margin-top: 10px; }
.note { margin: 9px 0 0; font-size: 13px; color: var(--text2); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button {
  background: var(--steel3); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 8px; cursor: pointer; text-align: center; touch-action: manipulation;
}
.seg button .t { display: block; font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: 17px; letter-spacing: 0.5px; }
.seg button .s { display: block; font-size: 12px; color: var(--text2); margin-top: 1px; }
.seg button[aria-checked="true"] { border-color: var(--accent); background: rgba(245, 184, 0, 0.1); }
.seg button[aria-checked="true"] .t { color: var(--accent); }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track { width: 44px; height: 24px; border-radius: 12px; background: var(--steel4); position: relative; transition: background 0.2s; }
.thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track .thumb { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent2); outline-offset: 2px; }
.switch-label { font-size: 13px; color: var(--text2); min-width: 22px; }

.color-name { font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: 17px; color: var(--text); text-align: right; }
.cgroup { margin-top: 12px; }
.cgroup-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.cgroup-name { font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text3); font-weight: 600; }
.cgroup-lead { font-size: 11.5px; color: var(--text3); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 7px; }
.swatch {
  aspect-ratio: 1; border-radius: 6px; cursor: pointer; padding: 0; position: relative;
  border: 1px solid rgba(255, 255, 255, 0.18); touch-action: manipulation;
}
.swatch.metallic { background-image: linear-gradient(135deg, rgba(255,255,255,0.35), rgba(255,255,255,0) 45%, rgba(0,0,0,0.18)); }
.swatch[aria-checked="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.lead {
  margin: 14px 0 0; font-size: 13px; padding: 9px 11px; border-radius: var(--radius);
  background: rgba(245, 184, 0, 0.08); border: 1px solid rgba(245, 184, 0, 0.25); color: var(--text);
}

.spec h2 { margin-bottom: 8px; }
.spec dl { margin: 0 0 14px; display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 14px; }
.spec dt { color: var(--text3); }
.spec dd { margin: 0; text-align: right; }
.btn {
  width: 100%; background: var(--accent); color: var(--accent-ink); border: none; border-radius: var(--radius);
  padding: 12px; cursor: pointer; font-family: 'Barlow Condensed', sans-serif; font-weight: 700;
  font-size: 18px; letter-spacing: 1px; touch-action: manipulation;
}
.btn:hover { background: var(--accent2); }
.fine { font-size: 12px; color: var(--text3); margin: 10px 0 0; }
.noscript { position: fixed; inset: auto 0 40% 0; text-align: center; }

/* ---------- phones: options become a bottom sheet ---------- */
@media (max-width: 760px) {
  :root { --topbar-h: 50px; }
  .brand-word { display: none; }
  .topbar { gap: 8px; padding: 0 12px; }
  .tab { font-size: 15px; padding: 14px 9px 11px; }
  .view-tools { left: 10px; right: 10px; top: 10px; max-width: none; }
  .view-tools button { font-size: 12.5px; padding: 6px 11px; }
  .hint { display: none; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 52%;
    border-radius: 16px 16px 0 0; border-bottom: none; transition: transform 0.3s ease;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .panel.collapsed { transform: translateY(calc(100% - 58px)); }
  .sheet-handle {
    display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%;
    background: none; border: none; padding: 9px 16px 8px; cursor: pointer; touch-action: manipulation;
  }
  .grip { width: 40px; height: 4px; border-radius: 2px; background: var(--steel4); }
  .sheet-summary { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .panel-body { padding-top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  #loader, .bar-fill, .panel, .thumb, .track { transition: none; }
}
