:root {
  color-scheme: dark;
  font-family: "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
  --frame: #1b1b1b;
  --background: #242424;
  --panel: #2a2a2a;
  --panel-hover: #303030;
  --field: #2c2c2c;
  --control: #333333;
  --control-hover: #3c3c3c;
  --console: #1a1a1a;
  --text: #f2f2f2;
  --secondary: #c8c8c8;
  --muted: #9e9e9e;
  --accent: #35c2b4;
  --accent-hover: #5fd6c8;
  --accent-dark: #1b9a90;
  --accent-on: #062a2c;
  --accent-soft: rgba(53, 194, 180, 0.12);
  --error: #e5484d;
  --error-text: #f0a5a7;
  --warning: #e5a00d;
  --line: rgba(255, 255, 255, 0.1);
  --line-soft: rgba(255, 255, 255, 0.065);
  --focus: #e8fffc;
  --radius: 14px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--frame);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--frame);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
select {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 78% 16%, rgba(53, 194, 180, 0.075), transparent 26rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.018), transparent 38%);
}

.page-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.brand-logo {
  display: block;
  width: auto;
  height: 52px;
  object-fit: contain;
}

.brand-logo.compact {
  height: 36px;
}

.context-label {
  margin: 0 0 0.55rem;
  color: var(--accent-hover);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.login-view {
  width: min(100% - 2rem, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(3rem, 10vh, 7.5rem) 0 2.5rem;
}

.login-brand,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.login-brand {
  margin-bottom: clamp(4rem, 12vh, 7rem);
}

.login-copy h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.65rem, 8vw, 4.5rem);
  font-weight: 670;
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.login-copy > p:last-child {
  max-width: 35rem;
  margin: 1.25rem 0 0;
  color: var(--secondary);
  font-size: 1rem;
  line-height: 1.65;
}

.login-form {
  margin-top: 2.5rem;
}

label {
  display: block;
  margin-bottom: 0.58rem;
  color: var(--secondary);
  font-size: 0.79rem;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  background: var(--field);
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

input,
select {
  min-height: 48px;
  padding: 0.75rem 0.9rem;
}

textarea {
  min-height: 8.5rem;
  padding: 1rem;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: var(--control);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(53, 194, 180, 0.15);
}

input::placeholder {
  color: #a8a8a8;
}

.password-row {
  position: relative;
}

.password-row input {
  padding-right: 3.4rem;
}

.icon-button {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  place-items: center;
  background: transparent;
}

.icon-button:hover {
  background: var(--control-hover);
}

.icon-button svg,
.text-button svg,
.primary-button svg,
.copy-button svg,
.result-warning svg,
.security-note svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.primary-button,
.secondary-button,
.copy-button {
  min-height: 46px;
  border-radius: 10px;
  font-weight: 680;
}

.primary-button {
  display: inline-flex;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  border: 0;
  align-items: center;
  justify-content: space-between;
  color: var(--accent-on);
  background: var(--accent);
  box-shadow: 0 8px 24px rgba(10, 34, 34, 0.24);
  transition:
    background-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.primary-button:hover {
  background: var(--accent-hover);
  box-shadow: 0 10px 28px rgba(10, 34, 34, 0.32);
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(0);
}

.primary-button:disabled,
.secondary-button:disabled,
.copy-button:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

.form-message {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.error-message {
  color: var(--error-text);
}

.security-note {
  display: flex;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.security-note svg {
  flex: 0 0 auto;
  color: var(--accent);
}

.generator-view {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 280px minmax(0, 1fr);
}

.generator-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  padding: 2rem 1.75rem;
  border-right: 1px solid var(--line);
  flex-direction: column;
  background: rgba(31, 31, 31, 0.94);
}

.sidebar-heading {
  margin-top: 4rem;
}

.sidebar-heading h1 {
  max-width: 10ch;
  margin: 0;
  font-size: 1.75rem;
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.trust-list {
  margin: 3rem 0 0;
}

.trust-list > div {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.trust-list dt {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.trust-list dd {
  margin: 0.35rem 0 0;
  color: var(--secondary);
  font-size: 0.88rem;
  font-weight: 600;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(53, 194, 180, 0.09);
}

.sidebar-foot {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.73rem;
}

.sidebar-foot strong {
  color: var(--secondary);
}

.text-button {
  display: inline-flex;
  margin: 1rem 0 0;
  padding: 0;
  border: 0;
  align-items: center;
  gap: 0.45rem;
  color: var(--secondary);
  background: transparent;
}

.text-button:hover {
  color: var(--text);
}

.workbench {
  width: min(100%, 980px);
  min-height: 100vh;
  padding: clamp(2rem, 5vw, 4.25rem) clamp(1.25rem, 5vw, 4.5rem);
}

.workbench-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.workbench-header h2,
.result-panel h2 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.55rem);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.workbench-header > div > p:last-child {
  max-width: 58ch;
  margin: 0.85rem 0 0;
  color: var(--secondary);
  line-height: 1.6;
}

.live-status {
  display: flex;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(53, 194, 180, 0.25);
  border-radius: 999px;
  align-items: center;
  gap: 0.6rem;
  color: #9ce9df;
  background: rgba(53, 194, 180, 0.08);
  font-size: 0.73rem;
  font-weight: 650;
}

.license-tabs {
  display: grid;
  margin-top: 3.5rem;
  border-bottom: 1px solid var(--line);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.license-tab {
  position: relative;
  padding: 1rem 0 1.15rem;
  border: 0;
  text-align: left;
  color: var(--muted);
  background: transparent;
  font-size: 0.95rem;
  font-weight: 650;
}

.license-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  content: "";
  background: transparent;
}

.license-tab:hover {
  color: var(--secondary);
}

.license-tab.is-active {
  color: var(--text);
}

.license-tab.is-active::after {
  background: var(--accent);
}

.license-tab span {
  display: block;
  margin-top: 0.32rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 450;
}

.form-stage {
  padding-top: 2.5rem;
}

.license-form {
  max-width: 680px;
}

.field-group + .field-group {
  margin-top: 1.75rem;
}

.field-help {
  display: block;
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.form-summary {
  display: grid;
  margin-top: 2.25rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  grid-template-columns: 1fr auto;
  gap: 0.72rem 1.5rem;
  font-size: 0.8rem;
}

.form-summary span {
  color: var(--muted);
}

.form-summary strong {
  color: var(--secondary);
  font-weight: 650;
}

.generate-button {
  width: auto;
  min-width: 220px;
  margin-top: 2rem;
  gap: 2rem;
}

.engineer-intro {
  display: flex;
  margin-bottom: 2rem;
  padding: 1.1rem 0 1.3rem;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
  gap: 1rem;
}

.engineer-intro > svg {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.engineer-intro h3 {
  margin: 0;
  font-size: 1rem;
}

.engineer-intro p {
  max-width: 55ch;
  margin: 0.45rem 0 0;
  color: var(--secondary);
  font-size: 0.82rem;
  line-height: 1.5;
}

.number-field {
  position: relative;
}

.number-field input {
  padding-right: 7.5rem;
}

.number-field span {
  position: absolute;
  top: 50%;
  right: 1rem;
  color: var(--muted);
  font-size: 0.76rem;
  transform: translateY(-50%);
}

.result-panel {
  max-width: 760px;
  animation: reveal-result 520ms var(--ease-out) both;
}

@keyframes reveal-result {
  from {
    clip-path: inset(0 0 100% 0);
    filter: blur(5px);
    opacity: 0.4;
  }
  to {
    clip-path: inset(0);
    filter: blur(0);
    opacity: 1;
  }
}

.result-panel > header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.success-badge {
  display: grid;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(53, 194, 180, 0.3);
  border-radius: 14px;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
}

.success-badge svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result-details {
  display: grid;
  margin: 2.5rem 0;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 2rem;
}

.result-details dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.result-details dd {
  margin: 0.38rem 0 0;
  overflow-wrap: anywhere;
  color: var(--secondary);
  font-size: 0.85rem;
  font-weight: 630;
}

.key-output {
  position: relative;
}

.key-output textarea {
  padding-bottom: 4.35rem;
  color: #d8d8d8;
  background: var(--console);
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 0.76rem;
  line-height: 1.65;
}

.copy-button {
  position: absolute;
  right: 0.7rem;
  bottom: 0.7rem;
  display: inline-flex;
  min-height: 38px;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(53, 194, 180, 0.25);
  align-items: center;
  gap: 0.55rem;
  color: #b8f1ea;
  background: #203a38;
}

.copy-button:hover {
  color: var(--text);
  background: #274744;
}

.result-warning {
  display: flex;
  max-width: 68ch;
  margin: 1rem 0 0;
  align-items: flex-start;
  gap: 0.65rem;
  color: #e7c876;
  font-size: 0.75rem;
  line-height: 1.55;
}

.result-warning svg {
  flex: 0 0 auto;
  color: var(--warning);
}

.secondary-button {
  margin-top: 1.5rem;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--secondary);
  background: var(--control);
}

.secondary-button:hover {
  color: var(--text);
  background: var(--control-hover);
}

.toast {
  position: fixed;
  z-index: 5;
  right: 1.25rem;
  bottom: 1.25rem;
  max-width: min(360px, calc(100vw - 2.5rem));
  padding: 0.8rem 1rem;
  border: 1px solid rgba(53, 194, 180, 0.26);
  border-radius: 10px;
  color: #d8fffa;
  background: #213c39;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
  font-size: 0.82rem;
  animation: toast-in 300ms var(--ease-out) both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 840px) {
  .generator-view {
    grid-template-columns: 1fr;
  }

  .generator-sidebar {
    position: static;
    height: auto;
    min-height: 0;
    padding: 1.25rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }

  .sidebar-heading,
  .trust-list {
    display: none;
  }

  .sidebar-foot {
    display: flex;
    margin: 0 0 0 auto;
    align-items: center;
    gap: 1rem;
  }

  .sidebar-foot p {
    display: none;
  }

  .sidebar-foot .text-button {
    margin: 0;
  }

  .workbench {
    min-height: 0;
  }
}

@media (max-width: 620px) {
  .login-view {
    padding-top: 2rem;
  }

  .login-brand {
    margin-bottom: 4rem;
  }

  .workbench-header {
    display: block;
  }

  .live-status {
    display: inline-flex;
    margin-top: 1.25rem;
  }

  .license-tabs {
    margin-top: 2.5rem;
  }

  .license-tab {
    padding-right: 0.65rem;
  }

  .license-tab span {
    display: none;
  }

  .result-details {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .generate-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
