:root {
  --bg-base: #e8edf5;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #8190a5;
  --accent: #2563eb;
  --accent-light: #3b82f6;
  --cyan: #0891b2;
  --violet: #7c3aed;
  --success: #059669;
  --danger: #dc2626;
  --line: rgba(71, 85, 105, .12);
  --glass-bg: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .82);
  --glass-border: rgba(255, 255, 255, .76);
  --shadow-sm: 0 2px 10px rgba(71, 85, 105, .08);
  --shadow-md: 0 10px 28px rgba(71, 85, 105, .12), 0 2px 6px rgba(71, 85, 105, .05);
  --shadow-lg: 0 24px 60px rgba(71, 85, 105, .18), 0 4px 12px rgba(71, 85, 105, .07);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --transition: 180ms cubic-bezier(.2, .75, .25, 1);
}

[data-theme="dark"] {
  --bg-base: #111827;
  --text-primary: #e5edf9;
  --text-secondary: #b0bdd0;
  --text-muted: #8492a8;
  --accent: #7aa7ff;
  --accent-light: #93b7ff;
  --cyan: #38bdf8;
  --violet: #a78bfa;
  --success: #34d399;
  --danger: #fb7185;
  --line: rgba(226, 232, 240, .13);
  --glass-bg: rgba(24, 36, 56, .72);
  --glass-strong: rgba(25, 38, 59, .92);
  --glass-border: rgba(148, 163, 184, .2);
  --shadow-sm: 0 2px 14px rgba(0, 0, 0, .16);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, .24), 0 2px 7px rgba(0, 0, 0, .12);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .42), 0 4px 12px rgba(0, 0, 0, .18);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 8% 0%, rgba(147, 197, 253, .42), transparent 32rem),
    radial-gradient(circle at 94% 18%, rgba(196, 181, 253, .34), transparent 28rem),
    linear-gradient(135deg, #e3eafa 0%, #e8f1fb 48%, #eeeafa 100%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  transition: color var(--transition), background var(--transition);
}
[data-theme="dark"] body {
  background:
    radial-gradient(circle at 8% 0%, rgba(37, 99, 235, .24), transparent 33rem),
    radial-gradient(circle at 94% 18%, rgba(124, 58, 237, .22), transparent 28rem),
    linear-gradient(135deg, #0d1524 0%, #111827 52%, #17132a 100%);
}
body::before, body::after {
  position: fixed;
  z-index: -1;
  width: 20rem;
  height: 20rem;
  border-radius: 999px;
  filter: blur(70px);
  opacity: .35;
  pointer-events: none;
  content: "";
}
body::before { top: 48%; left: -8rem; background: #bae6fd; }
body::after { right: -7rem; bottom: -5rem; background: #ddd6fe; }
[data-theme="dark"] body::before { background: #1d4ed8; opacity: .16; }
[data-theme="dark"] body::after { background: #6d28d9; opacity: .14; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
button { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(59, 130, 246, .36); outline-offset: 2px; }

.page-shell { position: relative; z-index: 1; width: min(100% - 32px, 1120px); margin: 0 auto; padding: 22px 0 34px; }
.glass-panel {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(28px) saturate(1.35);
  -webkit-backdrop-filter: blur(28px) saturate(1.35);
}
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 70px;
  margin-bottom: 18px;
  padding: 13px 20px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(26px) saturate(1.4);
  -webkit-backdrop-filter: blur(26px) saturate(1.4);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--text-primary); }
.brand:hover { color: var(--text-primary); }
.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  box-shadow: 0 7px 18px rgba(37, 99, 235, .26);
}
.brand-mark svg { width: 23px; height: 23px; }
.brand-copy { display: grid; min-width: 0; gap: 1px; }
.brand-copy strong { font-size: 1.06rem; font-weight: 760; letter-spacing: -.02em; }
.brand-copy small { color: var(--text-muted); font-size: .74rem; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.status-chip, .status-pill, .format-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid rgba(5, 150, 105, .15);
  border-radius: 999px;
  color: var(--success);
  background: rgba(16, 185, 129, .08);
  font-size: .74rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-chip::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; box-shadow: 0 0 0 4px rgba(16, 185, 129, .1); }
.status-pill { padding: 5px 10px; }
.format-chip { border-color: rgba(37, 99, 235, .14); color: var(--accent); background: rgba(59, 130, 246, .08); font-size: .7rem; }
.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  background: rgba(255, 255, 255, .34);
  transition: var(--transition);
}
.icon-button:hover { color: var(--accent); background: var(--glass-strong); transform: translateY(-1px); }
.icon-button svg { width: 18px; height: 18px; }
.icon-button .moon-icon, [data-theme="dark"] .icon-button .sun-icon { display: none; }
[data-theme="dark"] .icon-button .moon-icon { display: block; }

.app-main { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); align-items: start; gap: 16px; }
.left-column { display: grid; gap: 16px; min-width: 0; }
.intro-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 30px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: .69rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.25rem); letter-spacing: -.05em; line-height: 1.2; }
h2 { margin: 0; font-size: 1.12rem; letter-spacing: -.025em; }
h3 { margin: 0; font-size: .88rem; }
.lead { max-width: 680px; margin: 9px 0 0; color: var(--text-secondary); font-size: .86rem; }
code { padding: 2px 5px; border-radius: 5px; color: var(--accent); background: rgba(59, 130, 246, .1); font: .86em ui-monospace, SFMono-Regular, Menlo, monospace; }
.privacy-badge { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 10px 13px; border: 1px solid rgba(37, 99, 235, .14); border-radius: 11px; color: var(--text-secondary); background: rgba(219, 234, 254, .36); font-size: .75rem; font-weight: 700; }
[data-theme="dark"] .privacy-badge { background: rgba(59, 130, 246, .1); }
.privacy-badge svg { width: 17px; height: 17px; color: var(--accent); }
.card { padding: 26px; }
.generator-card { padding-bottom: 22px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-heading.compact { margin-bottom: 17px; }
.form-stack { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label { color: var(--text-secondary); font-size: .76rem; font-weight: 700; }
.field-help { margin: 0; color: var(--text-muted); font-size: .72rem; }
.input, .select {
  width: 100%;
  min-height: 45px;
  padding: 10px 13px;
  border: 1px solid rgba(71, 85, 105, .13);
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--text-primary);
  background: rgba(255, 255, 255, .72);
  transition: var(--transition);
}
[data-theme="dark"] .input, [data-theme="dark"] .select { border-color: rgba(148, 163, 184, .2); background: rgba(15, 23, 42, .46); }
.input::placeholder { color: #a8b3c2; }
.input:focus { border-color: rgba(59, 130, 246, .55); background: var(--glass-strong); box-shadow: 0 0 0 4px rgba(59, 130, 246, .12); }
.secret-entry-row { display: flex; align-items: stretch; gap: 9px; }
.secret-entry-row .secret-input { min-width: 0; flex: 1 1 auto; }
.secret-input { font: .96rem ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.clear-button { flex: 0 0 auto; min-width: 64px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .78rem;
  font-weight: 700;
  transition: var(--transition);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { cursor: wait; opacity: .65; transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { color: #fff; background: linear-gradient(135deg, #3b82f6, #2563eb); box-shadow: 0 5px 14px rgba(37, 99, 235, .22); }
.btn-primary:hover { box-shadow: 0 8px 20px rgba(37, 99, 235, .3); }
.btn-secondary { color: var(--text-secondary); border-color: var(--line); background: rgba(255, 255, 255, .5); }
.btn-secondary:hover { color: var(--accent); background: var(--glass-strong); }
.btn-quiet { min-height: 36px; color: var(--text-muted); background: transparent; }
.btn-quiet:hover { color: var(--danger); background: rgba(239, 68, 68, .07); }
.form-message { margin: 0; font-size: .76rem; }
.error-message { color: var(--danger); }
.metadata-line { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--text-muted); font-size: .73rem; }

.results-card { position: sticky; top: 18px; animation: result-in .3s ease-out; }
@keyframes result-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
.current-code-card { padding: 23px 24px 18px; border: 1px solid rgba(59, 130, 246, .18); border-radius: var(--radius-md); background: linear-gradient(135deg, rgba(219, 234, 254, .62), rgba(224, 231, 255, .46)); }
[data-theme="dark"] .current-code-card { border-color: rgba(96, 165, 250, .24); background: linear-gradient(135deg, rgba(30, 64, 175, .2), rgba(76, 29, 149, .18)); }
.current-code-topline, .code-hint, .window-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.current-code-topline { color: var(--text-secondary); font-size: .74rem; font-weight: 700; }
.countdown-label { color: var(--accent); font-variant-numeric: tabular-nums; }
.code-display { display: block; width: 100%; margin: 7px 0 11px; padding: 0; border: 0; color: var(--text-primary); cursor: pointer; background: transparent; font: 700 clamp(2.7rem, 9vw, 4.6rem)/1.15 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .13em; text-align: center; transition: color var(--transition), transform var(--transition); }
.code-display:hover { color: var(--accent); transform: scale(1.015); }
.progress-track { height: 6px; overflow: hidden; border-radius: 999px; background: rgba(71, 85, 105, .13); }
.progress-track span { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #06b6d4, #3b82f6); transform-origin: left center; transition: transform 500ms linear; }
.code-hint { margin-top: 12px; color: var(--text-muted); font-size: .7rem; }
.copy-link { padding: 2px 0; border: 0; color: var(--accent); cursor: pointer; background: transparent; font-size: .72rem; font-weight: 700; }
.copy-link:hover:not(:disabled) { text-decoration: underline; }
.copy-link:disabled, .window-code:disabled { cursor: not-allowed; opacity: .48; }
.window-header { margin: 23px 2px 10px; }
.window-header h3 { font-size: .83rem; }
.window-header > span { color: var(--text-muted); font-size: .7rem; }
.window-list { display: grid; gap: 8px; }
.window-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 16px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255, 255, 255, .36); transition: var(--transition); }
[data-theme="dark"] .window-row { background: rgba(15, 23, 42, .25); }
.window-row:hover { border-color: rgba(59, 130, 246, .24); background: var(--glass-strong); }
.window-row.current { border-color: rgba(59, 130, 246, .28); background: rgba(219, 234, 254, .44); }
[data-theme="dark"] .window-row.current { background: rgba(30, 64, 175, .17); }
.window-label { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-secondary); font-size: .74rem; }
.window-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--text-muted); }
.window-row.current .window-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(59, 130, 246, .11); }
.window-time { color: var(--text-muted); font-size: .7rem; white-space: nowrap; }
.window-code { min-width: 94px; padding: 0; border: 0; color: var(--text-primary); cursor: pointer; background: transparent; font: 700 1rem ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; text-align: right; }
.window-code:hover { color: var(--accent); }

