:root {
  --paper: #F5F3EC;
  --ink: #16231B;
  --ink2: #2E3A33;
  --muted: #5B6660;
  --line: #D4D0C3;
  --line2: #E4E0D4;
  --green: #1E5B3A;
  --green2: #3E7D4A;
  --green-dark: #123823;
  --mint: #9FD3AE;
  --head-sub: #CFE3D5;
  --lime: #E2F2CF;
  --lime-line: #B9DE92;
  --fair: #BFE39A;
  --haz: #F8D7D5;
  --haz-line: #EBB0AC;
  --orange: #B4561C;
  --warn: #9A4614;
  --warn-bg: #F8E7DA;
  --white: #FFFFFF;
  --sand: #E9E5D9;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #E9E6DC;
  color: var(--ink);
  font-family: 'IBM Plex Sans KR', system-ui, -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
:focus-visible { outline: 3px solid #E9B949; outline-offset: 2px; }
h1, h2, p { margin: 0; }

#app { max-width: 480px; margin: 0 auto; }
.screen {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  overflow: hidden;
}
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pad { padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-xs { display: flex; flex-direction: column; gap: 6px; }
.stack-xxs { display: flex; flex-direction: column; gap: 3px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row-between.end { align-items: flex-end; }
.center { text-align: center; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }

.muted { color: var(--muted); }
.ink { color: var(--ink); }
.green { color: var(--green); }
.warn { color: var(--warn); }
.b { font-weight: 700; }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.h2 { font-size: 15px; font-weight: 700; }
.page-title { font-size: 26px; font-weight: 700; margin-top: 2px; }
.error { color: #A3261B; font-size: 13px; font-weight: 600; }
.title-icon { display: flex; align-items: center; gap: 8px; color: var(--green); font-size: 14px; }
.title-icon b, .title-icon h2 { color: var(--ink); }

/* buttons */
.btn {
  height: 50px; border-radius: 14px; border: 1.5px solid transparent;
  font-size: 15px; font-weight: 600; padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.btn.big { height: 54px; font-size: 16px; width: 100%; }
.btn.small { height: 44px; font-size: 13px; padding: 0 12px; border-radius: 10px; }
.btn.primary { background: var(--green); color: var(--white); }
.btn.dark { background: var(--ink); color: var(--white); }
.btn.outline { background: var(--white); color: var(--green); border-color: var(--green); }
.btn.white { background: var(--white); color: var(--green); }
.btn.danger { background: var(--white); color: #A3261B; border-color: #E2B4AE; }
.link-btn {
  background: none; border: 0; padding: 0; min-height: 44px;
  color: var(--green); font-size: 13px; font-weight: 600; text-decoration: underline;
}
.icon-btn {
  width: 48px; height: 48px; border-radius: 24px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent;
}
.icon-btn.outline { border-color: rgba(255, 255, 255, 0.35); color: var(--white); }
.icon-btn.ghost { margin-left: -10px; }

.bottom-bar {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line2); background: var(--paper);
}
.bottom-bar.single { grid-template-columns: 1fr; }

.card { background: var(--white); border-radius: 14px; padding: 14px; }
.lime-card { background: var(--lime); border: 1.5px solid var(--lime-line); border-radius: 14px; padding: 12px; }

/* auth */
.auth-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 0; height: 60px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 16px; }
.steps div { height: 4px; border-radius: 2px; background: #DAD6CA; }
.steps div.on { background: var(--green); }
.auth-body { flex: 1; overflow-y: auto; padding: 32px 24px 0; display: flex; flex-direction: column; gap: 16px; }
.logo { width: 56px; height: 56px; border-radius: 16px; background: var(--green); color: var(--white); display: flex; align-items: center; justify-content: center; }
.auth-title { font-size: 26px; line-height: 1.35; white-space: pre-line; }
.auth-body > p.muted { font-size: 14px; line-height: 1.6; }
.demo-note { background: #FFF6DC; border: 1px solid #F0D58A; border-radius: 10px; padding: 10px 12px; font-size: 13px; color: #6B4A00; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 600; }
.field input {
  height: 54px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--white);
  padding: 0 16px; font-size: 16px; font-weight: 400; width: 100%;
}
.field input:focus { border-color: var(--green); outline: none; }
.field input.code { font-size: 24px; font-weight: 600; letter-spacing: 0.35em; text-align: center; }
.auth-bottom { padding: 16px 24px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }

/* green headers */
.green-head { background: var(--green); color: var(--white); padding: 20px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.green-head.compact { padding-top: calc(18px + env(safe-area-inset-top)); }
.head-sub { color: var(--head-sub); font-size: 13px; }
.head-title { font-size: 24px; font-weight: 700; margin-top: 2px; }
.head-link { background: rgba(255,255,255,0.14); border: 0; color: var(--white); border-radius: 10px; height: 40px; padding: 0 12px; font-size: 13px; font-weight: 600; }
.tracking { letter-spacing: 0.08em; }
.gps-bar { display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,0.12); border-radius: 12px; padding: 6px 6px 6px 12px; }
.gps-text { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--white); }
.gps-text svg { color: var(--mint); }

/* course select */
.skeleton { height: 56px; border-radius: 12px; background: linear-gradient(90deg, #ECE9E0, #F7F5EF, #ECE9E0); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.club {
  min-height: 56px; border-radius: 12px; border: 1.5px solid var(--line2); background: var(--white);
  padding: 8px 12px; display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
}
.club.on { border: 2px solid var(--green); }
.radio { width: 22px; height: 22px; border-radius: 11px; border: 2px solid #B8B3A5; display: flex; align-items: center; justify-content: center; flex: none; }
.radio span { width: 10px; height: 10px; border-radius: 5px; }
.club.on .radio { border-color: var(--green); }
.club.on .radio span { background: var(--green); }
.club-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.club-name { font-size: 15px; font-weight: 700; }
.club-dist { font-size: 14px; font-weight: 700; color: var(--green); }
.search { display: flex; gap: 6px; }
.search input { flex: 1; min-width: 0; height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--white); padding: 0 12px; font-size: 15px; }
.course-row { display: flex; align-items: center; gap: 8px; }
.course-label { width: 34px; font-size: 13px; font-weight: 600; color: var(--ink2); flex: none; }
.chips { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 44px; flex: 1; min-width: 68px; border-radius: 10px; border: 1.5px solid var(--lime-line); background: var(--white); font-size: 14px; font-weight: 600; }
.chip.on { background: var(--green2); border-color: var(--green2); color: var(--white); }
.ok-tag { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--green); }
.par-grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; }
.par-cell { background: var(--paper); border: 0; border-radius: 6px; padding: 3px 0; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.par-cell b { font-size: 15px; }

/* play */
.play-head { padding-top: calc(18px + env(safe-area-inset-top)); padding-bottom: 36px; }
.hole-nav { display: flex; align-items: center; justify-content: space-between; }
.hole-title { font-size: 36px; font-weight: 700; line-height: 1.15; }
.dots { display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); gap: 3px; }
.dots span { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.22); }
.dots span.done { background: var(--mint); }
.dots span.cur { background: var(--white); }
.player {
  margin: -24px 16px 0; background: var(--white); border-radius: 16px; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 6px 18px rgba(22,35,27,0.10); position: relative;
}
.avatar { width: 44px; height: 44px; border-radius: 22px; background: #E3EDE5; color: var(--green); font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.player-name { font-weight: 600; font-size: 16px; }
.cur-score { font-size: 26px; font-weight: 700; line-height: 1.1; color: var(--green); }
.cur-score small { font-size: 15px; font-weight: 600; margin-left: 4px; }
.play-main { padding-top: 14px; gap: 12px; }
.mini-step { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.mini-step button { width: 32px; height: 32px; border-radius: 8px; border: 1.5px solid var(--lime-line); background: var(--white); font-size: 16px; }
.par-row { display: grid; grid-template-columns: 28px repeat(3, minmax(0, 1fr)); gap: 6px; align-items: center; }
.par-btn { height: 44px; border-radius: 10px; border: 1.5px solid var(--lime-line); background: var(--white); font-size: 15px; font-weight: 600; }
.par-btn.on { background: var(--green2); border-color: var(--green2); color: var(--white); }
.sym-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sym {
  height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--white);
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 0;
}
.sym.on { background: var(--green); border-color: var(--green); color: var(--white); }
.mark { display: inline-flex; align-items: center; justify-content: center; color: var(--ink); flex: none; }
.mark.on { color: var(--white); }
.mark.circle { width: 22px; height: 22px; border-radius: 50%; border: 2px solid currentColor; }
.mark.dcircle { width: 26px; height: 26px; border-radius: 50%; border: 6px double currentColor; }
.mark.dash { width: 20px; height: 0; border-top: 3px solid currentColor; }
.mark.square { width: 20px; height: 20px; border: 2px solid currentColor; }
.mark.dsquare { width: 24px; height: 24px; border: 6px double currentColor; }
.mark.plus { font-size: 17px; font-weight: 700; }
.lie-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.lie {
  height: 48px; border-radius: 10px; padding: 0 2px; font-size: 12px; line-height: 1.25; white-space: pre-line;
  border: 1.5px solid var(--line); background: var(--white); color: var(--ink); font-weight: 500;
}
.lie-haz { background: var(--haz); border-color: var(--haz-line); }
.lie-rough { background: var(--green2); border-color: var(--green2); color: var(--white); }
.lie-fair { background: var(--fair); border-color: var(--green2); }
.lie.on { border: 3px solid var(--ink); font-weight: 700; box-shadow: 0 3px 8px rgba(22,35,27,0.25); }
.dist-row { display: flex; align-items: center; gap: 10px; }
.dist-row > span:first-child { width: 40px; }
.dist-box { flex: 1; display: flex; align-items: center; height: 44px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 12px; background: #FAF9F5; }
.dist-box input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 18px; font-weight: 600; text-align: right; padding: 0; outline: none; }
.dist-box span { margin-left: 4px; font-size: 14px; }
.putt-row { display: flex; align-items: center; justify-content: space-between; }
.stepper { display: flex; align-items: center; gap: 6px; }
.round-btn { width: 44px; height: 44px; border-radius: 22px; border: 1.5px solid var(--line); background: var(--white); font-size: 22px; line-height: 1; }
.round-btn.solid { background: var(--green); border-color: var(--green); color: var(--white); }
.step-val { width: 44px; text-align: center; font-size: 28px; font-weight: 700; }

/* popup */
.overlay { position: absolute; inset: 0; background: rgba(22,35,27,0.55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
.dialog { width: 100%; max-width: 380px; background: var(--white); border-radius: 20px; padding: 24px 20px 18px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 16px 40px rgba(0,0,0,0.25); }
.emoji { font-size: 40px; line-height: 1; }
.dialog-title { font-size: 20px; }
.total-box { background: var(--green); color: var(--white); border-radius: 14px; padding: 14px; display: flex; justify-content: space-between; align-items: center; }
.total-box span { color: var(--head-sub); font-size: 14px; }
.total-box b { font-size: 32px; line-height: 1; }
.total-box small { font-size: 16px; margin-left: 6px; }
.kv { display: flex; justify-content: space-between; padding: 10px 12px; background: var(--paper); border-radius: 10px; font-size: 14px; }
.kv span { color: var(--muted); }
.kv.lime { background: var(--lime); }
.kv.lime span { color: var(--ink2); }
.cheer { text-align: center; background: #FFF6DC; border: 1.5px solid #F0D58A; border-radius: 12px; padding: 12px; font-size: 15px; font-weight: 700; color: #6B4A00; }

/* report */
.hero { background: var(--green); color: var(--white); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.hero-num { font-size: 40px; font-weight: 700; line-height: 1.1; }
.hero-num small { font-size: 18px; font-weight: 500; margin-left: 4px; }
.spark { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.big-num { font-size: 32px; font-weight: 700; line-height: 1.15; }
.big-num small { font-size: 14px; font-weight: 500; margin-left: 3px; }
.pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 12px; white-space: nowrap; }
.pill.good { color: var(--green); background: var(--lime); }
.pill.bad { color: var(--warn); background: var(--warn-bg); }
.pill.neutral { color: var(--muted); background: var(--sand); }
.insight { font-size: 13px; line-height: 1.6; color: var(--ink2); }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bar-row > span:first-child { width: 64px; }
.bar-row b { width: 40px; text-align: right; }
.bar { flex: 1; height: 10px; background: #EFECE3; border-radius: 5px; overflow: hidden; }
.bar span { display: block; height: 10px; border-radius: 5px; }
.bar .worse { background: var(--orange); }
.bar .better { background: var(--green); }
.stat-box { background: var(--paper); border-radius: 10px; padding: 8px 4px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.stat-box span { font-size: 11px; color: var(--muted); }
.stat-box b { font-size: 17px; }
.stat-box.warn-box { background: var(--warn-bg); }
.stat-box.warn-box span, .stat-box.warn-box b { color: #7A3810; }
.empty { padding: 28px 16px; color: var(--muted); line-height: 1.6; align-items: center; }
.empty svg { color: var(--green); }

/* list */
.segment { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; background: var(--sand); border-radius: 12px; padding: 4px; }
.segment button { height: 40px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; }
.segment button.on { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(22,35,27,0.15); }
.round-item {
  min-height: 64px; width: 100%; border-radius: 12px; border: 1.5px solid var(--line2); background: var(--white);
  padding: 8px 12px; display: flex; align-items: center; gap: 12px; text-align: left; color: var(--ink);
}
.round-item > svg { color: #8A918C; width: 16px; height: 16px; flex: none; }
.ri-date { width: 46px; display: flex; flex-direction: column; align-items: center; color: var(--muted); flex: none; }
.ri-date b { font-size: 15px; color: var(--ink); }
.ri-club { font-size: 15px; font-weight: 600; }
.best { font-size: 11px; font-weight: 700; color: var(--green); background: var(--lime); padding: 2px 8px; border-radius: 10px; vertical-align: middle; }
.ri-score { font-size: 26px; font-weight: 700; color: var(--green); }

/* scorecard */
.back-btn { align-self: flex-start; height: 44px; margin-left: -8px; border: 0; background: transparent; color: var(--white); font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 4px; padding: 0 8px; }
.glass { background: rgba(255,255,255,0.12); border-radius: 10px; padding: 6px 0; text-align: center; display: flex; flex-direction: column; }
.glass span { font-size: 11px; color: var(--head-sub); }
.glass b { font-size: 17px; }
.sc { padding: 10px 8px 8px; display: flex; flex-direction: column; gap: 4px; }
.sc-row { display: grid; grid-template-columns: 40px repeat(10, minmax(0, 1fr)); align-items: center; justify-items: center; font-size: 12px; min-height: 26px; }
.sc-head { background: var(--paper); border-radius: 8px; color: var(--muted); font-size: 11px; }
.sc-head b:first-child { color: var(--ink); }
.sc-score { min-height: 34px; }
.sc-score i { font-style: normal; width: 25px; height: 25px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.sc-score b { font-size: 14px; }
.sc-putt { background: var(--lime); border-radius: 8px; color: var(--ink2); }
.sc-eagle { border: 4px double var(--green); border-radius: 50%; color: var(--green); }
.sc-birdie { border: 1.5px solid var(--green); border-radius: 50%; color: var(--green); }
.sc-bogey { border: 1.5px solid var(--ink); }
.sc-double { border: 4px double var(--ink); font-size: 11px !important; }
.sc-triple { background: var(--ink); color: var(--white); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0 4px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.lg { width: 14px; height: 14px; display: inline-block; }
.legend .sc-eagle { border-width: 4px; }

.splash { align-items: center; justify-content: center; color: var(--green); }
.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--white); padding: 12px 16px; border-radius: 12px; font-size: 14px;
  max-width: calc(100% - 32px); z-index: 20;
}

@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
