/* postfajr — sunlight-readable, one-hand phone use */
:root {
  --green: #0b3d2e;
  --green-2: #12583f;
  --fairway: #1a7a52;
  --sand: #f4ead5;
  --paper: #ffffff;
  --ink: #14211c;
  --muted: #5c6f66;
  --accent: #e8b23a;
  --danger: #c0392b;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--sand);
  color: var(--ink);
  font-size: 17px;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--green-2); text-decoration: none; }

.topnav {
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topnav .brand { color: #fff; font-weight: 800; font-size: 1.1rem; }
.topnav .links { display: flex; gap: 14px; }
.topnav .links a { color: #d9e8e0; font-weight: 600; font-size: 0.95rem; }

main { max-width: 640px; margin: 0 auto; padding: 14px; }
h1 { font-size: 1.4rem; margin: 10px 0; }
h2 { font-size: 1.1rem; margin: 18px 0 8px; color: var(--green); }

.card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card .sub { color: var(--muted); font-size: 0.9rem; }

.btn {
  display: inline-block;
  background: var(--fairway);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  width: 100%;
  text-align: center;
  cursor: pointer;
}
.btn.secondary { background: #e6e0d0; color: var(--ink); }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: 0.5; }
.btn.inline { width: auto; padding: 10px 16px; font-size: 0.95rem; }

table.tbl { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--radius); overflow: hidden; }
.tbl th, .tbl td { padding: 10px 8px; text-align: left; border-bottom: 1px solid #eee7d8; }
.tbl th { background: var(--green); color: #fff; font-size: 0.85rem; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: none; }

.pill {
  display: inline-block;
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 700;
}
.pill.live { background: var(--danger); }
.pill.gold { background: var(--accent); color: var(--ink); }

input, select {
  font-size: 1rem;
  padding: 12px;
  border: 1px solid #cfc7b2;
  border-radius: 10px;
  width: 100%;
  background: #fff;
}
label { display: block; font-weight: 600; margin: 10px 0 4px; }
.field-row { display: flex; gap: 8px; }
.error-text { color: var(--danger); font-weight: 600; }
.muted { color: var(--muted); }

/* ---- Scorekeeper ---- */
.hole-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: var(--green);
  color: #fff;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
}
.hole-header .num { font-size: 2rem; font-weight: 800; }
.hole-header .meta { text-align: right; font-size: 0.95rem; }

.player-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 10px 12px 12px;
  margin-bottom: 10px;
}
.player-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.player-top .who { min-width: 0; }
.player-top .name { font-weight: 800; font-size: 1.05rem; }
.player-top .hint { color: #6b5d2e; font-size: 0.85rem; margin-left: 6px; white-space: nowrap; }
.player-top .pts .val { font-size: 1.3rem; font-weight: 800; color: var(--fairway); }
.player-top .pts .lbl { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; margin-left: 2px; }

/* one-tap score row */
.numrow { display: flex; gap: 6px; }
.numrow button {
  flex: 1; height: 54px;
  font-size: 1.35rem; font-weight: 800;
  font-variant-numeric: tabular-nums;
  border: 2px solid #d8d0ba; border-radius: 12px;
  background: #faf6ea; color: var(--ink);
  touch-action: manipulation;
  padding: 0;
}
.numrow button.is-par { border-color: var(--green-2); }
.numrow button.under { color: #b3261e; }
.numrow button.sel {
  background: var(--green); border-color: var(--green); color: #fff;
}
.numrow button.sel.under { background: #b3261e; border-color: #b3261e; }
.numrow button.more { font-weight: 700; color: var(--muted); }
.numrow button.more.sel { color: #fff; }

.match-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--green);
  color: #fff;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.match-footer .status { font-weight: 700; font-size: 0.95rem; flex: 1; text-align: center; }
.match-footer .status .mini { font-weight: 600; font-size: 0.8rem; opacity: 0.85; margin-top: 2px; }
.match-footer button {
  background: var(--fairway); color: #fff;
  border: none; border-radius: 10px;
  padding: 12px 18px; font-size: 1rem; font-weight: 700;
  touch-action: manipulation;
}
.match-footer button:disabled { opacity: 0.4; }
body.scoring main { padding-bottom: 90px; }

.sync-badge {
  position: fixed; top: 60px; right: 10px;
  background: var(--accent); color: var(--ink);
  border-radius: 999px; padding: 4px 10px;
  font-size: 0.8rem; font-weight: 700;
  z-index: 20;
  display: none;
}
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 8px 16px; border-radius: 999px;
  font-size: 0.9rem; opacity: 0; transition: opacity 0.3s;
  z-index: 30; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 0.92; }

/* hole-by-hole match grid */
.holes-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; margin: 8px 0; }
.holes-grid .cell {
  background: var(--paper); border-radius: 8px;
  text-align: center; padding: 6px 0; font-size: 0.85rem;
}
.holes-grid .cell .h { color: var(--muted); font-size: 0.7rem; }
.holes-grid .cell.won { background: var(--fairway); color: #fff; }
.holes-grid .cell.lost { background: #d8d0bc; }
.holes-grid .cell.push { background: var(--accent); }

/* running scorecard on the scoring screen — classic golf notation */
.scard { padding: 10px; }
.scard .scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scard table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.scard th, .scard td {
  min-width: 34px; padding: 7px 3px; text-align: center;
  font-size: 0.9rem; border-bottom: 1px solid #f0ead9;
}
.scard th { color: var(--muted); font-size: 0.75rem; }
.scard th.cur { background: var(--green); color: #fff; border-radius: 6px 6px 0 0; }
.scard th.pname {
  position: sticky; left: 0; background: var(--paper);
  text-align: left; padding-right: 8px; max-width: 76px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink); font-size: 0.85rem;
}
.scard .parrow td { color: var(--muted); font-size: 0.75rem; }
.scard td span { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; }
.scard td.u span { border: 2px solid #b3261e; border-radius: 50%; color: #b3261e; font-weight: 800; }
.scard td.bg span { border: 2px solid #8a8069; }
.scard td.db span { border: 2px solid var(--ink); box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px var(--ink); font-weight: 800; }
.scard td.miss span { color: var(--accent); font-weight: 800; }
.scard .tot { font-weight: 800; border-left: 2px solid #e5ddc8; }
.scard .nk {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; font-size: 0.75rem; font-variant-numeric: tabular-nums;
}
.scard .nk.u { border: 2px solid #b3261e; border-radius: 50%; color: #b3261e; font-weight: 800; }
.scard .nk.bg { border: 2px solid #8a8069; }
.scard .nk.db { border: 2px solid var(--ink); box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px var(--ink); font-weight: 800; }

.login-wrap { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; text-align: center; }
.login-wrap .logo { font-size: 3rem; }

.stat-bars { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin-top: 6px; }
.stat-bars .b1 { background: var(--fairway); }
.stat-bars .b2 { background: var(--green-2); }
.stat-bars .b3 { background: var(--accent); }
.stat-bars .b4 { background: var(--danger); }

.admin-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.admin-tabs button {
  background: #e6e0d0; border: none; border-radius: 999px;
  padding: 8px 16px; font-weight: 700; font-size: 0.9rem;
}
.admin-tabs button.active { background: var(--green); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