.info-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.info-card { display: flex; align-items: flex-start; gap: 12px; padding: 18px; box-shadow: var(--shadow-sm); }
.info-card h3 { margin: 1px 0 4px; }
.info-card p { margin: 0; color: var(--text-secondary); font-size: .73rem; line-height: 1.6; }
.info-icon { display: grid; width: 35px; height: 35px; flex: 0 0 auto; place-items: center; border-radius: 10px; }
.info-icon svg { width: 18px; height: 18px; }
.info-icon.blue { color: var(--accent); background: rgba(37, 99, 235, .1); }
.info-icon.cyan { color: var(--cyan); background: rgba(8, 145, 178, .1); }
.info-icon.violet { color: var(--violet); background: rgba(124, 58, 237, .1); }
.site-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding: 0 4px; color: var(--text-muted); font-size: .68rem; }
.toast { position: fixed; z-index: 10; right: 20px; bottom: 20px; max-width: min(360px, calc(100vw - 40px)); padding: 11px 15px; border: 1px solid var(--glass-border); border-radius: 11px; color: var(--text-primary); background: var(--glass-strong); box-shadow: var(--shadow-lg); font-size: .78rem; font-weight: 700; }
.toast.is-error { color: var(--danger); }

@media (max-width: 820px) {
  .page-shell { width: min(100% - 22px, 680px); padding-top: 11px; }
  .app-main { grid-template-columns: 1fr; }
  .results-card { position: static; }
  .intro-card { align-items: flex-start; flex-direction: column; padding: 23px; }
  .privacy-badge { align-self: flex-start; }
  .info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .page-shell { width: min(100% - 16px, 100%); }
  .site-header { min-height: 62px; padding: 11px 13px; border-radius: 16px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-copy strong { font-size: .94rem; }
  .brand-copy small { display: none; }
  .status-chip { padding: 5px 8px; font-size: .68rem; }
  .icon-button { width: 34px; height: 34px; }
  .intro-card, .card { padding: 20px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .format-chip { align-self: flex-start; }
  .secret-entry-row { gap: 7px; }
  .clear-button { min-width: 58px; padding-right: 12px; padding-left: 12px; }
  .current-code-card { padding: 19px 16px 15px; }
  .code-display { font-size: clamp(2.4rem, 14vw, 3.4rem); letter-spacing: .08em; }
  .window-row { grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; padding: 12px; }
  .window-time { grid-column: 1 / 2; grid-row: 2; }
  .window-code { grid-column: 2; grid-row: 1 / span 2; }
  .site-footer { align-items: center; flex-direction: column; gap: 3px; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
