* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #16301c; color: #f3f1e8; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.hidden { display: none !important; }
h1, h2, h3 { font-family: 'PlayfairSC', Georgia, serif; font-weight: normal; margin: 0 0 .4em; letter-spacing: .02em; }
.btn { font: inherit; font-size: 15px; color: #f3f1e8; background: #2c5a35; border: 1px solid #5f9a62; border-radius: 8px; padding: 9px 14px; cursor: pointer; }
.btn:hover { background: #366b40; }
.btn:focus-visible { outline: 2px solid #ffd76a; outline-offset: 2px; }
.btn.primary { background: #d9a93a; border-color: #f2cf73; color: #1f2a12; font-weight: 700; }
.btn.primary:hover { background: #e7b847; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.wide { flex: 1; }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; }
.note { font-size: 13px; opacity: .75; margin: 4px 0 10px; }
input { font: inherit; font-size: 16px; padding: 8px 10px; border-radius: 8px; border: 1px solid #5f9a62; background: #0f2414; color: #fff; width: 100%; -webkit-user-select: text; user-select: text; }
select { font: inherit; font-size: 15px; padding: 6px 8px; border-radius: 8px; border: 1px solid #5f9a62; background: #0f2414; color: #fff; }

/* title */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto;
  background: radial-gradient(ellipse at 50% 120%, #5fae4a 0%, #2f7d3a 35%, #173a20 75%); }
.card { width: min(460px, 100%); background: rgba(10, 26, 14, .82); border: 1px solid #4f8a55; border-radius: 16px; padding: 22px 22px 18px; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.card h1 { font-size: 34px; color: #ffe39a; text-align: center; margin-bottom: 0; }
.sub { text-align: center; margin: 2px 0 16px; font-family: 'Crimson', Georgia, serif; font-size: 18px; opacity: .9; }
.f { display: block; margin: 10px 0 4px; font-size: 14px; }
.f > input, .f > .row, .f > .seg { margin-top: 5px; }
.seg { display: flex; border: 1px solid #5f9a62; border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; font: inherit; font-size: 14px; background: #1d3f24; color: #ddd; border: 0; padding: 8px 0; cursor: pointer; border-right: 1px solid #3c6b42; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: #d9a93a; color: #1f2a12; font-weight: 700; }
#tBotList .bot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 14px; }
#tBotList .seg { flex: 0 0 220px; }
#resumeBox { margin-bottom: 8px; }

/* game layout */
#game { position: fixed; inset: 0; display: grid; grid-template-columns: 1fr 320px; grid-template-rows: auto 1fr auto; grid-template-areas: "hud hud" "stage side" "ctl side"; }
#hud { grid-area: hud; display: flex; align-items: center; gap: 16px; padding: 6px 12px; background: #10261580; background: linear-gradient(#0f2414, #15321b); border-bottom: 1px solid #3d6b43; min-height: 52px; }
#hud .hole { display: flex; flex-direction: column; line-height: 1.15; }
#hud .hole b { font-family: 'PlayfairSC', Georgia, serif; font-size: 19px; font-weight: normal; color: #ffe39a; }
#hud .hole span { font-size: 13px; opacity: .85; }
#hud .who { display: flex; align-items: center; gap: 7px; font-size: 15px; }
#hud .who span:last-child { opacity: .8; font-size: 13px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid #000; }
#hud .wind { display: flex; align-items: center; gap: 4px; font-size: 13px; }
#windc { width: 32px; height: 32px; }
#hud nav { margin-left: auto; display: flex; gap: 6px; }
#stage { grid-area: stage; position: relative; overflow: hidden; background: #6aa; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#info { position: absolute; left: 10px; top: 10px; background: rgba(8, 20, 10, .72); padding: 7px 11px; border-radius: 8px; font-size: 14px; line-height: 1.4; pointer-events: none; max-width: 60%; }
#info b { color: #ffe39a; }
#tip { position: absolute; left: 10px; right: 10px; bottom: 10px; background: rgba(8, 20, 10, .78); padding: 7px 11px; border-radius: 8px; font-size: 13px; display: none; }
#toast { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); background: rgba(10, 24, 12, .88); border: 1px solid #d9a93a; padding: 10px 18px; border-radius: 10px; font-size: 18px; font-weight: 600; text-align: center; pointer-events: none; max-width: 90%; }
#side { grid-area: side; background: #10261a; border-left: 1px solid #3d6b43; display: flex; flex-direction: column; min-height: 0; }
.mapWrap { flex: 1 1 auto; min-height: 220px; position: relative; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#caddy { flex: 0 0 auto; padding: 10px 12px 12px; border-top: 1px solid #3d6b43; font-size: 13.5px; line-height: 1.4; max-height: 46%; overflow: auto; }
#caddy h3 { font-size: 16px; color: #ffe39a; margin-bottom: 4px; }
#caddy p { margin: 0 0 6px; }
#caddy .adv { font-weight: 600; color: #fff; }
#caddy .adv2 { color: #ffe39a; }
#cHaz { margin: 0; padding-left: 18px; }
#cHaz li.water { color: #9fd0ff; } #cHaz li.sand { color: #f1dc9e; }
#controls { grid-area: ctl; display: flex; align-items: center; gap: 12px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(#15321b, #0f2414); border-top: 1px solid #3d6b43; }
.grp { display: flex; align-items: center; gap: 6px; }
.btn.arrow { width: 40px; height: 40px; padding: 0; font-size: 18px; font-weight: 700; }
#clubBox { width: 118px; text-align: center; display: flex; flex-direction: column; line-height: 1.15; }
#clubBox b { font-size: 15px; } #clubBox small { opacity: .75; font-size: 12px; }
.lbl { font-size: 13px; opacity: .85; }
#meterWrap { flex: 1; min-width: 160px; height: 46px; position: relative; }
#meter { position: absolute; inset: 0; width: 100%; height: 100%; }
.btn.big { font-size: 18px; padding: 12px 26px; min-width: 110px; }
#game.busy #controls .btn:not(#swing) { opacity: .45; pointer-events: none; }

/* modal */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 20; }
#modal .box { background: #10261a; border: 1px solid #5f9a62; border-radius: 14px; padding: 18px; max-width: min(980px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
#modal h2 { color: #ffe39a; font-size: 24px; }
#modal p, #modal li { line-height: 1.45; font-size: 14.5px; }
#modal .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
table.card { border-collapse: collapse; font-size: 13px; width: 100%; background: #f6f2e2; color: #1d2a18; border-radius: 6px; overflow: hidden; }
table.card th, table.card td { border: 1px solid #c7c0a2; padding: 4px 5px; text-align: center; min-width: 26px; }
table.card th { background: #2f6a37; color: #fff; font-weight: 600; }
table.card td.n { text-align: left; font-weight: 700; white-space: nowrap; }
table.card tr.par td { background: #e7e0c4; font-weight: 600; }
table.card td.tot { font-weight: 700; background: #ece5c8; }
table.card td.cur { outline: 2px solid #d9a93a; outline-offset: -2px; }
.sc { display: inline-block; min-width: 20px; line-height: 18px; }
.sc.eagle { border: 3px double #b2261f; border-radius: 50%; }
.sc.birdie { border: 1.5px solid #b2261f; border-radius: 50%; }
.sc.bogey { border: 1.5px solid #1d3e7a; }
.sc.dbl { border: 3px double #1d3e7a; }
.cardScroll { overflow-x: auto; }
.cardScroll + .cardScroll { margin-top: 8px; }
.res { list-style: none; padding: 0; margin: 8px 0; }
.res li { display: flex; gap: 10px; align-items: center; padding: 4px 0; font-size: 15px; }
.res li b { min-width: 110px; }

/* phone */
@media (max-width: 820px) {
  #game { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; grid-template-areas: "hud" "stage" "ctl"; }
  #side { position: fixed; z-index: 10; left: 0; right: 0; top: 50px; bottom: 132px; border: 0; display: none; background: rgba(12, 30, 18, .97); }
  #game.showMap #side { display: flex; }
  #hud { gap: 8px; padding: 4px 8px; min-height: 48px; flex-wrap: nowrap; }
  #hud .hole b { font-size: 16px; }
  #hud .who { font-size: 13px; flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.15; }
  #hud .who .dot { display: none; }
  #hud .wind span { display: none; }
  #hud nav { gap: 4px; } #hud nav .btn { padding: 6px 7px; font-size: 12px; }
  #controls { display: grid; grid-template-columns: auto auto; grid-template-areas: "club aim" "meter swing"; gap: 6px 8px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: stretch; }
  .grp.club { grid-area: club; } .grp.aim { grid-area: aim; justify-self: end; }
  #meterWrap { grid-area: meter; height: 50px; min-width: 0; }
  #swing { grid-area: swing; }
  .btn.arrow { width: 38px; height: 38px; }
  #clubBox { width: 96px; }
  #info { font-size: 12.5px; max-width: 75%; }
  #tip { display: block; }
  #toast { font-size: 15px; }
  table.card { font-size: 11.5px; } table.card th, table.card td { padding: 3px 2px; min-width: 20px; }
}
@media (max-width: 380px) { #hud nav #bHelp { display: none; } }
@media (max-height: 500px) and (pointer: coarse) {
  #game { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; grid-template-areas: "hud" "stage" "ctl"; }
  #side { position: fixed; z-index: 10; left: 0; right: 0; top: 50px; bottom: 132px; border: 0; display: none; background: rgba(12, 30, 18, .97); }
  #game.showMap #side { display: flex; }
  #hud { gap: 8px; padding: 4px 8px; min-height: 48px; flex-wrap: nowrap; }
  #hud .hole b { font-size: 16px; }
  #hud .who { font-size: 13px; flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.15; }
  #hud .who .dot { display: none; }
  #hud .wind span { display: none; }
  #hud nav { gap: 4px; } #hud nav .btn { padding: 6px 7px; font-size: 12px; }
  #controls { display: grid; grid-template-columns: auto auto; grid-template-areas: "club aim" "meter swing"; gap: 6px 8px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: stretch; }
  .grp.club { grid-area: club; } .grp.aim { grid-area: aim; justify-self: end; }
  #meterWrap { grid-area: meter; height: 50px; min-width: 0; }
  #swing { grid-area: swing; }
  .btn.arrow { width: 38px; height: 38px; }
  #clubBox { width: 96px; }
  #info { font-size: 12.5px; max-width: 75%; }
  #tip { display: block; }
  #toast { font-size: 15px; }
  table.card { font-size: 11.5px; } table.card th, table.card td { padding: 3px 2px; min-width: 20px; }
}
.screen { align-items: flex-start; } .screen > .card { margin: auto; }
