:root {
  --paper: #efe3cd;
  --paper-strong: #f7efe1;
  --ink: #1b1611;
  --muted: #685e51;
  --line: rgba(27, 22, 17, 0.14);
  --accent: #b94f2f;
  --accent-strong: #8d3018;
  --sea: #255f63;
  --panel: rgba(247, 239, 225, 0.88);
  --shadow: 0 30px 80px rgba(27, 22, 17, 0.14);
  --display-font: "Georgia", "Times New Roman", serif;
  --body-font: "Trebuchet MS", "Lucida Sans Unicode", sans-serif;
  --mono-font: "Consolas", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(185, 79, 47, 0.24), transparent 25rem),
    radial-gradient(circle at 85% 18%, rgba(37, 95, 99, 0.18), transparent 18rem),
    linear-gradient(180deg, #f5ebd9 0%, #ece0cc 48%, #e2d6c0 100%);
  color: var(--ink);
  font-family: var(--body-font);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18)),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 4.6rem,
      rgba(27, 22, 17, 0.03) 4.6rem,
      rgba(27, 22, 17, 0.03) 4.75rem
    );
  mix-blend-mode: multiply;
}

.noise,
.orbit {
  position: fixed;
  pointer-events: none;
}

.noise {
  inset: 0;
  opacity: 0.16;
  background-image:
    radial-gradient(rgba(27, 22, 17, 0.18) 0.45px, transparent 0.45px),
    radial-gradient(rgba(27, 22, 17, 0.1) 0.45px, transparent 0.45px);
  background-position: 0 0, 14px 14px;
  background-size: 28px 28px;
}

.orbit {
  border-radius: 999px;
  filter: blur(1px);
}

.orbit-one {
  width: 26rem;
  height: 26rem;
  border: 1px solid rgba(185, 79, 47, 0.22);
  top: -7rem;
  right: -4rem;
  animation: drift 24s ease-in-out infinite;
}

.orbit-two {
  width: 18rem;
  height: 18rem;
  border: 1px solid rgba(37, 95, 99, 0.26);
  bottom: 6rem;
  left: -6rem;
  animation: drift 16s ease-in-out infinite reverse;
}

.topbar,
.layout {
  position: relative;
  z-index: 1;
}

.topbar {
  padding: 1.5rem clamp(1.2rem, 3vw, 2.4rem) 0;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 3.1rem;
  height: 3.1rem;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff8f0;
  font-family: var(--display-font);
  font-size: 1.3rem;
  border-radius: 0.9rem;
  box-shadow: var(--shadow);
}

.brand strong {
  display: block;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand small {
  display: block;
  color: var(--muted);
}

.topbar-note {
  max-width: 34rem;
  color: var(--muted);
  font-size: 0.96rem;
}

.layout {
  padding: 2rem clamp(1.2rem, 3vw, 2.4rem) 2.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(21rem, 30rem);
  gap: 2rem;
  align-items: start;
}

.hero {
  animation: rise 0.8s ease both;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 249, 239, 0.68);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
}

.hero h1 {
  margin: 1.2rem 0 1rem;
  max-width: 12ch;
  font-family: var(--display-font);
  font-size: clamp(3rem, 8vw, 6.4rem);
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.hero h1 span {
  display: block;
  color: var(--accent-strong);
}

.lead {
  max-width: 42rem;
  margin: 0 0 1.8rem;
  font-size: 1.1rem;
  line-height: 1.7;
  color: #3b332b;
}

.stat-ribbon {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.8rem;
}

.stat-ribbon article,
.feature-card,
.note-card,
.panel-card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.stat-ribbon article {
  padding: 1rem;
  border-radius: 1.25rem;
  display: grid;
  gap: 0.3rem;
}

.stat-ribbon strong {
  font-family: var(--display-font);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1;
}

.stat-ribbon span {
  color: var(--muted);
  font-size: 0.92rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.feature-card {
  border-radius: 1.4rem;
  padding: 1.2rem;
  position: relative;
  overflow: hidden;
}

.feature-card::after {
  content: "";
  position: absolute;
  inset: auto auto 0 0;
  width: 5rem;
  height: 5rem;
  background: radial-gradient(circle, rgba(185, 79, 47, 0.18), transparent 68%);
}

.feature-index {
  margin: 0 0 0.9rem;
  font-family: var(--mono-font);
  color: var(--sea);
  letter-spacing: 0.16em;
}

.feature-card h2,
.note-card h3,
.panel-head strong,
.dashboard-head strong,
.ip-editor-head strong {
  margin: 0 0 0.5rem;
  font-family: var(--display-font);
  font-size: 1.55rem;
  line-height: 1.05;
}

.feature-card p:last-child,
.note-card p,
.note-card li,
.muted-note,
.dashboard-meta,
.topbar-note,
.flash {
  line-height: 1.65;
}

.notes {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 1rem;
}

.note-card {
  border-radius: 1.5rem;
  padding: 1.3rem;
}

.note-card.accent {
  background:
    linear-gradient(145deg, rgba(37, 95, 99, 0.12), rgba(255, 255, 255, 0.35)),
    var(--panel);
}

.note-card ol {
  margin: 0;
  padding-left: 1.2rem;
}

pre,
code {
  font-family: var(--mono-font);
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.control {
  position: sticky;
  top: 1.4rem;
  animation: rise 0.9s ease both 0.1s;
}

.panel-head {
  padding: 0.2rem 0.1rem 1rem;
}

.panel-head span,
.muted-label,
.dashboard-meta,
.muted-note {
  color: var(--muted);
}

.panel-head span,
.muted-label {
  display: block;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
}

.panel-card {
  padding: 1.25rem;
  border-radius: 1.5rem;
}

.panel-card + .panel-card {
  margin-top: 1rem;
}

.flash {
  margin-bottom: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(185, 79, 47, 0.32);
  background: rgba(185, 79, 47, 0.14);
}

.flash[data-type="success"] {
  border-color: rgba(37, 95, 99, 0.3);
  background: rgba(37, 95, 99, 0.12);
}

.auth-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.toggle-btn,
.primary-btn,
.ghost-btn,
.mini-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.toggle-btn {
  padding: 0.8rem 0.9rem;
  border-radius: 0.95rem;
  background: rgba(27, 22, 17, 0.05);
  color: var(--muted);
  font-weight: 700;
}

.toggle-btn.is-active {
  background: var(--ink);
  color: var(--paper-strong);
}

.auth-form,
.domain-form {
  display: grid;
  gap: 0.9rem;
}

.auth-form label,
.domain-form label {
  display: grid;
  gap: 0.45rem;
}

.auth-form span,
.domain-form span {
  font-weight: 700;
  font-size: 0.95rem;
}

input {
  width: 100%;
  border: 1px solid rgba(27, 22, 17, 0.12);
  border-radius: 1rem;
  padding: 0.95rem 1rem;
  font: inherit;
  background: rgba(255, 250, 242, 0.92);
  color: var(--ink);
}

input:focus {
  outline: 2px solid rgba(37, 95, 99, 0.24);
  border-color: rgba(37, 95, 99, 0.4);
}

.primary-btn,
.ghost-btn,
.mini-btn {
  border-radius: 999px;
  font-weight: 700;
}

.primary-btn {
  padding: 0.95rem 1.2rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff8f0;
}

.ghost-btn,
.mini-btn {
  padding: 0.7rem 1rem;
  background: rgba(27, 22, 17, 0.07);
  color: var(--ink);
}

.primary-btn:hover,
.ghost-btn:hover,
.mini-btn:hover,
.toggle-btn:hover {
  transform: translateY(-1px);
}

.is-hidden {
  display: none !important;
}

.dashboard-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}

.dashboard-summary {
  margin-bottom: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  background: rgba(27, 22, 17, 0.04);
  color: var(--muted);
}

.dashboard-summary p {
  margin: 0;
  line-height: 1.65;
}

.domain-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
}

#baseDomainHint {
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  background: rgba(27, 22, 17, 0.05);
  color: var(--muted);
  font-size: 0.9rem;
}

