.golf-game {
  --golf-accent: #a8eed0;
  --golf-line: #87ac9b55;
  width: min(100%, 870px);
  margin-inline: auto;
  color: #f4f5e9;
  display: grid;
  gap: 0.7rem;
}
.golf-game * {
  box-sizing: border-box;
}
.golf-banner {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: clamp(75px, 12vw, 124px);
  padding: clamp(12px, 2.5vw, 24px);
  background: #24463b;
  border: 1px solid var(--golf-line);
  border-radius: 12px;
}
.golf-scenery,
.golf-banner::after {
  position: absolute;
  z-index: -1;
  inset: 0;
}
.golf-scenery {
  background-repeat: no-repeat;
}
.golf-banner::after {
  content: '';
  background:
    linear-gradient(90deg, #102021e8, #1020206b 65%, #101a2033),
    linear-gradient(0deg, #122225ae, transparent 70%);
}
.golf-world {
  color: #e1f1df;
  font-size: 0.85rem;
  font-weight: 700;
}
.golf-name {
  color: #fffcdf;
  margin: 0.3rem 0 0;
  font-size: clamp(1.12rem, 3.4vw, 2.1rem);
  line-height: 1.16;
}
.golf-par {
  font-size: 0.82rem;
  background: #132227d1;
  color: #fbf5d4;
  font-weight: 800;
  border: 1px solid #f0f0c765;
  border-radius: 20px;
  padding: 0.3rem 0.65rem;
  white-space: nowrap;
}
.golf-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--golf-line);
  border-radius: 12px;
  box-shadow: 0 4px 18px #0003;
  background: #24463b;
}
.golf-stage .golf-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 680 / 360;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: crosshair;
  touch-action: manipulation;
}
.golf-game :focus-visible {
  outline: 3px solid #ffdb8c;
  outline-offset: 2px;
}
.golf-stage .golf-canvas:focus-visible {
  outline-offset: -5px;
}
.golf-turns {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.golf-player {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 0.4rem;
  border: 1px solid var(--golf-line);
  border-radius: 7px;
  padding: 0.35rem 0.6rem;
  background: #182728;
}
.golf-player .face {
  grid-row: span 2;
  width: 36px;
  height: 28px;
  border-radius: 2px;
  border-bottom: 2px solid var(--ball-color);
}
.golf-player.is-current {
  border-color: var(--ball-color);
  background: #26372f;
}
.golf-player strong {
  color: var(--ball-color);
  font-size: 0.89rem;
}
.golf-player span {
  grid-column: 2;
  color: #d1d9ce;
  font-size: 0.74rem;
}
.golf-controls {
  display: flex;
  gap: clamp(0.5rem, 2vw, 1.25rem);
  align-items: center;
  background: #1c2a2b;
  border: 1px solid var(--golf-line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
}
.golf-aim-controls {
  display: flex;
  gap: 0.35rem;
}
.golf-controls button,
.golf-card button {
  min-height: 44px;
  cursor: pointer;
  border: 1px solid #8ba496;
  border-radius: 7px;
  font: inherit;
  font-weight: 750;
  color: #fcffe9;
  background: #354743;
  line-height: 1.1;
}
.golf-aim-controls button {
  min-width: 44px;
  padding: 0 0.45rem;
  font-size: 1.45rem;
}
.golf-power {
  display: grid;
  flex: 1;
  gap: 0;
  min-width: 58px;
  cursor: pointer;
}
.golf-power span {
  color: #e7e8d9;
  font-size: 0.81rem;
}
.golf-power output {
  color: var(--golf-accent);
  font-weight: bold;
}
.golf-power input {
  margin: 0;
  height: 23px;
  accent-color: var(--golf-accent);
  width: 100%;
  cursor: pointer;
}
.golf-controls .golf-hit,
.golf-card button {
  background: var(--golf-accent);
  color: #1c2c28;
  padding: 0.55rem clamp(0.7rem, 3vw, 1.6rem);
  border-color: transparent;
}
.golf-controls button:disabled,
.golf-controls input:disabled {
  opacity: 0.55;
  cursor: default;
}
.golf-card:not([hidden]) {
  position: absolute;
  display: grid;
  place-items: center;
  inset: 0;
  background: #101f29a6;
  padding: 10px;
  text-align: center;
}
.golf-card > div {
  background: #1b2b2be8;
  padding: clamp(0.7rem, 2vw, 1.4rem);
  border: 1px solid var(--golf-accent);
  border-radius: 11px;
}
.golf-card h3,
.golf-card p {
  margin: 0 0 0.45em;
  color: #ffffe9;
}
.golf-game .golf-status,
.golf-game .golf-tip {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
}
.golf-status {
  color: var(--golf-accent);
  font-weight: 700;
}
.golf-tip,
.golf-help {
  color: #d2ddd3;
}
.golf-help {
  font-size: 0.86rem;
  padding-bottom: 0.4rem;
}
.golf-help summary {
  cursor: pointer;
  width: fit-content;
  padding: 0.35rem 0;
}
.golf-help p {
  margin: 0.35rem 0;
  line-height: 1.5;
}
@media (max-width: 480px) {
  .golf-game {
    gap: 0.45rem;
  }
  .golf-controls {
    padding: 0.35rem;
    gap: 0.45rem;
  }
  .golf-aim-controls {
    gap: 0.2rem;
  }
  .golf-player {
    padding: 0.23rem 0.4rem;
  }
  .golf-banner {
    padding: 0.65rem;
  }
}
/* Phone held sideways: the course fills the height, scores and controls sit beside it. */
@media (orientation: landscape) and (max-height: 540px) {
  .golf-game {
    width: 100%;
    grid-template-columns: auto minmax(180px, 1fr);
    grid-template-areas: 'stage banner' 'stage turns' 'stage controls' 'stage status' 'stage rest';
    align-items: start;
    gap: 0.4rem 0.7rem;
  }
  .golf-stage {
    grid-area: stage;
  }
  .golf-stage .golf-canvas {
    width: auto;
    max-width: calc(100vw - 240px);
    height: calc(100svh - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .golf-banner {
    grid-area: banner;
    min-height: 0;
    padding: 0.4rem 0.6rem;
  }
  .golf-world,
  .golf-scenery {
    display: none;
  }
  .golf-name {
    margin: 0;
    font-size: 0.95rem;
  }
  .golf-turns {
    grid-area: turns;
  }
  .golf-controls {
    grid-area: controls;
    flex-wrap: wrap;
    padding: 0.35rem;
    gap: 0.35rem;
  }
  .golf-status {
    grid-area: status;
    margin: 0;
    font-size: 0.8rem;
  }
  .golf-tip,
  .golf-help {
    grid-column: 2;
    font-size: 0.78rem;
  }
}
