:root {
  color-scheme: light dark;
  --page: #070a12;
  --page-soft: #0d1420;
  --page-text: #eef4f7;
  --page-muted: #9aa9b6;
  --panel: rgba(245, 248, 250, 0.88);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --panel-text: #0d1726;
  --panel-muted: #607080;
  --line: rgba(65, 85, 102, 0.18);
  --line-strong: rgba(65, 85, 102, 0.28);
  --accent: #078a8f;
  --accent-strong: #046b70;
  --accent-soft: rgba(7, 138, 143, 0.12);
  --success: #087b55;
  --success-soft: #e7f7f0;
  --warning: #9b5b06;
  --warning-soft: #fff6df;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --surface-radius: 22px;
  --control-radius: 14px;
  --pill-radius: 999px;
  font-family:
    "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--page-text);
  background:
    radial-gradient(circle at 82% 26%, rgba(4, 130, 136, 0.24), transparent 34rem),
    radial-gradient(circle at 14% 70%, rgba(98, 30, 89, 0.18), transparent 30rem),
    linear-gradient(145deg, var(--page) 0%, #0a0d17 54%, var(--page-soft) 100%);
  background-attachment: fixed;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(8, 138, 143, 0.36);
  outline-offset: 3px;
}

.site-header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px clamp(16px, 4vw, 36px);
  border-bottom: 1px solid rgba(224, 234, 240, 0.1);
  background: rgba(7, 10, 18, 0.82);
  backdrop-filter: blur(18px);
}

.brand,
.header-link {
  color: inherit;
  text-decoration: none;
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 760;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(120, 217, 218, 0.26);
  border-radius: 11px;
  color: #a9ebeb;
  background: rgba(7, 138, 143, 0.14);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions,
.section-actions,
.result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.security-badge,
.header-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: var(--pill-radius);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.security-badge {
  border: 1px solid rgba(59, 211, 153, 0.22);
  color: #8ce8bf;
  background: rgba(8, 123, 85, 0.16);
}

.header-link {
  border: 1px solid rgba(224, 234, 240, 0.13);
  color: #dce7ec;
  background: rgba(255, 255, 255, 0.04);
}

.header-link:hover {
  background: rgba(255, 255, 255, 0.09);
}

.page-shell {
  min-height: calc(100dvh - 62px);
  display: grid;
  place-items: center;
  padding: 30px 16px 42px;
}

.terminal,
.admin-panel {
  position: relative;
  width: min(100%, 590px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: var(--surface-radius);
  color: var(--panel-text);
  background: var(--panel);
  box-shadow:
    0 30px 84px rgba(0, 12, 24, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(26px) saturate(118%);
}

.terminal {
  padding: clamp(24px, 4vw, 34px);
}

.terminal::before,
.admin-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(126deg, rgba(255, 255, 255, 0.62), transparent 31%),
    radial-gradient(circle at 92% 12%, rgba(7, 138, 143, 0.1), transparent 27rem);
}

.terminal > *,
.admin-panel > * {
  position: relative;
}

.terminal-topline,
.pool-heading,
.result-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.terminal-label,
.service-tag,
.state-badge,
.result-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: var(--pill-radius);
  font-size: 12px;
  font-weight: 760;
}

.terminal-label {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: #354657;
  background: rgba(255, 255, 255, 0.54);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 214px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(219, 226, 231, 0.62);
}

.tab {
  min-height: 38px;
  border: 0;
  border-radius: 13px;
  color: #697888;
  background: transparent;
  font-size: 14px;
  font-weight: 760;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

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

.tab.is-active {
  color: var(--panel-text);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 20px rgba(21, 39, 55, 0.09);
}

.tab:active,
.primary-button:active,
.secondary-button:active,
.release-button:active {
  transform: translateY(1px) scale(0.99);
}

.title-block {
  margin: 26px 0 24px;
}

.service-tag {
  min-height: 27px;
  padding: 0 10px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.title-block h1,
.admin-intro h1 {
  margin: 10px 0 8px;
  font-size: clamp(2rem, 6vw, 3.1rem);
  line-height: 1.06;
  letter-spacing: -0.045em;
}

.title-block p,
.admin-intro p,
.section-heading p {
  margin: 0;
  color: var(--panel-muted);
  line-height: 1.65;
}

.title-block p {
  max-width: 35rem;
  font-size: 14px;
}

.usage-notice {
  margin: -4px 0 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.48);
}

.usage-notice-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.usage-notice-heading h2 {
  margin: 0;
  color: var(--panel-text);
  font-size: 14px;
}

.usage-notice-heading span {
  color: var(--panel-muted);
  font-size: 11px;
}

.usage-notice-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  margin: 0;
  padding: 15px;
  list-style: none;
}

.usage-notice-list li {
  display: grid;
  gap: 4px;
  align-content: start;
}

.usage-notice-list strong {
  color: var(--accent-strong);
  font-size: 12px;
}

.usage-notice-list span {
  color: #465768;
  font-size: 12px;
  line-height: 1.55;
}

.usage-notice-footer {
  margin: 0 15px 14px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  color: var(--warning);
  font-size: 11px;
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: #344454;
  font-size: 13px;
  font-weight: 760;
}

.query-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  color: var(--panel-text);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

input {
  min-height: 60px;
  padding: 0 16px;
}

textarea {
  resize: vertical;
  padding: 14px 16px;
  line-height: 1.7;
}

input::placeholder,
textarea::placeholder {
  color: #798896;
}

input:focus,
textarea:focus {
  border-color: rgba(7, 138, 143, 0.62);
}

.field-help {
  margin: 0;
  color: var(--panel-muted);
  font-size: 12px;
  line-height: 1.55;
}

.primary-button,
.secondary-button,
.release-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--control-radius);
  font-weight: 780;
  cursor: pointer;
  transition:
    transform 150ms ease,
    filter 150ms ease,
    background 150ms ease,
    opacity 150ms ease;
}

