/* Design tokens, admin view, dialog, toast. Look: an elegant Christmas evening –
   evergreen, berry red and gold, softly falling snow, warm fairy lights. */

:root {
  --frost: #f3f5f4;
  --frost-deep: #e6ebe8;
  --card: #ffffff;
  --ink: #15211b;
  --ink-soft: #2c3a33;
  --muted: #5c6b63;
  --rule: #d9e0dc;
  --rule-soft: #e9eeeb;
  --red: #b3122e;
  --red-deep: #8f0e25;
  --pine: #123a2c;
  --pine-mid: #1c5641;
  --gold: #c9a14a;
  --gold-soft: #f1dfac;
  --gold-text: #86670f;
  --live: #d4183b;
  --amber: #e9b23a;
  --ok: #4ade80;

  /* Playfair Display for headings (Christmas-card elegance), Barlow for text and numbers.
     Both cover Czech diacritics (ě č ř ů ň ť ď). */
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius-s: 6px;
  --radius-m: 8px;
  --radius-l: 12px;
  --shadow-card: 0 1px 2px rgb(18 58 44 / 0.06), 0 12px 30px -20px rgb(18 58 44 / 0.4);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 160ms;

  /* Surfaces */
  --evergreen: linear-gradient(180deg, #184634 0%, #113427 100%);
  --night: linear-gradient(180deg, #0a1922 0%, #0d241f 55%, #0f2d21 100%);
  /* Warm fairy lights along a top edge: two staggered rows give the strand a gentle zig-zag. */
  --fairy-lights:
    radial-gradient(circle at 12px 7px, rgb(255 246 222) 0 1.4px, rgb(255 212 140 / 0.65) 2.6px, rgb(255 190 100 / 0.22) 5px, transparent 10px) 0 0 / 48px 24px repeat-x,
    radial-gradient(circle at 36px 14px, rgb(255 246 222) 0 1.4px, rgb(255 212 140 / 0.65) 2.6px, rgb(255 190 100 / 0.22) 5px, transparent 10px) 0 0 / 48px 24px repeat-x;
  /* Snow textures (generated, see the commit message): still flakes, and two falling layers. */
  --flakes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cpath d='M40 42L40 29M40 34.5l-2.8 -3.4M40 34.5l2.8 -3.4M40 42L28.7 35.5M33.5 38.2l-4.4 0.8M33.5 38.2l-1.5 -4.2M40 42L28.7 48.5M33.5 45.8l-1.5 4.2M33.5 45.8l-4.4 -0.8M40 42L40 55M40 49.5l2.8 3.4M40 49.5l-2.8 3.4M40 42L51.3 48.5M46.5 45.8l4.4 -0.8M46.5 45.8l1.5 4.2M40 42L51.3 35.5M46.5 38.2l1.5 -4.2M46.5 38.2l4.4 0.8' fill='none' stroke='%23166534' stroke-opacity='0.07' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M118 114L118 105M118 108.8l-2 -2.3M118 108.8l2 -2.3M118 114L110.2 109.5M113.5 111.4l-3 0.5M113.5 111.4l-1 -2.9M118 114L110.2 118.5M113.5 116.6l-1 2.9M113.5 116.6l-3 -0.5M118 114L118 123M118 119.2l2 2.3M118 119.2l-2 2.3M118 114L125.8 118.5M122.5 116.6l3 -0.5M122.5 116.6l1 2.9M118 114L125.8 109.5M122.5 111.4l1 -2.9M122.5 111.4l3 0.5' fill='none' stroke='%23c8102e' stroke-opacity='0.06' stroke-width='2' stroke-linecap='round'/%3E%3Cg fill='%23166534' fill-opacity='0.05'%3E%3Ccircle cx='122' cy='34' r='2.5'/%3E%3Ccircle cx='30' cy='122' r='2'/%3E%3Ccircle cx='78' cy='80' r='1.6'/%3E%3C/g%3E%3C/svg%3E");
  --snow-still: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='23.3' cy='18.6' r='1.0' fill-opacity='0.25'/%3E%3Ccircle cx='36.4' cy='103.0' r='0.8' fill-opacity='0.28'/%3E%3Ccircle cx='137.6' cy='75.5' r='0.6' fill-opacity='0.18'/%3E%3Ccircle cx='79.3' cy='44.7' r='1.2' fill-opacity='0.27'/%3E%3Ccircle cx='150.5' cy='118.5' r='0.6' fill-opacity='0.13'/%3E%3Ccircle cx='110.6' cy='30.5' r='0.8' fill-opacity='0.16'/%3E%3Ccircle cx='115.4' cy='19.0' r='0.9' fill-opacity='0.24'/%3E%3Ccircle cx='34.6' cy='159.8' r='0.7' fill-opacity='0.23'/%3E%3Ccircle cx='178.8' cy='170.6' r='1.3' fill-opacity='0.18'/%3E%3Ccircle cx='132.0' cy='206.7' r='1.6' fill-opacity='0.21'/%3E%3Ccircle cx='76.6' cy='156.8' r='0.8' fill-opacity='0.17'/%3E%3Ccircle cx='72.4' cy='211.8' r='1.4' fill-opacity='0.16'/%3E%3Ccircle cx='71.2' cy='81.0' r='0.9' fill-opacity='0.16'/%3E%3Ccircle cx='72.9' cy='108.9' r='1.6' fill-opacity='0.17'/%3E%3Ccircle cx='184.2' cy='102.4' r='1.5' fill-opacity='0.23'/%3E%3Ccircle cx='214.8' cy='18.7' r='0.6' fill-opacity='0.14'/%3E%3C/g%3E%3C/svg%3E");
  --snow-far: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='30.0' cy='172.1' r='1.0' fill-opacity='0.78'/%3E%3Ccircle cx='36.5' cy='140.7' r='1.4' fill-opacity='0.55'/%3E%3Ccircle cx='10.8' cy='127.6' r='1.4' fill-opacity='0.61'/%3E%3Ccircle cx='23.0' cy='64.0' r='1.2' fill-opacity='0.45'/%3E%3Ccircle cx='235.0' cy='70.4' r='1.3' fill-opacity='0.53'/%3E%3Ccircle cx='215.5' cy='65.9' r='1.5' fill-opacity='0.71'/%3E%3Ccircle cx='197.0' cy='200.5' r='1.1' fill-opacity='0.68'/%3E%3Ccircle cx='50.8' cy='26.8' r='1.1' fill-opacity='0.66'/%3E%3Ccircle cx='91.4' cy='5.8' r='1.2' fill-opacity='0.79'/%3E%3Ccircle cx='64.0' cy='218.2' r='1.4' fill-opacity='0.63'/%3E%3Ccircle cx='219.3' cy='140.7' r='1.5' fill-opacity='0.49'/%3E%3Ccircle cx='212.7' cy='206.3' r='1.1' fill-opacity='0.76'/%3E%3Ccircle cx='164.9' cy='55.2' r='1.0' fill-opacity='0.66'/%3E%3Ccircle cx='214.3' cy='209.5' r='1.4' fill-opacity='0.50'/%3E%3Ccircle cx='234.7' cy='121.1' r='1.2' fill-opacity='0.79'/%3E%3Ccircle cx='131.0' cy='113.0' r='0.9' fill-opacity='0.73'/%3E%3Ccircle cx='105.7' cy='90.7' r='1.0' fill-opacity='0.49'/%3E%3Ccircle cx='129.8' cy='233.8' r='1.4' fill-opacity='0.67'/%3E%3Ccircle cx='72.0' cy='5.2' r='0.8' fill-opacity='0.56'/%3E%3Ccircle cx='128.9' cy='219.0' r='1.3' fill-opacity='0.61'/%3E%3Ccircle cx='6.8' cy='89.1' r='1.3' fill-opacity='0.82'/%3E%3Ccircle cx='55.7' cy='190.8' r='1.5' fill-opacity='0.70'/%3E%3Ccircle cx='117.7' cy='209.3' r='1.1' fill-opacity='0.72'/%3E%3Ccircle cx='26.0' cy='61.7' r='0.8' fill-opacity='0.82'/%3E%3Ccircle cx='59.8' cy='169.0' r='1.0' fill-opacity='0.58'/%3E%3Ccircle cx='132.1' cy='150.0' r='1.6' fill-opacity='0.70'/%3E%3C/g%3E%3C/svg%3E");
  --snow-near: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360' viewBox='0 0 360 360'%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='182.8' cy='244.3' r='2.7' fill-opacity='0.74'/%3E%3Ccircle cx='113.1' cy='44.9' r='3.1' fill-opacity='0.80'/%3E%3Ccircle cx='171.6' cy='121.3' r='2.8' fill-opacity='0.93'/%3E%3Ccircle cx='349.0' cy='164.4' r='2.6' fill-opacity='0.87'/%3E%3Ccircle cx='88.5' cy='28.2' r='2.1' fill-opacity='0.91'/%3E%3Ccircle cx='281.0' cy='251.1' r='2.1' fill-opacity='0.93'/%3E%3Ccircle cx='188.3' cy='59.8' r='2.7' fill-opacity='0.72'/%3E%3Ccircle cx='103.5' cy='311.2' r='3.3' fill-opacity='0.75'/%3E%3Ccircle cx='57.8' cy='260.0' r='2.6' fill-opacity='0.81'/%3E%3Ccircle cx='236.7' cy='310.5' r='2.8' fill-opacity='0.72'/%3E%3Ccircle cx='166.5' cy='103.5' r='2.2' fill-opacity='0.87'/%3E%3C/g%3E%3C/svg%3E");
  /* Icons drawn with CSS masks, so they take the text colour. */
  --snowflake: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21.5L12 2.5M14.3 3.4L12 5.8L9.7 3.4M3.77 16.75L20.23 7.25M20.6 9.69L17.37 8.9L18.3 5.71M3.77 7.25L20.23 16.75M18.3 18.29L17.37 15.1L20.6 14.31M9.7 20.6L12 18.2L14.3 20.6M3.4 14.31L6.63 15.1L5.7 18.29M5.7 5.71L6.63 8.9L3.4 9.69'/%3E%3C/svg%3E");
  --trophy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M6 2h12v2h3.5v3A4.5 4.5 0 0 1 17 11.5h-.3A6 6 0 0 1 13 14.9V18h3.5v4h-9v-4H11v-3.1a6 6 0 0 1-3.7-3.4H7A4.5 4.5 0 0 1 2.5 7V4H6V2zm0 4H4.5v1A2.5 2.5 0 0 0 6.3 9.4 6 6 0 0 1 6 8V6zm12 0v2a6 6 0 0 1-.3 1.4A2.5 2.5 0 0 0 19.5 7V6H18z'/%3E%3C/svg%3E");
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font: 400 15px/1.5 var(--font-body);
  color: var(--ink);
  background: var(--flakes), var(--frost);
}

button, input { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--pine-mid); outline-offset: 2px; }

/* A small snowflake before a label or heading. */
.eyebrow::before,
.login-eyebrow::before,
.viewer-eyebrow::before,
.panel-head h2::before {
  content: '';
  flex: none;
  width: 1em;
  height: 1em;
  background: currentColor;
  -webkit-mask: var(--snowflake) center / contain no-repeat;
  mask: var(--snowflake) center / contain no-repeat;
}

/* ---------- Shared crest (UTB monogram) ---------- */

.crest {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  color: var(--pine);
  font: italic 700 17px/1 var(--font-display);
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3.5px var(--gold), 0 8px 18px -8px rgb(0 0 0 / 0.55);
}

/* ---------- Falling snow (login and fullscreen viewer) ---------- */

.snowfall { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.snowfall::before,
.snowfall::after { content: ''; position: absolute; will-change: transform; }
/* Distant flakes: small, soft, slow. Each layer moves by exactly one tile, so the loop is seamless. */
.snowfall::before {
  inset: -240px 0 0;
  background: var(--snow-far);
  filter: blur(0.6px);
  animation: snow-far 20s linear infinite;
}
/* Near flakes: bigger and faster, drifting gently from side to side. */
.snowfall::after {
  inset: -360px -40px 0;
  background: var(--snow-near);
  animation: snow-near 12s linear infinite, snow-sway 7s ease-in-out infinite alternate;
}
@keyframes snow-far { to { transform: translateY(240px); } }
@keyframes snow-near { to { transform: translateY(360px); } }
@keyframes snow-sway { from { translate: -24px 0; } to { translate: 24px 0; } }

/* ---------- Buttons & inputs ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  font: 600 15px/1 var(--font-body);
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--fast) var(--ease), background-color var(--fast), border-color var(--fast), color var(--fast), box-shadow var(--fast);
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--small { min-height: 34px; padding: 0 12px; font-size: 14px; background: var(--pine); color: #fff; }
.btn--small:hover { background: var(--pine-mid); }
.btn--red { background: var(--red); color: #fff; box-shadow: 0 6px 14px -8px rgb(179 18 46 / 0.8); }
.btn--red:hover:not(:disabled) { background: var(--red-deep); }
.btn--light { background: #fff; color: var(--pine); box-shadow: 0 6px 16px -10px rgb(0 0 0 / 0.6), inset 0 -2px 0 var(--gold-soft); }
.btn--light:hover:not(:disabled) { background: #fffaf0; }
.btn--ghost-light { background: transparent; color: #fff; border-color: rgb(255 255 255 / 0.4); }
.btn--ghost-light:hover:not(:disabled) { background: rgb(255 255 255 / 0.1); border-color: rgb(255 255 255 / 0.85); }
.btn--quiet { background: var(--card); color: var(--ink-soft); border-color: var(--rule); }
.btn--quiet:hover:not(:disabled) { border-color: var(--pine-mid); color: var(--pine); }
.btn--quiet.is-danger { color: var(--live); }
.btn--quiet.is-danger:hover:not(:disabled) { border-color: var(--live); color: var(--live); }

.input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-s);
  background: var(--card);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.input::placeholder { color: #8b9991; }
.input:focus { outline: none; border-color: var(--pine-mid); box-shadow: 0 0 0 3px rgb(28 86 65 / 0.15); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--fast), color var(--fast);
}
.icon-btn:hover:not(:disabled) { background: var(--frost-deep); color: var(--pine); }
.icon-btn.is-danger:hover:not(:disabled) { background: #fbe4e8; color: var(--live); }
.icon-btn:disabled { opacity: 0.25; cursor: default; }
.icon-btn--small { width: 26px; height: 26px; font-size: 12px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  font: 600 12px/1.2 var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-soft);
}

.form-error { margin: 6px 0 0; color: var(--live); font-size: 13px; font-weight: 600; }
.form-error:empty { display: none; }
.form-error--light { color: var(--gold-soft); }

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  padding: 30px 28px 20px;
  color: #fff;
  background: var(--fairy-lights), var(--snow-still), var(--evergreen);
  /* A red ribbon with a thin gold edge. */
  border-bottom: 3px solid var(--red);
  box-shadow: 0 2px 0 var(--gold);
}
/* The name is an input (no intrinsic width), so the brand keeps room for it and
   the stats/actions wrap to the next row instead of cutting the name off. */
.brand { display: flex; align-items: center; gap: 14px; flex: 1 1 460px; min-width: min(100%, 460px); }
.brand-text { min-width: 0; flex: 1; }
.title-input {
  width: 100%;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px dashed transparent;
  background: transparent;
  font: 700 clamp(24px, 2.4vw, 32px)/1.15 var(--font-display);
  text-overflow: ellipsis;
  color: #fff;
}
.title-input:hover { border-bottom-color: rgb(255 255 255 / 0.45); }
.title-input:focus { outline: none; border-bottom-color: var(--gold-soft); }

.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat {
  display: grid;
  gap: 2px;
  padding: 7px 14px;
  border-radius: var(--radius-m);
  background: rgb(255 255 255 / 0.08);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.16);
  backdrop-filter: blur(2px);
}
.stat-value { font: 700 21px/1.15 var(--font-body); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(255 255 255 / 0.68); }
.stat--champion { background: #fffaf0; color: var(--pine); box-shadow: inset 4px 0 0 var(--gold); }
.stat--champion .stat-label { color: var(--gold-text); }
.stat--scorer .stat-value { max-width: 18ch; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* ---------- Layout & panels ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 20px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 26px 28px 28px;
  align-items: start;
}
.panel {
  min-width: 0;
  padding: 20px 22px 22px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  background: var(--card);
  box-shadow: var(--shadow-card);
}
.panel--teams { position: sticky; top: 16px; grid-row: span 2; max-height: calc(100vh - 32px); overflow: auto; }
.panel--scorers { grid-column: 2; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; font: 700 25px/1.1 var(--font-display); color: var(--pine); }
.panel-head h2::before { width: 18px; height: 18px; background: var(--red); }
.panel-count, .panel-hint { margin: 0; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.panel-note { margin: 16px 0 0; color: var(--muted); font-size: 12.5px; }

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

/* ---------- Team list ---------- */

.team-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.team-empty {
  padding: 20px 12px;
  border: 1px dashed var(--rule);
  border-radius: var(--radius-m);
  background: var(--frost);
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}
.team {
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  background: #fff;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.team:hover, .team.is-open { border-color: #b4c3bb; }
.team.is-open { box-shadow: 0 8px 20px -16px rgb(18 58 44 / 0.6); }
.team-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px 0 8px; }
.team-seed {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--frost-deep);
  color: var(--pine);
  font: 700 14px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
}
.team-name {
  flex: 1;
  width: 0; /* no intrinsic input width – the row decides, so tools never overflow */
  min-width: 0;
  padding: 4px 2px;
  border: 0;
  border-bottom: 1px dashed transparent;
  background: transparent;
  font: 600 17px/1.2 var(--font-body);
  color: var(--ink);
}
.team-name:hover { border-bottom-color: var(--rule); }
.team-name:focus { outline: none; border-bottom-color: var(--pine-mid); }
.team-tools { display: flex; flex: none; }
.players-toggle {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 2px 12px 8px 44px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.players-toggle:hover { color: var(--pine); }
.players-toggle-hint { font-weight: 600; color: var(--red); }

.players { padding: 4px 12px 12px; border-top: 1px solid var(--rule-soft); }
.player-list { list-style: none; margin: 8px 0 10px; padding: 0; display: grid; gap: 2px; }
.player { display: flex; align-items: center; gap: 10px; padding: 3px 0 3px 4px; border-radius: var(--radius-s); }
.player:hover { background: var(--frost); }
.player-number {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 24px;
  border-radius: 4px;
  background: var(--pine);
  color: #fff;
  font: 700 13px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
}
.player-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.add-player { display: flex; gap: 6px; margin-top: 8px; }
.add-player .input { min-height: 34px; font-size: 14px; }
.input--number { flex: none; width: 56px; text-align: center; padding: 0 6px; }

/* ---------- Bracket panel ---------- */

.bracket-scroll { overflow: auto; padding: 16px 4px 8px; margin: 0 -4px; }
.empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 260px;
  padding: 24px;
  border: 1px dashed var(--rule);
  border-radius: var(--radius-l);
  background: var(--flakes), var(--frost);
  color: var(--muted);
  text-align: center;
}
.empty p { margin: 0; max-width: 46ch; text-wrap: balance; }
.empty-title { font: 700 26px/1.15 var(--font-display); color: var(--pine); }

/* ---------- Top scorers (admin panel; the viewer restyles it in bracket.css) ---------- */

.scorer-board { list-style: none; margin: 0; padding: 0; display: grid; }
.scorer-row {
  display: grid;
  grid-template-columns: 2.2em minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule-soft);
}
.scorer-row:last-child { border-bottom: 0; }
.scorer-row.is-top {
  border-radius: var(--radius-s);
  background: linear-gradient(90deg, rgb(201 161 74 / 0.18), rgb(201 161 74 / 0.02) 70%);
  box-shadow: inset 3px 0 0 var(--gold);
}
.scorer-rank { font: 700 17px/1 var(--font-body); color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.scorer-row.is-top .scorer-rank { color: var(--gold-text); }
.scorer-who { display: grid; min-width: 0; }
.scorer-player { font: 600 16px/1.25 var(--font-body); color: var(--ink); overflow-wrap: anywhere; }
.scorer-club { font-size: 12.5px; font-weight: 500; color: var(--muted); overflow-wrap: anywhere; }
.scorer-total { font: 700 23px/1 var(--font-body); color: var(--pine); font-variant-numeric: tabular-nums; white-space: nowrap; }
.scorer-unit { font: 500 12px/1 var(--font-body); color: var(--muted); }
.scorers-empty {
  margin: 0;
  padding: 18px 12px;
  border: 1px dashed var(--rule);
  border-radius: var(--radius-m);
  background: var(--frost);
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 28px 28px;
}
.footer-group { display: flex; gap: 8px; flex-wrap: wrap; }
.footer-love { margin: 0; font: italic 600 16px/1 var(--font-display); color: var(--red-deep); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { outline: 2px solid var(--pine-mid); outline-offset: 2px; }

/* ---------- Score dialog ---------- */

.score-dialog {
  width: min(600px, calc(100vw - 32px));
  padding: 26px 28px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--snow-still), var(--evergreen);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.6), inset 0 4px 0 var(--red), inset 0 6px 0 var(--gold);
}
.score-dialog[open] { animation: dialog-in 240ms var(--ease); }
.score-dialog::backdrop { background: rgb(8 20 15 / 0.55); backdrop-filter: blur(3px); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.score-dialog :focus-visible { outline-color: var(--gold-soft); }
.score-title { margin: 6px 0 22px; font: 700 30px/1.1 var(--font-display); }

.scoreboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px auto 78px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.score-team { font: 600 18px/1.2 var(--font-body); overflow-wrap: anywhere; }
.score-team--a { text-align: right; }
.score-sep { font: 700 32px/1 var(--font-body); color: rgb(255 255 255 / 0.55); text-align: center; }
.score-input {
  width: 100%;
  height: 78px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #fff;
  color: var(--pine);
  font: 700 42px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  text-align: center;
  box-shadow: 0 10px 20px -12px rgb(0 0 0 / 0.7);
  appearance: textfield;
  -moz-appearance: textfield;
}
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-input:focus { outline: none; border-color: var(--gold-soft); box-shadow: 0 0 0 4px rgb(241 223 172 / 0.3); }
.score-input--small { width: 66px; height: 56px; font-size: 28px; }

.penalties {
  margin: 20px 0 0;
  padding: 14px 16px;
  border: 1px dashed rgb(241 223 172 / 0.7);
  border-radius: var(--radius-m);
  background: rgb(255 255 255 / 0.05);
}
.penalties legend { padding: 0 8px; font: 600 13px/1 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold-soft); }
.penalty-inputs { display: flex; align-items: center; justify-content: center; gap: 10px; }
.penalty-note { margin: 10px 0 0; font-size: 12.5px; color: rgb(255 255 255 / 0.8); text-align: center; }

