/* Word Golf (reading): the hole on top (a 5:2 box, as big as fits), the word he's on as letter
   tiles with the flag word's 🔊 button beside it, and three big word cards underneath. Everything
   he taps is at least 80px tall. */
.game.wordgolf { background: linear-gradient(180deg, #bfe6ff 0%, #e8f7ff 38%, #dcf3cc 100%); }
.wordgolf button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.wordgolf .game-top { padding-top: 5px; padding-bottom: 5px; }
.wordgolf .wg-back { min-height: 60px; min-width: 60px; white-space: nowrap; }
.wordgolf .hud span { white-space: nowrap; }
.wordgolf .hud i { font-style: normal; }
.wordgolf .hud i.n { display: none; }
.wordgolf .wg-body {
  flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 6px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
}
.wordgolf .wg-body.waiting .wg-play, .wordgolf .wg-body.waiting .wg-ball, .wordgolf .wg-body.waiting .wg-golfer { visibility: hidden; }

/* ---------- the hole ---------- */
.wordgolf .wg-stage { flex: 1 1 0; min-height: 110px; container-type: size; display: grid; place-items: center; }
.wordgolf .wg-course { position: relative; width: min(100cqw, 250cqh); aspect-ratio: 5 / 2; container-type: inline-size; }
.wordgolf .wg-map-box { position: absolute; inset: 0; border: 4px solid var(--ink); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); background: #77c35b; }
.wordgolf .wg-map { display: block; width: 100%; height: 100%; }
.wordgolf .wg-blades { animation: wg-spin 6s linear infinite; }
@keyframes wg-spin { to { transform: rotate(360deg); } }
.wordgolf .wg-ripple { animation: wg-ripple 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.wordgolf .wg-ripple.b { animation-delay: 1.2s; }
@keyframes wg-ripple { 50% { transform: scale(1.35); opacity: .4; } }
.wordgolf .wg-pennant { animation: wg-wave 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: left center; }
@keyframes wg-wave { 50% { transform: scaleX(.86) skewY(3deg); } }
.wordgolf .wg-props > span, .wordgolf .wg-bird { position: absolute; display: block; pointer-events: none; }
.wordgolf .wg-props svg, .wordgolf .wg-bird svg { display: block; width: 100%; height: 100%; }
.wordgolf .wg-caddie { width: 9.5%; aspect-ratio: 1; transform: translate(-50%, -100%); z-index: 2; }
.wordgolf .wg-caddie.cheer { animation: wg-jump .5s ease-in-out 4; }
.wordgolf .wg-duck { width: 6%; aspect-ratio: 1; transform: translate(-50%, -80%); animation: wg-bob 3s ease-in-out infinite; }
.wordgolf .wg-goalie { width: 8.5%; aspect-ratio: 1; transform: translate(-50%, -100%); z-index: 5; animation: wg-guard 2.2s ease-in-out infinite; }
.wordgolf .wg-goalie.save { animation: wg-save .7s ease-out; }
@keyframes wg-guard { 0%, 100% { margin-left: -3.2%; } 50% { margin-left: 3.2%; } }
@keyframes wg-save { 0% { margin-left: 0; } 40% { margin-left: -1%; transform: translate(-50%, -100%) rotate(-20deg) scale(1.1); } 100% { margin-left: 0; } }
@keyframes wg-bob { 50% { transform: translate(-50%, -90%) rotate(-4deg); } }
@keyframes wg-jump { 50% { transform: translate(-50%, -125%); } }

/* the ball and the golfer (placed by left/top, in the hole's coordinates) */
.wordgolf .wg-ball {
  position: absolute; z-index: 6; width: 3.6%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 38%, #ececec 66%, #b9b9c2); box-shadow: 0 .25cqw 0 rgba(0, 0, 0, .3), 0 0 0 .2cqw #8a8a96;
  transition-property: left, top, transform, opacity; transition-duration: .9s, .9s, .35s, .35s; transition-timing-function: cubic-bezier(.25, .7, .3, 1);
}
.wordgolf .wg-ball i { position: absolute; inset: 18%; border-radius: 50%; background: radial-gradient(circle, #cfcfd6 0 14%, transparent 16%) 0 0 / 34% 34%; opacity: .8; }
.wordgolf .wg-ball.rolling i { animation: wg-roll .3s linear infinite; }
@keyframes wg-roll { to { transform: rotate(360deg); } }
.wordgolf .wg-ball.still { transition: none; }
.wordgolf .wg-ball.sunk { transform: translate(-50%, -30%) scale(0); opacity: 0; transition-duration: .9s, .9s, .4s, .4s; }
.wordgolf .wg-ball.sink { transform: translate(-50%, -30%) scale(.25); opacity: 0; transition-delay: 0s, 0s, .55s, .6s; }
.wordgolf .wg-ball.pop { animation: wg-pop .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes wg-pop { from { transform: translate(-50%, -50%) scale(0); } }
.wordgolf .wg-golfer {
  position: absolute; z-index: 5; width: 9.6%; aspect-ratio: 140 / 225; transform: translate(-98%, -92%); pointer-events: none;
  transition: left .75s linear, top .75s linear;
}
.wordgolf .wg-golfer.still { transition: none; }
.wordgolf .wg-me { position: relative; width: 100%; height: 100%; }
.wordgolf .wg-me > .avatar-svg { display: block; width: 100%; height: 100%; }
.wordgolf .wg-club { position: absolute; left: 60%; top: 50%; width: 52%; transform-origin: 8% 3%; transform: rotate(-14deg); }
.wordgolf .wg-golfer.swing .wg-club { animation: wg-swing .5s ease-in-out; }
@keyframes wg-swing { 0% { transform: rotate(-14deg); } 40% { transform: rotate(22deg); } 70% { transform: rotate(-38deg); } 100% { transform: rotate(-14deg); } }
.wordgolf .wg-golfer.walk .wg-me { animation: wg-step .25s ease-in-out infinite; }
@keyframes wg-step { 50% { transform: translateY(-4%) rotate(2deg); } }
.wordgolf .wg-golfer.cheer .wg-me { animation: wg-hop .45s ease-in-out 4; }
@keyframes wg-hop { 50% { transform: translateY(-14%); } }

/* a hazard's splash, puff or bonk */
.wordgolf .wg-fx { position: absolute; inset: 0; pointer-events: none; z-index: 7; }
.wordgolf .wg-burst { position: absolute; font-size: 6.5cqw; line-height: 1; transform: translate(-50%, -60%); animation: wg-burst .8s ease-out forwards; }
@keyframes wg-burst { from { transform: translate(-50%, -40%) scale(.3); opacity: 0; } 30% { opacity: 1; } to { transform: translate(-50%, -90%) scale(1.25); opacity: 0; } }
.wordgolf .wg-bird { z-index: 8; width: 9%; aspect-ratio: 1; left: -10%; top: 10%; animation: wg-fly 2.4s ease-in-out forwards; }
@keyframes wg-fly { 0% { left: -10%; top: 30%; } 30% { top: 4%; } 60% { top: 22%; } 100% { left: 105%; top: 2%; } }

/* "Hole 3 · Par 4" as the hole starts */
.wordgolf .wg-title {
  position: absolute; left: 50%; top: 6%; z-index: 9; display: flex; flex-direction: column; align-items: center; padding: .4cqw 2.4cqw .6cqw;
  background: rgba(255, 255, 255, .94); border: 4px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow); color: var(--ink);
  transform: translateX(-50%); opacity: 0; pointer-events: none; white-space: nowrap;
}
.wordgolf .wg-title b { font-size: max(24px, 4cqw); line-height: 1.1; color: var(--grape); }
.wordgolf .wg-title span { font-size: max(16px, 2.2cqw); font-weight: 800; }
.wordgolf .wg-title span.rd-word { font-size: max(24px, 3.4cqw); font-weight: 700; }
.wordgolf .wg-title.show { animation: wg-title 2.6s ease-in-out forwards; }
@keyframes wg-title { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.8); } 12%, 80% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; } }

/* ---------- the word he's on, and the flag word ---------- */
.wordgolf .wg-play { flex: none; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.wordgolf .wg-row { display: flex; align-items: center; justify-content: center; gap: 10px 14px; flex-wrap: wrap; }
.wordgolf .wg-word { display: flex; gap: 6px; font-size: clamp(38px, 5.2vw, 66px); font-weight: 700; color: var(--ink); }
.wordgolf .wg-tile {
  min-width: 1.05em; height: 1.36em; padding: 0 .12em; box-sizing: border-box; display: grid; place-items: center; line-height: 1;
  background: #fff; border: 4px solid var(--ink); border-radius: 14px; box-shadow: 0 5px 0 rgba(58, 42, 74, .22);
}
.wordgolf .wg-tile.magic { color: #7a3fd6; background: #f4ecff; }
.wordgolf .wg-tile.new { background: #dcf8e3; animation: wg-tilepop .5s cubic-bezier(.2, 1.6, .4, 1); }
.wordgolf .wg-tile.hint { background: #fff1a8; animation: wg-hint 1s ease-in-out infinite; }
.wordgolf .wg-word.holed .wg-tile { background: #dcf8e3; border-color: #1f8a55; animation: wg-tilepop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes wg-tilepop { 0% { transform: scale(.6) rotate(-6deg); } 100% { transform: none; } }
@keyframes wg-hint { 50% { box-shadow: 0 0 0 6px #ffcc33, 0 5px 0 rgba(58, 42, 74, .22); transform: translateY(-4px); } }
.wordgolf .wg-arrow { font-size: clamp(26px, 3vw, 40px); color: var(--ink-soft); font-weight: 900; }
.wordgolf .wg-flag {
  display: inline-flex; align-items: center; gap: 8px; min-height: 88px; min-width: 120px; padding: 4px 18px; font: inherit; font-size: 42px; line-height: 1;
  color: var(--ink); background: #fff8d6; border: 4px solid var(--ink); border-radius: 24px; box-shadow: var(--shadow); cursor: pointer;
}
.wordgolf .wg-flag-pic:empty, .wordgolf .wg-flag-word:empty { display: none; }
.wordgolf .wg-flag-word { font-size: clamp(36px, 4.4vw, 56px); font-weight: 700; }
.wordgolf .wg-flag-ear { width: 58px; height: 58px; display: grid; place-items: center; font-size: 32px; background: #fff; border: 3px solid var(--ink); border-radius: 50%; }
.wordgolf .wg-flag.ping { animation: wg-ping .45s ease-out; }
.wordgolf .wg-flag.done { background: #dcf8e3; border-color: #1f8a55; }
@keyframes wg-ping { 40% { transform: scale(1.08); } }
@media (hover: hover) { .wordgolf .wg-flag:hover { background: #fff1b3; } .wordgolf .wg-card.show:hover:not(:disabled) { background: #fff8d6; } }

/* ---------- the three words to read ---------- */
.wordgolf .wg-cards { display: flex; gap: 14px; justify-content: center; width: 100%; max-width: 920px; }
.wordgolf .wg-card {
  flex: 1 1 0; min-width: 0; min-height: 96px; padding: 4px 10px; font-size: clamp(36px, 4.8vw, 62px); font-weight: 700; line-height: 1.1; letter-spacing: 1px;
  color: var(--ink); background: #fff; border: 4px solid var(--ink); border-radius: 24px; box-shadow: var(--shadow); cursor: pointer;
  opacity: 0; transform: translateY(12px) scale(.94); transition: opacity .25s, transform .25s, background .2s;
}
.wordgolf .wg-card[hidden] { display: none; }
.wordgolf .wg-card.show { opacity: 1; transform: none; }
.wordgolf .wg-card:disabled { cursor: default; }
.wordgolf .wg-card.ok { background: #dcf8e3; box-shadow: 0 0 0 5px var(--good), var(--shadow); transform: translateY(-4px); }
.wordgolf .wg-card.bad { background: #ffe1e3; color: #b33; text-decoration: line-through 4px rgba(179, 51, 51, .55); opacity: .75; }
.wordgolf .wg-card.fade { opacity: .3; }

/* ---------- start card, scorecard, trophy ---------- */
.wordgolf .wg-start, .wordgolf .wg-banner { position: absolute; inset: 0; z-index: 20; display: none; place-items: center; padding: 14px; background: rgba(30, 60, 40, .32); overflow: auto; }
.wordgolf .wg-start.show, .wordgolf .wg-banner.show { display: grid; }
.wordgolf .wg-start-card, .wordgolf .wg-card-box, .wordgolf .wg-end {
  background: #fff; border: 4px solid var(--ink); border-radius: 28px; padding: 14px 22px 18px; box-shadow: var(--shadow); text-align: center;
  max-width: min(620px, 100%); animation: wg-tilepop .35s ease-out;
}
.wordgolf h3 { margin: 2px 0 6px; font-size: 30px; color: var(--grape); }
.wordgolf .wg-hero { position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 10px; height: 130px; margin-bottom: 16px; }
.wordgolf .wg-hero-me { position: relative; width: 78px; height: 125px; }
.wordgolf .wg-hero-me .avatar-svg { width: 100%; height: 100%; display: block; }
.wordgolf .wg-hero-flag { font-size: 64px; line-height: 1; margin-left: 40px; }
.wordgolf .wg-hero-cad { width: 70px; height: 70px; display: block; }
.wordgolf .wg-hero-cad svg { width: 100%; height: 100%; }
.wordgolf .wg-how { margin: 0 0 10px; font-size: 26px; font-weight: 800; color: var(--ink-soft); }
.wordgolf .wg-how .rd-word { display: inline-block; font-size: 30px; font-weight: 700; color: var(--ink); background: #f3fbef; border: 3px solid var(--ink); border-radius: 12px; padding: 0 8px; }
.wordgolf .wg-go, .wordgolf .wg-next { min-height: 84px; min-width: 240px; font-size: 32px; padding: 6px 30px; }
.wordgolf .wg-off { font-weight: 700; color: var(--coral-dark, #c0392b); }
.wordgolf .wg-best, .wordgolf .wg-now { margin: 10px 0 0; font-weight: 700; color: var(--ink-soft); }
.wordgolf .wg-now .rd-word { font-size: 20px; color: var(--ink); }
.wordgolf .wg-chain { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 4px 0 6px; }
.wordgolf .wg-chain span { font-size: 34px; font-weight: 700; padding: 0 10px; background: #f3fbef; border: 3px solid var(--ink); border-radius: 14px; }
.wordgolf .wg-chain span.flag { background: #dcf8e3; border-color: #1f8a55; }
.wordgolf .wg-chain i { font-style: normal; font-weight: 900; color: var(--ink-soft); }
.wordgolf .wg-sub { margin: 0 0 8px; font-size: 20px; font-weight: 800; color: var(--ink-soft); }
.wg-score { border-collapse: collapse; margin: 0 auto 12px; font-weight: 800; font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.wg-score th, .wg-score td { border: 2px solid var(--ink); padding: 2px 9px; min-width: 30px; text-align: center; }
.wg-score tr:first-child th { background: #e8f7ff; }
.wg-score tr th:first-child { background: #f3fbef; text-align: left; }
.wg-score tr.me td { background: #fff; }
.wg-score td.birdie { background: #dcf8e3 !important; }
.wg-score td.birdie::after { content: '🐦'; font-size: 13px; margin-left: 1px; }
.wg-score td.par { background: #fff8d6 !important; }
.results .wg-score { margin: 2px auto; font-size: 15px; }
.results .wg-score th, .results .wg-score td { padding: 1px 6px; min-width: 22px; }
.wordgolf .wg-banner.end { background: rgba(30, 60, 40, .45); }
.wordgolf .wg-podium { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 170px; margin: 18px 0 8px; }
.wordgolf .wg-end-me { width: 100px; height: 160px; animation: wg-hop .5s ease-in-out infinite; }
.wordgolf .wg-end-me .avatar-svg { width: 100%; height: 100%; display: block; }
.wordgolf .wg-trophy { width: 96px; height: 112px; animation: wg-shine 1.2s ease-in-out infinite; }
@keyframes wg-shine { 50% { transform: rotate(-6deg) scale(1.06); } }
.wordgolf .wg-end-cad { width: 84px; height: 84px; animation: wg-hop .5s .25s ease-in-out infinite; }
.wordgolf .wg-end-cad svg { width: 100%; height: 100%; }

/* ---------- tall screens: bigger cards, stacked on a phone ---------- */
@media (max-aspect-ratio: 1/1) {
  .wordgolf .wg-body { justify-content: center; gap: 22px; padding-bottom: 5vh; }
  .wordgolf .wg-stage { flex: 0 1 auto; height: calc((100vw - 32px) * .4); max-height: 46vh; }
  .wordgolf .wg-play { gap: 20px; }
  .wordgolf .wg-word { font-size: clamp(38px, 8vw, 76px); }
  .wordgolf .wg-card { min-height: 120px; font-size: clamp(36px, 7.4vw, 66px); }
  .wordgolf .wg-flag { min-height: 96px; }
}
@media (max-width: 560px) {
  .wordgolf .game-top h2 { font-size: 22px; }
  .wordgolf .hud { font-size: 16px; gap: 4px; }
  .wordgolf .hud span { padding: 0 8px; }
  .wordgolf .wg-hud-par { display: none; }
  .wordgolf .hud i.w { display: none; }
  .wordgolf .hud i.n { display: inline; }
  .wordgolf .wg-how { font-size: 20px; }
  .wordgolf .wg-how .rd-word { font-size: 24px; padding: 0 5px; }
  .wordgolf .wg-body { gap: 10px; padding-left: 12px; padding-right: 12px; }
  .wordgolf .wg-word { font-size: 38px; gap: 5px; }
  .wordgolf .wg-tile { border-width: 3px; border-radius: 12px; }
  .wordgolf .wg-flag { min-height: 82px; padding: 4px 12px; font-size: 34px; gap: 6px; }
  .wordgolf .wg-flag-ear { width: 50px; height: 50px; font-size: 28px; }
  .wordgolf .wg-cards { flex-direction: column; gap: 10px; }
  .wordgolf .wg-card { flex: none; min-height: 88px; font-size: 44px; }
  .wordgolf .wg-chain span { font-size: 26px; }
  .wordgolf h3 { font-size: 26px; }
  .wg-score { font-size: 15px; }
  .wg-score th, .wg-score td { padding: 2px 5px; min-width: 22px; }
}
/* short and wide (a phone on its side): the hole gets less room */
@media (max-height: 560px) and (min-aspect-ratio: 1/1) {
  .wordgolf .wg-card { min-height: 80px; font-size: 38px; }
  .wordgolf .wg-word { font-size: 36px; }
  .wordgolf .wg-flag { min-height: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  .wordgolf .wg-blades, .wordgolf .wg-ripple, .wordgolf .wg-pennant, .wordgolf .wg-goalie, .wordgolf .wg-duck { animation: none; }
}
