:root {
  --bg: #07111f;
  --surface: #0d1b2a;
  --surface-raised: #132538;
  --border: #263c51;
  --text: #f2f7fb;
  --muted: #90a4b8;
  --teal: #2dd4bf;
  --teal-dark: #082f2d;
  --danger: #fb7185;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  background: rgba(7, 17, 31, 0.96);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(45, 212, 191, 0.55);
  border-radius: 7px;
  background: var(--teal-dark);
  color: var(--teal);
  font-weight: 900;
}

.brand-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  overflow: hidden;
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy span,
.security-note {
  color: var(--muted);
  font-size: 0.7rem;
}

.shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 28px 18px max(48px, env(safe-area-inset-bottom));
}

.auth-view {
  min-height: calc(100vh - 150px);
  display: grid;
  place-items: center;
}

.auth-panel,
.generator-view {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel {
  max-width: 520px;
  padding: clamp(22px, 6vw, 36px);
}

.section-heading,
.generator-header {
  margin-bottom: 24px;
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--teal);
  font-size: 0.67rem;
  font-weight: 850;
  letter-spacing: 0.13em;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 1.85rem);
  line-height: 1.2;
}

form {
  display: grid;
  gap: 18px;
}

label,
legend {
  color: #cad7e3;
  font-size: 0.78rem;
  font-weight: 750;
}

label span {
  color: var(--muted);
  font-weight: 500;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: #081522;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input {
  min-height: 48px;
  padding: 0 13px;
}

input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.13);
}

input::placeholder {
  color: #60758a;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 6px;
  font-weight: 850;
}

.primary-button {
  min-height: 48px;
  border: 1px solid #5eead4;
  background: var(--teal);
  color: #052e2b;
}

.secondary-button {
  padding: 0 13px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.security-note {
  margin: 18px 0 0;
  text-align: center;
}

.generator-view {
  padding: clamp(20px, 5vw, 34px);
}

.generator-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.secure-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid rgba(45, 212, 191, 0.42);
  border-radius: 6px;
  background: var(--teal-dark);
  color: var(--teal);
  font-size: 0.65rem;
  font-weight: 800;
}

.generator-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.duration-field {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
  border: 0;
}

.duration-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #081522;
}

.duration-tabs label {
  min-width: 0;
}

.duration-tabs input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.duration-tabs span {
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.duration-tabs input:checked + span {
  border-color: rgba(45, 212, 191, 0.5);
  background: var(--teal-dark);
  color: var(--teal);
}

.duration-amount,
.generate-button {
  grid-column: 1 / -1;
}

.number-control {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
}

.number-control button {
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--teal);
  font-size: 1.25rem;
  font-weight: 900;
}

.number-control button:first-child {
  border-radius: 6px 0 0 6px;
}

.number-control button:last-child {
  border-radius: 0 6px 6px 0;
}

.number-control input {
  border-right: 0;
  border-left: 0;
  border-radius: 0;
  text-align: center;
}

.result-panel {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.result-heading div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.result-heading span {
  color: var(--teal);
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.result-heading strong {
  overflow: hidden;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#licenseResult {
  min-height: 150px;
  padding: 13px;
  resize: vertical;
  color: #a7f3d0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.72rem;
  line-height: 1.55;
}

.result-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}

.result-meta div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #081522;
}

.result-meta dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.62rem;
}

.result-meta dd {
  overflow: hidden;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 18px;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 15px;
  border: 1px solid rgba(45, 212, 191, 0.42);
  border-radius: 7px;
  background: #102b2b;
  color: #ccfbf1;
  box-shadow: var(--shadow);
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: rgba(251, 113, 133, 0.5);
  background: #35141d;
  color: #fecdd3;
}

@media (max-width: 580px) {
  .shell {
    padding: 18px 12px max(38px, env(safe-area-inset-bottom));
  }

  .generator-view {
    padding: 18px 14px;
  }

  .generator-form {
    grid-template-columns: 1fr;
  }

  .generator-form > *,
  .duration-amount,
  .generate-button {
    grid-column: 1;
  }

  .result-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 370px) {
  .secure-badge {
    display: none;
  }

  .duration-tabs span {
    padding: 0 4px;
    font-size: 0.67rem;
  }
}