.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 20px; font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--red); }
.check em { color: rgb(255 255 255 / 0.7); font-style: normal; font-weight: 400; }

/* Goal scorers inside the score dialog */
.scorers {
  margin: 20px 0 0;
  padding: 12px 14px 14px;
  border: 1px solid rgb(255 255 255 / 0.18);
  border-radius: 10px;
  background: rgb(255 255 255 / 0.05);
}
.scorers legend { padding: 0 8px; font: 700 18px/1 var(--font-display); }
.scorer-note { margin: 0 0 12px; font-size: 12.5px; color: rgb(255 255 255 / 0.75); }
.scorer-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.scorer-team {
  margin: 0 0 6px;
  font: 600 12px/1.2 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-soft);
  overflow-wrap: anywhere;
}
.scorer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.scorer { display: flex; gap: 4px; }
.scorer-add {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 4px 8px 4px 5px;
  border: 0;
  border-radius: var(--radius-s);
  background: rgb(255 255 255 / 0.94);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform var(--fast) var(--ease), background-color var(--fast), box-shadow var(--fast);
}
.scorer-add:hover { background: #fff; transform: translateY(-1px); }
.scorer-add:active { transform: translateY(0) scale(0.98); }
.scorer.has-goals .scorer-add { background: #fff; box-shadow: inset 3px 0 0 var(--red); }
.scorer-number {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  border-radius: 4px;
  background: var(--pine);
  color: #fff;
  font: 700 13px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
}
.scorer-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; font-weight: 600; }
.scorer-goals { flex: none; min-width: 24px; text-align: center; font: 600 18px/1 var(--font-body); color: var(--muted); }
.scorer.has-goals .scorer-goals {
  padding: 4px 6px;
  border-radius: 4px;
  background: var(--red);
  color: #fff;
  font: 700 14px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
}
.scorer-undo {
  flex: none;
  width: 38px;
  border: 1px solid rgb(255 255 255 / 0.35);
  border-radius: var(--radius-s);
  background: transparent;
  color: #fff;
  font: 600 20px/1 var(--font-body);
  cursor: pointer;
  transition: background-color var(--fast), border-color var(--fast);
}
.scorer-undo:hover { background: rgb(255 255 255 / 0.12); border-color: rgb(255 255 255 / 0.7); }
.scorer-empty {
  padding: 8px 10px;
  border: 1px dashed rgb(255 255 255 / 0.35);
  border-radius: var(--radius-s);
  font-size: 13px;
  color: rgb(255 255 255 / 0.85);
}

.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.spacer { flex: 1; }

/* ---------- Sync status ---------- */

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-m);
  background: rgb(255 255 255 / 0.08);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.16);
  font: 500 14px/1 var(--font-body);
  white-space: nowrap;
}
.sync-chip:empty { display: none; }
.sync-chip::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: rgb(255 255 255 / 0.55); }
.sync-chip[data-kind='saved']::before { background: var(--ok); box-shadow: 0 0 0 3px rgb(74 222 128 / 0.2); }
.sync-chip[data-kind='saving']::before,
.sync-chip[data-kind='loading']::before { background: var(--gold-soft); animation: live-pulse 1.1s ease-in-out infinite; }
.sync-chip[data-kind='offline'],
.sync-chip[data-kind='auth'] { background: rgb(233 178 58 / 0.16); box-shadow: inset 0 0 0 1px rgb(233 178 58 / 0.6); }
.sync-chip[data-kind='offline']::before,
.sync-chip[data-kind='auth']::before { background: var(--amber); }

