/* Layout: one narrow column like a club notice board; coloured band on top,
   condensed scoreboard numerals, two bib colours for the teams. */
:root {
  /* Colours come from /group/theme.css (palette of the group, light and dark). */
  --display: "Barlow Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5; }
[hidden] { display: none !important; }
button, input { font: inherit; }
:focus-visible { outline: 2px solid var(--highlight); outline-offset: 2px; }
.wrap { max-width: 900px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* hero */
.hero { background: var(--primary); color: var(--primary-ink); background-image: repeating-linear-gradient(90deg, transparent 0 60px, rgba(0, 0, 0, .06) 60px 120px); padding-top: env(safe-area-inset-top, 0px); }
.hero-inner { padding-block: 26px 20px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; }
h1 { font-family: var(--display); font-weight: 700; font-size: 3rem; line-height: .95; margin: 0; text-transform: uppercase; letter-spacing: .01em; }
.hero-sub { margin: 6px 0 0; opacity: .85; font-size: .95rem; }
.hero-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.stats { display: flex; gap: 22px; }
.stat { display: flex; flex-direction: column; align-items: flex-end; }
.stat b { font-family: var(--display); font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.session { display: flex; gap: 10px; align-items: center; font-size: .85rem; }
.role-pill { border: 1px solid var(--chalk); border-radius: 999px; padding: 2px 10px; text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }
.link-btn { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; }

.main { padding-block: 22px 48px; display: flex; flex-direction: column; gap: 22px; }
#app-view { display: flex; flex-direction: column; gap: 18px; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
h2, h3 { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; margin: 0; }
h2 { font-size: 1.6rem; } h3 { font-size: 1.3rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

/* login */
.login { display: flex; justify-content: center; }
.login-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 10px; }
.login-card p { margin: 0; }
.login-card label { font-size: .85rem; color: var(--muted); }
input[type=password], input[type=text], input[type=date], input[type=number], input:not([type]) { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); padding: 8px 10px; min-width: 0; }

/* buttons and messages */
.btn { background: var(--primary); color: var(--primary-ink); border: 0; border-radius: 6px; padding: 9px 16px; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn.danger { background: transparent; color: var(--loss); border: 1px solid var(--loss); }
.msg { font-size: .9rem; margin: 0; min-height: 0; }
.msg:empty { display: none; }
.msg.err { color: var(--loss); } .msg.ok { color: var(--win); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); overflow-x: auto; }
.tabs button { font-family: var(--display); font-weight: 600; font-size: 1.15rem; letter-spacing: .03em; text-transform: uppercase; background: none; border: 0; color: var(--muted); padding: 6px 12px 8px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--highlight); }

/* table */
.table-box { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; text-align: right; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th.l, td.l { text-align: left; }
td.rank { font-family: var(--display); font-weight: 700; font-size: 1.2rem; color: var(--muted); width: 2.5em; }
tr.top td.rank { color: var(--win); }
td.name { font-weight: 600; }
td.elo { font-family: var(--display); font-weight: 700; font-size: 1.35rem; }
.delta { font-size: .85rem; }
.up { color: var(--win); } .down { color: var(--loss); } .flat { color: var(--muted); }
.form { display: inline-flex; gap: 3px; }
.form i { display: inline-block; width: 18px; height: 18px; border-radius: 3px; font-style: normal; font-size: .68rem; font-weight: 600; line-height: 18px; text-align: center; color: var(--surface); }
.form i.S { background: var(--win); } .form i.U { background: var(--draw); } .form i.N { background: var(--loss); }
.spark { display: block; }
.tag { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; margin-left: 6px; font-weight: 500; }
@media (max-width: 620px) { .hide-sm { display: none; } }

/* games */
.games { display: flex; flex-direction: column; gap: 10px; }
.game { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px 14px; align-items: start; }
.game-head { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.game-score { font-family: var(--display); font-weight: 700; font-size: 2rem; line-height: 1; align-self: center; font-variant-numeric: tabular-nums; }
.game-team { font-size: .88rem; min-width: 0; }
.game-team.b { text-align: right; }
.game-team strong { display: block; font-family: var(--display); font-size: 1.05rem; text-transform: uppercase; letter-spacing: .03em; }
.game-team.a strong { color: var(--team-a-text); } .game-team.b strong { color: var(--team-b-text); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; padding: 24px 20px; text-align: center; color: var(--muted); }

/* enter match */
.meta-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: .9rem; }
.meta-row select { font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); padding: 6px 8px; }
.roster { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line); min-width: 0; }
.row .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .label small { color: var(--muted); margin-left: 6px; font-variant-numeric: tabular-nums; }
.row.in-a { background: var(--team-a-soft); } .row.in-b { background: var(--team-b-soft); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; flex: none; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 4px 11px; cursor: pointer; font-weight: 600; font-size: .85rem; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on.A { background: var(--team-a); color: #fff; }
.seg button.on.B { background: var(--team-b); color: #fff; }
@media (max-width: 520px) { h1 { font-size: 2.3rem; } .hero-right { align-items: flex-start; } .stat { align-items: flex-start; } .game { padding: 10px 12px; gap: 6px 8px; } }

/* admin */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 14px; align-items: start; }
.admin-grid p { margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form input { flex: 1 1 140px; }
.list { border: 1px solid var(--line); border-radius: 8px; }
.list .row:last-child { border-bottom: 0; }
.row .row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row.paused .label { color: var(--muted); }

.explain { font-size: .92rem; }
.explain p { margin: 6px 0; max-width: 68ch; }
.explain code { background: var(--sunken); padding: 1px 5px; border-radius: 4px; font-size: .88em; overflow-wrap: anywhere; }
.explain ul { margin: 6px 0; padding-left: 20px; max-width: 68ch; }

/* small-screen adjustments */
.list .row { flex-wrap: wrap; }
.list .row .label { white-space: normal; }
@media (max-width: 520px) {
  .tabs { flex-wrap: wrap; overflow-x: visible; }
  .tabs button { font-size: 1rem; padding: 6px 8px 8px; }
}

/* share image */
.table-tools { margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }

/* settings */
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; cursor: pointer; }
.check input { margin-top: 4px; }

/* admin site: group settings */
.group-form .fields { display: flex; flex-direction: column; gap: 10px; }
.group-form label:not(.check) { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
.group-form label small { font-size: .78rem; }
.group-form input:not([type=checkbox]), .group-form select { color: var(--ink); font-size: .95rem; }
.group-form select { font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); padding: 7px 8px; }
.field-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.field-row label { flex: 1 1 150px; }
.icon-preview { width: 56px; height: 56px; border-radius: 12px; flex: none; }
.group-form a { color: inherit; }

/* team proposal and bib changes */
.proposal { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--highlight); border-radius: 10px; padding: 10px 14px; font-size: .9rem; }
.proposal p { margin: 2px 0; }
.bib-games { margin-top: 14px; }
.bib-game { grid-template-columns: 1fr 1fr; }

/* player profile */
.name-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; text-align: left; }
.profile { width: min(560px, calc(100% - 24px)); max-height: calc(100% - 32px); overflow-y: auto; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); }
.profile:not([open]) { display: none; }
.profile[open] { position: fixed; inset: 16px 0 auto; margin: 0 auto; z-index: 10; }
.profile::backdrop { background: rgba(0, 0, 0, .45); }
.profile-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.close-btn { background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-size: 1.1rem; width: 40px; height: 40px; cursor: pointer; flex: none; }
.profile-body { padding: 12px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.profile-body h3 { font-size: 1.1rem; margin-top: 6px; }
.profile-body p { margin: 0; }
.profile-facts, .profile-pair { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.profile-facts > div, .profile-pair > div { background: var(--sunken); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.profile-facts small, .profile-pair small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.profile-facts .big { font-family: var(--display); font-size: 1.8rem; line-height: 1; }
.profile-chart { width: 100%; height: auto; display: block; background: var(--sunken); border-radius: 8px; }
.profile .list .row { flex-wrap: nowrap; }
.profile .form i { vertical-align: 1px; }

/* movement in the table */
.mv { font-style: normal; font-size: .75rem; font-weight: 600; margin-left: 5px; }
.day-best { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; font-weight: 600; }
.badge { background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .72rem; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }

/* next matchday poll */
.poll { display: flex; flex-direction: column; gap: 8px; }
.poll p { margin: 0; }
.poll-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.poll-head strong { font-size: 1.05rem; }
.poll-me { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .9rem; }
.poll-me select { font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); padding: 7px 8px; min-width: 0; }
.poll-answer button { padding: 7px 12px; }
.poll-me .poll-answer button { padding: 9px 14px; font-size: .95rem; }
.poll-me input { font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); padding: 7px 8px; min-width: 0; flex: 1 1 140px; }
.poll-full { flex-basis: 100%; }
.seg button.on.yes { background: var(--win); color: var(--surface); }
.seg button.on.no { background: var(--loss); color: var(--surface); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.poll-count { font-size: .95rem; }
.poll details summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: 2px 0; }
.poll details .list { margin-top: 6px; }
.poll details .row { flex-wrap: nowrap; }
input[type=time] { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); padding: 8px 10px; min-width: 0; }

