:root {
  --green: #1e5631;
  --green-light: #2f7a44;
  --green-pale: #eaf3ec;
  --gold: #c9a227;
  --red: #b3452b;
  --gray: #6b7280;
  --border: #dfe5e0;
  --bg: #f6f8f6;
  --card: #ffffff;
  --text: #1f2a24;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--green); }

header {
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: white;
  text-align: left;
}
.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}
header h1 { margin: 0; font-size: 1.5rem; letter-spacing: 0.3px; }
header h1 a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none;
}
header h1 a:hover { opacity: 0.9; }
header h1 a img { display: block; flex-shrink: 0; }
header p { margin: 6px 0 0; opacity: 0.9; font-size: 0.9rem; }

nav {
  display: flex;
  justify-content: center;
  gap: 4px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 8px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
nav a {
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray);
}
nav a:hover { background: var(--green-pale); color: var(--green); }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 1.05rem; }
.card h3 { margin: 20px 0 6px; font-size: 0.92rem; color: var(--green); }
.card h3:first-of-type { margin-top: 4px; }
.card p { line-height: 1.6; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

select, input[type=text], input[type=email], input[type=date], input[type=number], input[type=password] {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 0.95rem;
  background: white;
  color: var(--text);
  font-family: inherit;
}
select { flex: 1; min-width: 160px; }

button.primary, a.btn-primary {
  background: var(--green);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-block;
}
button.primary:hover, a.btn-primary:hover { background: var(--green-light); }

button.secondary, a.secondary {
  background: white;
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: 8px;
  padding: 9px 15px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-block;
}

button.danger {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 0.85rem;
}

/* Solid, unmistakably serious action, reserved for genuinely destructive
   confirmations (deleting a whole account), not everyday deletes. */
button.btn-danger {
  background: var(--red);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}
button.btn-danger:hover { background: #962f1c; }

/* Lets any table scroll horizontally on a narrow phone instead of
   squashing its columns unreadably, the same trick already used for the
   scorecard grid. */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--border); }
th { color: var(--gray); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; }
td.hole-label { text-align: left; color: var(--gray); }

