/* QuizRoster Builder — styles.css */
:root {
  --bg: #0f0b1a;
  --bg-card: #1a1333;
  --bg-card-alt: #231b42;
  --bg-input: #130e28;
  --border: #2e2456;
  --border-light: #3d3170;
  --text: #e8e4f0;
  --text-muted: #9d94b8;
  --text-dim: #6b608a;
  --accent: #6C3AED;
  --accent-light: #8b5cf6;
  --accent-glow: rgba(108, 58, 237, 0.25);
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --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 { font-size: 16px; 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-light); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

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

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 11, 26, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}
.logo:hover, .logo:focus-visible { text-decoration: none; }
.main-nav {
  display: flex;
  gap: 20px;
}
.main-nav a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 4px 0;
}
.main-nav a:hover, .main-nav a:focus-visible {
  color: var(--text);
  text-decoration: none;
}

/* Hero */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 20px 40px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--text), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 16px 0 24px;
  max-width: 520px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-note { font-size: 0.85rem; color: var(--text-dim); margin-top: 16px; }
.hero-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  text-align: center;
  min-width: 120px;
}
.stat strong {
  display: block;
  font-size: 1.6rem;
  color: var(--accent-light);
}
.stat span { font-size: 0.8rem; color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover, .btn:focus-visible { text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--accent-light);
  border-color: var(--accent-light);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-light);
}
.btn-ghost:hover, .btn-ghost:focus-visible {
  color: var(--text);
  border-color: var(--accent-light);
}
.btn-small { padding: 6px 14px; font-size: 0.82rem; }
.btn-full { width: 100%; }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }

/* Sections */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.section-sub {
  color: var(--text-muted);
  margin-bottom: 24px;
  max-width: 600px;
}

/* Builder */
.builder-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}
.builder-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.panel-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.form-group label .hint {
  font-weight: 400;
  color: var(--text-dim);
}
input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.category-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.category-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 0.82rem;
}
.category-tag button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.category-tag button:hover { color: var(--red); }

.add-row {
  display: flex;
  gap: 8px;
}
.add-row input { flex: 1; }

/* Preview */
.preview-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: sticky;
  display: flex;
  flex-direction: column;
  min-height: 500px;
}
.preview-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-alt);
}
.tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent-light);
}
.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.preview-content { flex: 1; overflow-y: auto; }
.tab-panel { display: none; padding: 20px; }
.tab-panel.active { display: block; }

/* Question list in preview */
.round-block { margin-bottom: 28px; }
.round-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.round-header h4 {
  font-size: 1.05rem;
  font-weight: 700;
}
.round-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.question-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(46,36,86,0.4);
}
.question-item:last-child { border-bottom: none; }
.q-number {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-light);
  min-width: 24px;
  padding-top: 2px;
}
.q-body { flex: 1; }
.q-text { font-size: 0.92rem; margin-bottom: 2px; }
.q-answer { font-size: 0.82rem; color: var(--green); }
.q-tags { display: flex; gap: 6px; margin-top: 4px; }
.q-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.q-tag.cat { background: var(--bg-card-alt); color: var(--accent-light); border: 1px solid var(--border-light); }
.q-tag.diff-easy { background: rgba(52,211,153,0.15); color: var(--green); }
.q-tag.diff-medium { background: rgba(251,191,36,0.15); color: var(--yellow); }
.q-tag.diff-hard { background: rgba(248,113,113,0.15); color: var(--red); }
.q-points {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.q-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
}
.q-delete:hover { color: var(--red); }

/* Score sheet */
.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.score-table th,
.score-table td {
  padding: 8px 10px;
  text-align: center;
  border: 1px solid var(--border);
}
.score-table th {
  background: var(--bg-card-alt);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.score-table td.team-name {
  text-align: left;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.score-table input.score-input {
  width: 48px;
  padding: 4px;
  text-align: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.85rem;
}
.score-table .total-cell {
  font-weight: 700;
  color: var(--accent-light);
}

/* Balance meter */
.balance-meter {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card-alt);
}
.balance-meter h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.balance-bars { display: flex; flex-direction: column; gap: 6px; }
.balance-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
}
.balance-label { width: 80px; color: var(--text-muted); }
.balance-track {
  flex: 1;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}
