:root {
  color-scheme: dark;
  --bg: #070a14;
  --bg-2: #0d1224;
  --surface: rgba(17, 24, 39, 0.72);
  --surface-2: rgba(23, 31, 52, 0.82);
  --surface-3: rgba(12, 18, 34, 0.88);
  --border: rgba(148, 163, 184, 0.18);
  --border-strong: rgba(167, 139, 250, 0.30);
  --text: #f8fafc;
  --muted: #aab4c8;
  --muted-2: #7f8aa3;
  --primary: #6d7cff;
  --primary-2: #8b5cf6;
  --primary-text: #ffffff;
  --accent: #38bdf8;
  --field-bg: rgba(8, 13, 28, 0.84);
  --field-border: rgba(148, 163, 184, 0.18);
  --timer-track: rgba(148, 163, 184, 0.16);
  --timer-lit: linear-gradient(90deg, #38bdf8, #8b5cf6);
  --shadow: rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 22% 12%, rgba(56, 189, 248, 0.16), transparent 30rem),
    radial-gradient(circle at 78% 0%, rgba(139, 92, 246, 0.18), transparent 28rem),
    linear-gradient(140deg, var(--bg), var(--bg-2));
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

button,
textarea {
  font: inherit;
}

.topbar {
  width: min(1040px, calc(100% - 32px));
  min-height: 66px;
  margin: 18px auto 0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.62);
  box-shadow: 0 18px 50px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px) saturate(140%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: var(--primary-text);
  font-weight: 900;
  letter-spacing: -0.04em;
  box-shadow: 0 12px 28px rgba(109, 124, 255, 0.22);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: -0.01em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.shell {
  width: min(1040px, calc(100% - 32px));
  margin: 36px auto 44px;
}

.hero {
  /* max-width: 620px; */
  margin: 0 auto 28px;
  text-align: center;
}

.eyebrow {
  width: fit-content;
  margin: 0 auto 14px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #c4b5fd;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 54px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.lead {
  max-width: 580px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.glass-card {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 26px;
  background: rgba(15, 23, 42, 0.58);
  box-shadow: 0 28px 90px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(24px) saturate(150%);
}

.input-panel,
.result-panel,
.security-note {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.input-panel,
.result-panel {
  padding: 22px;
}

.result-panel {
  background:
    linear-gradient(150deg, rgba(96, 165, 250, 0.08), transparent 42%, rgba(139, 92, 246, 0.09)),
    var(--surface);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title span {
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-title small {
  color: var(--muted-2);
  font-size: 12px;
}

label {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

textarea {
  width: 100%;
  min-height: 176px;
  resize: vertical;
  border: 1px solid var(--field-border);
  border-radius: 16px;
  background: var(--field-bg);
  color: var(--text);
  padding: 16px;
  direction: ltr;
  outline: none;
  font: 14px/1.55 "SFMono-Regular", Consolas, "Courier New", monospace;
  box-shadow: inset 0 1px 14px rgba(0, 0, 0, 0.20);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea::placeholder {
  color: rgba(170, 180, 200, 0.72);
}

textarea:focus {
  border-color: rgba(96, 165, 250, 0.62);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.11), inset 0 1px 14px rgba(0, 0, 0, 0.20);
}

button {
  border: 0;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease, opacity 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: var(--primary-text);
  padding: 13px 18px;
  box-shadow: 0 14px 32px rgba(109, 124, 255, 0.22);
}

.secondary {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  padding: 13px 18px;
}

.token-meter {
  margin-bottom: 16px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(96, 165, 250, 0.10), rgba(139, 92, 246, 0.07)),
    rgba(8, 13, 28, 0.52);
}

.token-meter.active {
  animation: tokenIn 180ms ease-out;
}

@keyframes tokenIn {
  from {
    opacity: 0.76;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.token-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.token-title {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.token-title i {
  width: 3px;
  height: 18px;
  display: inline-block;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--primary-2));
}

.token-pill {
  min-width: 54px;
  display: inline-flex;
  justify-content: center;
  border: 1px solid rgba(147, 197, 253, 0.28);
  border-radius: 10px;
  background: rgba(96, 165, 250, 0.10);
  color: var(--text);
  padding: 7px 10px;
}

.token-pill b {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.token-bars {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 3px;
  margin-top: 14px;
}

.token-bars span {
  height: 9px;
  border-radius: 999px;
  background: var(--timer-track);
}

.token-bars span.active {
  background: var(--timer-lit);
  box-shadow: 0 0 14px rgba(109, 124, 255, 0.22);
}

.code-display {
  min-height: 148px;
  display: grid;
  place-items: center;
  position: relative;
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid rgba(147, 197, 253, 0.22);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(96, 165, 250, 0.14), transparent 44%),
    linear-gradient(315deg, rgba(139, 92, 246, 0.13), transparent 48%),
    var(--surface-3);
}

.code-display::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.10), transparent 36%);
}

.code-value,
.code-display small {
  position: relative;
  z-index: 1;
}

.code-value {
  border: 0;
  background: transparent;
  color: var(--code-text);
  padding: 0;
  font-size: clamp(42px, 5vw, 58px);
  font-weight: 900;
  letter-spacing: 0.055em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 12px 30px rgba(96, 165, 250, 0.12);
  cursor: pointer;
}

.code-value:hover {
  transform: scale(1.01);
  filter: none;
}

.code-value:focus-visible {
  outline: 3px solid rgba(96, 165, 250, 0.38);
  outline-offset: 8px;
}

.code-display small {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.10em;
}

.result-panel textarea {
  min-height: 94px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

#message {
  min-height: 21px;
  margin: 14px 0 0;
  color: #facc15;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

#message.ok {
  color: #a78bfa;
}

.security-note {
  max-width: 750px;
  margin: 18px auto 0;
  padding: 15px 17px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.security-note span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.14);
  color: #c4b5fd;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.security-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.footer-line {
  width: min(1040px, calc(100% - 32px));
  margin: -18px auto 28px;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  color: var(--muted-2);
  font-size: 13px;
  font-weight: 800;
}

.footer-line a {
  color: #c4b5fd;
  text-decoration: none;
  letter-spacing: 0.08em;
}

.footer-line a:hover {
  color: var(--text);
}

@media (max-width: 900px) {
  .glass-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar,
  .shell,
  .footer-line {
    width: min(100% - 20px, 1040px);
  }

  .topbar {
    margin-top: 10px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .shell {
    margin-top: 28px;
  }

  h1 {
    font-size: 36px;
  }

  .glass-card {
    padding: 10px;
    border-radius: 22px;
  }

  .input-panel,
  .result-panel {
    padding: 16px;
    border-radius: 18px;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .actions,
  .security-note {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .token-bars {
    gap: 2px;
  }
}