input.score-input { width: 44px; text-align: center; padding: 6px 2px; }
input.log-date-input { width: 132px; padding: 6px 4px; font-size: 0.8rem; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge.under { background: #e3f1e6; color: var(--green); }
.badge.over { background: #f6e6e1; color: var(--red); }
.badge.even { background: #f0f0f0; color: var(--gray); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  background: var(--green-pale);
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
}
.stat .num { font-size: 1.6rem; font-weight: 800; color: var(--green); }
.stat .label { font-size: 0.75rem; color: var(--gray); margin-top: 2px; }

.empty { color: var(--gray); font-size: 0.9rem; text-align: center; padding: 24px 10px; }

.history-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px 10px;
}
.history-item:last-child { border-bottom: none; }
.history-item .meta { font-size: 0.8rem; color: var(--gray); }
.history-item .total { font-weight: 700; }

.course-actions {
  display: flex;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 6px;
  margin-left: auto;
}

.cell-best {
  background: #fff8e1;
  font-weight: 700;
  color: #8a6d00;
  border-radius: 6px;
}

.scorecard-banner {
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: white;
  border-radius: 12px;
  padding: 20px 18px;
  margin-bottom: 16px;
}
.scorecard-banner .tag { margin: 0 0 4px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.85; }
.scorecard-banner .course-name { margin: 0; font-size: 1.25rem; font-weight: 800; }
.scorecard-banner .golfer-name { margin: 4px 0 0; font-size: 0.95rem; opacity: 0.92; }

.scorecard-wrap { overflow-x: auto; }
table.scorecard { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 0.85rem; }
table.scorecard th, table.scorecard td {
  padding: 8px 5px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
table.scorecard th:last-child, table.scorecard td:last-child { border-right: none; }
table.scorecard th { color: var(--gray); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; background: var(--green-pale); }
table.scorecard th.subtotal, table.scorecard td.subtotal { background: var(--green-pale); font-weight: 800; color: var(--green); }
table.scorecard td.row-label {
  text-align: left;
  padding-left: 8px;
  font-weight: 700;
  color: var(--gray);
  font-size: 0.72rem;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Physical-scorecard look for the public share page: a printed card
   (typewriter-style grid/labels) with "Score" filled in by hand in
   pencil, real circle/square birdie-eagle-bogey marks, and a signed
   name at the bottom, like an actual clubhouse scorecard. */
.scorecard-physical { margin: 4px 0 8px; }

.sc-half {
  background: #fdfdfb;
  border: 1px solid #dcd8cf;
  border-radius: 12px;
  box-shadow: 0 10px 22px rgba(30,20,10,0.14), 0 1px 0 rgba(0,0,0,0.04);
  padding: 14px 14px 6px;
  margin-bottom: 18px;
}
.sc-half:nth-of-type(1) { transform: rotate(-0.5deg); }
.sc-half:nth-of-type(2) { transform: rotate(0.4deg); }

.sc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid #2c2c2c;
}
.sc-head-field { min-width: 0; }
.sc-head-label {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8a8478;
  display: block;
}
.sc-head-value {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 0.85rem;
  color: #242118;
  font-weight: 700;
  margin-top: 2px;
  overflow-wrap: break-word;
}
.sc-head-value.sc-hand {
  font-family: 'Caveat', cursive;
  font-size: 1.55rem;
  color: #1f3a63;
  font-weight: 700;
  margin-top: 0;
}
.sc-head-par {
  flex-shrink: 0;
  text-align: center;
  border: 2px solid #2c2c2c;
  border-radius: 6px;
  padding: 3px 12px;
  font-family: 'Special Elite', 'Courier New', monospace;
}
.sc-head-par .lbl { font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.06em; color: #8a8478; }
.sc-head-par .n { font-size: 1.15rem; font-weight: 800; color: #242118; }

table.sc-table { width: 100%; border-collapse: collapse; font-family: 'Special Elite', 'Courier New', monospace; font-size: 0.72rem; }
table.sc-table th, table.sc-table td { border: 1px solid #d7d2c4; padding: 6px 3px; text-align: center; color: #2b271e; }
table.sc-table th { background: #f4f1e8; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.04em; color: #5c5747; }
table.sc-table td.sc-hole { font-weight: 700; }
table.sc-table th.sc-si-col, table.sc-table td.sc-si-col { color: #b23b2e; }
table.sc-table tr.sc-subtotal td, table.sc-table tr.sc-subtotal th { background: #f4f1e8; font-weight: 800; }
table.sc-table td.sc-score-cell { background: #fbfaf5; }

.sc-score {
  display: inline-block;
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  font-weight: 700;
  color: #4b4842;
}
table.sc-table td:nth-child(odd) .sc-score { transform: rotate(-4deg); }
table.sc-table td:nth-child(even) .sc-score { transform: rotate(3deg); }
tr.sc-subtotal .sc-score { font-size: 1.45rem; }

/* Real scorecard scoring marks: circle a birdie, double-circle an eagle,
   square a bogey, double-square worse than that. */
.sc-score.mark { width: 1.8em; height: 1.8em; line-height: 1.65em; }
.sc-score.mark-birdie { border: 2px solid #4b4842; border-radius: 50%; }
.sc-score.mark-eagle { border: 4px double #4b4842; border-radius: 50%; }
.sc-score.mark-bogey { border: 2px solid #4b4842; }
.sc-score.mark-dbogey { border: 4px double #4b4842; }

.sc-totals {
  background: #fdfdfb;
  border: 1px solid #dcd8cf;
  border-radius: 12px;
  box-shadow: 0 10px 22px rgba(30,20,10,0.14);
  padding: 12px 16px;
  margin-bottom: 18px;
}
.sc-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 0.78rem;
  color: #5c5747;
  border-bottom: 1px dashed #d7d2c4;
}
.sc-totals-row:last-child { border-bottom: none; }
.sc-totals-row .v { font-family: 'Caveat', cursive; font-size: 1.3rem; color: #1f3a63; font-weight: 700; }
.sc-totals-row.sc-final { font-weight: 800; color: #242118; }
.sc-totals-row.sc-final .v { font-size: 1.7rem; }

.sc-signature {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 8px;
  margin: 4px 8px 12px;
}
.sc-signature .sc-sig-name {
  font-family: 'Caveat', cursive;
  font-size: 1.7rem;
  color: #1f3a63;
  border-bottom: 1px solid #2c2c2c;
  padding: 0 10px 2px;
  min-width: 150px;
  text-align: center;
}
.sc-signature .sc-sig-label {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 0.6rem;
  color: #8a8478;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 3px;
}

.share-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.btn-whatsapp, .btn-facebook {
  display: inline-block;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 9px 15px;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
}
.btn-whatsapp { background: #25d366; }
.btn-whatsapp:hover { background: #1fb958; }
.btn-facebook { background: #1877f2; }
.btn-facebook:hover { background: #1466d1; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 0.9rem; }
.flash.success { background: #e3f1e6; color: var(--green); }
.flash.error { background: #f6e6e1; color: var(--red); }

footer {
  text-align: center;
  color: var(--gray);
  font-size: 0.75rem;
  padding: 20px;
}

/* Custom dd/mm/yyyy date picker (assets/uk-date.js), replaces native
   <input type="date">, whose display format is set by the visitor's own
   browser/OS locale, not something markup can override. */
.uk-date-field { position: relative; display: inline-flex; }
input.uk-date-display {
  cursor: pointer;
  background: white;
  caret-color: transparent;
}
.uk-date-popup {
  display: none;
  position: fixed;
  z-index: 100;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.16);
  padding: 10px;
  width: 230px;
}
.uk-date-popup.open { display: block; }
.uk-date-popup-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.uk-date-popup-label { font-weight: 700; font-size: 0.85rem; }
.uk-date-nav {
  background: var(--green-pale);
  border: none;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  font-size: 1rem;
  line-height: 1;
  color: var(--green);
  cursor: pointer;
}
.uk-date-popup-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}
.uk-date-popup-week span {
  text-align: center;
  font-size: 0.66rem;
  color: var(--gray);
  font-weight: 700;
}
.uk-date-popup-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.uk-date-day {
  border: none;
  background: none;
  border-radius: 6px;
  padding: 6px 0;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text);
}
.uk-date-day:hover { background: var(--green-pale); }
.uk-date-day.is-today { font-weight: 800; color: var(--green); }
.uk-date-day.is-selected { background: var(--green); color: white; }
.uk-date-popup-foot { margin-top: 8px; text-align: center; }
.uk-date-today {
  background: none;
  border: 1px solid var(--green);
  color: var(--green);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.78rem;
  cursor: pointer;
}

/* Homepage hero + marketing sections */
.hero {
  text-align: center;
  padding: 40px 20px 30px;
  background: linear-gradient(180deg, var(--green-pale), transparent);
  border-radius: 16px;
  margin-bottom: 22px;
}
.hero-eyebrow {
  display: inline-block;
  background: var(--green);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 13px;
  border-radius: 20px;
  margin-bottom: 16px;
}
.hero h2 {
  font-size: 2.1rem;
  line-height: 1.15;
  margin: 0 0 14px;
  color: var(--text);
  font-weight: 800;
}
.hero-sub {
  font-size: 1.02rem;
  color: var(--gray);
  max-width: 460px;
  margin: 0 auto 22px;
  line-height: 1.6;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.btn-large { padding: 13px 28px; font-size: 1rem; box-shadow: 0 10px 22px rgba(30,86,49,0.22); }
.hero-meta { font-size: 0.8rem; color: var(--gray); margin: 0; }

/* Hand-written scorecard preview, reusing the same Caveat/Special Elite
   "real scorecard" look built for public share links, so the homepage's
   first real visual is the same distinctive thing you get once you sign
   up, not a generic stock screenshot. */
.sc-preview {
  background: #fdfdfb;
  border: 1px solid #dcd8cf;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(30,20,10,0.12);
  padding: 18px 16px 14px;
  margin-bottom: 24px;
}
.sc-preview-head {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8a8478;
  text-align: center;
  margin-bottom: 14px;
}
.sc-preview-holes { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.sc-preview-hole {
  flex: 1;
  min-width: 84px;
  text-align: center;
  border-right: 1px dashed #d7d2c4;
  padding: 0 8px;
}
.sc-preview-hole:last-child { border-right: none; }
.sc-preview-num {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 0.66rem;
  color: #5c5747;
  margin-bottom: 4px;
}
.sc-preview-num span { display: block; color: #8a8478; margin-top: 1px; }
.sc-preview-scores {
  font-size: 0.76rem;
  color: #a39d8c;
  text-decoration: line-through;
  margin-bottom: 8px;
}
.sc-preview-best { display: flex; justify-content: center; }
.sc-preview-total {
  text-align: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #d7d2c4;
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 0.85rem;
  color: #5c5747;
}
.sc-preview-total strong { font-family: 'Caveat', cursive; font-size: 1.55rem; color: #1f3a63; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 16px;
}
.feature-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green-pale);
  border-radius: 10px;
  color: var(--green);
  margin-bottom: 10px;
}
.feature h3 { margin: 0 0 4px; font-size: 0.95rem; color: var(--text); }
.feature p { margin: 0; font-size: 0.85rem; color: var(--gray); line-height: 1.5; }

.step-list { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step-list li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 10px 0;
  font-size: 0.95rem;
  line-height: 1.6;
}
.step-list li::before {
  counter-increment: step;
  content: counter(step);
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.cta-banner {
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: white;
  border-radius: 14px;
  padding: 30px 20px;
  text-align: center;
  margin: 24px 0 16px;
}
.cta-banner h2 { margin: 0 0 8px; font-size: 1.35rem; }
.cta-banner p { margin: 0 0 18px; opacity: 0.92; font-size: 0.9rem; }
.cta-banner a.btn-primary { background: white; color: var(--green); }
.cta-banner a.btn-primary:hover { background: #f0f0f0; }

@media (max-width: 480px) {
  .hero { padding: 30px 16px 24px; }
  .hero h2 { font-size: 1.6rem; }
  .feature-grid { grid-template-columns: 1fr; }
  .sc-preview-holes { flex-direction: column; gap: 14px; }
  .sc-preview-hole { border-right: none; border-bottom: 1px dashed #d7d2c4; padding: 0 0 12px; }
  .sc-preview-hole:last-child { border-bottom: none; padding-bottom: 0; }
}
