/* EuroScore: Song Contest Prediction Scorecard */
:root {
  --bg: #0f0e17;
  --bg-surface: #1a1929;
  --bg-card: #232136;
  --bg-input: #2e2b45;
  --border: #3d3a54;
  --border-light: #4e4a6a;
  --text: #e8e6f0;
  --text-muted: #9895b0;
  --text-dim: #6b6788;
  --gold: #f5c542;
  --gold-dim: #b8922e;
  --accent: #7c5bf5;
  --accent-light: #9b7fff;
  --danger: #f5515f;
  --success: #42d6a4;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 16px rgba(0,0,0,0.3);
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width: 1100px;
}

*, *::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;
  display: flex;
  flex-direction: column;
}

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

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--gold);
  color: var(--bg);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 100;
}
.skip-link:focus { top: 16px; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
}
.logo:hover, .logo:focus-visible { text-decoration: none; color: var(--gold); }
.logo-icon { flex-shrink: 0; }

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
}
.main-nav a {
  color: var(--text-muted);
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.main-nav a:hover,
.main-nav a:focus-visible,
.main-nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--gold);
  text-decoration: none;
}

/* Hero */
.hero {
  padding: 48px 0 36px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--gold), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 16px;
}
.hero-meta {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
}
.badge--ghost {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
}

/* Generator */
.generator { padding: 12px 0 40px; }
.generator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.panel--full {
  grid-column: 1 / -1;
}
.panel h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.panel-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.player-list, .country-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.item-row input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.9rem;
  font-family: var(--font);
}
.item-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,91,245,0.2);
}
.item-row .row-num {
  color: var(--text-dim);
  font-size: 0.8rem;
  min-width: 22px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.btn-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.btn-remove:hover, .btn-remove:focus-visible {
  color: var(--danger);
  background: rgba(245,81,95,0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn--primary {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
}
.btn--primary:hover:not(:disabled) { background: var(--gold-dim); }
.btn--secondary {
  background: var(--bg-input);
  color: var(--text);
  border-color: var(--border);
}
.btn--secondary:hover { background: var(--border); }
.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn--ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-light); }
.btn--lg { padding: 12px 28px; font-size: 1rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.actions-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Preview */
.preview-section { padding: 0 0 48px; }
.preview-section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.preview-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  padding: 10px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Scorecard print styles */
.scorecard {
  background: #fff;
  color: #1a1a2e;
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  page-break-inside: avoid;
}
.scorecard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #1a1a2e;
}
.scorecard-header h3 {
  font-size: 1.3rem;
  font-weight: 800;
}
.scorecard-header .player-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #444;
}
.scorecard table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.scorecard th, .scorecard td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: center;
}
.scorecard th {
  background: #f0f0f0;
  font-weight: 700;
  font-size: 0.8rem;
}
.scorecard td:first-child { text-align: left; font-weight: 600; }
.scorecard .total-row td {
  font-weight: 800;
  background: #f0f0f0;
  font-size: 0.95rem;
}

/* Tally sheet */
.tally-sheet {
  background: #fff;
  color: #1a1a2e;
  border-radius: var(--radius);
  padding: 28px;
  page-break-inside: avoid;
}
.tally-sheet h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.tally-sheet .subtitle {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 16px;
}
.tally-sheet table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.tally-sheet th, .tally-sheet td {
  border: 1px solid #ccc;
  padding: 5px 6px;
  text-align: center;
}
.tally-sheet th {
  background: #f0f0f0;
  font-weight: 700;
  font-size: 0.75rem;
}
.tally-sheet td:first-child { text-align: left; font-weight: 600; }
.tally-sheet .rank-input {
  width: 36px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 2px;
  font-size: 0.8rem;
  font-family: var(--font);
}
.tally-sheet .rank-input:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

/* Example card */
.example-card {
  background: #fff;
  color: #1a1a2e;
  border-radius: var(--radius);
  padding: 28px;
  max-width: 600px;
}
.example-card .note {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 12px;
  font-style: italic;
}

/* Guide */
.guide { padding: 0 0 60px; }
.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.guide-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.guide-block h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--gold);
}
.guide-block p, .guide-block li {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.guide-block ol, .guide-block ul {
  padding-left: 20px;
  margin-top: 8px;
}
.guide-block li { margin-bottom: 6px; }
.guide-block dl { margin-top: 8px; }
.guide-block dt {
  font-weight: 700;
  color: var(--text);
  margin-top: 12px;
  font-size: 0.925rem;
}
.guide-block dd {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-left: 0;
  margin-top: 2px;
}
.guide-block .note {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(245,197,66,0.08);
  border-left: 3px solid var(--gold-dim);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.scoring-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.875rem;
}
.scoring-table caption {
  text-align: left;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.scoring-table th, .scoring-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.scoring-table th {
  background: var(--bg-card);
  font-weight: 700;
  color: var(--text);
}
.scoring-table td { color: var(--text-muted); }

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 32px 0 20px;
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.footer-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold);
}
.footer-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.footer-links {
  list-style: none;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-links a {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.footer-links a:hover { color: var(--text); }
.footer-copy {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
}

/* Scrollbar */
.player-list::-webkit-scrollbar,
.country-list::-webkit-scrollbar {
  width: 6px;
}
.player-list::-webkit-scrollbar-thumb,
.country-list::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

/* Print */
@media print {
  body { background: #fff; color: #000; }
  .site-header, .site-footer, .hero, .generator, .guide, .preview-tabs, .actions-bar { display: none !important; }
  .preview-section { display: block !important; }
  .tab-panel { display: block !important; }
  .scorecard, .tally-sheet, .example-card {
    box-shadow: none;
    border: 1px solid #ccc;
    margin-bottom: 20px;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .generator-grid { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: 1fr; }
  .hero { padding: 32px 0 24px; }
  .actions-bar { flex-direction: column; align-items: stretch; }
  .actions-bar .btn { justify-content: center; }
  .footer-grid { flex-direction: column; }
}

@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .panel { padding: 16px; }
  .scorecard, .tally-sheet { padding: 16px; }
  .scorecard table, .tally-sheet table { 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;
}
