:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f7f5ff;
  background: #0d0c13;
  --surface: rgba(25, 23, 34, 0.94);
  --surface-raised: #211e2d;
  --surface-soft: #17151f;
  --border: #3d394d;
  --border-strong: #514a65;
  --text: #f7f5ff;
  --muted: #bdb8ca;
  --accent-hover: #a78bfa;
  --accent-soft: #30244e;
  --danger: #ff9aa9;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 300px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% -10%, rgba(111, 67, 233, 0.35), transparent 34rem),
    radial-gradient(circle at 90% 4%, rgba(88, 51, 158, 0.18), transparent 28rem),
    #0d0c13;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: #c6b3ff;
}

a:hover {
  color: #e0d7ff;
}

:focus-visible {
  outline: 3px solid #d5c8ff;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #17111f;
  background: #fff;
  font-weight: 800;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 44px 24px 80px;
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 30px;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
}

.header-actions a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
  letter-spacing: -0.02em;
}

h3 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.eyebrow,
.section-kicker {
  margin-bottom: 8px;
  color: #b9a3ff;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.17em;
}

.subtitle,
.section-heading p,
.panel-heading p,
.form-heading p,
.item-description {
  color: var(--muted);
}

.subtitle {
  max-width: 680px;
  margin-bottom: 0;
  line-height: 1.55;
}

.button {
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #fff;
  font-weight: 750;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.button-primary {
  background: #7147e3;
}

.button-primary:hover:not(:disabled) {
  color: #17111f;
  background: var(--accent-hover);
}

.button-secondary,
.button-ghost {
  border-color: var(--border-strong);
  background: #322e40;
}

.button-secondary:hover:not(:disabled),
.button-ghost:hover:not(:disabled) {
  border-color: #796e93;
  background: #474159;
}

.button-danger {
  border-color: #784050;
  color: #ffdce2;
  background: #542b37;
}

.button-danger:hover:not(:disabled) {
  background: #713849;
}

.login-card,
.panel,
.summary {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(440px, 100%);
  padding: 30px;
}

.section-heading-compact {
  margin-bottom: 24px;
}

.section-heading-compact p:last-child {
  margin-bottom: 0;
  line-height: 1.5;
}

form,
label {
  display: grid;
}

form {
  gap: 18px;
}

label {
  gap: 8px;
  color: #eae6f5;
  font-size: 0.91rem;
  font-weight: 700;
}

label small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  background: #111018;
}

input::placeholder {
  color: #777185;
}

input:hover {
  border-color: #6d657f;
}

input:read-only {
  color: #c9c3d4;
  background: #292632;
  cursor: not-allowed;
}

.form-message {
  min-height: 20px;
  margin: -4px 0;
  font-size: 0.9rem;
}

.form-message-error {
  color: var(--danger);
}

.notice {
  margin: 0 0 18px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-raised);
}

.notice-success {
  border-color: #306b52;
  color: #b9f5d9;
  background: #18392c;
}

.notice-error {
  border-color: #7f4350;
  color: #ffd1d8;
  background: #45242d;
}

.notice-info {
  border-color: #435d86;
  color: #d7e4ff;
  background: #222f49;
}

.summary {
  margin-bottom: 20px;
  padding: 24px;
}

.summary-heading {
  margin-bottom: 18px;
}

