/* Metropolis (SIL OFL) – sama fontti kuin blackbirds.fi:ssä, ladattu omalta palvelimelta */
@font-face { font-family: Metropolis; font-weight: 400; font-display: swap; src: url(fonts/metropolis-400.woff2) format("woff2"); }
@font-face { font-family: Metropolis; font-weight: 600; font-display: swap; src: url(fonts/metropolis-600.woff2) format("woff2"); }
@font-face { font-family: Metropolis; font-weight: 800; font-display: swap; src: url(fonts/metropolis-800.woff2) format("woff2"); }
@font-face { font-family: Metropolis; font-weight: 900; font-display: swap; src: url(fonts/metropolis-900.woff2) format("woff2"); }

/* Blackbirds United -värit logosta: keltainen kilpi, lähes musta lintu, hopeinen reunus ja nauha */
:root {
  --bb-yellow: #ffc000;
  --bb-black: #231f20;
  --bb-silver: #a09a98;
  --bb-ribbon: #dcdcdc;

  --bg: #121011;
  --card: #1c191a;
  --card-2: #2a2627;
  --line: #3a3536;
  --text: #f5f3f2;
  --muted: #aaa3a1;
  --accent: var(--bb-yellow);
  --accent-ink: var(--bb-black);
  --accent-soft: #3a2f0c;
  --good: #3ddc84;
  --bad: #ff5a5f;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 Metropolis, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  /* keltainen raita yläreunassa kuten seuran pelipaidoissa ja kotisivulla */
  border-top: 5px solid var(--bb-yellow);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }
.wrap.wide { max-width: 1100px; }

