:root {
  color-scheme: dark;
  --bg: #111212;
  --surface: #161717;
  --text: #e5e5df;
  --muted: #8e928c;
  --border: #2a2d29;
  --soft: #20231f;
  --accent: #d1e9b1;
  --accent-ink: #27341c;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
body:has(dialog[open]) { overflow: hidden; }
button, input { font: inherit; -webkit-tap-highlight-color: transparent; }
button { border: 0; background: none; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
svg { display: block; }
button svg { width: 19px; height: 19px; }
.shell { width: min(960px, calc(100% - 64px)); margin: 48px auto; }
.library-bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.search { display: flex; align-items: center; gap: 11px; height: 44px; width: 360px; padding: 0 14px; color: var(--muted); border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.search:focus-within { border-color: var(--muted); }
.search svg { width: 17px; height: 17px; flex-shrink: 0; }
.search input { width: 100%; min-width: 0; border: 0; background: none; color: var(--text); outline: none; font-size: 13px; }
.search input::placeholder { color: var(--muted); }
.count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; padding: 0; margin: 0; list-style: none; }
.icon-tile { display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; transition: background .15s, border-color .15s; }
.icon-tile:hover { background: var(--soft); border-color: var(--muted); }
.icon-tile svg { width: 28px; height: 28px; }
.drawer { position: fixed; inset: auto 0 0; width: 100%; max-width: none; max-height: 85dvh; margin: 0; padding: 0; overflow: auto; overscroll-behavior: contain; color: var(--text); background: var(--surface); border: 0; border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; box-shadow: 0 -16px 80px #0003; }
.drawer[open] { animation: drawer-in 220ms cubic-bezier(.22, 1, .36, 1); }
.drawer::backdrop { background: #0006; }
.drawer-inner { width: min(960px, calc(100% - 64px)); margin: auto; padding: 22px 0 max(28px, env(safe-area-inset-bottom)); }
.drawer-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
h1 { font-size: 16px; letter-spacing: -.3px; font-weight: 500; margin: 0; }
.drawer-actions { display: flex; gap: 8px; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 7px; color: var(--muted); }
.icon-button:hover { color: var(--text); background: var(--soft); }
.drawer-content { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 40px; align-items: center; margin-top: 20px; }
.preview-column { min-width: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.stage { width: 100%; min-height: 180px; display: grid; place-items: center; border-radius: 7px; }
#main-icon { display: grid; place-items: center; width: 80px; height: 80px; border: 1px solid transparent; border-radius: 18px; transition: background .15s, border-color .15s; }
.stage:hover #main-icon { background: var(--surface); border-color: var(--border); }
#main-icon svg { width: 48px; height: 48px; }
.sizes { display: flex; align-items: center; justify-content: center; gap: 4px; color: var(--muted); }
.sizes button { min-width: 32px; min-height: 30px; font-size: 11px; color: var(--muted); border-radius: 5px; }
.sizes button[aria-pressed=true] { background: var(--soft); color: var(--text); }
.sizes>span { margin-left: 5px; font-size: 10px; }
.segmented { display: flex; border: 1px solid var(--border); padding: 3px; border-radius: 7px; background: var(--bg); }
.segmented button { width: 50%; min-height: 33px; font-size: 12px; color: var(--muted); border-radius: 4px; }
.segmented button[aria-pressed=true] { background: var(--soft); color: var(--text); }
.replay-button { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 41px; border: 1px solid var(--border); border-radius: 7px; color: var(--muted); font-size: 12px; }
.replay-button:hover { color: var(--text); background: var(--soft); }
.replay-button svg { width: 16px; height: 16px; }
.timing { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin: 24px 0 6px; }
.timing output { font-family: ui-monospace, SFMono-Regular, monospace; }
input[type=range] { width: 100%; height: 20px; display: block; accent-color: var(--accent); margin: 0 0 24px; cursor: pointer; }
.export-buttons { display: flex; gap: 8px; }
.primary-button { display: flex; align-items: center; justify-content: center; gap: 8px; flex: 1; min-height: 38px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 550; }
.primary-button:hover { filter: brightness(1.06); }
.primary-button svg { width: 16px; height: 16px; }
.download { height: 38px; width: 38px; }
.toast { position: absolute; bottom: 12px; left: 50%; transform: translate(-50%, 6px); opacity: 0; pointer-events: none; background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 7px; font-size: 12px; text-align: center; transition: opacity .15s, transform .15s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
[hidden] { display: none !important; }
[data-theme=light] { color-scheme: light; --bg: #f8f9f5; --surface: #fff; --text: #2d322a; --muted: #697062; --border: #dce0d6; --soft: #e9eddf; --accent: #43652b; --accent-ink: #fff; }
@keyframes drawer-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (max-width: 600px) {
  .shell { width: calc(100% - 32px); margin: 24px auto; }
  .library-bar { gap: 16px; margin-bottom: 20px; }
  .search { flex: 1; min-width: 0; }
  .icon-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
  .drawer-inner { width: calc(100% - 32px); padding-top: 16px; }
  .drawer-content { grid-template-columns: 1fr; gap: 20px; margin-top: 16px; }
  .stage { min-height: 125px; }
  .timing { margin-top: 18px; }
  input[type=range] { margin-bottom: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
