/* Scorekarte – heller „Papier“-Look, gut lesbar in der Sonne auf dem Platz */
:root {
  color-scheme: light;
  --bg: #F4F1E8;
  --paper: #FFFDF7;
  --ink: #15302A;
  --muted: #4C5A54;
  --line: #DCD6C6;
  --line-2: #EAE5D7;
  --green: #1E6B47;
  --green-2: #E3F0E7;
  --red: #C23B2A;
  --red-2: #FBE7E3;
  --amber: #B7791F;
  --amber-2: #FCF1DC;
  --blue: #2B5FA8;
  --birdie: #C23B2A;
  --eagle: #8A2BB0;
  --bogey: #2B5FA8;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; -webkit-tap-highlight-color: transparent; font-size: 17px; line-height: 1.45; }
a { color: var(--green); }
td, .num, input.cell { font-variant-numeric: tabular-nums; }

/* Kopf */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: rgba(21, 48, 42, .97); color: #F4F1E8;
}
.top a.brand { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none;
  font-weight: 800; letter-spacing: .04em; }
.top a.brand img { width: 30px; height: 30px; border-radius: 8px; }
.top .who { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 13px; opacity: .9; }
.top .who a { color: inherit; text-decoration: none; }
.top .who button { background: none; border: 1px solid rgba(255,255,255,.35); color: inherit; border-radius: 999px;
  padding: 4px 10px; font: inherit; cursor: pointer; }
main { max-width: 860px; margin: 0 auto; padding: 16px 16px calc(40px + var(--safe-b)); }
main.wide { max-width: 1180px; }

/* Grundbausteine */
h1 { font-size: 26px; margin: 6px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 26px 0 10px; font-weight: 700; }
.sub { color: var(--muted); font-size: 16px; margin-bottom: 14px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card + .card { margin-top: 10px; }
.muted { color: var(--muted); }
.small { font-size: 14.5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }
.flash { padding: 10px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 14px; }
.flash.error { background: var(--red-2); border: 1px solid var(--red); }
.flash.ok { background: var(--green-2); border: 1px solid var(--green); }
.pill { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap; background: var(--paper); }
.pill.green { border-color: var(--green); color: var(--green); }
.pill.red { border-color: var(--red); color: var(--red); }
.pill.amber { border-color: var(--amber); color: var(--amber); }
.tee-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25);
  vertical-align: middle; margin-right: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 15px; font: 600 15px/1.1 system-ui, sans-serif; text-decoration: none;
  cursor: pointer; background: var(--paper); color: var(--ink); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); border-color: var(--red); background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

/* Formulare */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font: inherit; color: var(--ink); }
textarea { min-height: 120px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink); font-weight: 500; margin: 8px 0; }
.check input { width: 18px; height: 18px; }

/* Listen */
.list a.item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line-2);
  text-decoration: none; color: var(--ink); }
.list a.item:last-child { border-bottom: 0; }
.list .item .t { font-weight: 650; }
.list .item .m { font-size: 13px; color: var(--muted); }
.list .item .chev { margin-left: auto; color: var(--muted); }

/* Wertungs-Reiter */
.modes { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin: 4px 0 10px; }
.modes a { flex: none; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none;
  color: var(--ink); font-size: 15.5px; background: var(--paper); text-align: center; }
