/* Golf scorecard theme */

.golf-card .card-titlebar {
  background: linear-gradient(90deg, #228b22 0%, #87ceeb 50%, #228b22 100%);
  color: #fff;
}
.golf-card .card-titlebar .label { color: #fff; }
.golf-card .ctrl-btn { color: #fff; }
.golf-card .ctrl-btn:hover { color: var(--accent-yellow); }

.golf-card .card-marquee {
  background: #1a4d1a;
  color: #8dff8d;
  border-bottom-color: #228b22;
}

.golf-card .card-body {
  background: #f0f8f0;
  font-family: var(--font-mono);
}

.golf-header {
  text-align: center;
  padding: 20px 80px 8px;
  border-bottom: 3px double #228b22;
  margin-bottom: 16px;
  position: relative;
  min-height: 130px;
}

/* Golf greens with flagsticks flanking the name */
.sprite-green {
  position: absolute;
  bottom: 3px;
  width: 60px;    /* 20 * 3 */
  height: 120px;  /* 40 * 3 */
  image-rendering: pixelated;
  background: url(/assets/sprites/scenes/golf-green.png) no-repeat;
  background-size: 240px 120px;  /* 80 * 3 x 40 * 3 */
  animation: green-flag 0.8s steps(1) infinite;
}
.sprite-green--left  { left: 12px; }
.sprite-green--right { right: 12px; transform: scaleX(-1); animation-delay: 0.4s; }

@keyframes green-flag {
  0%   { background-position: 0 0; }
  25%  { background-position: -60px 0; }
  50%  { background-position: -120px 0; }
  75%  { background-position: -180px 0; }
  100% { background-position: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sprite-green { animation: none; }
}
@media (max-width: 720px) {
  .golf-header { padding-left: 64px; padding-right: 64px; }
  .sprite-green--left  { left: 4px; }
  .sprite-green--right { right: 4px; }
}
.golf-header h2 {
  font-family: var(--font-display);
  color: #228b22;
  font-size: 24px;
  margin: 0 0 4px;
  letter-spacing: 0.08em;
}
.golf-header .golfer-info {
  font-family: var(--font-mono);
  font-size: 16px;
  color: #444;
}

.golf-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.golf-stat-box {
  text-align: center;
  padding: 8px;
  border: 1px solid #228b22;
  border-radius: 4px;
  background: #fff;
}
.golf-stat-box .stat-label {
  font-family: var(--font-mono);
  font-size: 17px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.golf-stat-box .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #228b22;
  font-family: var(--font-mono);
}

.golf-section {
  margin-bottom: 16px;
}
.golf-section h3 {
  font-family: var(--font-mono);
  font-size: 18px;
  margin: 0 0 6px;
  padding: 2px 6px;
  background: #228b22;
  color: #fff;
  display: inline-block;
}

.scorecard-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 14px;
}
.scorecard-table th {
  background: #2d5a2d;
  color: #fff;
  padding: 3px 4px;
  text-align: center;
  font-size: 14px;
}
.scorecard-table td {
  padding: 3px 4px;
  text-align: center;
  border-bottom: 1px solid #ddd;
}
.scorecard-table tr:nth-child(even) td {
  background: rgba(34, 139, 34, 0.05);
}

.score-under { color: #c41e3a; font-weight: 700; }
.score-over { color: #228b22; }
.score-even { color: #666; }

/* Scoring distribution bars — bar widths are relative to the largest bucket
   so they use the available section width instead of hugging 0% on the left */
.scoring-dist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--card-body);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
.dist-bar {
  display: grid;
  grid-template-columns: 72px 1fr 46px;
  align-items: center;
  gap: 10px;
  height: 26px;
}
.dist-label {
  font-size: 17px;
  font-weight: 700;
  text-align: right;
}
.dist-fill {
  height: 22px;
  min-width: 4px;
  border: 2px solid var(--ink);
  transition: width 0.3s;
}
.dist-pct {
  font-size: 17px;
  font-weight: 700;
  color: #333;
  text-align: left;
}
.dist-birdie { background: #228b22; }
.dist-par { background: #4caf50; }
.dist-bogey { background: #ff9800; }
.dist-double { background: #f44336; }
.dist-triple { background: #b71c1c; }

/* Golfer info size bump */
.golf-header .golfer-info { font-size: 17px; }

/* Table size bump */
.scorecard-table { font-size: 16px; }
.scorecard-table th { font-size: 16px; padding: 4px 6px; }
.scorecard-table td { padding: 4px 6px; }

@media (max-width: 720px) {
  .golf-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .scorecard-table { font-size: 14px; }
  .scorecard-table th { font-size: 14px; padding: 2px 3px; }
  .scorecard-table td { padding: 2px 3px; }
  .dist-label { width: 52px; font-size: 14px; }
}
@media (max-width: 480px) {
  .golf-header h2 { font-size: 20px; }
  .golf-header { padding-top: 12px; min-height: 110px; padding-left: 50px; padding-right: 50px; }
  .sprite-green { transform-origin: bottom center; transform: scale(0.7); }
  .sprite-green--right { transform: scale(0.7) scaleX(-1); }
  .golf-stats-grid { gap: 6px; }
  .golf-stat-box { padding: 6px; }
  .golf-stat-box .stat-value { font-size: 20px; }
}

/* --- Sub-labels on section headers --- */
.golf-sub {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 400;
  color: #ffd9a5;
  margin-left: 10px;
  letter-spacing: 0.5px;
}

/* --- SVG line charts (handicap trend, score-to-par trend) --- */
.golf-chart {
  display: block;
  width: 100%;
  max-width: 800px;
  height: auto;
  background: var(--card-body);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 6px;
  box-sizing: border-box;
  image-rendering: pixelated;
}
.chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 17px;
}
.legend-chip { display: inline-flex; align-items: center; gap: 6px; }
.chip-swatch {
  display: inline-block;
  width: 14px; height: 4px;
  border: 1px solid var(--ink);
}

/* --- Approach miss dispersion (compass-around-pin layout) --- */
.miss-dispersion {
  max-width: 360px;
  margin: 0 auto;
  padding: 20px;
  background: var(--card-body);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
.miss-row {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.miss-row-top { margin-bottom: 8px; }
.miss-row-bot { margin-top: 8px; }
.miss-row-mid {
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.miss-cell { flex: 1; text-align: center; }
.miss-target {
  font-size: 36px;
  line-height: 1;
}
.miss-label {
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--accent-pink-dark);
}
.miss-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
}

/* --- Hole difficulty grid --- */
.hole-diff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 6px;
}
.hole-diff-cell {
  padding: 6px 4px;
  text-align: center;
  border: 2px solid var(--ink);
  background: var(--card-body);
  font-family: var(--font-mono);
}
.hole-diff-cell.diff-easy { background: #d6f5d6; }
.hole-diff-cell.diff-mid  { background: #fff4c2; }
.hole-diff-cell.diff-hard { background: #ffd7d7; }
.hd-rank {
  font-size: 16px;
  color: var(--accent-pink-dark);
}
.hd-value {
  font-size: 20px;
  font-weight: 700;
}
.hd-sub { font-size: 14px; color: #666; }

/* --- Histograms (diff distribution + monthly) --- */
.hist {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding: 10px 12px 0;
  background: var(--card-body);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
.hist-bar {
  flex: 1;
  min-width: 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
}
.hist-fill {
  width: 100%;
  background: var(--accent-pink);
  border: 2px solid var(--ink);
  border-bottom: 0;
  min-height: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
}
.hist-fill.hist-fill-month { background: var(--accent-cyan); }
.hist-count {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.hist-label {
  font-family: var(--font-mono);
  font-size: 14px;
  color: #555;
  margin-top: 3px;
  text-align: center;
  word-break: break-word;
}

/* --- "Used in HI" row highlight --- */
.scorecard-table tr.used-in-hi { background: #fff4c2; }
.hi-star {
  color: #b38600;
  font-weight: 700;
  cursor: help;
}

/* Green-themed tooltip box-shadow on the golf card */
.golf-card [data-tip]::after {
  box-shadow: 3px 3px 0 #228b22;
}

/* --- Goals --- */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.goal-card {
  padding: 14px 16px;
  background: var(--card-body);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
.goal-card.goal-hit {
  background: #d6f5d6;
}
.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.goal-label {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
}
.goal-deadline {
  font-family: var(--font-mono);
  font-size: 16px;
  color: #228b22;
  letter-spacing: 0.5px;
}
.goal-values {
  font-family: var(--font-mono);
  font-size: 28px;
  text-align: center;
  margin-bottom: 6px;
}
.goal-current { color: #c41e3a; font-weight: 700; }
.goal-arrow { color: #666; margin: 0 10px; }
.goal-target { color: #228b22; font-weight: 700; }
.goal-track {
  position: relative;
  height: 22px;
  border: 2px solid var(--ink);
  background: #fff;
  margin: 6px 0;
  overflow: hidden;
}
.goal-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50 0%, #228b22 100%);
  transition: width 0.4s ease;
}
.goal-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  text-shadow: 0 0 2px #fff;
}
.goal-gap {
  font-family: var(--font-mono);
  font-size: 16px;
  color: #444;
  text-align: center;
}

/* Refreshed goal card: bigger, richer summary + trendline */
.goal-section .goal-card { padding: 18px 20px; }
.goal-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (max-width: 640px) {
  .goal-summary { grid-template-columns: repeat(2, 1fr); }
}
.goal-summary-metric {
  padding: 8px 10px;
  background: #fff;
  border: 2px solid var(--ink);
  text-align: center;
}
.goal-summary-label {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--accent-pink-dark);
}
.goal-summary-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  margin-top: 2px;
}
.goal-on-pace  { color: #0a8a0a; }
.goal-off-pace { color: #c41e3a; }
.goal-pace-note {
  font-family: var(--font-mono);
  font-size: 17px;
  line-height: 1.5;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #fff9d6;
  border-left: 4px solid var(--accent-pink-dark);
}
.goal-chart { margin-top: 4px; }