.summary-heading h2 {
  margin-bottom: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.summary-card {
  display: flex;
  min-height: 104px;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(140deg, var(--surface-raised), #191722);
}

.summary-label {
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 650;
}

.summary-value {
  font-size: 2rem;
  line-height: 1;
}

.panel {
  margin-bottom: 20px;
  padding: 24px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.panel-heading p:last-child {
  max-width: 730px;
  margin-bottom: 0;
  line-height: 1.5;
}

.toolbar {
  margin-bottom: 14px;
}

.search-field {
  display: block;
}

.card-list {
  display: grid;
  gap: 12px;
}

.item-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.item-main {
  min-width: 0;
}

.item-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.item-title-row h3 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.69rem;
  font-weight: 850;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.badge-premium,
.badge-lifetime,
.badge-enabled,
.badge-available {
  border-color: #34775a;
  color: #b9f5d9;
  background: #1b4433;
}

.badge-vip {
  border-color: #6750a4;
  color: #dfd2ff;
  background: #382963;
}

.badge-linked {
  border-color: #6750a4;
  color: #dfd2ff;
  background: #382963;
}

.badge-trial {
  border-color: #396f8b;
  color: #cceeff;
  background: #203f52;
}

.badge-ad-supported {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(96, 165, 250, 0.42);
}

.badge-pending {
  border-color: #7b6437;
  color: #ffe3a6;
  background: #46391f;
}

.badge-blocked,
.badge-disabled {
  border-color: #81424e;
  color: #ffd1d8;
  background: #4a252e;
}

.device-id {
  margin-bottom: 5px;
  color: #e1dced;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.88rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.item-description {
  margin-bottom: 7px;
  font-size: 0.88rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 0.79rem;
}

.device-source {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  width: fit-content;
  margin: 12px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  background: #252130;
  font-size: 0.77rem;
}

.device-source strong {
  color: #f2ecff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9rem;
}

.device-source small {
  font-size: 0.77rem;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 390px;
}

.item-actions .button {
  min-height: 38px;
  padding: 8px 11px;
  font-size: 0.8rem;
}

.empty-state {
  margin: 0;
  padding: 30px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.dns-form,
.license-form {
  margin-bottom: 24px;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #15131c;
}

.license-label-field {
  max-width: 560px;
}

.form-heading h3 {
  margin-bottom: 5px;
}

.form-heading p {
  margin-bottom: 0;
  font-size: 0.86rem;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(150px, 0.55fr) minmax(220px, 1fr) minmax(280px, 1.5fr);
  gap: 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.count-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.dns-card {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.dns-code-box {
  display: grid;
  min-width: 86px;
  place-items: center;
  align-self: stretch;
  align-content: center;
  padding: 10px 14px;
  border: 1px solid #554377;
  border-radius: 11px;
  background: var(--accent-soft);
}

.dns-code-box span {
  color: #bca9ef;
  font-size: 0.6rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.dns-code-box strong {
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
}

.dns-url {
  margin-bottom: 7px;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.license-key-reveal {
  display: grid;
  gap: 15px;
  margin-bottom: 24px;
  padding: 19px;
  border: 1px solid #8a713a;
  border-radius: 14px;
  background: #352b18;
}

.license-key-reveal h3 {
  margin-bottom: 6px;
}

.license-key-reveal p {
  margin-bottom: 0;
  color: #f4dfae;
  line-height: 1.5;
}

.license-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.license-key-value {
  min-height: 48px;
  padding: 13px;
  border: 1px solid #9c8248;
  border-radius: 10px;
  color: #fff8e8;
  background: #17130d;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: clamp(0.86rem, 2vw, 1rem);
  font-weight: 750;
  line-height: 1.45;
  overflow-wrap: anywhere;
  user-select: all;
}

.license-key-reveal .copy-status {
  min-height: 20px;
  color: #b9f5d9;
  font-size: 0.86rem;
}

.license-key-reveal > .button {
  justify-self: start;
}

.license-binding {
  display: grid;
  gap: 4px;
  width: fit-content;
  margin: 12px 0 0;
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--muted);
  background: #252130;
  font-size: 0.77rem;
}

.license-binding strong {
  color: #f2ecff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.license-delete-note {
  align-self: center;
  max-width: 190px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: right;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 880px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: 0.7fr 1.3fr;
  }

  .form-field-wide {
    grid-column: 1 / -1;
  }

  .item-card,
  .dns-card {
    grid-template-columns: 1fr;
  }

  .dns-code-box {
    min-height: 78px;
    justify-self: stretch;
  }

  .item-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .license-delete-note {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 28px 14px 56px;
  }

  .site-header,
  .panel-heading {
    display: grid;
  }

  .header-actions {
    display: grid;
  }

  .site-header .button,
  .panel-heading .button {
    width: 100%;
  }

  .login-card,
  .panel,
  .summary {
    padding: 18px;
    border-radius: 16px;
  }

  .summary-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-field-wide {
    grid-column: auto;
  }

  .summary-card {
    min-height: 88px;
  }

  .item-card {
    padding: 15px;
  }

  .item-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .item-actions,
  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .item-actions .button,
  .form-actions .button {
    width: 100%;
  }

  .license-key-row {
    grid-template-columns: 1fr;
  }

  .license-key-row .button,
  .license-key-reveal > .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
