/* mini-golf-3d.css - stage, HUD and screens for Putt Planet. Phone-first; tap targets are 44px or larger. */
.mg-stage { position: relative; width: 100%; aspect-ratio: 9 / 16; max-height: calc(100vh - 150px); max-height: calc(100svh - 150px); min-height: 440px; border-radius: 14px; overflow: hidden; background: #8fd3f4; box-shadow: 0 2px 10px rgba(0,0,0,.18); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; color: #fff; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.mg-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.mg-stage.mg-big, .mg-stage:fullscreen { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-height: none; min-height: 0; aspect-ratio: auto; border-radius: 0; z-index: 99999; }
html.mg-noscroll, html.mg-noscroll body { overflow: hidden; }
.mg-below { display: flex; justify-content: center; margin-top: 0.7rem; }
.mg-bigbtn { min-height: 44px; padding: 0 1.4rem; border: 0; border-radius: 22px; background: #0f7a4f; color: #fff; font-weight: 700; font-size: 1rem; cursor: pointer; }
.mg-bigbtn:active { transform: scale(.97); }

.mg-hud { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; padding: 8px; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.mg-hud[hidden] { display: none; }
.mg-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mg-ic { pointer-events: auto; width: 44px; height: 44px; border-radius: 22px; border: 0; background: rgba(8,30,22,.62); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.mg-ic:active { background: rgba(8,30,22,.85); }
.mg-info { background: rgba(8,30,22,.62); border-radius: 18px; padding: 6px 14px; display: flex; flex-wrap: wrap; gap: 2px 10px; justify-content: center; font-size: 0.85rem; line-height: 1.25; }
.mg-info b { font-size: 0.95rem; }
.mg-sub2 { display: flex; justify-content: center; gap: 8px; margin-top: 6px; font-size: 0.78rem; }
.mg-sub2 span:empty { display: none; }
.mg-sub2 span { background: rgba(8,30,22,.55); border-radius: 12px; padding: 3px 10px; }
.mg-banner { align-self: center; margin-top: 10px; max-width: 92%; background: rgba(255,255,255,.93); color: #153; border-radius: 14px; padding: 8px 14px; font-size: 0.88rem; font-weight: 600; text-align: center; opacity: 0; transform: translateY(-6px); transition: opacity .25s, transform .25s; }
.mg-banner.on { opacity: 1; transform: none; }
.mg-bottom { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.mg-power { position: relative; height: 22px; border-radius: 11px; background: rgba(8,30,22,.6); overflow: hidden; }
.mg-power i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #4c4; transition: width .06s linear; }
.mg-power span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.mg-tools { display: flex; gap: 8px; justify-content: center; }
.mg-tool { pointer-events: auto; min-height: 44px; min-width: 92px; padding: 0 14px; border: 0; border-radius: 22px; background: rgba(8,30,22,.66); color: #fff; font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.mg-tool:active { background: rgba(8,30,22,.9); }
.mg-tool.off { opacity: .4; }
.mg-coach { position: absolute; left: 12px; right: 12px; bottom: 120px; background: #fff; color: #153; border-radius: 16px; padding: 10px 14px; font-size: 0.92rem; font-weight: 600; text-align: center; box-shadow: 0 4px 14px rgba(0,0,0,.3); pointer-events: none; animation: mgBob 1.6s ease-in-out infinite; }
.mg-coach[hidden] { display: none; }
@keyframes mgBob { 50% { transform: translateY(-4px); } }

.mg-toasts { position: absolute; top: 62px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 6; }
.mg-toast { background: rgba(8,30,22,.88); color: #fff; padding: 7px 14px; border-radius: 16px; font-size: 0.85rem; font-weight: 600; max-width: 90%; text-align: center; }
.mg-toast.gold { background: #b5820b; }
.mg-fade { position: absolute; inset: 0; background: #0b2a20; opacity: 0; pointer-events: none; transition: opacity .16s; z-index: 8; }
.mg-fade.on { opacity: 1; }
.mg-lost, .mg-fallback { position: absolute; inset: 0; z-index: 9; background: rgba(8,30,22,.94); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 10px; line-height: 1.5; }
.mg-lost[hidden], .mg-fallback[hidden] { display: none; }
.mg-fallback a { color: #8fe8b9; }

.mg-screens { position: absolute; inset: 0; z-index: 5; }
.mg-screens[hidden] { display: none; }
.mg-screen { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; padding: 12px; padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(7,34,26,.78), rgba(7,34,26,.9)); }
.mg-screen.menu { background: linear-gradient(180deg, rgba(7,34,26,.35), rgba(7,34,26,.82) 55%); display: flex; flex-direction: column; justify-content: flex-start; }
.mg-screen.card { background: rgba(7,34,26,.45); display: flex; align-items: center; justify-content: center; }
.mg-hero { text-align: center; margin: 6px 0 10px; }
.mg-logo { font-size: 2.3rem; font-weight: 900; letter-spacing: .01em; text-shadow: 0 3px 0 #0a5a3a, 0 6px 14px rgba(0,0,0,.4); }
.mg-tag { font-size: 0.82rem; opacity: .9; }
.mg-stat { display: flex; justify-content: center; gap: 14px; font-size: 0.9rem; font-weight: 700; margin-bottom: 6px; }
.mg-coin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3a8, #f2b01e 60%, #b5820b); margin-right: 5px; vertical-align: -2px; }
.mg-xp { height: 8px; border-radius: 4px; background: rgba(255,255,255,.2); overflow: hidden; flex: 1; }
.mg-xp.wide { margin: 0 6px 12px; flex: none; }
.mg-xp i { display: block; height: 100%; background: linear-gradient(90deg, #7dffb2, #35e0ff); }
.mg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mg-btn { min-height: 52px; border: 0; border-radius: 14px; background: rgba(255,255,255,.14); color: #fff; padding: 8px 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-family: inherit; font-size: 1rem; }
.mg-btn b { font-size: 1rem; }
.mg-btn small { font-size: 0.72rem; opacity: .85; }
.mg-btn:active { transform: scale(.98); background: rgba(255,255,255,.24); }
.mg-btn.primary { background: linear-gradient(180deg, #2fc77f, #0f9b5f); box-shadow: 0 3px 0 #0a6f43; }
.mg-btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,.3); }
.mg-btn.span2 { grid-column: span 2; }
.mg-bar { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px; }
.mg-bar h2 { margin: 0; font-size: 1.2rem; text-align: center; }
.mg-back { width: 44px; height: 44px; border: 0; border-radius: 22px; background: rgba(255,255,255,.16); color: #fff; font-size: 1.8rem; line-height: 1; cursor: pointer; }
.mg-coins { font-weight: 800; font-size: 0.9rem; min-width: 44px; text-align: right; }
.mg-lv { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; margin: 6px 0 10px; }
.mg-list { display: flex; flex-direction: column; gap: 8px; }
.mg-list.tight { gap: 6px; }
.mg-course { position: relative; display: flex; align-items: center; gap: 12px; min-height: 76px; text-align: left; border: 0; border-left: 6px solid var(--acc, #2fc77f); border-radius: 14px; background: rgba(255,255,255,.14); color: #fff; padding: 10px 12px; cursor: pointer; font-family: inherit; }
.mg-course.locked { opacity: .55; }
.mg-cnum { width: 36px; height: 36px; border-radius: 50%; background: var(--acc, #2fc77f); color: #082; display: grid; place-items: center; font-weight: 900; flex: none; }
.mg-ctext { display: flex; flex-direction: column; gap: 1px; }
.mg-ctext b { font-size: 1rem; }
.mg-ctext small { font-size: 0.75rem; opacity: .85; }
.mg-ctext em { font-size: 0.75rem; font-style: normal; color: #ffe27a; }
.mg-lock { position: absolute; right: 10px; top: 10px; font-size: 0.62rem; font-weight: 800; letter-spacing: .08em; background: rgba(0,0,0,.4); border-radius: 8px; padding: 2px 6px; }
.mg-holes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mg-hole { min-height: 92px; border: 0; border-radius: 14px; background: rgba(255,255,255,.14); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; font-family: inherit; padding: 6px 4px; }
.mg-hole b { font-size: 1.3rem; }
.mg-hole small { font-size: 0.68rem; opacity: .85; text-align: center; }
.mg-hole span { font-size: 0.7rem; }
.mg-hole em { font-style: normal; font-size: 0.8rem; color: #ffe27a; min-height: 1em; }
.mg-hole.locked { opacity: .45; }
.mg-note { font-size: 0.78rem; opacity: .85; line-height: 1.45; margin: 10px 2px; }
.mg-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.mg-tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 22px; background: rgba(255,255,255,.12); color: #fff; font-weight: 700; cursor: pointer; font-family: inherit; }
.mg-tabs button.on { background: #2fc77f; color: #052; }
.mg-shop { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mg-item { min-height: 104px; border: 2px solid transparent; border-radius: 14px; background: rgba(255,255,255,.12); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 2px; cursor: pointer; font-family: inherit; }
.mg-item b { font-size: 0.78rem; }
.mg-item small { font-size: 0.66rem; opacity: .9; }
.mg-item.equipped { border-color: #7dffb2; background: rgba(47,199,127,.25); }
.mg-item.poor, .mg-item.locked, .mg-item.quest { opacity: .6; }
.mg-sw { width: 44px; height: 44px; }
.mg-tr { display: flex; height: 22px; width: 54px; border-radius: 11px; overflow: hidden; background: rgba(0,0,0,.3); align-items: stretch; }
.mg-tr i { flex: 1; }
.mg-tr i.none { background: repeating-linear-gradient(45deg, transparent 0 4px, rgba(255,255,255,.2) 4px 6px); }
.mg-h3 { margin: 14px 2px 6px; font-size: 0.95rem; }
.mg-mission, .mg-ach { background: rgba(255,255,255,.12); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.mg-mission.done, .mg-ach.got { background: rgba(47,199,127,.28); }
.mg-mission small, .mg-ach small { font-size: 0.72rem; opacity: .85; }
.mg-ach em { font-style: normal; font-size: 0.72rem; color: #ffe27a; }
.mg-set { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.mg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(255,255,255,.1); border-radius: 12px; padding: 6px 12px; min-height: 52px; }
.mg-sw2 { min-height: 44px; min-width: 84px; border: 0; border-radius: 22px; background: rgba(255,255,255,.18); color: #fff; font-weight: 700; cursor: pointer; font-family: inherit; padding: 0 14px; }
.mg-sw2.on { background: #2fc77f; color: #052; }
.mg-sw2.danger { background: #b4402e; }
.mg-seg { display: flex; gap: 4px; }
.mg-seg button { min-height: 44px; min-width: 52px; border: 0; border-radius: 22px; background: rgba(255,255,255,.14); color: #fff; font-weight: 700; text-transform: capitalize; cursor: pointer; font-family: inherit; }
.mg-seg button.on { background: #2fc77f; color: #052; }
.mg-help p { font-size: 0.9rem; line-height: 1.5; margin: 10px 2px; }

.mg-card { width: 100%; max-width: 330px; background: rgba(8,36,27,.94); border-radius: 20px; padding: 18px 16px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: mgPop .22s ease-out; }
.mg-card.wide { max-width: 380px; margin: 0 auto; }
@keyframes mgPop { from { transform: scale(.92); opacity: 0; } }
.mg-label { font-size: 1.7rem; font-weight: 900; color: #ffe27a; }
.mg-bigtxt { font-size: 1.2rem; font-weight: 800; margin: 4px 0; }
.mg-stars { font-size: 2rem; color: #ffd23d; letter-spacing: .1em; margin: 2px 0 6px; }
.mg-card p { margin: 4px 0; font-size: 0.9rem; }
.mg-earn { color: #9ff0c4; font-weight: 700; }
.mg-hint { background: rgba(255,255,255,.1); border-radius: 10px; padding: 8px 10px; margin: 10px 0 !important; font-size: 0.85rem !important; }
.mg-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0; }
.mg-chip { background: rgba(255,255,255,.16); border-radius: 12px; padding: 3px 10px; font-size: 0.75rem; font-weight: 700; }
.mg-chip.gold { background: #b5820b; }
.mg-actions { display: flex; gap: 8px; margin-top: 12px; }
.mg-actions .mg-btn { flex: 1; }
.mg-actions.col { flex-direction: column; }
.mg-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; margin: 8px 0; }
.mg-table th, .mg-table td { padding: 4px 3px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.12); }
.mg-table td:nth-child(2) { text-align: left; }
.mg-table td:last-child { color: #ffd23d; }

@media (max-width: 360px) { .mg-logo { font-size: 1.9rem; } .mg-tool { min-width: 80px; padding: 0 10px; } }
@media (prefers-reduced-motion: reduce) { .mg-coach, .mg-card { animation: none; } .mg-banner, .mg-fade, .mg-power i { transition: none; } }
.mg-screen.menu > :first-child { margin-top: auto; }

/* Shell full screen (immersive on iPhone, native on Android): the course fills the stage under the dock. */
html.pip-immersive .game-wrap.pip-stage, html.pip-native .game-wrap.pip-stage, .game-wrap.pip-stage:fullscreen { display: flex; flex-direction: column; overflow: hidden !important; padding-left: 0 !important; padding-right: 0 !important; padding-bottom: 0 !important; }
html.pip-native .game-wrap.pip-stage { padding-top: 0; max-width: none; margin: 0; }
html.pip-immersive .mg-stage, html.pip-native .mg-stage, .game-wrap:fullscreen .mg-stage { flex: 1 1 auto; min-height: 0; max-height: none; width: 100%; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
html.pip-immersive .mg-below, html.pip-native .mg-below, .game-wrap:fullscreen .mg-below, html.pip-immersive .game-title, html.pip-native .game-title { display: none; }
@media (orientation: landscape) and (max-height: 520px) { html.pip-immersive .mg-stage, html.pip-native .mg-stage { min-height: 0; } }