/* ---------- Login ---------- */

.login {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px;
  overflow: hidden;
  background:
    var(--fairy-lights),
    radial-gradient(70vw 50vh at 50% -10%, rgb(255 214 150 / 0.12), transparent 70%),
    var(--night);
}
.login-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  width: min(400px, 100%);
  padding: 28px 28px 26px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 30px 70px -30px rgb(0 0 0 / 0.8), inset 0 4px 0 var(--red), inset 0 6px 0 var(--gold);
}
.login-crest { justify-self: center; margin-bottom: 8px; background: var(--pine); color: #fff; box-shadow: inset 0 0 0 2px var(--pine), inset 0 0 0 3.5px var(--gold), 0 8px 18px -8px rgb(0 0 0 / 0.45); }
.login-eyebrow { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 0; font: 600 12px/1.2 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.login-title { margin: 0 0 10px; text-align: center; font: 700 27px/1.15 var(--font-display); color: var(--pine); text-wrap: balance; }
.field { margin-top: 6px; font-weight: 600; font-size: 14px; color: var(--ink-soft); }
.login-submit { margin-top: 10px; width: 100%; }
.login-link { margin-top: 6px; text-align: center; font-weight: 600; color: var(--pine-mid); text-decoration: none; }
.login-link:hover { text-decoration: underline; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: var(--radius-m);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 16px 40px -12px rgb(0 0 0 / 0.55);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 200ms, transform 300ms var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind='error'] { background: var(--live); }
.toast:empty { display: none; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 20px 16px; gap: 16px; }
  .panel--teams { position: static; grid-row: auto; max-height: none; }
  .panel--scorers { grid-column: auto; }
  .topbar { padding: 28px 16px 16px; }
  .footer { padding: 0 16px 24px; }
}

@media (max-width: 520px) {
  .panel { padding: 16px; }
  .add-team { flex-direction: column; }
  .crest { width: 44px; height: 44px; font-size: 15px; }
  .scoreboard { grid-template-columns: 1fr 64px auto 64px 1fr; gap: 6px; }
  .score-input { height: 64px; font-size: 34px; }
  .score-team { font-size: 15px; }
  .score-dialog { padding: 22px 16px; }
  .scorer-cols { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