/* scoreboard ("Spiel eintragen"), after docs/mockups/scoreboard.html.
   Layout by screen width, not by device: tablets like the iPad Air 2 (768 and 1024 px)
   get the teams side by side, phones (< 600 px) stacked. No animations, no shadows. */
.sb-board { display: grid; grid-template-columns: 1fr 120px 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.sb-team { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sb-team.a { background: var(--team-a-soft); }
.sb-team.b { background: var(--team-b-soft); text-align: right; }
.sb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sb-team.b .sb-head { flex-direction: row-reverse; }
.sb-name { font-family: var(--display); font-weight: 700; font-size: 34px; text-transform: uppercase; white-space: nowrap; }
.a .sb-name { color: var(--team-a-text); } .b .sb-name { color: var(--team-b-text); }
.sb-avg { color: var(--muted); font-size: 16px; }
.sb-score { display: flex; flex-direction: column; gap: 10px; }
.sb-goals { width: 100%; min-width: 0; font-family: var(--display); font-weight: 700; font-size: 168px; line-height: .95; text-align: center; font-variant-numeric: tabular-nums; border: 0; border-radius: 10px; background: transparent; color: var(--ink); padding: 0; -moz-appearance: textfield; appearance: textfield; }
.sb-goals::-webkit-outer-spin-button, .sb-goals::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sb-goals::placeholder { color: var(--ink); opacity: 1; }
.sb-goals:focus { background: var(--surface); }
.sb-btns { display: grid; grid-template-columns: 1fr 88px; gap: 10px; }
.sb-team.b .sb-btns { grid-template-columns: 88px 1fr; }
.sb-plus, .sb-minus { border: 0; border-radius: 12px; font-family: var(--display); font-weight: 700; cursor: pointer; touch-action: manipulation; }
.sb-plus { height: 104px; font-size: 52px; color: #fff; }
.a .sb-plus { background: var(--team-a); } .b .sb-plus { background: var(--team-b); }
.sb-minus { height: 104px; font-size: 30px; background: var(--surface); color: var(--muted); border: 2px solid var(--line); }
.sb-players { font-size: 16px; }
.sb-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); padding: 8px 4px; }
.sb-colon { font-family: var(--display); font-weight: 700; font-size: 110px; line-height: .8; color: var(--muted); }
.sb-mid small { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; text-align: center; }
.sb-mid b { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sb-info { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; display: flex; flex-direction: column; gap: 8px; }
.sb-info p { margin: 0; }
.sb-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--sunken); }
.sb-bar .x { background: var(--team-a); width: var(--share-a, 50%); } .sb-bar .y { background: var(--team-b); flex: 1; }
.sb-line { display: flex; justify-content: space-between; gap: 12px; font-size: 16px; }
.sb-line .note { color: var(--muted); font-size: 14px; }
.sb-line .up, .sb-line .down { font-weight: 700; }
.sb-actions { display: flex; gap: 12px; align-items: stretch; }
.sb-save { flex: 1.4; min-height: 64px; border: 0; border-radius: 12px; background: var(--primary); color: var(--primary-ink); font-size: 22px; font-weight: 700; cursor: pointer; }
.sb-save:disabled { opacity: .45; cursor: not-allowed; }
.sb-ghost { flex: 1; min-height: 64px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-size: 17px; font-weight: 600; cursor: pointer; }
.sb-ghost:disabled { opacity: .45; cursor: not-allowed; }
@media (min-width: 600px) and (orientation: portrait) {
  .sb-goals { font-size: 200px; }
  .sb-plus, .sb-minus { height: 140px; }
  .sb-team { gap: 18px; padding-block: 24px 28px; }
  .sb-board { grid-template-columns: 1fr 104px 1fr; }
  .sb-mid small { font-size: 11px; letter-spacing: .04em; }
  .sb-colon { font-size: 90px; }
  .sb-actions { flex-wrap: wrap; }
  .sb-save { flex-basis: 100%; }
}
@media (max-width: 599px) {
  .sb-board { grid-template-columns: 1fr; }
  .sb-team { padding: 12px 14px 14px; gap: 8px; }
  .sb-team.b { text-align: left; }
  .sb-team.b .sb-head { flex-direction: row; }
  .sb-name { font-size: 26px; }
  .sb-avg { font-size: 13px; }
  .sb-score { display: grid; grid-template-columns: 92px 1fr 64px; gap: 10px; align-items: center; }
  .sb-goals { font-size: 88px; text-align: left; }
  .sb-btns { display: contents; }
  .sb-team.b .sb-btns .sb-minus { order: 2; }
  .sb-plus, .sb-minus { height: 88px; }
  .sb-plus { font-size: 40px; } .sb-minus { font-size: 24px; }
  .sb-players { font-size: 13px; color: var(--muted); }
  .sb-mid { flex-direction: row; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 0; gap: 8px; }
  .sb-colon { display: none; }
  .sb-mid b { font-size: 15px; }
  .sb-info { padding: 10px 14px; }
  .sb-line { flex-direction: column; gap: 2px; font-size: 14px; }
  .sb-line .note { font-size: 12px; }
  .sb-actions { flex-wrap: wrap; gap: 8px; }
  .sb-save { flex-basis: 100%; min-height: 56px; font-size: 19px; }
  .sb-ghost { min-height: 52px; font-size: 15px; }
}
.scoreboard .hero-inner { padding-block: 10px; align-items: center; }
.scoreboard h1 { font-size: 30px; }
.scoreboard .hero-sub, .scoreboard .stats, .scoreboard #explain, .scoreboard #next-matchday { display: none; }
.scoreboard .main { padding-top: 12px; gap: 12px; }
/* iPad in landscape (768 px high): smaller numbers so "Spiel speichern" stays on screen */
@media (min-width: 600px) and (orientation: landscape) and (max-height: 820px) {
  .sb-goals { font-size: 128px; }
  .sb-plus, .sb-minus { height: 92px; }
  .sb-team { padding-block: 12px 14px; gap: 8px; }
  .sb-colon { font-size: 80px; }
}
