:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-elevated: #22263a;
  --text: #e8eaf0;
  --text-muted: #8b8fa3;
  --accent: #f5a623;
  --accent-dim: #c4841d;
  --accent-glow: rgba(245, 166, 35, 0.15);
  --border: #2a2e3d;
  --success: #34d399;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 17, 23, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
}
.logo:hover { text-decoration: none; }
.logo-icon { width: 32px; height: 32px; color: var(--accent); }
.logo-text .accent { color: var(--accent); }

.main-nav {
  display: flex;
  gap: 24px;
}
.main-nav a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}
.main-nav a:hover { color: var(--text); text-decoration: none; }

/* Hero */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 24px 60px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.hero-tag {
  display: inline-block;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  max-width: 480px;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-visual {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  height: 200px;
}

.beard-illustration {
  border-radius: 50% 50% 45% 45%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  position: relative;
}
.beard-illustration::after {
  content: '';
  position: absolute;
  bottom: 15%;
  left: 15%;
  right: 15%;
  height: 55%;
  background: var(--accent);
  border-radius: 0 0 40% 40%;
  opacity: 0.3;
}
.beard-lg { width: 120px; height: 140px; }
.beard-md { width: 90px; height: 110px; align-self: flex-start; }
.beard-sm { width: 64px; height: 80px; align-self: center; }
.beard-md::after { opacity: 0.2; }
.beard-sm::after { opacity: 0.12; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  font-family: var(--font);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #1a1000; }
.btn-primary:hover { background: #ffc04a; }
.btn-secondary { background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

/* Sections */
section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 24px;
}

.section-header {
  margin-bottom: 32px;
}
.section-header h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}
.section-header p {
  color: var(--text-muted);
  max-width: 600px;
}

/* Ranker */
.ranker-section { padding-top: 40px; }
.ranker-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
}

.round-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg-card);
  padding: 4px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.round-tab {
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  font-family: var(--font);
  transition: all 0.2s;
}
.round-tab.active {
  background: var(--accent);
  color: #1a1000;
}
.round-tab:hover:not(.active) { color: var(--text); background: var(--bg-elevated); }

.beard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.beard-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: grab;
  transition: all 0.2s;
  user-select: none;
}
.beard-item:hover { border-color: var(--accent-dim); }
.beard-item.dragging { opacity: 0.5; border-color: var(--accent); }
.beard-item.drag-over { border-color: var(--accent); background: var(--accent-glow); }

.beard-rank {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
  flex-shrink: 0;
}

.beard-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.beard-info { flex: 1; min-width: 0; }
.beard-name { font-weight: 600; font-size: 0.95rem; }
.beard-team { font-size: 0.8rem; color: var(--text-muted); }

.drag-handle {
  color: var(--text-muted);
  cursor: grab;
  font-size: 1.2rem;
  padding: 4px;
}

.ranker-actions {
  display: flex;
  gap: 12px;
}

.save-note {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--success);
  min-height: 1.4em;
}

.ranker-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  height: fit-content;
}
.ranker-sidebar h3 { font-size: 1rem; margin-bottom: 12px; }
.ranker-sidebar p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; line-height: 1.5; }

.stat-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  margin-top: 16px;
}
.stat-number { display: block; font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

/* Tracker */
.tracker-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
}

.tracker-input-row {
  display: grid;
  grid-template-columns: 160px 180px 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 24px;
}

.field-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field-group input,
.field-group select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
}
.field-group input:focus,
.field-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.streak-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.streak-info { display: flex; align-items: baseline; gap: 8px; }
.streak-count { font-size: 2rem; font-weight: 700; color: var(--accent); }
.streak-label { font-size: 0.85rem; color: var(--text-muted); }

