:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #0a0a0a;
  --text-soft: #525252;
  --text-muted: #a3a3a3;
  --accent: #ff6929;
  --accent-hover: #ff5510;
  --stroke: rgba(0,0,0,0.06);
  --shadow: rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-lg: 20px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --font-xs: 0.75rem;
  --font-sm: 0.875rem;
  --font-base: 1rem;
  --font-lg: 1.125rem;
  --font-xl: 1.25rem;
  --font-2xl: 1.5rem;
  --font-3xl: 2rem;
  --font-4xl: 2.5rem;
  --letter-tight: -0.02em;
  --letter-normal: 0;
  --letter-wide: 0.05em;
  --line-tight: 1.2;
  --line-normal: 1.5;
  --line-relaxed: 1.75;
}

[data-theme="dark"] {
  --bg: #000000;
  --surface: #0f0f0f;
  --text: #ffffff;
  --text-soft: #a3a3a3;
  --text-muted: #666666;
  --stroke: rgba(255,255,255,0.1);
  --shadow: rgba(0,0,0,0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #0f0f0f;
    --text: #ffffff;
    --text-soft: #a3a3a3;
    --text-muted: #666666;
    --stroke: rgba(255,255,255,0.1);
    --shadow: rgba(0,0,0,0.5);
  }
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  font-size: var(--font-base);
  line-height: var(--line-normal);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

#mesh-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.4;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.gate.hidden {
  display: none;
}

.gate-card {
  max-width: 400px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.gate-logo {
  width: 120px;
  height: auto;
  margin: 0 auto;
}

.gate-card h1 {
  font-size: var(--font-3xl);
  font-weight: 700;
  letter-spacing: var(--letter-tight);
  line-height: var(--line-tight);
}

.gate-card > p {
  font-size: var(--font-base);
  color: var(--text-soft);
}

.gate-card form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.gate-card input {
  padding: 0.75rem var(--spacing-md);
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  font-family: var(--font);
  font-size: var(--font-base);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.gate-card input:focus {
  border-color: var(--accent);
}

.error {
  color: #dc2626;
  font-size: var(--font-sm);
  min-height: 1.25rem;
}

.hint {
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.hint a {
  color: var(--accent);
  text-decoration: none;
}

.hint a:hover {
  text-decoration: underline;
}

.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 0.625rem var(--spacing-lg);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: var(--font-sm);
  font-weight: 600;
  letter-spacing: var(--letter-normal);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255,105,41,0.25);
  font-weight: 500;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255,105,41,0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--stroke);
  font-weight: 500;
}

.btn-secondary:hover {
  background: rgba(255,105,41,0.05);
  border-color: var(--stroke);
  color: var(--text);
}

.btn-download {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  gap: 0.375rem;
}

.btn-download:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  padding: var(--spacing-sm) var(--spacing-md);
}

.btn-ghost:hover {
  color: var(--accent);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: var(--font-xs);
}

.btn-danger {
  background: #fee;
  color: #dc2626;
  border: 1px solid #fcc;
}