.modes a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Rangliste */
table.board { width: 100%; border-collapse: collapse; }
table.board th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; padding: 6px 6px; border-bottom: 1px solid var(--line); }
table.board td { padding: 10px 6px; border-bottom: 1px solid var(--line-2); }
table.board tr:last-child td { border-bottom: 0; }
table.board .rk { width: 34px; font-weight: 800; color: var(--muted); }
table.board tr.p1 .rk { color: #B8860B; }
table.board .val { text-align: right; font-weight: 800; font-size: 20px; }
table.board .r { text-align: right; }
table.board a { color: var(--ink); text-decoration: none; font-weight: 600; }
.medal { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; color: #fff; font-weight: 800; }
.medal.m1 { background: #C9A227; } .medal.m2 { background: #9BA4AE; } .medal.m3 { background: #B07A4A; }

/* Scorekarten-Raster */
.sc-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
table.sc { border-collapse: collapse; font-size: 13px; min-width: 100%; }
table.sc th, table.sc td { border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 0; text-align: center; min-width: 30px; height: 30px; }
table.sc th { background: #F0ECDF; font-weight: 600; font-size: 11.5px; color: var(--muted); }
table.sc th.name, table.sc td.name { position: sticky; left: 0; z-index: 2; background: var(--paper); text-align: left;
  padding: 0 8px; min-width: 120px; max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.sc th.name { background: #F0ECDF; }
table.sc td.sum, table.sc th.sum { background: #F6F2E6; font-weight: 700; min-width: 38px; }
table.sc .s { display: inline-grid; place-items: center; width: 24px; height: 24px; }
table.sc .s.birdie { border: 1.5px solid var(--birdie); border-radius: 50%; color: var(--birdie); font-weight: 700; }
table.sc .s.eagle, table.sc .s.ace, table.sc .s.albatross { border: 3px double var(--eagle); border-radius: 50%; color: var(--eagle); font-weight: 800; }
table.sc .s.bogey { border: 1.5px solid var(--bogey); color: var(--bogey); }
table.sc .s.double, table.sc .s.worse { border: 3px double var(--bogey); color: var(--bogey); }
table.sc .s.pickup { color: var(--muted); }
table.sc .pts { display: block; font-size: 9.5px; color: var(--muted); line-height: 1; margin-top: -2px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-top: 8px; }

/* Prüfansicht */
.photo { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #222; }
.photo img { display: block; width: 100%; max-height: 62vh; object-fit: contain; cursor: zoom-in; }
.photo.big img { max-height: none; cursor: zoom-out; }
.review-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .review-grid { grid-template-columns: minmax(360px, 44%) 1fr; align-items: start; }
  .review-grid .photo { position: sticky; top: 64px; } }
.pcard { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 12px; margin-bottom: 14px; }
.pcard.attn { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber) inset; }
.pcard.bad { border-color: var(--red); box-shadow: 0 0 0 1px var(--red) inset; }
.pcard .head { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.pcard .head2 { display: grid; grid-template-columns: 1fr 1fr 0.8fr; gap: 8px; margin-top: 8px; }
@media (max-width: 560px) { .pcard .head, .pcard .head2 { grid-template-columns: 1fr 1fr; } }
.pcard label { margin: 0 0 3px; font-size: 11.5px; }
.holes { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; margin-top: 10px; }
.holes .h { text-align: center; }
.holes .h .n { font-size: 10.5px; color: var(--muted); line-height: 1.2; }
.holes .h .n b { color: var(--ink); }
input.cell { width: 100%; text-align: center; padding: 7px 0; border: 1px solid var(--line); border-radius: 8px;
  font-size: 17px; font-weight: 700; background: #fff; color: var(--ink); }
input.cell.error { border: 2px solid var(--red); background: var(--red-2); }
input.cell.warn { border: 2px solid var(--amber); background: var(--amber-2); }
input.cell.sum { border: 2px dashed var(--amber); }
input.cell.pickup { color: var(--muted); }
.holes .h .pt { font-size: 10.5px; color: var(--muted); }
.sumline { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; margin-top: 8px; }
.sumline b { font-variant-numeric: tabular-nums; }
.issues { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
.issues li { padding: 6px 9px; border-radius: 8px; margin-top: 5px; }
.issues li.warn { background: var(--amber-2); }
.issues li.error { background: var(--red-2); }
.issues li.info { background: #EEF2F7; }
.savebar { position: sticky; bottom: 0; z-index: 10; background: rgba(244, 241, 232, .96); padding: 10px 0 calc(10px + var(--safe-b));
  border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--line); border-top-color: var(--green); border-radius: 50%;
  animation: spin 1s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Statistik */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.tile .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile .v { font-size: 22px; font-weight: 800; margin-top: 2px; }
.tile .d { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.bar { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); }
.dist { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--line-2); }
.dist i { display: block; height: 100%; }

/* Teilen */
.share { display: flex; gap: 8px; align-items: center; background: var(--green-2); border: 1px solid #BFD9C8; border-radius: 12px; padding: 10px 12px; }
.share input { flex: 1; min-width: 0; font-size: 13px; padding: 7px 9px; }
.viewer-note { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 30px; }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }

.nowrap { white-space: nowrap; }
@media (max-width: 520px) {
  table.board .hide-m { display: none; }
  table.board td, table.board th { padding-left: 4px; padding-right: 4px; }
  table.board .val { font-size: 16px; }
}

/* Lesbarkeit auf dem Handy (auch für ältere Augen) */
.show-m { display: none; }
@media (max-width: 520px) {
  .show-m { display: block; }
  .hide-m { display: none !important; }
  .modes { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .modes a { padding: 12px 6px; border-radius: 12px; }
  table.board td { padding-top: 12px; padding-bottom: 12px; }
}
tr.me td { background: #FFF4CF; }
tr.me td:first-child { box-shadow: inset 4px 0 0 #C9A227; }
.me-banner { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; background: #FFF4CF; border: 1px solid #E5C866;
  border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; font-size: 16px; }
.me-banner b { font-size: 20px; }
.me-banner a { margin-left: auto; font-weight: 600; }
details.explain { margin-top: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; }
details.explain summary { cursor: pointer; padding: 10px 0; font-weight: 650; color: var(--green); }
details.explain dt { font-weight: 700; margin-top: 10px; }
details.explain dd { margin: 2px 0 0; color: var(--ink); }
details.explain dl { margin: 0 0 12px; }
table.sc9 { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 10px; font-variant-numeric: tabular-nums; }
table.sc9 th, table.sc9 td { border: 1px solid var(--line-2); text-align: center; padding: 6px 0; font-size: 16px; }
table.sc9 th { background: #F0ECDF; font-size: 13px; color: var(--muted); font-weight: 600; }
table.sc9 tr > th:first-child { width: 74px; text-align: left; padding-left: 6px; font-size: 13px; }
table.sc9 tr.vg td { font-size: 13px; color: var(--muted); }
table.sc9 .sum { background: #F6F2E6; font-weight: 700; width: 44px; }
table.sc9 sup { font-size: 10px; color: var(--muted); }
table.sc9 .s { display: inline-grid; place-items: center; width: 26px; height: 26px; }
table.sc9 .s.birdie { border: 2px solid var(--birdie); border-radius: 50%; color: var(--birdie); font-weight: 700; }
table.sc9 .s.eagle, table.sc9 .s.ace, table.sc9 .s.albatross { border: 3px double var(--eagle); border-radius: 50%; color: var(--eagle); font-weight: 800; }
table.sc9 .s.bogey { border: 2px solid var(--bogey); color: var(--bogey); }
table.sc9 .s.double, table.sc9 .s.worse { border: 3px double var(--bogey); color: var(--bogey); }
@media (max-width: 400px) { table.sc9 th, table.sc9 td { font-size: 14px; } table.sc9 tr > th:first-child { width: 66px; font-size: 12px; } table.sc9 .s { width: 22px; height: 22px; } }

/* Foto-Ausschnitt in der Prüfansicht */
.zoom { position: sticky; top: 58px; z-index: 15; margin-bottom: 12px; background: var(--paper); border: 2px solid var(--green);
  border-radius: 12px; overflow: hidden; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.zoom-img { position: relative; height: 150px; background-color: #222; background-repeat: no-repeat; }
.zoom-mark { position: absolute; border: 3px solid #E0362C; border-radius: 6px; box-shadow: 0 0 0 2000px rgba(0,0,0,.18); pointer-events: none; }
.zoom-label { font-size: 14px; padding: 6px 10px; color: var(--muted); }
@media (min-width: 1000px) { .zoom-img { height: 190px; } }

.foot { margin-top: 40px; text-align: center; font-size: 14px; color: var(--muted); }
.foot a { color: var(--muted); }
.legal ul { padding-left: 20px; }
.lock { background: #FFF4CF; border: 1px solid #E5C866; border-radius: 12px; padding: 14px; margin: 12px 0; }
