:root {
  --bg: #f8fafc;
  --bg-accent: #f1f5f9;
  --panel: rgba(255, 255, 255, 0.75);
  --panel-strong: rgba(255, 255, 255, 0.95);
  --text: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.08);
  --primary: #0ea5e9;
  --primary-strong: #0284c7;
  --primary-soft: rgba(14, 165, 233, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.15);
  --shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 10px 20px -5px rgba(15, 23, 42, 0.04);
  --glass-border: rgba(255, 255, 255, 0.6);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: 
    radial-gradient(circle at 15% 50%, rgba(14, 165, 233, 0.08), transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.06), transparent 40%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-accent) 100%);
  background-attachment: fixed;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseLive {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.animate-fade-in {
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

.layout {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: var(--shadow-soft);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
}

.nav-link.is-active {
  color: white;
  background: var(--text);
  border-color: var(--text);
}

.hero,
.panel {
  background: var(--panel);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: flex-start;
  padding: 48px;
  margin-bottom: 24px;
}

.hero-large {
  align-items: stretch;
}

.hero-stack {
  display: grid;
  gap: 16px;
}

.hero-note {
  width: min(340px, 100%);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

h1,
h2,
h3,
pre,
button,
input {
  margin: 0;
}

h1 {
  font-size: clamp(2.5rem, 4.5vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hero-copy {
  max-width: 54ch;
  color: var(--muted);
  line-height: 1.6;
  font-size: 1.1rem;
}

.hero-actions,
.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-weight: 600;
  background: var(--text);
  color: white;
  border: 1px solid var(--text);
  transition: all 0.2s ease;
}

.button-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -10px rgba(15, 23, 42, 0.5);
}

.button-link-ghost {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
  border-color: var(--line);
  backdrop-filter: blur(8px);
}

.button-link-ghost:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.3fr);
  gap: 24px;
  margin: 24px 0;
}

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

.panel {
  padding: 32px;
}

.auth-panel {
  max-width: 480px;
  margin: 0 auto;
}

.inset-panel {
  padding: 24px;
  margin: 0;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-border);
  box-shadow: none;
}

.compact-panel {
  width: min(340px, 100%);
}

.session-panel {
  border-color: rgba(14, 165, 233, 0.2);
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.feature-card p:last-child,
.section-copy,
.panel-copy {
  color: var(--muted);
  line-height: 1.6;
}

.panel-copy {
  margin: 0 0 20px;
  max-width: 60ch;
}

.note-title {
  margin: 0 0 16px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
}

.feature-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  line-height: 2;
  font-weight: 500;
}

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

.form {
  display: grid;
  gap: 16px;
}

.form-wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.form-wide button {
  align-self: stretch;
}

.readonly-block {
  display: grid;
  gap: 8px;
}

.readonly-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

.readonly-value {
  display: block;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  font-family: monospace;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.status-card {
  padding: 20px;
  grid-column: span 4;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.status-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.status-card-wide {
  grid-column: span 6;
}

.status-card.is-good {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(236, 253, 245, 0.8));
  border-color: rgba(16, 185, 129, 0.3);
}

.status-card.is-warn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(254, 242, 242, 0.8));
  border-color: rgba(239, 68, 68, 0.3);
}

.status-card.is-live::before {
  content: "";
  position: absolute;
  top: 16px;
  right: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulseLive 2s infinite;
}

.status-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-label svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.status-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.status-value-small {
  font-size: 1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.control-panel {
  display: grid;
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.control-heading {
  display: grid;
  gap: 8px;
}

.control-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.checkbox-row:hover {
  background: #ffffff;
}

.checkbox-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  appearance: none;
}

select {
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2364748b%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
  background-repeat: no-repeat;
  background-position: right 16px top 50%;
  background-size: 12px auto;
  cursor: pointer;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

button {
  border: 0;
  border-radius: 12px;
  padding: 14px 24px;
  background: var(--text);
  color: white;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -10px rgba(15, 23, 42, 0.5);
  background: #000;
}

.danger-button {
  background: var(--danger);
}

.danger-button:hover {
  background: #b91c1c;
  box-shadow: 0 10px 20px -10px rgba(239, 68, 68, 0.5);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
  border: 1px solid var(--line);
}

.ghost-button:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--text);
  box-shadow: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.neutral {
  background: rgba(100, 116, 139, 0.1);
  color: var(--muted);
}

.badge.success {
  background: var(--success-soft);
  color: var(--success);
}

.badge.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.accent {
  background: var(--primary-soft);
  color: var(--primary);
}

.output {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  background: #0f172a;
  color: #f8fafc;
  min-height: 80px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 860px) {
  .site-header,
  .hero,
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .grid,
  .grid-3,
  .form-wide,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .status-card-wide,
  .status-card {
    grid-column: auto;
  }
}
