:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #18181b;
  --muted: #71717a;
  --faint: #a1a1aa;
  --border: #e7e5e4;
  --hover: #f4f4f5;
  --accent: #18181b;
  --accent-text: #fafaf9;
  --ok: #16a34a;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px -12px rgba(0,0,0,.08);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0d;
    --surface: #141416;
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --faint: #52525b;
    --border: #27272a;
    --hover: #1c1c1f;
    --accent: #f4f4f5;
    --accent-text: #0c0c0d;
    --ok: #4ade80;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c0c0d;
  --surface: #141416;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #52525b;
  --border: #27272a;
  --hover: #1c1c1f;
  --accent: #f4f4f5;
  --accent-text: #0c0c0d;
  --ok: #4ade80;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background-color .2s ease, color .2s ease;
}

button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration-color: var(--faint); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 8px; }

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; letter-spacing: -.01em; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: 10px; color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* Hero */
.hero {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; padding: 12vh 0 7vh;
}
.uuid {
  position: relative;
  background: transparent; border: 0; padding: 16px 20px; border-radius: 16px;
  font-family: var(--mono); font-weight: 500;
  font-size: clamp(18px, 3.9vw, 30px); letter-spacing: -.01em;
  line-height: 1.35; text-align: center;
  overflow-wrap: anywhere;
  transition: background-color .15s ease;
}
.uuid:hover { background: var(--hover); }
.uuid #uuid-text { display: inline-block; }
.uuid #uuid-text.pop { animation: pop .28s cubic-bezier(.2,.8,.2,1); }
.hint {
  position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%);
  font: 500 12px/1 var(--sans); color: var(--faint); white-space: nowrap;
  opacity: 0; transition: opacity .15s ease;
}
.uuid:hover .hint, .uuid:focus-visible .hint, .hint.ok { opacity: 1; }
.hint.ok { color: var(--ok); }

@keyframes pop {
  from { opacity: 0; transform: translateY(6px); filter: blur(3px); }
  to   { opacity: 1; transform: none; filter: none; }
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  font-weight: 500; box-shadow: var(--shadow);
  transition: transform .08s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { opacity: .9; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; box-shadow: none; }
.btn kbd {
  font: 500 11px/1 var(--sans); padding: 3px 6px; border-radius: 6px;
  border: 1px solid currentColor; opacity: .45;
}
.btn.copied { color: var(--ok); border-color: var(--ok); }

/* Controls */
.controls {
  display: grid; gap: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 20px; box-shadow: var(--shadow);
}
.group { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 12px; }
.label { font-size: 13px; color: var(--muted); font-weight: 500; }

.seg {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; width: fit-content;
  background: var(--hover); border-radius: 11px;
}
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--muted);
  transition: background-color .15s ease, color .15s ease;
}
.seg button small { font-size: 12px; font-weight: 400; color: var(--faint); margin-left: 2px; }
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg button[aria-checked="true"] small { color: var(--muted); }

.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); font-size: 13px; font-family: var(--mono);
  color: var(--muted); cursor: pointer; user-select: none;
  transition: all .15s ease;
}
.chip span:hover { color: var(--text); border-color: var(--faint); }
.chip input:checked + span { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 2px; }

/* Bulk */
.bulk {
  margin-top: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow); overflow: hidden;
}
.bulk-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--muted); font-weight: 500;
}
.bulk-actions { display: flex; gap: 8px; }
.list {
  list-style: none; margin: 0; padding: 6px; max-height: 420px; overflow: auto;
  counter-reset: n;
}
.list li {
  counter-increment: n;
  display: flex; align-items: center; gap: 14px;
  padding: 7px 14px; border-radius: 10px;
  font: 14px/1.4 var(--mono); cursor: pointer;
  overflow-wrap: anywhere;
}
.list li::before {
  content: counter(n); min-width: 2.5em; text-align: right;
  color: var(--faint); font-size: 12px; flex-shrink: 0;
}
.list li:hover { background: var(--hover); }
.list li.ok { color: var(--ok); }

/* Footer */
.foot { margin-top: 40px; text-align: center; font-size: 13px; color: var(--faint); }
.foot p { margin: 4px 0; }
.foot code { font-family: var(--mono); font-size: 12px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px);
  background: var(--accent); color: var(--accent-text);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: all .2s ease;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .hero { padding: 8vh 0 5vh; }
  .group { grid-template-columns: 1fr; gap: 8px; }
  .btn kbd { display: none; }
  .controls { padding: 16px; }
  .list li { font-size: 12.5px; gap: 10px; padding: 7px 10px; }
  .list li::before { min-width: 2em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
