:root {
  color-scheme: dark;
  --bg: #080808;
  --glass-sm: rgba(255,255,255,.055);
  --glass-md: rgba(255,255,255,.08);
  --border: rgba(255,255,255,.11);
  --border-bright: rgba(255,255,255,.20);
  --text: #fff;
  --muted: rgba(255,255,255,.42);
  --space-sm: clamp(.5rem, .7vw, .75rem);
  --space-md: clamp(.75rem, 1vw, 1rem);
  --space-lg: clamp(1rem, 1.4vw, 1.5rem);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", ui-sans-serif, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--bg); }
body { min-height: 100dvh; margin: 0; overflow-x: hidden; background: var(--bg); color: var(--text); }
button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 78% 28%, rgba(255,255,255,.07), transparent 24%),
    radial-gradient(circle at 14% 80%, rgba(255,255,255,.035), transparent 28%);
}

.shell { position: relative; width: min(100% - 40px, 1180px); min-height: 100dvh; margin: 0 auto; display: grid; grid-template-rows: auto 1fr; }
.nav { height: 82px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-lg); border-bottom: 1px solid rgba(255,255,255,.07); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand img { width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 10px 28px rgba(0,0,0,.82)) drop-shadow(0 0 18px rgba(255,255,255,.14)); }
.brand span { display: grid; gap: 3px; }
.brand strong { font-size: 15px; line-height: 1; }
.brand small { color: rgba(255,255,255,.34); font-size: 11px; }

.download { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 14px; border: 1px solid var(--border); border-top-color: var(--border-bright); border-radius: 13px; background: var(--glass-sm); box-shadow: 0 2px 8px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.1); color: rgba(255,255,255,.82); font-size: 13px; font-weight: 600; text-decoration: none; }
.download img { width: 17px; filter: invert(1); opacity: .75; }
.download:hover { background: var(--glass-md); }

.hero { width: min(100%, 640px); align-self: center; justify-self: center; padding: 64px 0; }
.label { margin: 0; color: rgba(255,255,255,.32); font-size: 10px; font-weight: 650; letter-spacing: .1em; line-height: 1; }

.card { border: 1px solid var(--border); border-top-color: var(--border-bright); border-radius: 20px; background: var(--glass-sm); box-shadow: 0 1px 3px rgba(0,0,0,.55), 0 16px 40px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.11); backdrop-filter: blur(32px) saturate(160%); }
.generator { display: grid; gap: 18px; min-width: 0; padding: clamp(20px, 3vw, 30px); }
.generator-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.generator-head > div { display: grid; gap: 8px; }
h2 { margin: 0; font-size: 24px; letter-spacing: -.035em; }
.ready { padding: 6px 9px; border-radius: 9px; background: rgba(255,255,255,.06); color: rgba(255,255,255,.44); font-size: 11px; }
.ready.loading { color: rgba(255,255,255,.76); }
.ready.success { background: rgba(116,255,174,.1); color: #9fffc3; }
.ready.error { background: rgba(255,96,96,.09); color: #ff9f9f; }

.token-wrap { display: grid; gap: 9px; }
textarea { width: 100%; min-height: 128px; resize: vertical; padding: 14px 15px; border: 1px solid rgba(255,255,255,.10); border-top-color: rgba(255,255,255,.18); border-radius: 14px; outline: none; background: rgba(255,255,255,.05); box-shadow: 0 2px 8px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.07); color: #fff; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; transition: background .18s, border-color .18s; }
textarea::placeholder { color: rgba(255,255,255,.22); }
textarea:focus { border-color: rgba(255,255,255,.24); border-top-color: rgba(255,255,255,.38); background: rgba(255,255,255,.075); }
textarea:disabled { opacity: .5; }
.token-hint { color: rgba(255,255,255,.25); font-size: 11px; }
.status { min-height: 18px; margin: 0; color: rgba(255,255,255,.38); font-size: 12px; line-height: 1.5; }
.status.success { color: #9fffc3; }
.status.error { color: #ff9f9f; }

.progress { height: 2px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.06); }
.progress span { display: block; width: 40%; height: 100%; background: #fff; animation: loading 1s ease-in-out infinite alternate; }
@keyframes loading { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.result { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 14px; border: 1px solid rgba(255,255,255,.09); border-radius: 16px; background: rgba(255,255,255,.045); }
.result[hidden], .progress[hidden] { display: none; }
.result-copy { min-width: 0; display: grid; gap: 7px; }
.result a { overflow: hidden; color: rgba(255,255,255,.88); font: 12px/1.35 ui-monospace, SFMono-Regular, Consolas, monospace; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.result small { color: rgba(255,255,255,.28); font-size: 10px; }
.result-actions { display: flex; gap: 8px; }
.result-actions button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.12); border-top-color: rgba(255,255,255,.22); border-radius: 13px; background: rgba(255,255,255,.07); box-shadow: 0 2px 8px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.1); cursor: pointer; }
.result-actions button:hover { background: rgba(255,255,255,.12); }
.result-actions button:active { transform: scale(.96); }
.result-actions button.done { background: rgba(116,255,174,.12); border-color: rgba(116,255,174,.24); }
.result-actions img { width: 18px; filter: invert(1); opacity: .82; }

:focus-visible { outline: 1.5px solid rgba(255,255,255,.45); outline-offset: 3px; }

@media (max-width: 820px) {
  .shell { width: min(100% - 28px, 620px); }
  .nav { height: 70px; }
  .download { width: 42px; padding: 0; }
  .download img { width: 18px; }
  .download { font-size: 0; }
  .hero { padding: 48px 0; }
}

@media (max-width: 480px) {
  .shell { width: min(100% - 20px, 620px); }
  .hero { padding: 34px 0; }
  .generator { padding: 18px; border-radius: 18px; }
  .result { grid-template-columns: 1fr; }
  .result-actions { width: 100%; }
  .result-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .progress span { animation: none; width: 100%; }
}
