/* Guest browser scoring — matches the Stix tournament-round scorecard */

:root {
  --sa-cream: #fef6e3;
  --sa-cream-2: #e8e3d5;
  --sa-ink: #5f1513;
  --sa-muted: #8f7371;
  --sa-green: #2e5a36;
  --sa-gold: #d4af37;
  --sa-line: #dab6b6;
  --sa-line-soft: rgba(95, 21, 19, 0.14);
  --sa-sans: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body.score-app {
  margin: 0;
  min-height: 100%;
  background: #e8e3d5;
  color: var(--sa-ink);
  font-family: var(--sa-sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.score-app {
  min-height: 100dvh;
  min-height: 100svh;
}

a { color: inherit; }

.sa-shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--sa-cream);
}

@media (min-width: 560px) {
  .sa-shell {
    box-shadow: 0 0 0 1px var(--sa-line-soft), 0 24px 70px rgba(95, 21, 19, 0.16);
  }
}

.sa-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  gap: 10px;
}

.sa-center h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
}

.sa-center p {
  margin: 0;
  color: var(--sa-muted);
  font-weight: 600;
  line-height: 1.4;
  max-width: 28ch;
}

.sa-spin {
  width: 36px;
  height: 36px;
  border: 3px solid var(--sa-line);
  border-top-color: var(--sa-ink);
  border-radius: 50%;
  animation: sa-spin 0.7s linear infinite;
}

@keyframes sa-spin { to { transform: rotate(360deg); } }

.sa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 12px;
}

.sa-header-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sa-ink);
  text-decoration: none;
  flex-shrink: 0;
}

.sa-header-btn img {
  width: 28px;
  height: 28px;
  display: block;
}