.primary-button {
  min-height: 60px;
  min-width: 154px;
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f4ffff;
  background: linear-gradient(135deg, #123548, var(--accent) 56%, #08a6a8);
  box-shadow: 0 14px 30px rgba(5, 104, 109, 0.22);
}

.primary-button:hover {
  filter: brightness(1.06);
}

.primary-button[disabled],
.secondary-button[disabled],
.release-button[disabled] {
  cursor: not-allowed;
  opacity: 0.58;
}

.primary-button[aria-busy="true"] {
  background:
    linear-gradient(105deg, #123548 15%, #168f92 44%, #2eb0ad 54%, #168f92 64%, #123548 85%);
  background-size: 240% 100%;
  animation: button-progress 1.35s ease-in-out infinite;
}

.secondary-button,
.release-button {
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  color: #203244;
  background: rgba(255, 255, 255, 0.68);
}

.secondary-button:hover {
  background: rgba(255, 255, 255, 0.94);
}

.release-button {
  border-color: rgba(180, 83, 9, 0.26);
  color: #874a08;
  background: rgba(255, 246, 223, 0.84);
}

.release-button:hover {
  background: #fff2cf;
}

.status-message {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(155, 91, 6, 0.22);
  border-radius: var(--control-radius);
  color: #784606;
  background: var(--warning-soft);
  font-size: 13px;
  line-height: 1.55;
}

.status-message.is-success {
  border-color: rgba(8, 123, 85, 0.22);
  color: var(--success);
  background: var(--success-soft);
}

.status-message.is-error {
  border-color: rgba(180, 35, 24, 0.2);
  color: var(--danger);
  background: var(--danger-soft);
}

.result-panel,
.pool-panel,
.notice,
.generated-section,
.inventory-section {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.5);
}

.result-panel {
  padding: 18px;
  box-shadow: 0 18px 40px rgba(24, 49, 66, 0.08);
}

.result-heading h2,
.pool-heading h2,
.section-heading h2 {
  margin: 4px 0 0;
  color: var(--panel-text);
}

.result-heading h2 {
  font-size: 20px;
}

.result-kicker {
  color: var(--panel-muted);
}

.state-badge {
  min-height: 30px;
  padding: 0 11px;
  color: var(--warning);
  background: var(--warning-soft);
}

.result-panel.is-complete .state-badge {
  color: var(--success);
  background: var(--success-soft);
}

.result-section {
  margin-top: 18px;
}

.result-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #445566;
  font-size: 12px;
  font-weight: 730;
}

.country-name {
  color: var(--accent-strong);
}

.value-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.readonly-value {
  min-height: 56px;
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.72);
}

.phone-prefix {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.readonly-value strong {
  min-width: 0;
  padding: 0 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.code-block {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.68);
}

.code-block span,
.code-block p {
  color: var(--panel-muted);
}

.code-block span {
  font-size: 12px;
  font-weight: 730;
}

.code-block strong {
  display: block;
  margin-top: 6px;
  color: #344555;
  font-size: clamp(2.2rem, 9vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0.04em;
}

.result-panel.is-complete .code-block {
  border-color: rgba(8, 123, 85, 0.25);
  background: var(--success-soft);
}

.result-panel.is-complete .code-block strong {
  color: var(--success);
}

.code-block p {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.55;
}

.result-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.pool-panel {
  padding: 15px;
}

.pool-heading h2 {
  font-size: 13px;
}

.pool-heading span {
  color: var(--panel-muted);
  font-size: 11px;
}

.pool-card {
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: rgba(237, 242, 245, 0.76);
}

.pool-card span {
  color: var(--panel-muted);
  font-size: 12px;
}

.pool-card strong {
  margin-top: 5px;
  font-size: 24px;
}

.pool-card.is-available {
  border-color: rgba(8, 123, 85, 0.22);
  background: var(--success-soft);
}

.pool-card.is-available strong {
  color: var(--success);
}

.pool-card.is-unavailable strong {
  color: var(--warning);
}

.notice {
  padding: 14px 15px;
  color: #465768;
  font-size: 12px;
  line-height: 1.6;
}

.admin-shell {
  min-height: calc(100dvh - 62px);
  padding: 30px 16px 50px;
}

.admin-panel {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 36px);
}

.admin-intro {
  max-width: 720px;
}

.admin-intro h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.admin-form,
.generated-section,
.inventory-section {
  margin-top: 26px;
}

.admin-form {
  display: grid;
  gap: 18px;
  max-width: 700px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.admin-form .primary-button {
  width: fit-content;
}

.generated-section,
.inventory-section {
  padding: 20px;
}

.section-heading {
  align-items: flex-start;
}

.section-heading h2 {
  font-size: 18px;
}

.section-heading p {
  margin-top: 5px;
  font-size: 12px;
}

.generated-section textarea {
  margin-top: 15px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.52);
}

.summary-strip div {
  padding: 15px;
}

.summary-strip div + div {
  border-left: 1px solid var(--line);
}

.summary-strip dt {
  color: var(--panel-muted);
  font-size: 12px;
}

.summary-strip dd {
  margin: 5px 0 0;
  color: var(--panel-text);
  font-size: 24px;
  font-weight: 780;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.52);
  font-size: 13px;
}

