:root {
  --ink: #16221f;
  --muted: #64716d;
  --line: #dce5e1;
  --canvas: #f4f7f5;
  --surface: #ffffff;
  --brand: #0f6b5d;
  --brand-dark: #094d43;
  --brand-soft: #e3f3ee;
  --accent: #d9f26a;
  --orange: #f4a261;
  --danger: #ba3a3a;
  --shadow: 0 12px 36px rgba(18, 46, 39, .08);
  --radius: 22px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100%; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(15,107,93,.25); outline-offset: 2px; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 7px; color: var(--brand); font-size: 11px; font-weight: 850; letter-spacing: .13em; }
.muted { color: var(--muted); }
.desktop-only { display: inline; }
.full-width { width: 100%; }
.stack { display: grid; gap: 10px; }
.print-only { display: none; }

.button, .icon-button, .nav-item, .text-button { border: 0; min-height: 44px; border-radius: 13px; transition: transform .16s ease, background .16s ease, box-shadow .16s ease; }
.button:active, .icon-button:active, .nav-item:active { transform: scale(.98); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 11px 16px; font-weight: 750; }
.button-primary { color: #fff; background: var(--brand); box-shadow: 0 7px 18px rgba(15,107,93,.18); }
.button-primary:hover { background: var(--brand-dark); }
.button-soft { color: var(--brand-dark); background: var(--brand-soft); }
.button-surface { color: var(--ink); background: var(--surface); border: 1px solid var(--line); }
.button-danger { color: #fff; background: var(--danger); }
.button-small { min-height: 44px; padding: 8px 12px; }
.icon-button { display: inline-grid; place-items: center; min-width: 44px; padding: 0; color: var(--ink); background: #eef3f1; font-size: 21px; }
.text-button { min-width: 44px; min-height: 44px; padding: 4px 0; color: var(--brand); background: transparent; font-weight: 800; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 850; letter-spacing: -.02em; }
.brand-large { font-size: 20px; }
.brand-mark { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--accent); background: var(--brand); font-family: "SF Pro Display", "SF Pro Text", Inter, ui-sans-serif, sans-serif; font-size: 13px; font-weight: 950; letter-spacing: -.04em; }
.brand-large .brand-mark { width: 44px; height: 44px; border-radius: 14px; }
.brand-button { border: 0; cursor: pointer; }

.start-view { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 560px) minmax(380px, 620px); justify-content: center; align-items: center; gap: clamp(50px,8vw,130px); padding: clamp(28px,5vw,70px); overflow: hidden; background: radial-gradient(circle at 85% 15%, #dff1e9 0, transparent 38%), var(--canvas); }
.start-panel h1 { margin: 22px 0 18px; max-width: 600px; font-size: clamp(48px,6.3vw,84px); line-height: .96; letter-spacing: -.065em; }
.start-panel > .eyebrow { margin-top: 24px; }
.start-copy { max-width: 510px; margin: 0 0 28px; color: var(--muted); font-size: 18px; line-height: 1.55; }
.start-actions { display: grid; gap: 10px; max-width: 470px; }
.button-hero { min-height: 72px; justify-content: flex-start; padding: 13px 18px; text-align: left; border-radius: 18px; }
.button-hero > span:first-child { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: rgba(255,255,255,.16); font-size: 23px; }
.button-surface.button-hero > span:first-child { color: var(--brand); background: var(--brand-soft); }
.button-hero strong, .button-hero small { display: block; }
.button-hero strong { font-size: 16px; }
.button-hero small { margin-top: 3px; color: inherit; opacity: .68; font-size: 12px; font-weight: 600; }
.start-panel > .text-button { margin-top: 14px; }
.start-visual { position: relative; width: min(100%,540px); aspect-ratio: .93; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; border-radius: 44px; padding: 50px; overflow: hidden; box-shadow: 0 42px 90px rgba(6,60,50,.25); background: linear-gradient(145deg,#0e6d5d,#07483f); transform: rotate(1.2deg); }
.start-visual:before { content: ""; position: absolute; inset: -15% auto auto 30%; width: 90%; height: 65%; border-radius: 50%; background: rgba(217,242,106,.08); filter: blur(1px); }
.visual-top { position: absolute; top: 28px; left: 28px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 99px; background: rgba(255,255,255,.12); font-size: 12px; font-weight: 750; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(217,242,106,.12); }
.visual-score { z-index: 1; display: grid; grid-template-columns: 1fr auto auto auto 1fr; align-items: center; gap: 17px; width: 100%; text-align: center; font-size: 21px; font-weight: 750; }
.visual-score strong { font-size: clamp(62px,7vw,96px); letter-spacing: -.07em; }
.visual-score em { opacity: .5; font-size: 40px; font-style: normal; }
.visual-time { z-index: 1; margin-top: 5px; color: var(--accent); font-size: 34px; font-weight: 850; font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.visual-strip { position: absolute; right: 26px; bottom: 26px; left: 26px; display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 17px 19px; border: 1px solid rgba(255,255,255,.13); border-radius: 18px; background: rgba(255,255,255,.09); backdrop-filter: blur(10px); }
.visual-strip span { opacity: .65; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.visual-strip strong { grid-row: 1/3; grid-column: 2; font-size: 18px; }
.visual-strip small { margin-top: 4px; opacity: .72; }
.recent-list { display: grid; gap: 8px; max-width: 470px; margin-top: 22px; }
.recent-heading { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.recent-item { display: grid; grid-template-columns: minmax(0,1fr) 44px; align-items: center; gap: 8px; border-top: 1px solid var(--line); font-size: 13px; }
.recent-open { min-width: 0; display: grid; justify-items: start; gap: 3px; min-height: 54px; padding: 8px 8px 8px 14px; border: 0; border-radius: 13px; color: var(--ink); background: transparent; text-align: left; }
.recent-open:hover { background: var(--brand-soft); }
.recent-open:disabled { cursor: not-allowed; opacity: .45; }
.recent-open strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-open span { color: var(--muted); font-size: 11px; }
.recent-delete { min-width: 44px; min-height: 44px; border: 0; border-radius: 12px; color: var(--danger); background: #faeeee; font-size: 18px; }

.app-shell { min-height: 100dvh; }
.app-header { position: sticky; z-index: 30; top: 0; height: 70px; display: grid; grid-template-columns: 210px minmax(0,1fr) auto; align-items: center; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(18px); }
.tournament-title { min-width: 0; display: flex; flex-direction: column; align-items: center; }
.tournament-title strong, .tournament-title span { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tournament-title strong { font-size: 14px; }
.tournament-title span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.sync-pill { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 11px; border-radius: 99px; color: #296057; background: #edf6f3; font-size: 11px; }
.sync-pill span { width: 7px; height: 7px; border-radius: 50%; background: #44a98f; }
.sync-pill.syncing span { animation: pulse 1s infinite; background: var(--orange); }
.sync-pill.offline span { background: #84918d; }
@keyframes pulse { 50% { opacity: .25; } }

.app-body { display: grid; grid-template-columns: 196px minmax(0,1fr); min-height: calc(100dvh - 70px); }
.side-nav { position: sticky; top: 70px; height: calc(100dvh - 70px); display: flex; flex-direction: column; gap: 5px; padding: 20px 13px; border-right: 1px solid var(--line); background: #fbfcfb; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 13px; color: var(--muted); background: transparent; text-align: left; }
.nav-item span { min-width: 22px; font-size: 17px; text-align: center; }
.nav-item b { font-size: 13px; }
.nav-item.active { color: var(--brand-dark); background: var(--brand-soft); }
.bottom-nav { display: none; }
.content-area { min-width: 0; }
.page { display: none; max-width: 1280px; margin: 0 auto; padding: 30px clamp(18px,3vw,44px) 55px; }
.active-page { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: .55; transform: translateY(2px); } }
.live-heading, .page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.live-heading h2, .page-heading h2 { margin: 0; font-size: clamp(27px,3vw,40px); letter-spacing: -.045em; }
.live-heading p:last-child, .page-heading p:last-child { margin: 5px 0 0; color: var(--muted); }
.round-controls, .toolbar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.toolbar select { width: auto; min-height: 44px; }
.surface { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }

.field-cards { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.field-card { min-width: 0; overflow: hidden; border: 1px solid #d4e1dc; border-radius: 25px; background: var(--surface); box-shadow: var(--shadow); }
.field-card-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.field-card-top strong { font-size: 14px; }
.match-state { padding: 5px 9px; border-radius: 99px; color: #367367; background: var(--brand-soft); font-size: 10px; font-weight: 850; letter-spacing: .05em; }
.match-state.finished { color: #596460; background: #edf0ef; }
.scoreboard { display: grid; grid-template-columns: 1fr 74px 18px 74px 1fr; align-items: center; gap: 7px; padding: 24px 18px 12px; }
.score-team { min-width: 0; font-size: 20px; font-weight: 850; text-align: center; overflow: hidden; text-overflow: ellipsis; }
.score-number { border: 0; border-radius: 17px; color: var(--ink); background: #f1f5f3; font-size: 46px; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -.05em; cursor: pointer; }
.score-colon { color: #9ba7a3; font-size: 28px; text-align: center; }
.score-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 18px 18px; }
.team-score-actions { display: flex; justify-content: center; gap: 6px; }
.score-button { min-width: 48px; min-height: 48px; border: 0; border-radius: 14px; color: var(--brand-dark); background: var(--brand-soft); font-size: 16px; font-weight: 900; }
.score-button.minus { min-width: 42px; color: #69736f; background: #f0f2f1; }
.timer-zone { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 18px; color: #fff; background: var(--brand); }
.timer-readout { min-width: 112px; color: var(--accent); font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.timer-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.timer-buttons .button { min-height: 44px; color: var(--brand-dark); background: #fff; }
.timer-buttons .button.secondary { color: #fff; background: rgba(255,255,255,.14); }
.timer-buttons .reset-match-button { color: #fff; background: #a83d3d; }
.field-empty { min-height: 280px; display: grid; place-items: center; padding: 25px; color: var(--muted); text-align: center; }
.live-lower { display: grid; grid-template-columns: 1.3fr .9fr; gap: 16px; margin-top: 16px; }
.next-card, .mini-table-card { padding: 19px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.section-head h3 { margin: 0; font-size: 18px; }
.next-matches { display: grid; gap: 8px; margin-top: 15px; }
.next-match { display: grid; grid-template-columns: 100px 1fr auto; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 14px; background: #f5f8f6; }
.next-match strong { font-size: 14px; }
.next-match span, .next-match small { color: var(--muted); font-size: 12px; }

.mini-row { display: grid; grid-template-columns: 28px 1fr auto auto; align-items: center; gap: 8px; padding: 9px 2px; border-top: 1px solid var(--line); font-size: 13px; }
.mini-row:first-child { margin-top: 11px; }
.rank-badge { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: #eef2f0; font-size: 11px; font-weight: 850; }
.mini-row:nth-child(1) .rank-badge { color: var(--brand-dark); background: var(--accent); }

.notice { margin: 0 0 16px; padding: 13px 15px; border: 1px solid; border-radius: 15px; font-size: 13px; line-height: 1.4; }
.notice-warning { color: #76400f; border-color: #f2d1a9; background: #fff5e8; }
.notice-info { color: #315c53; border-color: #cde3dc; background: #edf7f4; }
.conflict-banner { width: 100%; text-align: left; font: inherit; cursor: pointer; }
.conflict-banner:not(:disabled)::after { content: 'Details anzeigen →'; display: block; margin-top: 3px; font-size: 12px; font-weight: 800; }
.conflict-details { display: grid; gap: 9px; margin-top: 16px; }
.conflict-detail { padding: 12px 13px; border: 1px solid #f2d1a9; border-radius: 12px; background: #fffaf4; color: #5f3711; font-size: 13px; line-height: 1.45; }
.round-list { display: grid; gap: 15px; }
.round-block { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.round-block.tie-break-round { border-color: #d8b84d; box-shadow: inset 4px 0 #d8b84d; }
.round-block.tie-break-round .round-head { background: #fff8da; }
.round-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; background: #f7f9f8; border-bottom: 1px solid var(--line); }
.round-head strong { font-size: 14px; }
.round-head span { color: var(--muted); font-size: 12px; }
.round-actions { display: flex; align-items: center; gap: 10px; }
.delete-round { color: #b33a3a; }
.schedule-match { display: grid; grid-template-columns: 130px minmax(140px,1fr) 30px minmax(140px,1fr) 105px 42px; align-items: center; gap: 9px; padding: 11px 16px; border-bottom: 1px solid #edf1ef; }
.schedule-match:last-child { border-bottom: 0; }
.schedule-match select, .schedule-match input { min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px; background: #fff; }
.schedule-score { font-weight: 850; text-align: center; font-variant-numeric: tabular-nums; }
.schedule-score.live-score { color: var(--brand); }
.pause-row { padding: 10px 18px; color: var(--muted); background: #fbfcfb; font-size: 12px; }

.table-surface { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.standing-row { display: grid; grid-template-columns: 54px minmax(150px,1fr) repeat(6,minmax(58px,.5fr)); align-items: center; gap: 8px; min-height: 58px; padding: 0 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.standing-row:last-child { border-bottom: 0; }
.standing-row.header { min-height: 42px; color: var(--muted); background: #f6f8f7; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.standing-row .team-cell { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.standing-row.shared-standing { background: #fffcf0; }
.standing-row .team-cell small { margin-left: auto; color: #8a711e; font-size: 10px; font-weight: 850; text-transform: uppercase; }
.tie-panel { margin-top: 16px; padding: 20px; border: 1px solid #e5d58e; border-radius: var(--radius); background: #fffbeb; }
.tie-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.tie-panel-head h3 { margin: 3px 0 5px; font-size: 20px; }
.tie-panel-head p { max-width: 700px; margin: 0; color: #6d6341; font-size: 13px; line-height: 1.5; }
.tie-groups { display: grid; gap: 8px; margin-top: 16px; }
.tie-groups article { display: flex; justify-content: space-between; align-items: center; gap: 15px; min-height: 52px; padding: 10px 13px; border: 1px solid rgba(138,113,30,.2); border-radius: 13px; background: rgba(255,255,255,.72); }
.tie-groups article > span, .manual-tie > div > span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.manual-tie { display: grid !important; grid-template-columns: minmax(140px,1fr) minmax(150px,220px) auto; }
.manual-tie select { margin: 0; }
.team-color { flex: 0 0 auto; width: 11px; height: 11px; border-radius: 4px; }

.bracket-scroll { overflow-x: auto; padding: 10px 2px 25px; -webkit-overflow-scrolling: touch; }
.bracket { min-width: 850px; display: grid; grid-template-columns: repeat(3,minmax(230px,1fr)); gap: 80px; align-items: center; padding: 10px 20px; }
.bracket-column { display: grid; gap: 35px; }
.bracket-column:nth-child(2) { gap: 150px; }
.bracket-title { margin: 0 0 12px; color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.bracket-match { position: relative; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.bracket-team { display: grid; grid-template-columns: 1fr 46px; align-items: center; min-height: 45px; padding-left: 13px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 750; }
.bracket-team:last-child { border-bottom: 0; }
.bracket-score-input { width: 46px; min-height: 45px; height: 100%; padding: 0; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: #f8faf9; font-weight: 900; text-align: center; }
.bracket-score-input:disabled { color: #9aa5a1; background: #f1f3f2; }
.bracket-match:not(.last):after { content: ""; position: absolute; left: 100%; top: 50%; width: 80px; border-top: 2px solid #bfd1cb; }
.bracket-empty { padding: 40px; border: 1px dashed #bdcac5; border-radius: 20px; color: var(--muted); text-align: center; }

.ceremony-stage { position: relative; min-height: 610px; overflow: hidden; padding: clamp(24px,4vw,52px); color: #fff; background: radial-gradient(circle at 50% 0, rgba(217,242,106,.2), transparent 34%), linear-gradient(145deg,#0d6c5c,#073f37); }
.ceremony-stage:before, .ceremony-stage:after { content: "★  ✦  ★"; position: absolute; top: 25px; color: rgba(217,242,106,.2); font-size: 32px; letter-spacing: 24px; animation: ceremonyFloat 4s ease-in-out infinite; }
.ceremony-stage:before { left: 5%; }
.ceremony-stage:after { right: 5%; animation-delay: -2s; }
@keyframes ceremonyFloat { 50% { transform: translateY(12px) rotate(4deg); opacity: .55; } }
.ceremony-announcement { position: relative; z-index: 2; display: grid; justify-items: center; min-height: 135px; text-align: center; animation: ceremonyReveal 1.15s cubic-bezier(.16,.84,.24,1); }
.ceremony-announcement span { color: var(--accent); font-size: 13px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.ceremony-announcement strong { margin-top: 8px; font-size: clamp(34px,5vw,68px); line-height: 1; letter-spacing: -.05em; }
.ceremony-announcement strong em { display: inline-block; margin: 0 .22em; color: var(--accent); font-size: .48em; font-style: normal; vertical-align: middle; }
.ceremony-announcement small { margin-top: 10px; color: rgba(255,255,255,.7); font-size: 13px; }
@keyframes ceremonyReveal { from { opacity: 0; transform: translateY(20px) scale(.96); } }
.ceremony-podium { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: end; gap: 16px; max-width: 900px; min-height: 310px; margin: 25px auto 0; }
.podium-place { display: grid; align-content: end; min-width: 0; transition: filter .35s ease, opacity .35s ease, transform .35s ease; }
.podium-place.waiting { opacity: .38; filter: grayscale(1); }
.podium-place.revealed { animation: podiumRise 1.35s cubic-bezier(.16,.84,.24,1) both; }
.podium-place.empty { min-height: 1px; opacity: 0; }
@keyframes podiumRise { 0% { opacity: 0; transform: translateY(100px) scale(.82); } 60% { transform: translateY(-10px) scale(1.03); } 100% { opacity: 1; transform: none; } }
.podium-team { display: grid; min-height: 80px; place-content: center; padding: 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 18px 18px 0 0; background: rgba(255,255,255,.1); text-align: center; backdrop-filter: blur(10px); }
.podium-team span { color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.podium-team strong { margin-top: 5px; overflow-wrap: anywhere; font-size: clamp(17px,2vw,25px); line-height: 1.15; }
.podium-block { display: grid; height: 120px; place-items: center; border-radius: 0 0 16px 16px; color: var(--brand-dark); background: #dfe9e5; font-size: 54px; font-weight: 950; }
.rank-1 .podium-block { height: 205px; background: linear-gradient(#e5f679,#c6dc4d); }
.rank-2 .podium-block { height: 155px; background: linear-gradient(#f2f5f4,#cbd8d4); }
.rank-3 .podium-block { background: linear-gradient(#e6b47e,#c8874f); }
.ceremony-controls { position: relative; z-index: 1; display: flex; justify-content: center; gap: 9px; margin-top: 28px; }
.ceremony-controls .button-primary { color: var(--brand-dark); background: var(--accent); }
.ceremony-controls .button-soft { color: #fff; background: rgba(255,255,255,.12); }
.ceremony-focus .app-header, .ceremony-focus .side-nav, .ceremony-focus .bottom-nav, .ceremony-focus .page:not(#ceremonyView) { display: none !important; }
.ceremony-focus .app-body, .ceremony-focus .content-area, .ceremony-focus #ceremonyView { display: block; min-height: 100dvh; padding: 0; }
.ceremony-focus #ceremonyView .page-heading, #ceremonyView:fullscreen .page-heading { display: none; }
.ceremony-focus .ceremony-stage, #ceremonyView:fullscreen .ceremony-stage { min-height: 100dvh; border: 0; border-radius: 0; }
.ceremony-focus .ceremony-controls, #ceremonyView:fullscreen .ceremony-controls { margin-top: clamp(56px,8vh,92px); }
#ceremonyView:fullscreen { width: 100vw; max-width: none; min-height: 100vh; padding: 0; overflow: auto; background: #073f37; }
.confetti-layer { position: absolute; z-index: 4; inset: 0; overflow: hidden; pointer-events: none; }
.confetti-layer i { position: absolute; top: -28px; left: var(--x); width: 10px; height: 18px; border-radius: 2px; background: var(--confetti); opacity: 0; transform: rotate(0); animation: confettiFall var(--duration) var(--delay) cubic-bezier(.2,.65,.35,1) forwards; }
.confetti-layer i:nth-child(3n) { width: 15px; height: 8px; border-radius: 50%; }
.confetti-layer i:nth-child(4n) { width: 7px; height: 22px; }
.winner-celebration { animation: winnerGlow 3.8s ease-in-out; }
.winner-celebration .rank-1.revealed { animation: podiumRise 1.35s cubic-bezier(.16,.84,.24,1) both, winnerPulse 2.8s 1.1s ease-in-out; }
@keyframes confettiFall { 0% { opacity: 0; transform: translate3d(0,-20px,0) rotate(0); } 8% { opacity: 1; } 100% { opacity: .95; transform: translate3d(var(--drift),720px,0) rotate(var(--spin)); } }
@keyframes winnerGlow { 40% { box-shadow: inset 0 0 130px rgba(217,242,106,.3), 0 20px 50px rgba(8,45,38,.3); } }
@keyframes winnerPulse { 50% { filter: drop-shadow(0 0 30px rgba(217,242,106,.65)); transform: scale(1.035); } }

.team-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.team-card { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.team-card-head { display: flex; justify-content: space-between; align-items: center; }
.team-name-input { min-width: 0; width: 100%; border: 0; border-bottom: 1px solid transparent; background: transparent; font-size: 21px; font-weight: 850; }
.team-name-input:focus { border-bottom-color: var(--brand); outline: 0; }
.team-card p { margin: 0; color: var(--muted); font-size: 12px; }
.color-choice { width: 34px; height: 34px; padding: 0; border: 2px solid #fff; border-radius: 11px; box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.team-actions { display: flex; gap: 6px; }
.team-actions .icon-button { min-width: 40px; min-height: 40px; font-size: 15px; }

.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.settings-card { padding: 20px; }
.settings-card h3 { margin: 0 0 18px; font-size: 17px; }
.settings-hint { margin: -8px 0 15px; font-size: 12px; line-height: 1.45; }
.sound-options { margin: -6px 0 10px 31px; padding-left: 12px; border-left: 2px solid var(--brand-soft); transition: opacity .2s ease; }
.sound-options .switch-row { min-height: 36px; margin-bottom: 4px; }
.sound-options.disabled-options { opacity: .42; pointer-events: none; }
label { display: grid; gap: 7px; margin-bottom: 13px; color: #46524e; font-size: 12px; font-weight: 750; }
input, select { min-height: 44px; width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 8px 11px; color: var(--ink); background: #fff; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 12px; }
.switch-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.switch-row input { width: 21px; height: 21px; min-height: auto; accent-color: var(--brand); }
.role-buttons { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin: 14px 0; }
.danger-zone { border-color: #ead2d2; }

.dialog { max-width: min(780px,calc(100vw - 24px)); width: 100%; max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 26px; color: var(--ink); background: transparent; box-shadow: 0 30px 90px rgba(8,36,30,.3); }
.dialog::backdrop { background: rgba(7,30,25,.58); backdrop-filter: blur(5px); }
.dialog-shell { max-height: calc(100dvh - 24px); overflow-y: auto; padding: 24px; border-radius: 26px; background: var(--surface); }
.compact-dialog { max-width: 500px; }
.share-dialog { max-width: 620px; }
.dialog-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.dialog-top h2, .dialog-shell > h2 { margin: 0; font-size: 27px; letter-spacing: -.04em; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.progress { height: 5px; margin: 20px 0 12px; overflow: hidden; border-radius: 9px; background: #e9eeec; }
.progress i { display: block; height: 100%; width: 25%; border-radius: inherit; background: var(--brand); transition: width .25s ease; }
.step-dots { display: flex; gap: 7px; margin-bottom: 22px; }
.step-dots span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; color: #7f8a86; background: #eef2f0; font-size: 11px; font-weight: 850; }
.step-dots span.active, .step-dots span.done { color: #fff; background: var(--brand); }
.wizard-body { min-height: 310px; }
.choice-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.choice-card { position: relative; display: grid; justify-items: start; gap: 9px; min-height: 96px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: #fff; text-align: left; }
.choice-card strong { font-size: 14px; }
.choice-card small { color: var(--muted); font-size: 11px; }
.choice-card.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.choice-icon { font-size: 23px; }
.wizard-note { margin: 16px 0 0; padding: 13px; border-radius: 14px; color: #315c53; background: #eef7f4; font-size: 12px; }
.team-editor-list { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.team-editor-row { display: grid; grid-template-columns: 32px 1fr 42px; align-items: center; gap: 7px; }
.team-editor-row i { width: 18px; height: 18px; border-radius: 6px; }
.team-editor-row button { min-width: 40px; min-height: 40px; border: 0; border-radius: 11px; color: var(--danger); background: #faeeee; }
.wizard-summary { display: grid; grid-template-columns: repeat(2,1fr); gap: 11px; }
.summary-tile { padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: #f8faf9; }
.summary-tile span, .summary-tile strong { display: block; }
.summary-tile span { color: var(--muted); font-size: 11px; }
.summary-tile strong { margin-top: 5px; font-size: 15px; }
.share-layout { display: grid; grid-template-columns: 220px 1fr; gap: 25px; align-items: center; margin-top: 20px; }
.qr-box { min-height: 220px; display: grid; place-items: center; padding: 15px; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.qr-box img, .qr-box canvas { max-width: 100%; }
.session-code { margin: 5px 0 12px; font-size: 34px; font-weight: 900; letter-spacing: .1em; }
.code-input { text-transform: uppercase; font-size: 24px; font-weight: 850; letter-spacing: .1em; text-align: center; }
.toast-region { position: fixed; z-index: 100; top: 82px; right: 18px; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: 360px; padding: 12px 15px; border-radius: 13px; color: #fff; background: #193f37; box-shadow: var(--shadow); font-size: 13px; animation: toastIn .2s ease; }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } }

@media (max-width: 1050px) {
  .start-view { grid-template-columns: minmax(0,560px) minmax(320px,430px); gap: 45px; }
  .app-header { grid-template-columns: 150px minmax(0,1fr) auto; }
  .app-body { grid-template-columns: 84px minmax(0,1fr); }
  .side-nav .nav-item { justify-content: center; padding: 0; }
  .side-nav .nav-item b { display: none; }
  .team-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .schedule-match { grid-template-columns: 100px minmax(110px,1fr) 20px minmax(110px,1fr) 85px 42px; }
}

@media (max-width: 900px) and (min-height: 541px) {
  .field-cards { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body { padding-bottom: calc(70px + var(--safe-bottom)); }
  .desktop-only { display: none; }
  .start-view { min-height: calc(100dvh - 70px); display: block; padding: 28px 18px 35px; }
  .start-panel { max-width: 520px; margin: 0 auto; }
  .start-panel h1 { margin-top: 34px; font-size: clamp(46px,15vw,68px); }
  .start-copy { font-size: 16px; }
  .start-visual { display: none; }
  .app-header { height: 62px; grid-template-columns: 44px minmax(0,1fr) auto; padding: 0 10px; }
  .app-header .brand-mark { width: 44px; height: 44px; }
  .header-actions .button-small { min-width: 44px; min-height: 44px; padding: 8px; }
  .header-actions .sync-pill { padding: 0 9px; }
  .header-actions .sync-pill b { display: none; }
  #fullscreenBtn { display: none; }
  .app-body { display: block; min-height: calc(100dvh - 62px); }
  .side-nav { display: none; }
  .bottom-nav { position: fixed; z-index: 40; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5,1fr); height: calc(66px + var(--safe-bottom)); padding: 5px 5px var(--safe-bottom); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(18px); }
  .bottom-nav.no-bracket { grid-template-columns: repeat(4,1fr); }
  .bottom-nav .nav-item { min-width: 0; min-height: 56px; display: grid; justify-items: center; align-content: center; gap: 2px; padding: 0 3px; border-radius: 10px; }
  .bottom-nav .nav-item span { font-size: 18px; }
  .bottom-nav .nav-item b { font-size: 9px; }
  .page { padding: 21px 13px 30px; }
  .live-heading, .page-heading { align-items: flex-start; margin-bottom: 17px; }
  .live-heading h2, .page-heading h2 { font-size: 29px; }
  .page-heading { flex-direction: column; }
  .round-controls .icon-button { display: none; }
  .round-controls .button { padding: 10px 12px; }
  .field-cards { grid-template-columns: 1fr; }
  .field-card:not(:first-child) { margin-top: 2px; }
  .scoreboard { grid-template-columns: 1fr 62px 12px 62px 1fr; padding: 20px 10px 10px; }
  .score-team { font-size: 17px; }
  .score-number { font-size: 39px; }
  .score-actions { padding: 0 10px 13px; gap: 8px; }
  .score-button { min-width: 46px; min-height: 50px; }
  .timer-zone { padding: 13px 12px; }
  .timer-readout { min-width: 96px; font-size: 31px; }
  .timer-buttons .button { padding: 8px 12px; }
  .timer-buttons .button { min-width: 44px; }
  .text-button { min-height: 44px; }
  .live-lower { grid-template-columns: 1fr; }
  .next-match { grid-template-columns: 82px 1fr auto; }
  .mini-table-card { display: none; }
  .toolbar { width: 100%; justify-content: flex-start; }
  .toolbar .button { flex: 1; padding: 9px 8px; font-size: 12px; }
  .ceremony-stage { min-height: 560px; padding: 28px 14px; }
  .ceremony-podium { gap: 7px; min-height: 275px; }
  .podium-team { min-height: 72px; padding: 8px 5px; }
  .podium-team strong { font-size: 15px; }
  .podium-block { height: 90px; font-size: 40px; }
  .rank-1 .podium-block { height: 160px; }
  .rank-2 .podium-block { height: 125px; }
  .ceremony-controls { display: grid; grid-template-columns: 1fr 1.4fr; }
  .ceremony-controls #ceremonyResetBtn { grid-column: 1/-1; }
  .round-block { overflow: visible; }
  .schedule-match { position: relative; grid-template-columns: 1fr 22px 1fr; gap: 8px; padding: 13px 12px 54px; }
  .schedule-match .field-label { grid-column: 1/-1; font-size: 11px; color: var(--muted); }
  .schedule-match .schedule-score { position: absolute; bottom: 12px; left: 12px; }
  .schedule-match .delete-match { position: absolute; right: 12px; bottom: 8px; }
  .standing-row { grid-template-columns: 38px minmax(120px,1fr) 55px 55px; padding: 0 11px; }
  .standing-row > :nth-child(4), .standing-row > :nth-child(5), .standing-row > :nth-child(6), .standing-row > :nth-child(7) { display: none; }
  .standing-row.header > :nth-child(8), .standing-row:not(.header) > :nth-child(8) { display: block; }
  .standing-row .team-cell small { display: none; }
  .tie-panel { padding: 15px; }
  .tie-panel-head { align-items: stretch; flex-direction: column; }
  .tie-groups article, .manual-tie { align-items: stretch; flex-direction: column; }
  .manual-tie { grid-template-columns: 1fr; }
  .team-grid, .settings-grid { grid-template-columns: 1fr; }
  .team-card { padding: 15px; }
  .dialog { max-width: 100vw; width: 100vw; max-height: 100dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .dialog-shell { max-height: 96dvh; padding: 20px 16px calc(20px + var(--safe-bottom)); border-radius: 24px 24px 0 0; }
  .wizard-body { min-height: 360px; }
  .choice-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .team-editor-list { grid-template-columns: 1fr; }
  .share-layout { grid-template-columns: 1fr; }
  .qr-box { width: 220px; min-height: 220px; margin: 0 auto; }
  .toast-region { top: 70px; right: 10px; left: 10px; }
  .toast { max-width: none; }
}

@media (max-width: 420px) {
  .start-panel h1 { font-size: 48px; }
  .button-hero { min-height: 68px; }
  .scoreboard { grid-template-columns: 1fr 56px 10px 56px 1fr; }
  .score-number { font-size: 35px; }
  .timer-buttons .button span { display: none; }
  .choice-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .choice-card { min-height: 84px; padding: 12px; }
  .wizard-summary { grid-template-columns: 1fr; }
}

@media (orientation: landscape) and (max-height: 540px) and (max-width: 950px) {
  body { padding-bottom: calc(58px + var(--safe-bottom)); }
  .app-header { height: 54px; }
  .page { padding-top: 12px; }
  .live-heading { margin-bottom: 10px; }
  .live-heading h2 { font-size: 24px; }
  .field-cards { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .field-card-top { padding: 8px 12px; }
  .scoreboard { padding: 10px 8px 5px; }
  .score-number { font-size: 32px; }
  .score-actions { padding: 0 8px 8px; }
  .score-button { min-height: 42px; }
  .timer-zone { padding: 8px 10px; }
  .timer-readout { font-size: 25px; }
  .timer-buttons .button { min-height: 38px; }
  .live-lower { display: none; }
  .bottom-nav { height: calc(54px + var(--safe-bottom)); }
  .bottom-nav .nav-item { min-height: 45px; }
}

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

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  @page turnierLandscape { size: A4 landscape; margin: 10mm; }
  body { padding: 0; color: #000; background: #fff; }
  .app-header, .side-nav, .bottom-nav, .page:not(#scheduleView), .page-heading .toolbar, #scheduleWarning, .toast-region { display: none !important; }
  .app-body, .content-area { display: block; }
  #scheduleView { display: block !important; max-width: none; padding: 0; }
  body.print-landscape #scheduleView { page: turnierLandscape; }
  .print-only { display: block !important; }
  .print-heading { margin-bottom: 6mm; }
  .print-heading h1 { margin: 0; font-size: 22pt; }
  .print-heading p { margin: 2mm 0 0; font-size: 11pt; }
  .page-heading { margin: 0 0 5mm; }
  .page-heading .eyebrow, .page-heading h2 { display: none; }
  .round-list { gap: 4mm; }
  .round-block { break-inside: avoid; border: 1px solid #000; border-radius: 0; box-shadow: none; }
  .round-head { padding: 3mm 4mm; border-bottom: 1px solid #000; background: #eee !important; }
  .schedule-match { grid-template-columns: 30mm 1fr 6mm 1fr 28mm; padding: 2.5mm 4mm; border-bottom: 1px solid #777; }
  .schedule-match select { appearance: none; border: 0; padding: 0; font-weight: 700; }
  .schedule-match .delete-match { display: none; }
  .delete-round { display: none; }
  .schedule-score:after { content: "   Ergebnis: ____ : ____"; font-weight: 400; }
  .pause-row { padding: 2mm 4mm; color: #000; background: #fff; }
  .print-standing { margin-top: 7mm; break-inside: avoid; }
  .print-standing h2 { margin: 0 0 3mm; font-size: 14pt; }
  .print-standing-row { display: grid; grid-template-columns: 1.5fr repeat(4,1fr); min-height: 9mm; align-items: center; border: 1px solid #000; border-bottom: 0; }
  .print-standing-row:last-child { border-bottom: 1px solid #000; }
  .print-standing-row > span { height: 100%; display: flex; align-items: center; padding: 1.5mm 2mm; border-right: 1px solid #000; font-size: 9pt; }
  .print-standing-row > span:last-child { border-right: 0; }
  .print-standing-row.header { min-height: 7mm; font-weight: 700; background: #eee !important; }
}