.sa-header-titles {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.sa-course {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sa-hole-sub {
  margin: 3px 0 0;
  color: var(--sa-green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.sa-guest-chip {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--sa-muted);
  text-transform: uppercase;
}

.sa-banner {
  margin: 0 16px 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--sa-line-soft);
  color: var(--sa-muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.sa-banner.lock {
  background: var(--sa-cream-2);
  color: var(--sa-ink);
}

.sa-arena {
  text-align: center;
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--sa-line-soft);
}

.sa-arena.compact { padding: 4px 12px 8px; }

.sa-arena-label {
  margin: 0;
  color: var(--sa-muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 4px;
}

.sa-arena-num {
  margin: -6px 0 -2px;
  color: var(--sa-ink);
  font-size: clamp(52px, 18vw, 75px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.04em;
}

.sa-arena.compact .sa-arena-num {
  font-size: clamp(44px, 14vw, 55px);
}

.sa-par {
  margin: 0;
  color: var(--sa-muted);
  font-size: 13px;
  font-weight: 700;
}

.sa-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px 16px;
  -webkit-overflow-scrolling: touch;
}

.sa-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 12px;
}

.sa-divider span {
  color: var(--sa-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
}

.sa-divider i {
  flex: 1;
  height: 1px;
  background: var(--sa-line);
}

.sa-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--sa-line-soft);
  border-radius: 16px;
  padding: 12px 12px 22px;
  margin-bottom: 10px;
  box-shadow: 0 4px 10px rgba(26, 5, 4, 0.08);
}

.sa-card.open {
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-width: 0;
}

.sa-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sa-info {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
  padding-right: 8px;
}

.sa-avatar {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background: var(--sa-ink);
  color: var(--sa-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  margin-right: 12px;
  flex-shrink: 0;
  border: 1.5px solid var(--sa-ink);
}

.sa-name {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sa-topar {
  font-size: 14px;
  font-weight: 800;
}

.sa-topar.under { color: var(--sa-gold); }
.sa-topar.even { color: var(--sa-green); }
.sa-topar.over { color: var(--sa-ink); }

.sa-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.sa-gross {
  color: var(--sa-muted);
  font-size: 12px;
  font-weight: 800;
}

.sa-counter {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid rgba(95, 21, 19, 0.16);
  border-radius: 14px;
  padding: 4px;
  flex-shrink: 0;
}

.sa-pm {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--sa-green);
  color: var(--sa-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.sa-pm svg { width: 22px; height: 22px; display: block; }

.sa-pm:disabled {
  opacity: 0.45;
  cursor: default;
}

.sa-scorebox {
  width: 44px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ss-num {
  color: var(--sa-ink);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.ss-muted { color: #dab6b6; font-size: 22px; }

.ss-birdie,
.ss-eagle,
.ss-bogey,
.ss-dbl {
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: solid;
  border-width: 1.5px;
}

.ss-birdie { width: 30px; height: 30px; border-radius: 15px; }
.ss-eagle { width: 32px; height: 32px; border-radius: 16px; }
.ss-eagle-in {
  width: 24px;
  height: 24px;
  border-radius: 12px;
  border: 1.5px solid;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ss-bogey { width: 28px; height: 28px; border-radius: 4px; }
.ss-dbl { width: 32px; height: 32px; border-radius: 4px; }
.ss-dbl-in {
  width: 24px;
  height: 24px;
  border-radius: 2px;
  border: 1.5px solid;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ss-birdie .ss-num,
.ss-eagle .ss-num,
.ss-bogey .ss-num,
.ss-dbl .ss-num { font-size: 16px; }

.sa-toggle {
  position: absolute;
  bottom: 2px;
  left: 50%;
  margin-left: -10px;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(95, 21, 19, 0.18);
  border-radius: 10px;
  background: #fff;
  color: var(--sa-ink);
  padding: 0;
  cursor: pointer;
}

.sa-toggle svg { width: 12px; height: 12px; display: block; margin: auto; }

.sa-panel {
  background: #fff;
  border: 1px solid var(--sa-line-soft);
  border-top: 0;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  margin-bottom: 10px;
  padding: 8px 10px 6px;
}

.sa-nine { margin-bottom: 8px; }

.sa-nine-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px 4px;
}

.sa-nine-h span {
  color: var(--sa-muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.5px;
}

.sa-nine-h strong {
  color: var(--sa-ink);
  font-size: 13px;
  font-weight: 900;
}

.sa-nine-row {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
}

.sa-cell {
  border: 0;
  background: transparent;
  padding: 2px 0;
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.sa-cell.on { background: rgba(95, 21, 19, 0.08); }

.sa-cell-h {
  display: block;
  color: var(--sa-ink);
  font-size: 10px;
  font-weight: 900;
}

.sa-cell-p {
  display: block;
  color: var(--sa-muted);
  font-size: 8px;
  font-weight: 700;
  margin-bottom: 3px;
}

.sa-cell-line {
  width: 55%;
  height: 1px;
  margin: 0 auto 3px;
  background: rgba(95, 21, 19, 0.15);
}

.sa-cell.on .sa-cell-line { background: rgba(95, 21, 19, 0.35); }

.sa-cell-score {
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sa-cell-score .ss-num { font-size: 13px; }
.sa-cell-score .ss-muted { font-size: 13px; color: #dab6b6; }
.sa-cell-score .ss-birdie { width: 24px; height: 24px; border-radius: 12px; }
.sa-cell-score .ss-eagle { width: 26px; height: 26px; border-radius: 13px; }
.sa-cell-score .ss-eagle-in { width: 18px; height: 18px; border-radius: 9px; }
.sa-cell-score .ss-bogey { width: 22px; height: 22px; }
.sa-cell-score .ss-dbl { width: 26px; height: 26px; }
.sa-cell-score .ss-dbl-in { width: 18px; height: 18px; }

.sa-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--sa-cream);
  border-top: 1px solid var(--sa-line-soft);
}

.sa-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--sa-green);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
}

.sa-nav svg { width: 20px; height: 20px; display: block; }

.sa-nav:disabled {
  opacity: 0.55;
  cursor: default;
}

.sa-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid rgba(95, 21, 19, 0.28);
  background: #fff;
  color: var(--sa-ink);
  text-decoration: none;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-align: center;
  line-height: 1.2;
}

.sa-mid svg { width: 16px; height: 16px; margin-bottom: 2px; }

.sa-store {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  background: #111;
  color: #fff;
  text-decoration: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 700;
  min-width: 220px;
}

.sa-store small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.8;
}

.sa-store strong { font-size: 17px; line-height: 1.1; }

.sa-toast {
  position: fixed;
  left: 50%;
  top: calc(10px + env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 20;
  background: var(--sa-ink);
  color: var(--sa-cream);
  font-size: 13px;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(95, 21, 19, 0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.sa-toast.on { opacity: 1; }
.sa-toast.err { background: #9b1c1c; }

button, a.sa-nav, a.sa-mid, a.sa-pm {
  touch-action: manipulation;
}
