/* Mobile-first. Palette from pirkkalanpingviinit.fi: primary red #eb1f2a, black, greys #1a1a1a/#404040, white, Lato */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&display=swap');
:root {
  --bg: #000000; --card: #1a1a1a; --card-alt: #262626; --border: #404040; --text: #ffffff; --muted: #b3b3b3;
  --primary: #eb1f2a; --primary-hover: #ff3641; --gold: #ffd200; --ok: #3fbf7f;
  --tap: 44px; --radius: 8px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 12px calc(32px + env(safe-area-inset-bottom)); }

/* header */
header { position: sticky; top: 0; z-index: 10; background: var(--bg); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; margin-bottom: 12px; border-bottom: 3px solid var(--primary); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.brand img { width: 40px; height: 40px; flex: none; }
h1 { font-size: 18px; margin: 0; min-width: 0; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; line-height: 1.1; }
h1 small { display: block; white-space: normal; font-size: 12px; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
h2 { font-size: 13px; margin: 0 0 10px; color: var(--gold); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.card { scroll-margin-top: 76px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 12px; margin-bottom: 14px; }

/* forms */
form { display: grid; gap: 10px; }
.row { display: grid; gap: 10px; }
.row.scores { grid-template-columns: 1fr 1fr; align-items: end; }
.row.scores label:nth-child(1), .row.scores label:nth-child(4) { grid-column: span 2; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea { width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: 6px; border: 1px solid var(--border); background: #0d0d0d; color: var(--text); font: inherit; font-size: 16px; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 32px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
input[type=number] { text-align: center; font-size: 28px; font-weight: 900; min-height: 60px; -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }
button, a.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 10px 18px; border: 0; border-radius: 6px; background: var(--primary); color: #fff; font: inherit; font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button:hover, a.btn:hover { background: var(--primary-hover); }
button:disabled { opacity: .6; cursor: default; }
button.ghost, a.ghost { background: transparent !important; color: var(--muted); border: 1px solid var(--border); }
button.ghost:hover, a.ghost:hover { color: var(--text); border-color: var(--muted); }
button.small, a.small { min-height: 36px; padding: 6px 12px; font-size: 13px; }
button.danger, a.danger { background: transparent; color: var(--primary); border: 1px solid var(--border); }
button.danger:hover, a.danger:hover { background: var(--primary); color: #fff; }
.actions { display: flex; gap: 8px; }
form .actions { flex-direction: column-reverse; }
form .actions button { width: 100%; }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
form.inline input { flex: 1 1 140px; min-width: 0; }
form.inline input[type=date] { flex: 1 1 150px; }
form.inline button { flex: 1 0 auto; }
.msg { min-height: 20px; font-size: 14px; }
.msg.error { color: var(--primary); }
.msg.ok { color: var(--ok); }
.hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.empty { color: var(--muted); text-align: center; padding: 20px; font-size: 14px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 4px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
tbody tr:nth-child(even) { background: var(--card-alt); }
table.standings th, table.standings td { text-align: center; font-variant-numeric: tabular-nums; }
table.standings th.team, table.standings td.team { text-align: left; width: 100%; font-weight: 700; padding-left: 6px; }
table.standings td.rank { color: var(--muted); }
table.standings td.pts { font-weight: 900; color: var(--gold); font-size: 17px; }
table.standings tbody tr:first-child td.team { color: var(--gold); }
h3.round { font-size: 13px; margin: 14px 0 4px; padding: 7px 10px; background: var(--primary); color: #fff; border-radius: 6px; text-transform: uppercase; letter-spacing: .06em; display: flex; justify-content: space-between; gap: 8px; }
h3.round span { font-weight: 400; text-transform: none; letter-spacing: 0; }
h3.round:first-child { margin-top: 0; }
table.results td { padding: 12px 4px; }
table.results td.home { text-align: right; width: 38%; }
table.results td.away { text-align: left; width: 38%; }
table.results td.win { font-weight: 900; }
table.results td.score { text-align: center; font-weight: 900; font-size: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; padding: 12px 8px; }
table.results td.notes { font-size: 13px; color: var(--muted); }
table.results tr.tap { cursor: pointer; }
table.results tr.tap td.chev { width: 20px; color: var(--muted); text-align: right; }
table.results tr.tap:active { background: var(--border); }
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: var(--tap); padding: 4px 0; border-bottom: 1px solid var(--border); }
ul.list li small { color: var(--muted); margin-left: 6px; }
ul.list li.empty { justify-content: center; }
.two-col { display: grid; gap: 14px; }
.hide-sm { display: none; }

/* login */
.login { max-width: 360px; margin: 8vh auto; text-align: center; }
.login img { width: 120px; height: 120px; }
.login form { text-align: left; }

/* larger screens */
@media (min-width: 600px) {
  .wrap { padding: 0 16px 40px; }
  header { padding: 14px 0; margin-bottom: 20px; }
  .brand img { width: 52px; height: 52px; }
  h1 { font-size: 22px; }
  .card { padding: 16px; margin-bottom: 20px; }
  .row { grid-template-columns: 1fr 1fr; }
  .row.scores { grid-template-columns: 1fr 88px 88px 1fr; }
  .row.scores label:nth-child(1), .row.scores label:nth-child(4) { grid-column: auto; }
  input[type=number] { font-size: 22px; min-height: var(--tap); }
  form .actions { flex-direction: row; justify-content: flex-end; }
  form .actions button { width: auto; }
  .two-col { grid-template-columns: 1fr 1fr; gap: 20px; }
  .hide-sm { display: table-cell; }
  table.results td.home, table.results td.away { width: 32%; }
  th, td { padding: 8px 6px; }
}
header .actions { align-items: center; flex-wrap: nowrap; }
header .actions .small { padding: 6px 10px; white-space: nowrap; }
.lang-toggle { min-width: 40px; font-weight: 900; }
@media (max-width: 599px) { header .actions .small { font-size: 12px; padding: 6px 8px; } }
h1 .season { font-weight: 700; color: var(--gold); }
.season-line { margin: 0 0 16px; color: var(--gold); font-weight: 700; }
header .actions { flex: none; }
footer { display: flex; justify-content: center; padding: 8px 0; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; margin: 0 6px; }
td.team .dot { margin-left: 0; }
ul.list .dot { margin-left: 0; }
input[type=color] { flex: 0 0 52px !important; padding: 4px; min-height: var(--tap); cursor: pointer; }