.dashboard-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  font-size: 0.92rem;
}

.domain-list {
  display: grid;
  gap: 0.9rem;
}

.domain-card {
  display: grid;
  gap: 1rem;
  padding: 1.15rem;
  border-radius: 1.2rem;
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.86);
}

.domain-card-head,
.domain-actions,
.tool-row {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

.domain-name {
  margin: 0;
  font-size: 1.18rem;
}

.domain-subline {
  margin: -0.2rem 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(27, 22, 17, 0.06);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.status-chip::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--accent);
}

.status-chip.active::before {
  background: var(--sea);
}

.domain-meta {
  margin: 0.9rem 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.domain-meta div {
  padding: 0.7rem 0.8rem;
  border-radius: 0.9rem;
  background: rgba(27, 22, 17, 0.04);
}

.domain-meta dt {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.domain-meta dd {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  word-break: break-word;
}

.ip-editor,
.tool-panel {
  border: 1px solid rgba(27, 22, 17, 0.1);
  border-radius: 1rem;
  background: rgba(27, 22, 17, 0.035);
}

.ip-editor {
  padding: 1rem;
}

.ip-editor-head,
.ip-editor-actions,
.tool-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
}

.ip-editor-head {
  margin-bottom: 0.9rem;
}

.ip-editor-head strong {
  display: block;
  margin: 0;
  font-size: 1.18rem;
}

.ip-editor-head span,
.tool-panel-label,
.field-hint {
  color: var(--muted);
  font-size: 0.88rem;
}

.ip-editor-grid,
.toolkit-grid {
  display: grid;
  gap: 0.8rem;
}

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

.inline-field {
  display: grid;
  gap: 0.45rem;
}

.inline-field span {
  font-weight: 700;
  font-size: 0.92rem;
}

.ip-editor-actions {
  margin-top: 0.9rem;
}

.field-hint {
  line-height: 1.5;
}

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

.tool-panel {
  padding: 0.9rem;
}

.tool-panel-head {
  margin-bottom: 0.7rem;
}

.tool-panel-label {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tool-row {
  justify-content: flex-end;
}

.token-box,
.code-box {
  padding: 0.8rem 0.9rem;
  border-radius: 0.95rem;
  background: #1d1a17;
  color: #f7efe1;
  overflow-x: auto;
}

.danger-btn {
  background: rgba(185, 79, 47, 0.12);
  color: var(--accent-strong);
}

.domain-actions {
  margin-top: 0.9rem;
}

.empty-state {
  padding: 1.2rem;
  border-radius: 1rem;
  border: 1px dashed rgba(27, 22, 17, 0.24);
  color: var(--muted);
  text-align: center;
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(1.5rem, 1rem, 0) rotate(6deg);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .control {
    position: static;
  }

  .feature-grid,
  .notes,
  .stat-ribbon {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .feature-grid,
  .notes,
  .stat-ribbon,
  .domain-meta,
  .ip-editor-grid,
  .toolkit-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    max-width: none;
  }

  .dashboard-head,
  .dashboard-meta,
  .domain-card-head,
  .domain-actions,
  .ip-editor-head,
  .ip-editor-actions,
  .tool-panel-head,
  .tool-row {
    flex-direction: column;
    align-items: stretch;
  }

  .domain-input-wrap {
    grid-template-columns: 1fr;
  }
}