/* ---------- yläpalkki ---------- */
.top { display: flex; align-items: center; gap: 14px; padding: 6px 0 18px; }
.crest { width: 64px; height: 64px; flex: none; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5)); }
.club { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.top h1 { margin: 2px 0 0; font-size: 22px; line-height: 1.15; font-weight: 900; }
.top .spacer { flex: 1; }
/* joukkueen nimi hopeisella nauhalla kuten logon BLACKBIRDS-teksti */
.ribbon {
  display: inline-block; margin-top: 6px; padding: 5px 14px 4px;
  background: var(--bb-ribbon); color: var(--bb-black);
  border-top: 2px solid var(--bb-silver); border-bottom: 2px solid var(--bb-silver);
  font-weight: 900; text-transform: uppercase; letter-spacing: .03em;
  transform: rotate(-2deg) skewX(-6deg);
}
.ribbon > span { display: inline-block; transform: skewX(6deg); }

/* ---------- kortit ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.card h2 .right { float: right; color: var(--text); font-weight: 700; }
.hello { font-size: 20px; font-weight: 700; margin: 0 0 14px; }
.hello button { margin-left: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- valinnat ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.label { font-size: 13px; color: var(--muted); margin: 14px 0 8px; font-weight: 600; }
.label:first-child { margin-top: 0; }

.opt {
  background: var(--card-2); border: 2px solid transparent; border-radius: 12px;
  padding: 12px 10px; cursor: pointer; text-align: left; min-height: 48px;
  display: flex; align-items: center; gap: 8px; font-weight: 600;
  transition: transform .08s, border-color .15s, background .15s;
}
.opt:active { transform: scale(.97); }
.opt .em { font-size: 22px; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.chip {
  background: var(--card-2); border: 2px solid transparent; border-radius: 999px;
  padding: 8px 14px; cursor: pointer; font-weight: 700; min-width: 56px;
}
.chip.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.player-btn { justify-content: center; text-align: center; }
.player-btn .num { color: var(--muted); font-weight: 500; font-size: 13px; }

.stepper { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.stepper input {
  width: 90px; text-align: center; background: var(--card-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px; font-weight: 700;
}
input[type=date], input[type=text], input[type=password], input[type=number], select, textarea {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px;
}
textarea { width: 100%; min-height: 140px; resize: vertical; }

.btn {
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 800; cursor: pointer;
  background: var(--card-2); color: var(--text);
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.big { width: 100%; padding: 16px; font-size: 18px; margin-top: 16px; }
.btn.danger { background: #3a1517; color: #ffb3b5; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; font-size: 14px; }

/* ---------- tilastot ---------- */
.goal-num { font-size: 34px; font-weight: 900; line-height: 1; }
.goal-num small { font-size: 15px; color: var(--muted); font-weight: 600; }
.bar { height: 14px; border-radius: 999px; background: var(--card-2); overflow: hidden; margin: 12px 0 6px; }
.bar > i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, #e0a200, var(--accent));
  transition: width 1.2s cubic-bezier(.2, .8, .2, 1);
}
.bar.done > i { background: linear-gradient(90deg, #2ecc71, var(--good)); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { background: var(--card-2); border-radius: 12px; padding: 12px; }
.tile .v { font-size: 24px; font-weight: 900; }
.tile .k { font-size: 12px; color: var(--muted); font-weight: 600; }

.level { display: flex; align-items: center; gap: 14px; }
.level .big-em { font-size: 46px; line-height: 1; }
.level .name { font-size: 20px; font-weight: 900; }

.rank { list-style: none; padding: 0; margin: 0; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.rank li:last-child { border-bottom: 0; }
.rank .pos { width: 26px; text-align: center; font-weight: 900; color: var(--muted); }
.rank .nm { flex: 1; font-weight: 600; }
.rank .val { font-weight: 800; }
.rank .val small { color: var(--muted); font-weight: 500; }
.rank li.me { background: var(--accent-soft); border-radius: 10px; border-bottom-color: transparent; }
.rank li.me .nm { color: var(--accent); }

.weeks { display: flex; align-items: flex-end; gap: 6px; height: 110px; margin-top: 6px; }
.weeks .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.weeks .col i { width: 100%; background: var(--bb-silver); opacity: .55; border-radius: 6px 6px 2px 2px; min-height: 3px; }
.weeks .col.now i { background: var(--accent); }
.weeks .col span { font-size: 11px; color: var(--muted); margin-top: 4px; }
.weeks .col b { font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }

.acts { display: grid; gap: 6px; margin-top: 4px; }
.acts .row { display: grid; grid-template-columns: 26px 1fr 60px; align-items: center; gap: 8px; font-size: 14px; }
.acts .row .b { height: 8px; border-radius: 99px; background: var(--card-2); overflow: hidden; }
.acts .row .b i { display: block; height: 100%; background: #b38700; }
.acts .row .n { text-align: right; color: var(--muted); }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; font-size: 14px; }
.feed li:last-child { border-bottom: 0; }
.feed .t { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

.badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.badge { text-align: center; background: var(--card-2); border-radius: 12px; padding: 10px 4px; font-size: 11px; color: var(--muted); }
.badge .em { font-size: 26px; display: block; filter: grayscale(1) opacity(.3); }
.badge.on { color: var(--text); background: var(--accent-soft); }
.badge.on .em { filter: none; }

.err { color: var(--bad); font-weight: 600; margin-top: 10px; min-height: 1em; }
.foot { text-align: center; margin-top: 24px; }

/* ---------- juhlinta ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(5, 5, 7, .88); z-index: 50;
  display: grid; place-items: center; padding: 20px; backdrop-filter: blur(4px);
}
.overlay[hidden] { display: none; }
.celebrate { text-align: center; max-width: 420px; width: 100%; animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.celebrate .boom { font-size: 80px; line-height: 1; }
.celebrate .plus { font-size: 46px; font-weight: 900; color: var(--accent); margin: 8px 0 0; }
.celebrate p { margin: 6px 0 14px; font-size: 18px; }
.celebrate .extra { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 12px 0; text-align: left; }
.celebrate .actions { display: flex; gap: 10px; margin-top: 16px; }
.celebrate .actions .btn { flex: 1; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 70;
  background: var(--card-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px;
}

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 700; }
.tabs button.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.row-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-flex > .grow { flex: 1; min-width: 160px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
tr.flag td { background: #2a1416; }
.tbl-wrap { overflow-x: auto; }
.team-link { font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; color: var(--muted); }
.qr { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; }
td input[type=number] { width: 70px; }
td input, td select { padding: 5px 6px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--card-2); font-size: 12px; color: var(--muted); }

input.sel { border-color: var(--accent); }

@media print {
  body { background: #fff; color: #000; }
  .noprint, #app { display: none !important; }
  .overlay { position: static; background: none; backdrop-filter: none; }
  .overlay .card { background: #fff; border: 0; color: #000; }
  .overlay h2 { color: #000 !important; }
}

/* ---------- Blackbirds-ilme ---------- */
.weeks .col.now i { opacity: 1; }
.card h2 {
  text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 800;
  padding-left: 10px; border-left: 3px solid var(--accent); line-height: 1.2;
}
.card h2 .right { text-transform: none; letter-spacing: 0; font-size: 13px; }
.btn.primary, .btn.big { text-transform: uppercase; letter-spacing: .04em; font-weight: 900; }
.btn.primary { box-shadow: 0 3px 0 #b38700; }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #b38700; }
.goal-num, .tile .v, .level .name, .celebrate .plus { font-weight: 900; letter-spacing: -.01em; }
.level .big-em img { width: 46px; height: 46px; }
.brand-foot { text-align: center; margin-top: 28px; color: var(--muted); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.brand-foot img { width: 34px; height: 34px; display: block; margin: 0 auto 6px; opacity: .85; }

/* ---------- tasomerkit: seuran logo + tason värinen rengas ---------- */
.lvl {
  --s: 46px; --ring: #6b6566;
  width: var(--s); height: var(--s); flex: none; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #2e2a2b, #161314);
  box-shadow: 0 0 0 calc(var(--s) * .06) var(--ring), 0 2px 8px rgba(0, 0, 0, .5);
}
.lvl img { width: 74%; height: 74%; object-fit: contain; }
.lvl-first img { filter: grayscale(1) brightness(.85); }
.lvl-top {
  background: radial-gradient(circle at 50% 40%, #3a2f0c, #161314);
  box-shadow: 0 0 0 calc(var(--s) * .06) var(--ring), 0 0 calc(var(--s) * .45) rgba(255, 192, 0, .55);
}
.celebrate .boom .lvl { margin: 0 auto 6px; }
.rank .lvl { margin: 0 2px; }

/* ---------- tiedoston valinta (MyClub-tuonti) ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.file-drop {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px; border: 2px dashed var(--bb-yellow); border-radius: 12px;
  background: var(--accent-soft); cursor: pointer; transition: background .15s, border-color .15s;
}
.file-drop:hover, .file-drop.over { background: #4a3c0e; }
.file-drop:focus-within { outline: 2px solid var(--bb-yellow); outline-offset: 2px; }
.file-drop .btn { pointer-events: none; }
.file-drop-text { color: var(--muted); }
.file-drop-text b { color: var(--text); }
.file-drop.disabled { border-color: var(--line); background: var(--card-2); cursor: not-allowed; opacity: .7; }
