/* Golf Through Ruins (golf.html, docs/110): what it has that Cara Runs (css/run.css) does not. */

#golf-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
#golf-title .rlogo, #golf-loading .rlogo { font-size: clamp(2rem, 8.5vw, 3.4rem); letter-spacing: 0.08em; }
#golf-title .rlogo span, #golf-loading .rlogo span { display: block; }

/* the hole and its par, top left */
.ghud__left { position: absolute; left: max(16px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7); }
.ghud__hole { display: flex; align-items: baseline; gap: 10px; }
.ghud__hole > b { font: 900 clamp(1.5rem, 4.6vw, 2.1rem)/1 var(--font-display); letter-spacing: 0.04em; color: #fff; }
.ghud__hole span { font: 800 1rem/1 var(--font-body); color: #ffe2b8; }
.ghud__place { margin-top: 4px; font: 600 0.85rem/1.2 var(--font-body); color: rgba(255, 255, 255, 0.85); }

/* the stroke, the spare shots and the run against par, top middle */
.ghud__mid { position: absolute; left: 50%; top: max(12px, env(safe-area-inset-top)); transform: translateX(-50%); display: flex; align-items: stretch; gap: 8px; }
.ghud__mid > div { display: grid; justify-items: center; align-content: center; gap: 3px; padding: 6px 12px; border-radius: 14px; background: rgba(8, 20, 14, 0.62); border: 1px solid rgba(255, 255, 255, 0.18); }
.ghud__mid small { font: 700 0.66rem/1 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); }
.ghud__mid b { font: 900 1.35rem/1 var(--font-display); font-variant-numeric: tabular-nums; color: #fff; }
.ghud__spares span { display: flex; align-items: center; gap: 3px; min-height: 1.35rem; }
.ghud__spares i { width: 9px; height: 16px; border-radius: 1px 1px 4px 4px; background: linear-gradient(180deg, #ff5a4a 0 40%, #f4f2ea 40% 46%, #dcd6c8 46%); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.ghud__spares b { margin-left: 5px; font-size: 1.1rem; }
.ghud__spares.is-low i { animation: glow 0.8s ease-in-out infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 10px rgba(255, 120, 90, 0.9); } }
.ghud__powers { position: absolute; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 62px); transform: translateX(-50%); display: flex; gap: 6px; }

/* the power meter, upright on the right side */
.gmeter { position: absolute; right: max(22px, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); width: 26px; height: min(46vh, 300px); border-radius: 14px; background: rgba(8, 20, 14, 0.7); border: 2px solid rgba(255, 255, 255, 0.4); overflow: hidden; }
.gmeter i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; border-radius: 10px; }
.gmeter span { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); font: 700 0.7rem/1 var(--font-body); }

/* the round buttons, bottom right: the mulligan when there is one, a look over the hole */
.gbtns { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: max(22px, calc(env(safe-area-inset-bottom) + 16px)); display: flex; gap: 10px; pointer-events: auto; }
.gbtn-round { width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.5); background: rgba(8, 20, 14, 0.66); color: #fff; font-size: 1.4rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; touch-action: none; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }
.gbtn-round small { font: 800 0.56rem/1 var(--font-body); letter-spacing: 0.05em; text-transform: uppercase; }
.gbtn-round--mull { background: radial-gradient(circle at 40% 30%, rgba(90, 230, 160, 0.95), rgba(20, 120, 70, 0.92)); }
.gbtn-round:active { transform: scale(0.94); }

