/* Clubhouse Tour: phone-first, portrait, one thumb. */
:root {
  --bg: #12382a; --panel: #fffaf0; --ink: #1f2430; --muted: #6b7280; --line: #e6dcc6;
  --green: #2fa35a; --green-d: #1f7a42; --gold: #ffb52e; --red: #e8483f; --blue: #3d8fe0; --cream: #fffaf0;
  --r: 16px; --tap: 48px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --font: "Avenir Next", "Nunito", "Trebuchet MS", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font); overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
body { position: fixed; inset: 0; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.ui { position: fixed; inset: 0; display: flex; flex-direction: column; pointer-events: none; }
.ui > * { pointer-events: auto; }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: 0.01em; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 0 0 10px; line-height: 1.4; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; } .row > .grow, .grow { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 10px; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.btn { min-height: var(--tap); padding: 10px 18px; border: 0; border-radius: 14px; font: 800 16px var(--font); color: var(--ink); background: #efe6d2; box-shadow: 0 3px 0 rgba(0,0,0,0.18); cursor: pointer; touch-action: manipulation; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.18); }
.btn.primary { background: var(--green); color: #fff; } .btn.gold { background: var(--gold); color: #3a2a00; }
.btn.danger { background: var(--red); color: #fff; } .btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn.icon { min-width: var(--tap); padding: 0 12px; font-size: 22px; } .btn.big { min-height: 60px; font-size: 19px; }
.btn.seg { min-height: 40px; padding: 6px 10px; font-size: 13px; border-radius: 10px; background: rgba(255,255,255,0.18); color: #fff; box-shadow: none; }
.btn.seg.on { background: #fff; color: var(--ink); }
.btn:disabled { opacity: 0.45; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 14px; }
input, select, textarea { font: 600 16px var(--font); min-height: var(--tap); padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); width: 100%; -webkit-user-select: text; user-select: text; }
label { font-weight: 700; font-size: 14px; display: block; margin-bottom: 4px; }

/* screens */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: calc(var(--sat) + 8px) calc(var(--sar) + 12px) calc(var(--sab) + 8px) calc(var(--sal) + 12px); }
.screen.solid { background: linear-gradient(#1c5a40, #12382a); }
.topbar { display: flex; align-items: center; gap: 8px; color: #fff; margin-bottom: 8px; min-height: var(--tap); }
.topbar h1 { flex: 1; font-size: 22px; text-shadow: 0 2px 0 rgba(0,0,0,0.25); }
.topbar .btn.icon { background: rgba(255,255,255,0.18); color: #fff; box-shadow: none; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; padding-bottom: 12px; }
.card { background: var(--panel); border-radius: var(--r); padding: 14px; box-shadow: 0 4px 0 rgba(0,0,0,0.15); margin-bottom: 10px; }
.card.tight { padding: 10px 12px; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; background: #efe6d2; }
.pill.green { background: #d6f3de; color: #14602f; } .pill.red { background: #ffd9d5; color: #8a1d16; } .pill.gold { background: #ffe9b8; color: #6b4a00; } .pill.blue { background: #d8e9ff; color: #164a86; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; touch-action: pan-x; }
.tabs .btn { flex: 1; min-height: 40px; padding: 6px 10px; font-size: 14px; white-space: nowrap; background: rgba(255,255,255,0.16); color: #fff; box-shadow: none; }
.tabs .btn.on { background: #fff; color: var(--ink); }
table.lb { width: 100%; border-collapse: collapse; font-size: 15px; }
table.lb th { text-align: left; font-size: 12px; color: var(--muted); padding: 4px 6px; }
table.lb td { padding: 8px 6px; border-top: 1px solid var(--line); }
table.lb td.num, table.lb th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.lb tr.me td { background: #fff3cf; font-weight: 800; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* clubhouse home */
.home { justify-content: space-between; }
.home-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.home-name { color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.3); } .home-name small { display: block; font-weight: 700; opacity: 0.85; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip { background: rgba(0,0,0,0.38); color: #fff; padding: 6px 10px; border-radius: 999px; font-weight: 800; font-size: 14px; }
.home-bottom { display: flex; flex-direction: column; gap: 8px; max-height: 62vh; }
.home-panel { background: rgba(255,250,240,0.95); border-radius: var(--r); padding: 10px; overflow-y: auto; touch-action: pan-y; }
.doors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.door { background: #fff; border: 0; border-radius: 12px; padding: 8px 2px; font: 800 11.5px var(--font); color: var(--ink); min-height: 58px; box-shadow: 0 2px 0 rgba(0,0,0,0.12); position: relative; }
.door .ico { display: block; font-size: 22px; line-height: 1.1; }
.badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; border-radius: 999px; min-width: 20px; height: 20px; font-size: 12px; line-height: 20px; padding: 0 5px; font-weight: 800; }
.today { display: flex; align-items: center; gap: 10px; }
.today .btn { flex: 1; }
.feed-item { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; } .feed-item:first-child { border-top: 0; }
.react { display: inline-flex; gap: 4px; margin-top: 4px; } .react button { border: 0; background: #efe6d2; border-radius: 999px; padding: 3px 8px; font-size: 14px; min-height: 30px; } .react button.on { background: #ffe9b8; }

/* play HUD */
.play .aim-layer { position: absolute; inset: 0; touch-action: none; }
.hud-top { position: absolute; top: calc(var(--sat) + 8px); left: calc(var(--sal) + 8px); display: flex; gap: 10px; align-items: flex-start; pointer-events: none; }
.hud-box { background: rgba(0,0,0,0.42); color: #fff; border-radius: 12px; padding: 7px 10px; font-size: 13px; font-weight: 700; }
.hud-info b { display: block; font-size: 15px; } .hud-info span { display: block; opacity: 0.92; }
.hud-dist { color: #fff; font-size: 30px; white-space: nowrap; font-weight: 900; text-shadow: 0 2px 0 rgba(0,0,0,0.4), 0 0 12px rgba(0,0,0,0.35); margin-top: 2px; }
.hud-wind { position: absolute; top: calc(var(--sat) + 184px); right: calc(var(--sar) + 8px); width: 96px; display: flex; align-items: center; justify-content: center; gap: 4px; pointer-events: none; padding: 5px 6px; } .wind-cv { width: 30px; height: 30px; } .wind-tx { font-size: 13px; white-space: nowrap; }
.minimap { position: absolute; top: calc(var(--sat) + 8px); right: calc(var(--sar) + 8px); width: 96px; height: 168px; border-radius: 12px; border: 2px solid rgba(255,255,255,0.75); background: #234; touch-action: none; z-index: 3; }
.minimap.big { right: 50%; transform: translateX(50%); top: calc(var(--sat) + 56px); box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.hud-lie { position: absolute; left: calc(var(--sal) + 8px); top: calc(var(--sat) + 86px); background: rgba(0,0,0,0.42); color: #fff; border-radius: 10px; padding: 5px 9px; font-size: 13px; font-weight: 800; max-width: 60vw; }
.hud-goal { position: absolute; left: calc(var(--sal) + 8px); top: calc(var(--sat) + 120px); color: #ffe24a; font-weight: 800; font-size: 14px; text-shadow: 0 1px 0 rgba(0,0,0,0.6); max-width: 62vw; }
.hud-menu { position: absolute; left: calc(var(--sal) + 8px); bottom: calc(var(--sab) + 262px); background: rgba(0,0,0,0.42) !important; color: #fff !important; box-shadow: none !important; z-index: 4; }
.play-msg { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-size: 34px; font-weight: 900; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,0.35); opacity: 0; pointer-events: none; letter-spacing: 0.03em; }
.play-msg.show { animation: pop 1.3s ease-out both; }
.play-msg[data-r="3"] { color: #7dffa1; font-size: 44px; } .play-msg[data-r="0"] { color: #ffb0a8; }
@keyframes pop { 0% { opacity: 0; transform: scale(0.6); } 15% { opacity: 1; transform: scale(1.12); } 30% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.play-banner { position: absolute; left: 12px; right: 12px; top: 20%; text-align: center; color: #fff; opacity: 0; transform: translateY(10px); transition: opacity 0.2s, transform 0.2s; pointer-events: none; }
.play-banner.show { opacity: 1; transform: none; }
.play-banner .big { font-size: 38px; font-weight: 900; text-shadow: 0 3px 0 rgba(0,0,0,0.35), 0 0 18px rgba(0,0,0,0.3); }
.play-banner .sub { font-size: 16px; font-weight: 800; text-shadow: 0 2px 0 rgba(0,0,0,0.45); margin-top: 2px; }
.play-banner.good .big { color: #ffe24a; } .play-banner.bad .big { color: #ffb0a8; }
.plan-bar { position: absolute; left: calc(var(--sal) + 8px); right: calc(var(--sar) + 8px); bottom: calc(var(--sab) + 256px); display: flex; align-items: center; gap: 6px; z-index: 4; padding-left: 56px; }
.plan-bar .btn.icon { background: rgba(0,0,0,0.42); color: #fff; box-shadow: none; min-width: 44px; }
.club-name { background: rgba(0,0,0,0.42); color: #fff; border-radius: 12px; padding: 5px 10px; min-width: 96px; text-align: center; } .club-name b { display: block; font-size: 15px; } .club-name span { font-size: 12px; opacity: 0.9; }
.shape-toggle { display: flex; gap: 3px; position: absolute; right: 0; bottom: 56px; background: rgba(0,0,0,0.42); padding: 4px; border-radius: 12px; }
.swing-pad { position: absolute; left: 0; right: 0; bottom: 0; height: calc(250px + var(--sab)); touch-action: none; background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.38) 30%); z-index: 2; }
.pad-cv { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.swing-pad.side-left .pad-cv { transform: translateX(-26%); } .swing-pad.side-right .pad-cv { transform: translateX(26%); }
.pad-hint { position: absolute; left: 0; right: 0; bottom: calc(var(--sab) + 10px); text-align: center; color: #fff; font-weight: 800; font-size: 13px; opacity: 0.85; pointer-events: none; }
.hide { display: none !important; }
.caddie-tip { position: absolute; left: 12px; right: 12px; top: 27%; background: var(--panel); border-radius: 16px; padding: 12px 14px; font-weight: 700; font-size: 15px; box-shadow: 0 6px 0 rgba(0,0,0,0.2); display: none; pointer-events: none; z-index: 5; }
.caddie-tip.show { display: block; }

/* modal, toast, misc */
.modal-wrap { position: fixed; inset: 0; background: rgba(8,20,14,0.6); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: calc(var(--sat) + 10px) 10px calc(var(--sab) + 10px); }
.modal { background: var(--panel); border-radius: 20px; width: 100%; max-width: 480px; max-height: 100%; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,0.4); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 12px 4px 16px; } .modal-head .btn.icon { background: transparent; box-shadow: none; }
.modal-body { padding: 8px 16px 16px; overflow-y: auto; touch-action: pan-y; }
.toast { position: fixed; left: 50%; bottom: calc(var(--sab) + 90px); transform: translate(-50%, 20px); background: rgba(20,24,30,0.92); color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 800; font-size: 14px; opacity: 0; transition: all 0.2s; z-index: 80; pointer-events: none; max-width: 88vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sync-pill { position: fixed; top: calc(var(--sat) + 4px); left: 50%; transform: translateX(-50%); background: #ffb52e; color: #3a2a00; font-weight: 800; font-size: 12px; padding: 4px 10px; border-radius: 999px; z-index: 70; display: none; }
.sync-pill.show { display: block; }
.version-label { position: fixed; left: calc(var(--sal) + 4px); bottom: calc(var(--sab) + 2px); font: 600 10px var(--font); color: rgba(255,255,255,0.45); background: none; border: 0; padding: 6px; z-index: 60; touch-action: none; }
.perf-overlay { position: fixed; left: 4px; top: calc(var(--sat) + 4px); background: rgba(0,0,0,0.7); color: #7dffa1; font: 11px ui-monospace, monospace; padding: 3px 6px; border-radius: 6px; z-index: 90; pointer-events: none; }
.rotate-overlay { position: fixed; inset: 0; background: #12382a; color: #fff; display: none; align-items: center; justify-content: center; text-align: center; z-index: 100; font-weight: 800; font-size: 18px; }
.rotate-icon { font-size: 54px; }
@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) { .rotate-overlay { display: flex; } }
.boot { margin: auto; color: #fff; text-align: center; font-weight: 800; }
.boot-logo { width: 96px; height: 96px; margin: 0 auto 14px; background: url(/icons/icon.svg) center/contain no-repeat; }

/* creator, bag, packs, cards */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; } .swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); } .swatch.on { box-shadow: 0 0 0 3px var(--ink); }
.opt { min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font: 800 14px var(--font); color: var(--ink); } .opt.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.stat-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; } .stat-row .name { width: 84px; font-weight: 800; }
.bar { flex: 1; height: 14px; background: #eadfc8; border-radius: 999px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.bar.neg > i { background: var(--red); } .bar.gold > i { background: var(--gold); }
.item { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: #fff; margin-bottom: 8px; border-left: 6px solid var(--line); }
.item.rare { border-left-color: #4da3ff; } .item.epic { border-left-color: #b46bff; } .item.legendary { border-left-color: #ffb52e; }
.item .meta { flex: 1; min-width: 0; } .item .meta b { display: block; } .item .meta span { font-size: 13px; color: var(--muted); display: block; }
.item.on { box-shadow: inset 0 0 0 3px var(--green); }
.pack-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.pack-card { width: 76vw; max-width: 320px; aspect-ratio: 3/4; border-radius: 22px; background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 18px; box-shadow: 0 0 0 6px var(--glow, #b8c4cc), 0 0 46px 10px var(--glow, #b8c4cc); animation: reveal 0.5s cubic-bezier(.2,1.4,.4,1) both; }
.pack-card.slow { animation-duration: 1.4s; }
@keyframes reveal { 0% { transform: scale(0.3) rotate(-8deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.pack-box { width: 180px; height: 220px; border-radius: 20px; background: linear-gradient(135deg, #2fa35a, #1f7a42); box-shadow: 0 8px 0 rgba(0,0,0,0.25); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 900; font-size: 22px; animation: wiggle 1.2s infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
.share-img { width: 100%; border-radius: 14px; display: block; box-shadow: 0 4px 0 rgba(0,0,0,0.15); }
.scorecard { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; text-align: center; font-weight: 800; font-size: 14px; margin: 6px 0; }
.scorecard > div { background: #fff; border-radius: 6px; padding: 4px 0; } .scorecard .h { background: transparent; color: var(--muted); font-size: 11px; }
.sc-b { color: #b02a1f; } .sc-g { color: #14602f; } .sc-e { box-shadow: inset 0 0 0 2px var(--gold); }
.install-steps { counter-reset: s; } .install-steps li { margin-bottom: 10px; font-weight: 700; }
.codebox { font: 900 34px ui-monospace, monospace; letter-spacing: 0.2em; text-align: center; background: #fff; border-radius: 14px; padding: 12px; border: 2px dashed var(--line); -webkit-user-select: text; user-select: text; }
.trophy-shelf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; } .trophy { text-align: center; font-size: 12px; font-weight: 800; } .trophy .cup { font-size: 44px; display: block; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01s !important; transition-duration: 0.01s !important; } }
@media (min-width: 700px) { .screen, .hud-top { max-width: 520px; margin: 0 auto; left: 0; right: 0; } }
