/* Guldtoft Padel - design system, aligned with the guldtoft.dk brand.
   Warm paper background, ink-navy text, burnt-orange accent, editorial
   serif headings. Self-hosted fonts - no external CDN at runtime. */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/Fraunces-variable.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('../fonts/InterTight-variable.woff2') format('woff2');
}

:root {
  --ink: #0f1b2d;
  --ink-2: #1b2a41;
  --paper: #f5f1ea;
  --paper-2: #ede6d8;
  --accent: #c6531f;
  --accent-soft: #e8a87c;
  --line: #0f1b2d;
  --muted: #5c6a7c;
  --green: #2f5d3a;
  --red: #a53a2b;
  --amber: #b7791f;
  --danger-bg: #f6e2dc;
  --warn-bg: #f5e6cd;
  --ok-bg: #e3ead9;
  --radius: 2px;
  --radius-lg: 3px;
  --shadow: none;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { padding: 0; margin: 0; }

body {
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .round-tag, .join-code {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

a { color: var(--accent); }

.app-shell {
  min-height: 100vh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}

.topbar {
  background: rgba(245, 241, 234, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--ink);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(15, 27, 45, 0.1);
  flex-wrap: wrap;
  gap: 8px;
}

.topbar .brand {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
}

.topbar .brand .accent { color: var(--accent); }

.topbar nav {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}

.topbar nav a, .topbar .lang-switch a {
  color: var(--ink);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
}

.topbar nav a.active, .topbar nav a:hover {
  background: var(--ink);
  color: var(--paper);
}

.main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.main.narrow { max-width: 640px; }

.court-lines {
  background-image:
    linear-gradient(rgba(15, 27, 45, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 27, 45, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

.card {
  background: #fff;
  border: 1px solid rgba(15, 27, 45, 0.1);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card h1, .card h2, .card h3 { margin-top: 0; }

h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; font-family: inherit; font-weight: 700; letter-spacing: normal; }

.page-title { color: var(--ink); margin: 4px 0 20px; }
.page-title h1 { margin: 0; font-size: 1.9rem; }
.page-title p { margin: 6px 0 0; color: var(--muted); font-size: 0.92rem; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

label { display: block; font-weight: 600; font-size: 0.8rem; margin: 12px 0 6px; color: var(--ink); text-transform: uppercase; letter-spacing: 0.03em; }
.field-hint { color: var(--muted); font-size: 0.78rem; margin-top: 4px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(15, 27, 45, 0.25);
  border-radius: var(--radius);
  font-size: 1rem;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.checkbox-line { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.checkbox-line input { width: auto; }
.checkbox-line label { margin: 0; font-weight: 500; text-transform: none; letter-spacing: normal; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 140px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: var(--paper);
  border: 1px solid var(--accent);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  min-height: 44px;
  font-family: inherit;
}
.btn:hover { background: #a8441a; border-color: #a8441a; }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid rgba(15, 27, 45, 0.3); }
.btn.secondary:hover { background: rgba(15, 27, 45, 0.06); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.danger:hover { background: #8a2f22; border-color: #8a2f22; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.small { padding: 8px 12px; font-size: 0.8rem; min-height: 36px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.alert { padding: 12px 14px; border-radius: var(--radius); margin: 14px 0; font-size: 0.9rem; border: 1px solid transparent; }
.alert.error { background: var(--danger-bg); color: var(--red); border-color: rgba(165, 58, 43, 0.3); }
.alert.warn { background: var(--warn-bg); color: var(--amber); border-color: rgba(183, 121, 31, 0.3); }
.alert.ok { background: var(--ok-bg); color: var(--green); border-color: rgba(47, 93, 58, 0.3); }

table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { text-align: left; padding: 10px 8px; border-bottom: 1px solid rgba(15, 27, 45, 0.1); }
table.data th { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: rgba(198, 83, 31, 0.05); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: rgba(15, 27, 45, 0.08);
  color: var(--muted);
}
.badge.live { background: var(--green); color: #fff; }
.badge.paused { background: var(--warn-bg); color: var(--amber); }
.badge.completed { background: rgba(15, 27, 45, 0.12); color: var(--ink); }
.badge.draft { background: rgba(15, 27, 45, 0.06); color: var(--muted); }
.badge.archived { background: var(--ink); color: var(--paper); }
.badge.scoring-rule { background: var(--accent-soft); color: var(--ink); margin: 6px 0 4px; font-size: 0.74rem; }

.status-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: #9aa5b1; margin-right: 6px;
}
.status-dot.live { background: var(--green); box-shadow: 0 0 0 3px rgba(47, 93, 58, 0.18); }
.status-dot.lost { background: var(--red); }

.conn-indicator {
  position: fixed; bottom: 14px; right: 14px; z-index: 40;
  background: var(--ink); color: var(--paper); padding: 8px 14px;
  border-radius: 999px; font-size: 0.78rem; display: flex; align-items: center;
}

/* Court cards for live scoring */
.court-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.court-card {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 2px solid var(--ink);
}
.court-card.completed { border-color: var(--green); }

.court-card .court-name { font-weight: 700; font-size: 0.9rem; color: var(--accent-soft); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 10px; }

.team-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; }
.team-names { font-weight: 600; font-size: 1rem; color: var(--paper); }
.team-names .partner-sep { color: rgba(245, 241, 234, 0.6); font-weight: 400; }

.score-control { display: flex; align-items: center; gap: 8px; }
.score-btn {
  width: 40px; height: 40px; border-radius: var(--radius); border: 1px solid rgba(245, 241, 234, 0.3);
  background: rgba(245, 241, 234, 0.1); font-size: 1.3rem; font-weight: 700; cursor: pointer; color: var(--paper);
}
.score-btn:active { background: var(--accent); border-color: var(--accent); }
.score-value {
  min-width: 56px; text-align: center; font-family: 'Fraunces', serif; font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--paper);
}
.score-value-input {
  width: 72px; min-width: 72px; text-align: center; font-family: 'Fraunces', serif; font-size: 2rem; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--paper); background: rgba(245, 241, 234, 0.08);
  border: 1px solid rgba(245, 241, 234, 0.25); border-radius: var(--radius); padding: 4px 2px; -moz-appearance: textfield;
}
.score-value-input:focus { outline: none; border-color: var(--accent); background: rgba(245, 241, 234, 0.16); }
.score-value-input:hover { border-color: rgba(245, 241, 234, 0.45); }
.score-value-input::-webkit-outer-spin-button, .score-value-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.court-card.dirty { border-color: var(--amber); }

.vs-divider { text-align: center; color: rgba(245, 241, 234, 0.5); font-weight: 700; font-size: 0.75rem; margin: 2px 0; text-transform: uppercase; letter-spacing: 0.05em; }

.court-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.court-actions .btn.secondary { color: var(--paper); border-color: rgba(245, 241, 234, 0.35); }
.court-actions .btn.secondary:hover { background: rgba(245, 241, 234, 0.1); }

.resting-list { display: flex; flex-wrap: wrap; gap: 8px; }
.resting-chip { background: var(--paper-2); border: 1px solid rgba(15, 27, 45, 0.12); padding: 6px 12px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin: 24px 0; }
.podium .step { background: #fff; border: 1px solid rgba(15, 27, 45, 0.1); border-radius: var(--radius-lg) var(--radius-lg) 0 0; text-align: center; padding: 16px 12px; }
.podium .step.first { height: 180px; background: var(--paper-2); order: 2; min-width: 140px; border-color: var(--accent); }
.podium .step.second { height: 140px; order: 1; min-width: 120px; }
.podium .step.third { height: 110px; order: 3; min-width: 120px; }
.podium .medal { font-size: 2rem; }
.podium .name { font-family: 'Fraunces', serif; font-weight: 600; margin-top: 6px; }
.podium .pts { color: var(--muted); font-size: 0.85rem; }

.stat-tile { background: #fff; border: 1px solid rgba(15, 27, 45, 0.1); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat-tile .value { font-family: 'Fraunces', serif; font-size: 1.7rem; font-weight: 600; color: var(--accent); }
.stat-tile .label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

.round-tag { font-weight: 500; font-size: 1.15rem; color: var(--ink); }

.qr-box { background: #fff; padding: 12px; border: 1px solid rgba(15, 27, 45, 0.1); border-radius: var(--radius); display: inline-block; }
.join-code { font-size: 2.2rem; font-weight: 600; letter-spacing: 0.12em; color: var(--ink); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid rgba(15, 27, 45, 0.12); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 0.88rem; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--accent); border-color: var(--accent); }

footer.site-footer { text-align: center; color: var(--muted); font-size: 0.78rem; padding: 20px 0 40px; }
footer.site-footer a { color: var(--muted); }

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

@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .score-value, .score-value-input { font-size: 2.4rem; }
  .score-btn { width: 48px; height: 48px; font-size: 1.5rem; }
  .join-code { font-size: 1.8rem; }
}

@media print {
  body { background: #fff; }
  .topbar, .conn-indicator, .btn-row, .no-print { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