th,
td {
  padding: 13px 14px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #455768;
  background: rgba(230, 236, 240, 0.72);
  font-size: 12px;
}

tbody tr + tr td {
  border-top: 1px solid var(--line);
}

td {
  color: #2a3c4d;
}

.status-chip {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: var(--pill-radius);
  color: #455768;
  background: rgba(223, 230, 235, 0.72);
  font-size: 11px;
  font-weight: 760;
}

.status-chip.is-unused {
  color: var(--success);
  background: var(--success-soft);
}

.status-chip.is-reserved {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-chip.is-used {
  color: #49596a;
  background: #e9eef1;
}

.empty-cell {
  padding: 28px;
  color: var(--panel-muted);
  text-align: center;
}

@keyframes button-progress {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .terminal,
  .admin-panel {
    animation: panel-enter 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  @keyframes panel-enter {
    from {
      opacity: 0;
      transform: translateY(14px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --panel: rgba(22, 31, 41, 0.9);
    --panel-strong: rgba(28, 38, 49, 0.96);
    --panel-text: #eef5f7;
    --panel-muted: #a9b7c1;
    --line: rgba(204, 221, 228, 0.14);
    --line-strong: rgba(204, 221, 228, 0.22);
    --accent: #39b9b7;
    --accent-strong: #74d7d4;
    --accent-soft: rgba(57, 185, 183, 0.16);
    --success: #75d7aa;
    --success-soft: rgba(32, 121, 89, 0.22);
    --warning: #f1bd69;
    --warning-soft: rgba(143, 91, 20, 0.24);
    --danger: #ff9b93;
    --danger-soft: rgba(146, 40, 31, 0.22);
  }

  .terminal-label,
  input,
  textarea,
  .secondary-button,
  .readonly-value,
  .code-block,
  .result-panel,
  .pool-panel,
  .usage-notice,
  .notice,
  .generated-section,
  .inventory-section,
  .summary-strip,
  table {
    background: rgba(24, 35, 46, 0.7);
  }

  .tabs,
  th,
  .pool-card {
    background: rgba(9, 17, 25, 0.5);
  }

  .tab.is-active {
    background: rgba(57, 185, 183, 0.16);
  }

  .field label,
  .terminal-label,
  .result-label-row,
  .secondary-button,
  td,
  th,
  .usage-notice-list span,
  .notice {
    color: #cfdae0;
  }

  .status-chip.is-used {
    color: #c4d0d6;
    background: rgba(116, 132, 143, 0.18);
  }

  input::placeholder,
  textarea::placeholder {
    color: #91a2ae;
  }
}

@media (max-width: 720px) {
  body {
    background-attachment: scroll;
  }

  .site-header {
    min-height: 58px;
  }

  .security-badge {
    display: none;
  }

  .page-shell {
    min-height: calc(100dvh - 58px);
    align-items: start;
    padding-top: 18px;
  }

  .terminal-topline,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    width: 100%;
    min-width: 0;
  }

  .title-block {
    margin-top: 22px;
  }

  .query-row,
  .value-row {
    grid-template-columns: 1fr;
  }

  .usage-notice-list {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .value-row .secondary-button {
    width: 100%;
  }

  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-form-grid,
  .summary-strip {
    grid-template-columns: 1fr 1fr;
  }

  .summary-strip div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .summary-strip div:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .section-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 420px) {
  .site-header {
    padding-inline: 12px;
  }

  .brand {
    gap: 8px;
  }

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

  .header-link {
    min-height: 32px;
    padding-inline: 10px;
  }

  .terminal,
  .admin-panel {
    padding: 20px 16px;
  }

  .title-block h1,
  .admin-intro h1 {
    font-size: 2rem;
  }

  .result-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-form-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .summary-strip div + div,
  .summary-strip div:nth-child(3) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header,
  .terminal,
  .admin-panel {
    backdrop-filter: none;
  }

  .terminal,
  .admin-panel {
    background: var(--panel-strong);
  }
}