/* words that pop up in the middle: a lip-out, a splash */
.gpops { position: absolute; inset: 0; pointer-events: none; }
.gpop { position: absolute; left: 50%; top: 38%; transform: translateX(-50%); white-space: nowrap; font: 900 clamp(1.2rem, 4.4vw, 1.9rem)/1 var(--font-display); color: #fff; text-shadow: 0 3px 10px rgba(0, 0, 0, 0.7); animation: gpop 1.5s ease-out forwards; }
.gpop--meh { color: #ffd8a8; }
@keyframes gpop { 0% { transform: translateX(-50%) scale(0.6); opacity: 0; } 14% { transform: translateX(-50%) scale(1.1); opacity: 1; } 75% { opacity: 1; } 100% { transform: translateX(-50%) translateY(-30px); opacity: 0; } }

/* each hole's card as it comes up */
.gcard { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 3; display: grid; justify-items: center; gap: 4px; padding: 12px 24px 14px; border-radius: 16px; background: rgba(8, 20, 14, 0.78); border: 1px solid rgba(255, 210, 150, 0.35); color: #fff; text-align: center; pointer-events: none; max-width: min(92vw, 520px); animation: gcard 2.7s ease-out forwards; }
.gcard small { font: 700 0.78rem/1.2 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: #ffe0b4; }
.gcard b { font: 900 clamp(1.6rem, 6vw, 2.4rem)/1.05 var(--font-display); letter-spacing: 0.05em; }
.gcard span { font: 600 0.9rem/1.3 var(--font-body); color: #d8e2d8; }
@keyframes gcard { 0% { opacity: 0; transform: translateX(-50%) translateY(10px); } 10% { opacity: 1; transform: translateX(-50%); } 85% { opacity: 1; } 100% { opacity: 0; } }

.rhud__banner { top: 30%; }
.rhud__banner.is-great { background: linear-gradient(90deg, rgba(220, 150, 20, 0.88), rgba(255, 210, 90, 0.88)); color: #3a2200; text-shadow: none; }
.rhud__banner.is-par { background: linear-gradient(90deg, rgba(31, 154, 90, 0.86), rgba(47, 192, 119, 0.86)); }
.rhud__banner.is-over, .rhud__banner.is-short { background: rgba(70, 40, 20, 0.85); }
.rhud__banner.is-place { background: rgba(8, 20, 14, 0.78); border: 1px solid rgba(255, 210, 150, 0.4); font-size: clamp(1.1rem, 4vw, 1.7rem); }
.rhud__banner.is-best { background: linear-gradient(90deg, rgba(220, 150, 20, 0.85), rgba(255, 210, 90, 0.85)); color: #3a2200; text-shadow: none; }
.rhud__banner.is-pw-sticky { background: linear-gradient(90deg, rgba(200, 120, 20, 0.85), rgba(255, 184, 74, 0.85)); }
.rhud__banner.is-pw-guide { background: linear-gradient(90deg, rgba(40, 110, 200, 0.85), rgba(138, 216, 255, 0.82)); }
.rhud__banner.is-pw-mulligan { background: linear-gradient(90deg, rgba(30, 140, 90, 0.85), rgba(157, 255, 208, 0.8)); color: #06301a; text-shadow: none; }
.rhud__banner.is-pw-magnet { background: linear-gradient(90deg, rgba(110, 70, 200, 0.85), rgba(184, 154, 255, 0.82)); }

/* Call Cara: big and green on the title and end screens, a handset before the words */
.gbtn.gbtn--call.gcall { min-height: 58px; }
.gbtn.gbtn--call.gcall .gbtn__label { font-size: 1.12rem; }
.gbtn.gcall .gbtn__label::before { content: '📞 '; }
#golf-over .rstats { grid-template-columns: repeat(5, 1fr); }
#golf-title .rbest { flex-wrap: wrap; gap: 8px 18px; }

@media (max-width: 700px) {
  .ghud__place { display: none; }
  .ghud__mid { left: max(14px, env(safe-area-inset-left)); top: calc(max(14px, env(safe-area-inset-top)) + 44px); transform: none; }
  .ghud__mid > div { padding: 5px 9px; }
  .ghud__powers { left: max(14px, env(safe-area-inset-left)); transform: none; top: calc(max(14px, env(safe-area-inset-top)) + 104px); }
  .rhud__right { gap: 6px; }
  .rhud__right .rhud__btn { width: 36px; height: 36px; font-size: 0.95rem; }
  .rhud__right .rhud__tokens { padding: 5px 10px 5px 6px; font-size: 1.05rem; }
  #golf-over .rstats { grid-template-columns: repeat(3, 1fr); }
  .gcard { top: 30%; }
}
@media (max-width: 380px) { .rhud__right .rhud__btn { width: 32px; height: 32px; } .rhud__right { gap: 4px; } .ghud__mid b { font-size: 1.1rem; } }
@media (max-height: 560px) {
  #golf-title .rcard__eyebrow, #golf-title .rcard__tag, #golf-over .rcard__small { display: none; }
  #golf-title .rlogo, #golf-loading .rlogo { font-size: clamp(1.5rem, 6vh, 2.2rem); }
  #golf-title .rlogo span { display: inline; }
  #golf-title .rcard, #golf-over .rcard { padding: 12px 18px 12px; }
  #golf-title .rtabs { margin: 8px 0 6px; }
  #golf-title .rbest { margin-top: 2px; }
  #golf-title .ractions, #golf-over .ractions { margin-top: 10px; gap: 8px; grid-template-columns: 1fr 1fr; }
  #golf-title .ractions > a, #golf-title .ractions__row, #golf-over .ractions__row, #golf-over .rcontinue { grid-column: 1 / -1; }
  #golf-title .gbtn--tall, #golf-over .gbtn--tall, .gbtn.gbtn--call.gcall { min-height: 52px; }
  #golf-over .rcard__head { font-size: 1.7rem; margin-bottom: 2px; }
  #golf-over .rcard__text { margin-top: 4px; font-size: 0.86rem; line-height: 1.35; }
  #golf-over .rstats { margin-top: 8px; grid-template-columns: repeat(5, 1fr); }
  #golf-over .rstats div { padding: 6px 2px; }
  .rhud__banner { top: 62%; }
  .gcard { top: 16%; padding: 8px 16px; }
  .gmeter { height: 50vh; }
  .gbtn-round { width: 54px; height: 54px; }
}
@media (prefers-reduced-motion: reduce) { .gpop, .gcard, .ghud__spares.is-low i { animation: none; } }
/* a tablet upright: the stroke and the spares under the hole, clear of the buttons on the right */
@media (max-width: 900px) and (min-width: 701px) {
  .ghud__mid { left: max(16px, env(safe-area-inset-left)); top: calc(max(14px, env(safe-area-inset-top)) + 66px); transform: none; }
  .ghud__powers { left: max(16px, env(safe-area-inset-left)); transform: none; top: calc(max(14px, env(safe-area-inset-top)) + 126px); }
}
@media (max-width: 700px) { #golf-hint { bottom: auto; top: calc(max(14px, env(safe-area-inset-top)) + 160px); } }
@media (max-width: 440px) { .ghud__hole > b { font-size: 1.25rem; } .ghud__hole span { font-size: 0.85rem; } .ghud__hole { gap: 6px; } }
@media (max-height: 560px) and (min-width: 701px) { #golf-hint { bottom: auto; top: calc(max(14px, env(safe-area-inset-top)) + 134px); } }
@media (max-width: 900px) and (min-width: 701px) and (min-height: 561px) { #golf-hint { bottom: auto; top: calc(max(14px, env(safe-area-inset-top)) + 186px); } }