.balance-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.balance-fill.good { background: var(--green); }
.balance-fill.warn { background: var(--yellow); }
.balance-fill.bad { background: var(--red); }

/* Presets */
.presets-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.preset-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.preset-card:hover, .preset-card:focus-visible {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}
.preset-card.featured {
  border-color: var(--accent-light);
}
.preset-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 10px;
  background: var(--accent-glow);
  color: var(--accent-light);
  margin-bottom: 12px;
}
.preset-card h3 { font-size: 1.2rem; margin-bottom: 8px; }
.preset-card p { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 14px; }
.preset-details { list-style: none; margin-bottom: 16px; }
.presets-details li {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 3px 0;
  padding-left: 16px;
  position: relative;
}
.preset-details li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
}

/* Guide */
.guide-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}
.guide-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.guide-block h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--accent-light);
}
.guide-block p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* FAQ */
.faq-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.faq-block h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.faq-block details {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.faq-block details:last-child { border-bottom: none; }
.faq-block summary {
  font-weight: 600;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--text);
}
.faq-block summary:hover { color: var(--accent-light); }
.faq-block details p {
  font-size: 0.88rem;
  color: var(--text-muted);
  padding-top: 8px;
  padding-left: 16px;
}

/* Affiliate */
.affiliate-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}
.affiliate-card {
  display: flex;
  gap: 20px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.affiliate-icon { font-size: 2.5rem; }
.affiliate-info h3 { font-size: 1rem; margin-bottom: 6px; }
.affiliate-info p { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 12px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.footer-brand { display: flex; flex-direction: column; gap: 2px; }
.footer-brand strong { font-size: 0.9rem; }
.footer-brand span { font-size: 0.8rem; color: var(--text-dim); }
.footer-nav { display: flex; gap: 16px; }
.footer-nav a { font-size: 0.82rem; color: var(--text-muted); }
.footer-note { font-size: 0.75rem; color: var(--text-dim); width: 100%; text-align: center; margin-top: 8px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}
.empty-state p { font-size: 0.9rem; }

/* Print */
@media print {
  body { background: #fff; color: #000; }
  .site-header, .builder-panel, .preview-actions, .preview-tabs, .balance-meter, .site-footer, .hero, .presets-section, .guide-section, .affiliate-section, .affiliate-card { display: none !important; }
  .builder-section { padding: 0; }
  .builder-layout { display: block; }
  .preview-panel { border: none; }
  .tab-panel { display: none; }
  .tab-panel.active { display: block; }
  .question-item { border-bottom: 1px solid #ddd; }
  .score-table th, .score-table td { border-color: #ddd; color: #000; }
  .score-table input.score-input { border: 1px solid #ccc; }
}

/* Responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-sub { margin: 16px auto 24px; }
  .hero-actions { justify-content: center; }
  .hero-stats { flex-direction: row; justify-content: center; }
  .builder-layout { grid-template-columns: 1fr; }
  .preset-grid { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: 1fr; }
  .main-nav { display: none; }
  .affiliate-card { flex-direction: column; text-align: center; }
}

@media (max-width: 600px) {
  .header-inner { padding: 0 12px; }
  .hero { padding: 40px 16px 24px; }
  .builder-section { padding: 12px; }
  .presets-section, .guide-section { padding: 24px 12px; }
  .score-table { font-size: 0.75rem; }
  .score-table th, .score-table td { padding: 6px 4px; }
  .preview-actions { gap: 4px; }
  .preview-actions .btn-small { padding: 4px 8px; font-size: 0.75rem; }
}



/* 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;
}