.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.log-entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-entry {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.log-date { font-size: 0.8rem; color: var(--text-muted); min-width: 90px; }
.log-stage {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text);
}
.log-stage.clean { border: 1px solid #4a5568; }
.log-stage.stubble { border: 1px solid #68d391; color: #68d391; }
.log-stage.scruff { border: 1px solid #f6ad55; color: #f6ad55; }
.log-stage.short { border: 1px solid #f5a623; color: #f5a623; }
.log-stage.medium { border: 1px solid #ed8936; color: #ed8936; }
.log-stage.full { border: 1px solid #e53e3e; color: #e53e3e; }
.log-stage.legendary { border: 1px solid #f5a623; color: #f5a623; background: var(--accent-glow); }

.log-note { flex: 1; font-size: 0.85rem; color: var(--text-muted); }
.log-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  font-family: var(--font);
}
.log-delete:hover { color: #e53e3e; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.tracker-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  height: fit-content;
}
.tracker-sidebar h3 { font-size: 1rem; margin-bottom: 16px; }

.badge-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.badge-list li { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }
.badge-icon { margin-right: 4px; }

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.gallery-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}
.gallery-card:hover { transform: translateY(-2px); border-color: var(--accent-dim); }

.gallery-card-visual {
  height: 140px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.gallery-card-body { padding: 16px; }
.gallery-card-body h3 { font-size: 0.95rem; margin-bottom: 4px; }
.gallery-card-body p { font-size: 0.8rem; color: var(--text-muted); }
.gallery-card-year {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
}

/* Tips */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.tip-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.tip-card h3 { font-size: 1rem; margin-bottom: 10px; color: var(--accent); }
.tip-card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

/* Share Card */
.share-card-section { text-align: center; }
.card-preview { display: flex; justify-content: center; margin: 32px 0; }

.beard-card {
  width: 340px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
  border: 2px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 28px;
  text-align: left;
}

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-title { font-weight: 700; font-size: 1.1rem; }
.card-round { font-size: 0.75rem; color: var(--accent); background: var(--accent-glow); padding: 3px 10px; border-radius: 20px; }

.card-body { display: flex; align-items: center; gap: 24px; margin-bottom: 20px; }
.card-streak { text-align: center; }
.card-streak-num { display: block; font-size: 2.5rem; font-weight: 700; color: var(--accent); line-height: 1; }
.card-streak-text { font-size: 0.75rem; color: var(--text-muted); }
.card-badge { font-size: 0.9rem; font-weight: 600; }

.card-footer { border-top: 1px solid var(--border); padding-top: 12px; font-size: 0.75rem; color: var(--text-muted); }

.card-actions { display: flex; gap: 12px; justify-content: center; }

/* FAQ */
.faq-list {
  max-width: 720px;
  margin: 0 auto;
}

.faq-item { border-bottom: 1px solid var(--border); }
.faq-toggle {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  padding: 18px 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font);
}
.faq-toggle::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--accent);
  transition: transform 0.2s;
}
.faq-toggle[aria-expanded="true"]::after { content: '−'; }
.faq-item dd {
  padding: 0 0 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 40px 24px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
}

.footer-brand p { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

.footer-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-nav a { font-size: 0.85rem; color: var(--text-muted); }
.footer-nav a:hover { color: var(--text); }

.footer-copy { grid-column: 1 / -1; font-size: 0.8rem; color: var(--text-muted); margin-top: 8px; }

/* Responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 48px 24px 40px; }
  .hero-visual { display: none; }
  .ranker-layout { grid-template-columns: 1fr; }
  .tracker-layout { grid-template-columns: 1fr; }
  .tracker-input-row { grid-template-columns: 1fr 1fr; }
  .tracker-input-row .field-group:nth-child(3) { grid-column: 1 / -1; }
  .tracker-input-row .btn { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .header-inner { padding: 0 16px; }
  .main-nav { gap: 14px; }
  .main-nav a { font-size: 0.8rem; }
  section { padding: 40px 16px; }
  .hero h1 { font-size: 1.8rem; }
  .round-tabs { width: 100%; }
  .round-tab { flex: 1; padding: 8px 4px; font-size: 0.75rem; }
  .tracker-input-row { grid-template-columns: 1fr; }
  .beard-card { width: 100%; max-width: 340px; }
  .footer-inner { grid-template-columns: 1fr; }
}

/* Print */
@media print {
  .site-header, .site-footer, .hero-visual, .ranker-sidebar, .tracker-sidebar, .tips-section, .faq-section { display: none; }
  body { background: #fff; color: #000; }
  .beard-card { border-color: #000; background: #fff; }
}

/* Focus styles */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
