/* Bottle Cap League — Main Stylesheet */
:root {
  --bg: #1a1207;
  --bg-card: #2a1f0e;
  --bg-input: #3a2d18;
  --text: #f5e6c8;
  --text-dim: #b8a88a;
  --accent: #d4a017;
  --accent-hover: #e8b52e;
  --border: #4a3a20;
  --success: #4caf50;
  --danger: #e53935;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
  --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); text-decoration: none; }
a:hover, a:focus { color: var(--accent-hover); text-decoration: underline; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* Header */
.site-header {
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
}
.logo:hover, .logo:focus { color: var(--accent); text-decoration: none; }
.main-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.main-nav a {
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover, .main-nav a:focus {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

/* Hero */
.hero-section {
  background: linear-gradient(135deg, #2a1f0e 0%, #1a1207 60%, #0d0a04 100%);
  padding: 4rem 1.5rem 3rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 700px; margin: 0 auto; }
.hero-section h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--accent);
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--text-dim);
  margin-bottom: 2rem;
  max-width: 550px;
  margin-left: auto;
  margin-right: auto;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #1a1207;
  padding: 0.85rem 2rem;
  font-size: 1.05rem;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--accent-hover);
  color: #1a1207;
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  padding: 0.7rem 1.4rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}
.btn-secondary:hover, .btn-secondary:focus {
  background: var(--border);
  text-decoration: none;
}
.btn-small {
  background: var(--bg-input);
  color: var(--text-dim);
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
}
.btn-small:hover, .btn-small:focus {
  color: var(--text);
  background: var(--border);
  text-decoration: none;
}
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Generator Section */
.generator-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.gen-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}
.gen-main h2 { font-size: 1.6rem; margin-bottom: 0.25rem; }
.gen-desc { color: var(--text-dim); margin-bottom: 1.5rem; }

.gen-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.gen-fieldset {
  border: none;
  margin-bottom: 1.5rem;
  padding: 0;
}
.gen-fieldset legend {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}
.field-hint {
  font-weight: 400;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.player-inputs { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.player-row input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
}
.player-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.format-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.radio-card, .check-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s;
}
.radio-card:hover, .check-card:hover { border-color: var(--accent); }
.radio-card input, .check-card input { margin-top: 0.2rem; accent-color: var(--accent); }
.radio-label { display: flex; flex-direction: column; }
.radio-label small { color: var(--text-dim); font-size: 0.82rem; margin-top: 0.15rem; }
.check-card span { display: flex; flex-direction: column; }
.check-card small { color: var(--text-dim); font-size: 0.82rem; margin-top: 0.15rem; }

.house-rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
}

.gen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.gen-status {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  min-height: 1.2em;
}

/* Sidebar */
.gen-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 5rem;
}
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.sidebar-card h3 {
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 0.6rem;
}
.ref-list { list-style: none; }
.ref-list li {
  font-size: 0.88rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
.ref-list li:last-child { border-bottom: none; }
.sidebar-card p { font-size: 0.88rem; color: var(--text-dim); }

/* Results */
.results-area {
  margin-top: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.results-area h3 { font-size: 1.2rem; margin-bottom: 1rem; color: var(--accent); }
.bracket-output, .scoresheet-output { margin-bottom: 1.5rem; }

.bracket-table, .scoresheet-table, .hof-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.bracket-table th, .bracket-table td,
.scoresheet-table th, .scoresheet-table td,
.hof-table th, .hof-table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}
.bracket-table th, .scoresheet-table th, .hof-table th {
  background: var(--bg-input);
  color: var(--accent);
  font-weight: 600;
}
.bracket-table tr:nth-child(even),
.scoresheet-table tr:nth-child(even),
.hof-table tr:nth-child(even) {
  background: rgba(255,255,255,0.02);
}
.match-pair {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.match-pair .vs { color: var(--text-dim); font-size: 0.75rem; }

/* Rules Section */
.rules-section, .house-section, .hof-section, .issues-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.rules-section h2, .house-section h2, .hof-section h2, .issues-section h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}
.section-intro {
  color: var(--text-dim);
  margin-bottom: 1.5rem;
  max-width: 650px;
}
.rules-grid, .issues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.rule-card, .issue-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.rule-card h3, .issue-card h3 {
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.rule-card p, .issue-card p { font-size: 0.88rem; color: var(--text-dim); }

/* Variant Accordion */
.variant-accordion { display: flex; flex-direction: column; gap: 0.5rem; }
.variant {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.variant summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  list-style: none;
}
.variant summary::-webkit-details-marker { display: none; }
.variant summary::after {
  content: '+';
  margin-left: auto;
  font-size: 1.2rem;
  color: var(--accent);
}
.variant[open] summary::after { content: '−'; }
.variant summary:hover { background: var(--bg-input); }
.variant-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-input);
  color: var(--text-dim);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.variant p {
  padding: 0 1.25rem 1rem;
  font-size: 0.88rem;
  color: var(--text-dim);
}

/* Hall of Fame */
.hof-controls { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.hof-table-wrap { overflow-x: auto; }

/* Footer */
.site-footer {
  background: var(--bg-card);
  border-top: 2px solid var(--border);
  margin-top: 3rem;
  padding: 2rem 1.5rem;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}
.footer-inner p { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.footer-nav { display: flex; justify-content: center; gap: 1.25rem; margin-bottom: 0.75rem; }
.footer-meta { font-size: 0.78rem; color: var(--text-dim); opacity: 0.7; }

/* Print Styles */
@media print {
  .site-header, .site-footer, .gen-sidebar, .gen-panel, .gen-actions, .gen-status,
  .hero-section, .hof-controls, .hof-section, .issues-section, .house-section,
  #add-player, #add-hof-entry, #clear-hof {
    display: none !important;
  }
  body { background: #fff; color: #000; }
  .results-area {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .bracket-table th, .scoresheet-table th { background: #eee; color: #000; }
  .bracket-table th, .bracket-table td,
  .scoresheet-table th, .scoresheet-table td {
    border-color: #ccc;
    color: #000;
  }
}

/* Responsive */
@media (max-width: 900px) {
  .gen-layout { grid-template-columns: 1fr; }
  .gen-sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
  .sidebar-card { flex: 1 1 250px; }
}
@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .main-nav { gap: 0.75rem; }
  .hero-section { padding: 2.5rem 1rem 2rem; }
  .gen-actions { flex-direction: column; }
  .gen-actions button { width: 100%; }
  .house-rule-grid { grid-template-columns: 1fr; }
}



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