*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;background:#f5f5f5;color:#2c3e50;font-size:14px;line-height:1.6}

/* ── Setup screen ── */
.setup-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:2rem}
.setup-card{background:#fff;border-radius:8px;border:1px solid #e0e0e0;padding:2.5rem;width:100%;max-width:500px;box-shadow:0 2px 10px rgba(0,0,0,.08)}
.logo-row{display:flex;align-items:center;gap:12px;margin-bottom:2rem}
.logo-circle{width:44px;height:44px;background:linear-gradient(135deg,#0066CC,#0052A3);border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.logo-circle svg{width:22px;height:22px;stroke:#fff;fill:none;stroke-width:2;stroke-linecap:round}
.logo-text h1{font-size:18px;font-weight:700;color:#0066CC}
.logo-text p{font-size:13px;color:#6b7280;margin-top:2px}
.field{margin-bottom:1.2rem}
.field label{display:block;font-size:12px;font-weight:600;color:#4b5563;margin-bottom:6px;text-transform:uppercase;letter-spacing:.03em}
.field input{width:100%;padding:10px 14px;font-size:14px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#1f2937;transition:all .2s}
.field input:focus{outline:none;border-color:#0066CC;box-shadow:0 0 0 3px rgba(0,102,204,.1)}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.btn-gen{width:100%;padding:13px;font-size:15px;font-weight:600;background:#0066CC;color:#fff;border:none;border-radius:6px;cursor:pointer;margin-top:1rem;transition:background .2s}
.btn-gen:hover{background:#0052A3}
.btn-gen:disabled{background:#9ca3af;cursor:not-allowed}
.error-msg{background:#fef2f2;border:1px solid #fca5a5;border-radius:6px;padding:12px 16px;font-size:13px;color:#991b1b;margin-bottom:1rem;display:none}

/* ── Loading screen ── */
.loading-screen{display:none;min-height:100vh;align-items:center;justify-content:center;flex-direction:column;gap:18px;background:#f9fafb}
.spinner{width:40px;height:40px;border:4px solid #e5e7eb;border-top-color:#0066CC;border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.loading-msg{font-size:15px;color:#4b5563;font-weight:500;text-align:center;max-width:500px;padding:0 20px}
.loading-msg strong{color:#0066CC;display:block;font-size:16px;margin-bottom:8px;animation:pulse 2s ease-in-out infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:0.6}}
.loading-steps{display:flex;flex-direction:column;gap:8px;margin-top:10px}
.step{font-size:13px;color:#9ca3af;display:flex;align-items:center;gap:10px}
.step.done{color:#10b981}
.step.active{color:#0066CC;font-weight:600}
.step-dot{width:8px;height:8px;border-radius:50%;background:#d1d5db;flex-shrink:0}
.step.done .step-dot{background:#10b981;animation:pop .3s ease}
.step.active .step-dot{background:#0066CC;animation:pulse-dot 1.5s ease-in-out infinite}
@keyframes pop{0%{transform:scale(0)}50%{transform:scale(1.3)}100%{transform:scale(1)}}
@keyframes pulse-dot{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(1.2);opacity:0.7}}

/* ── Report screen ── */
.report-screen{display:none;min-height:100vh;flex-direction:column;background:#fff}
.report-header{background:#fff;color:#2c3e50;padding:0;display:flex;flex-direction:column;align-items:center;justify-content:center;border-bottom:1px solid #e5e7eb;flex-shrink:0;position:relative}
.header-top-line{width:100%;height:3px;background:#1B7FCC;margin:0}
.rh-content{text-align:center;width:100%;padding:2.5rem 2rem 1.5rem;max-width:800px;margin:0 auto}
.header-logo{max-width:140px;width:20%;height:auto;margin:0 auto 1.5rem;display:block}
.header-subtitle{font-size:15px;font-weight:500;color:#1B7FCC;text-transform:uppercase;letter-spacing:.08em;margin-bottom:1rem}
.header-title{font-size:32px;font-weight:700;color:#003366;margin-bottom:1rem;line-height:1.2}
.header-meta{font-size:13px;color:#6b7280;margin-bottom:0;font-weight:400}
.rh-buttons{display:flex;align-items:center;gap:10px;margin-top:1.25rem;margin-bottom:1.5rem;justify-content:center}
.btn-download{font-size:13px;background:#0066CC;border:none;color:#fff;padding:8px 16px;border-radius:6px;cursor:pointer;transition:background .2s;display:flex;align-items:center;gap:6px;font-weight:600}
.btn-download:hover{background:#0052A3}
.btn-download svg{flex-shrink:0}
.btn-reset{font-size:13px;background:#fff;border:1px solid #d1d5db;color:#4b5563;padding:8px 16px;border-radius:6px;cursor:pointer;transition:all .2s}
.btn-reset:hover{background:#f9fafb;border-color:#9ca3af}
.tab-bar{background:#fff;border-bottom:1px solid #e5e7eb;display:flex;justify-content:center;overflow-x:auto;flex-shrink:0;padding:0 2rem}
.tab{padding:14px 20px;font-size:14px;font-weight:600;color:#6b7280;background:none;border:none;border-bottom:3px solid transparent;cursor:pointer;white-space:nowrap;transition:all .2s}
.tab.active{color:#0066CC;border-bottom-color:#0066CC}
.tab:hover{color:#0066CC;background:#f9fafb}
.report-body{flex:1;overflow-y:auto;padding:2rem;max-width:1000px;margin:0 auto;width:100%;text-align:center}

/* ── Strokes Gained Cards ── */
.sg-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;margin-bottom:2rem;max-width:900px;margin-left:auto;margin-right:auto;justify-items:center;page-break-inside:avoid;break-inside:avoid}
.sg-card{border-radius:8px;padding:18px;text-align:center;border:1px solid transparent;width:100%;max-width:180px;page-break-inside:avoid;break-inside:avoid}
.sg-card.positive{background:#dcfce7;border-color:#86efac}
.sg-card.negative{background:#fee2e2;border-color:#fca5a5}
.sg-card.neutral{background:#fef3c7;border-color:#fde68a}
.sg-value{font-size:28px;font-weight:700;margin-bottom:4px}
.sg-card.positive .sg-value{color:#15803d}
.sg-card.negative .sg-value{color:#b91c1c}
.sg-card.neutral .sg-value{color:#a16207}
.sg-label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:#6b7280}

/* ── Section Styling ── */
.section{margin-bottom:2.5rem;text-align:center}
.section-number{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;background:#0066CC;color:#fff;border-radius:50%;font-weight:700;font-size:16px;margin-bottom:12px}
.section-title{font-size:20px;font-weight:700;color:#0066CC;margin-bottom:12px;display:block;text-align:center}
.section-subtitle{font-size:14px;font-weight:600;color:#4b5563;margin:1.5rem 0 .75rem;text-transform:uppercase;letter-spacing:.03em;text-align:center}

/* ── Tables (TrackMan Style) ── */
.table-wrap{overflow-x:auto;border-radius:8px;margin-bottom:2rem;box-shadow:0 1px 3px rgba(0,0,0,.1);max-width:100%;margin-left:auto;margin-right:auto;page-break-inside:avoid;break-inside:avoid}
.table-wrap.compact-table{max-width:800px}
table{width:100%;border-collapse:collapse;font-size:13px;background:#fff}
thead{background:#0066CC}
th{text-align:center;padding:12px 16px;font-size:12px;font-weight:700;color:#fff;text-transform:uppercase;letter-spacing:.04em;white-space:nowrap}
th:first-child{border-radius:8px 0 0 0}
th:last-child{border-radius:0 8px 0 0}
td{padding:12px 16px;border-bottom:1px solid #f3f4f6;color:#1f2937;white-space:nowrap;text-align:center}
tbody tr:nth-child(even){background:#f9fafb}
tbody tr:hover{background:#f3f4f6}
tbody tr:last-child td{border-bottom:none}
tbody tr:last-child td:first-child{border-radius:0 0 0 8px}
tbody tr:last-child td:last-child{border-radius:0 0 8px 0}

/* ── Key Insights Box ── */
.insights-box{background:#ecfdf5;border-left:4px solid:#10b981;border-radius:8px;padding:20px;margin-bottom:2rem;text-align:left;max-width:800px;margin-left:auto;margin-right:auto;page-break-inside:avoid;break-inside:avoid}
.insights-title{font-size:13px;font-weight:700;color:#047857;text-transform:uppercase;letter-spacing:.05em;margin-bottom:12px;text-align:left}
.insights-box ul{list-style:none;padding:0}
.insights-box li{font-size:14px;color:#1f2937;line-height:1.7;margin-bottom:10px;padding-left:24px;position:relative;text-align:left}
.insights-box li:before{content:'•';position:absolute;left:0;color:#10b981;font-weight:700}
.insights-box strong{color:#047857;font-weight:600}

/* ── Metric Grid ── */
.metric-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin-bottom:2rem;max-width:1000px;margin-left:auto;margin-right:auto;justify-items:center;page-break-inside:avoid;break-inside:avoid}
.metric{background:#fff;border:1px solid #e5e7eb;border-radius:8px;padding:16px;text-align:center;width:100%;max-width:250px;page-break-inside:avoid;break-inside:avoid}
.metric-label{font-size:11px;color:#6b7280;text-transform:uppercase;letter-spacing:.04em;margin-bottom:6px;font-weight:600}
.metric-value{font-size:24px;font-weight:700;color:#0066CC}
.metric-sub{font-size:12px;color:#9ca3af;margin-top:4px}

/* ── Chart Styling ── */
.chart-wrap{position:relative;width:100%;margin-bottom:2rem;background:#fff;padding:20px;border-radius:8px;border:1px solid #e5e7eb;max-width:900px;margin-left:auto;margin-right:auto;page-break-inside:avoid;break-inside:avoid}
.chart-title{font-size:14px;font-weight:600;color:#4b5563;margin-bottom:12px;text-transform:uppercase;letter-spacing:.03em;text-align:center}

/* ── Weather Cards ── */
.weather-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:10px;margin-bottom:2rem;max-width:900px;margin-left:auto;margin-right:auto;justify-items:center}
.weather-card{background:#fff;border:1px solid#e5e7eb;border-radius:8px;padding:14px;text-align:center;width:100%;max-width:160px}
.weather-card.ideal{background:#dcfce7;border-color:#86efac}
.weather-card.ok{background:#fef3c7;border-color:#fde68a}
.weather-card.avoid{background:#fee2e2;border-color:#fca5a5}
.weather-day{font-size:11px;font-weight:600;color:#6b7280;text-transform:uppercase;margin-bottom:6px}
.weather-temp{font-size:20px;font-weight:700;color:#1f2937;margin-bottom:4px}
.weather-condition{font-size:12px;color:#4b5563;margin-bottom:6px}
.weather-tag{font-size:11px;font-weight:700;text-transform:uppercase;margin-top:8px}
.weather-card.ideal .weather-tag{color:#15803d}
.weather-card.ok .weather-tag{color:#a16207}
.weather-card.avoid .weather-tag{color:#b91c1c}

/* ── Hole Strategy ── */
.hole-strategy{margin-bottom:1.5rem;background:#fff;border:1px solid #e5e7eb;border-radius:8px;padding:16px;display:flex;gap:14px;max-width:800px;margin-left:auto;margin-right:auto;text-align:left}
.hole-strategy.birdie-opportunity{border-left:4px solid #10b981}
.hole-strategy.caution{border-left:4px solid #f59e0b}
.hole-strategy.danger{border-left:4px solid #ef4444}
.hole-number-circle{width:40px;height:40px;background:#0066CC;color:#fff;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:16px;font-weight:700;flex-shrink:0}
.hole-par{font-size:10px;text-align:center;color:#6b7280;margin-top:4px}
.hole-content{flex:1;text-align:left}
.hole-stats{font-size:12px;color:#4b5563;margin-bottom:8px;text-align:left}
.hole-advice-text{font-size:14px;color:#1f2937;line-height:1.6;text-align:left}
.hole-badges{display:flex;gap:6px;margin-top:10px;flex-wrap:wrap}
.hole-badge{font-size:10px;font-weight:600;padding:3px 8px;border-radius:12px;text-transform:uppercase;letter-spacing:.03em}
.hole-badge.green{background:#dcfce7;color:#15803d}
.hole-badge.red{background:#fee2e2;color:#b91c1c}
.hole-badge.amber{background:#fef3c7;color:#a16207}
.hole-badge.blue{background:#dbeafe;color:#1e40af}

/* ── Utility Classes ── */
.positive{color:#15803d;font-weight:600}
.negative{color:#b91c1c;font-weight:600}
.neutral{color:#a16207;font-weight:600}
.divider{border:none;border-top:1px solid #e5e7eb;margin:2rem 0}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sg-cards{grid-template-columns:repeat(2,1fr)}
  .metric-grid{grid-template-columns:1fr}
  .weather-grid{grid-template-columns:repeat(2,1fr)}
  .report-header{flex-direction:column;align-items:center}
  .rh-right{margin-top:1rem}
  .tab-bar{padding:0 1rem}
  .report-body{padding:1.5rem}
}

@media (max-width: 480px) {
  .sg-cards{grid-template-columns:1fr}
  .weather-grid{grid-template-columns:1fr}
  .field-row{grid-template-columns:1fr}
}