.btn-danger:hover {
  background: #fdd;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250,250,250,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--stroke);
  padding: var(--spacing-md) var(--spacing-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

[data-theme="dark"] .topbar {
  background: rgba(0,0,0,0.85);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .topbar {
    background: rgba(0,0,0,0.85);
  }
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.topbar-logo {
  height: 32px;
  width: auto;
}

.topbar-title {
  font-size: var(--font-lg);
  font-weight: 600;
  letter-spacing: var(--letter-tight);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.role-badge {
  font-size: var(--font-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-wide);
  font-weight: 600;
  background: rgba(255,105,41,0.1);
  color: var(--accent);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-xl) var(--spacing-lg);
  text-align: center;
}

.hero h1 {
  font-size: var(--font-4xl);
  font-weight: 700;
  letter-spacing: var(--letter-tight);
  line-height: var(--line-tight);
  margin-bottom: var(--spacing-md);
}

.hero-sub {
  font-size: var(--font-lg);
  color: var(--text-soft);
  margin-bottom: var(--spacing-xl);
  line-height: var(--line-relaxed);
}

.kit-tabs {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.kit-tab {
  padding: 0.625rem var(--spacing-lg);
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text-soft);
  font-family: var(--font);
  font-size: var(--font-sm);
  font-weight: 600;
  letter-spacing: var(--letter-normal);
  cursor: pointer;
  transition: all 0.2s;
}

.kit-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.kit-tab.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

[data-theme="dark"] .kit-tab.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .kit-tab.active {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
  }
}

.content {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.section {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: 0 1px 3px var(--shadow);
  position: relative;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.section-title {
  font-size: var(--font-2xl);
  font-weight: 700;
  letter-spacing: var(--letter-tight);
  line-height: var(--line-tight);
}

.section-body {
  font-size: var(--font-base);
  line-height: var(--line-relaxed);
  color: var(--text-soft);
  white-space: pre-wrap;
  margin-bottom: var(--spacing-lg);
}

.section-body:empty {
  display: none;
}

.section-items {
  display: grid;
  gap: var(--spacing-md);
}

.item {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.02);
  border: 1px solid var(--stroke);
  align-items: flex-start;
}

[data-theme="dark"] .item {
  background: rgba(255,255,255,0.03);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .item {
    background: rgba(255,255,255,0.03);
  }
}

.item-label {
  font-weight: 600;
  font-size: var(--font-sm);
  min-width: 120px;
  flex-shrink: 0;
  color: var(--text);
}

.item-value {
  font-size: var(--font-sm);
  color: var(--text-soft);
  flex: 1;
  word-break: break-word;
}

.item-value a {
  color: var(--accent);
  text-decoration: none;
}

.item-value a:hover {
  text-decoration: underline;
}

.item-value img {
  max-width: 100%;
  border-radius: var(--radius);
  margin-top: var(--spacing-sm);
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-lg);
}

.team-card {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  background: var(--surface);
}

.team-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: var(--spacing-md);
}

.team-card h4 {
  font-size: var(--font-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
}

.team-card .role {
  font-size: var(--font-sm);
  color: var(--text-muted);
  margin-bottom: var(--spacing-sm);
}

.team-card .bio {
  font-size: var(--font-sm);
  line-height: var(--line-relaxed);
  color: var(--text-soft);
}

.edit-controls {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.edit-field {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: var(--font-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  resize: vertical;
}

.edit-field:focus {
  border-color: var(--accent);
}

textarea.edit-field {
  min-height: 100px;
  line-height: var(--line-relaxed);
}

.footer {
  max-width: 1200px;
  margin: var(--spacing-xl) auto 0;
  padding: var(--spacing-xl) var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--stroke);
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.link {
  color: var(--accent);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
}

.modal-panel {
  width: min(95vw, 800px);
  max-height: 90vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg) var(--spacing-xl);
  border-bottom: 1px solid var(--stroke);
}

.modal-header h2 {
  font-size: var(--font-xl);
  font-weight: 700;
  letter-spacing: var(--letter-tight);
}

.modal-body {
  padding: var(--spacing-xl);
  overflow-y: auto;
  flex: 1;
}

.code-gen {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  background: rgba(0,0,0,0.02);
}

[data-theme="dark"] .code-gen {
  background: rgba(255,255,255,0.03);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .code-gen {
    background: rgba(255,255,255,0.03);
  }
}

.code-gen h3 {
  font-size: var(--font-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: var(--font-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-wide);
  font-weight: 600;
  color: var(--text-muted);
}

.form-field input, .form-field select {
  padding: 0.5rem var(--spacing-md);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: var(--font-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.form-field input:focus, .form-field select:focus {
  border-color: var(--accent);
}

.code-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md) var(--spacing-lg);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  margin-bottom: var(--spacing-sm);
  background: var(--surface);
}

.code-card-left {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.code-card-code {
  font-weight: 700;
  font-size: var(--font-base);
  font-family: monospace;
}

.code-card-meta {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.code-card-right {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.code-status {
  font-size: var(--font-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-wide);
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
}

.code-status.active {
  background: #dcfce7;
  color: #16a34a;
}

.code-status.suspended {
  background: #fed7aa;
  color: #ea580c;
}

.code-status.revoked {
  background: #fee2e2;
  color: #dc2626;
}

.toast {
  position: fixed;
  bottom: var(--spacing-xl);
  left: 50%;
  transform: translate(-50%, 120%);
  background: var(--text);
  color: #fff;
  padding: 0.75rem var(--spacing-lg);
  border-radius: 999px;
  font-size: var(--font-sm);
  font-weight: 500;
  z-index: 300;
  transition: transform 0.3s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.toast.show {
  transform: translate(-50%, 0);
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: var(--font-3xl);
  }
  .hero-sub {
    font-size: var(--font-base);
  }
  .topbar {
    padding: var(--spacing-md);
  }
  .content {
    padding: var(--spacing-md);
  }
  .section {
    padding: var(--spacing-lg);
  }
  .item {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
  .item-label {
    min-width: auto;
  }
  .team-grid {
    grid-template-columns: 1fr;
  }
}
