:root {
  --green-900: #103c2a;
  --green-800: #174c35;
  --green-700: #216543;
  --green-100: #e4f0e8;
  --fairway: #6e9d63;
  --gold: #c7942e;
  --gold-light: #f4e5b8;
  --correct: #4f8b53;
  --present: #c69b3c;
  --absent: #727879;
  --ink: #18211d;
  --muted: #647069;
  --line: #d7ded9;
  --paper: #ffffff;
  --surface: #f4f7f4;
  --key: #dce2de;
  --danger: #a43e32;
  --shadow: 0 12px 34px rgba(16, 60, 42, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: #f4f6f4;
}

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, "Noto Sans KR", sans-serif;
}

body.splash-open {
  overflow: hidden;
}

.game-splash {
  position: fixed;
  z-index: 2000;
  inset: 0;
  background: #fff;
  opacity: 1;
  transition: opacity 0.28s ease;
}

.game-splash.is-leaving {
  pointer-events: none;
  opacity: 0;
}

.splash-start {
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: max(30px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  overflow: hidden;
  border: 0;
  border-radius: 0;
  color: var(--green-900);
  background: #fff;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  gap: 16px;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.splash-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.splash-kicker {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.splash-title {
  font-size: 64px;
  font-weight: 900;
  line-height: 1.05;
}

.splash-subtitle {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.splash-scene {
  position: relative;
  width: min(680px, 92vw);
  height: 100%;
  max-height: 520px;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-course {
  width: min(560px, 82%);
  max-height: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 16px 24px rgba(16, 60, 42, 0.16));
}

.splash-caddie {
  position: absolute;
  right: 0;
  bottom: 2%;
  width: 190px;
  height: 190px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(16, 60, 42, 0.17));
}

.splash-cta {
  min-width: 148px;
  min-height: 46px;
  padding: 0 24px;
  border-radius: 5px;
  color: #fff;
  background: var(--green-800);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 7px 16px rgba(16, 60, 42, 0.18);
}

.splash-cta::before {
  content: "▶";
  font-size: 11px;
}

@media (max-width: 600px) {
  .splash-start {
    padding-inline: 16px;
    gap: 10px;
  }

  .splash-kicker {
    font-size: 10px;
  }

  .splash-title {
    font-size: 44px;
  }

  .splash-subtitle {
    font-size: 12px;
  }

  .splash-scene {
    width: 100%;
    max-height: 420px;
    min-height: 220px;
  }

  .splash-course {
    width: min(430px, 94%);
  }

  .splash-caddie {
    right: -3%;
    bottom: 0;
    width: 138px;
    height: 138px;
  }
}

@media (max-height: 680px) {
  .splash-start {
    padding-block: 18px;
  }

  .splash-title {
    font-size: 38px;
  }

  .splash-scene {
    min-height: 180px;
    max-height: 330px;
  }

  .splash-caddie {
    width: 120px;
    height: 120px;
  }

  .splash-cta {
    min-height: 42px;
  }
}

button {
  font: inherit;
}

:focus {
  outline: none;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 18px 24px;
}

.game-header {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto minmax(140px, 1fr);
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-block h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.flag-mark {
  position: relative;
  width: 20px;
  height: 25px;
  flex: 0 0 20px;
  border-left: 2px solid var(--green-900);
}

.flag-mark::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 0;
  width: 14px;
  height: 10px;
  background: var(--gold);
  clip-path: polygon(0 0, 100% 18%, 0 100%);
}

.flag-mark::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -7px;
  width: 13px;
  height: 4px;
  border-radius: 50%;
  background: var(--green-700);
}

.round-summary {
  display: flex;
  align-items: stretch;
  min-height: 45px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.summary-item {
  min-width: 66px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
}

.summary-item:last-child {
  border-right: 0;
}

.summary-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
}

.summary-item strong {
  font-size: 15px;
  line-height: 1.25;
}

.score-item strong {
  color: var(--green-700);
}

.header-controls {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.header-button {
  flex: 0 0 auto;
  width: 54px;
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid var(--green-800);
  border-radius: 5px;
  color: var(--green-900);
  background: var(--paper);
  font-weight: 700;
  cursor: pointer;
}

.header-button:hover {
  background: var(--green-100);
}

.sound-toggle {
  width: 42px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.sound-toggle[aria-pressed="false"] {
  color: var(--muted);
  border-color: var(--line);
}

.mobile-course {
  display: none;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 26px;
  align-items: start;
  padding-top: 22px;
}

.play-area {
  min-width: 0;
  min-height: 690px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 0;
}

.game-content,
.status-panel {
  width: min(100%, 650px);
}

.game-content {
  position: relative;
}

.status-panel {
  min-height: 430px;
  padding: 70px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.status-panel h2 {
  margin: 19px 0 8px;
  font-size: 22px;
}

.status-panel p {
  max-width: 420px;
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.55;
}

.loading-mark {
  width: 34px;
  height: 34px;
  border: 4px solid var(--green-100);
  border-top-color: var(--green-700);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.status-panel:not(.is-loading) .loading-mark {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hole-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 0 3px 10px;
  border-bottom: 1px solid var(--line);
}

.play-date {
  min-height: 14px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.hole-title-row h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.hole-title-row h2 span {
  margin-left: 6px;
  color: var(--green-700);
  font-size: 13px;
}

.attempt-counter {
  margin: 0;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-weight: 700;
  white-space: nowrap;
}

.attempt-counter strong {
  color: var(--green-800);
  font-size: 13px;
}

.attempt-counter span {
  margin-top: 2px;
  font-size: 10px;
}

.current-hole-preview {
  display: none;
  margin: 0;
  padding: 0;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.modal.course-preview-layer {
  display: none;
}

.resume-note {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-left: 3px solid var(--gold);
  background: #fff8e5;
  color: #6a5019;
  font-size: 13px;
}

.word-board {
  --tile-count: 6;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin: 0 auto 24px;
}

.completed-message {
  width: min(100%, 430px);
  margin: 36px auto;
  padding: 34px 20px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--green-700);
  border-radius: 6px;
  background: var(--paper);
  text-align: center;
}

.completed-message p {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 13px;
}

.completed-message strong {
  display: block;
  margin-bottom: 20px;
  color: var(--green-800);
  font-size: 34px;
}

.board-row {
  width: min(100%, calc(var(--tile-count) * 55px));
  display: grid;
  grid-template-columns: repeat(var(--tile-count), minmax(0, 1fr));
  gap: 5px;
}

/* 모바일은 5줄로 시작해 시도에 따라 6·7번째 줄이 열리고, 데스크탑은 항상 7줄 표시 */
@media (max-width: 899px) {
  .board-row.is-unrevealed {
    display: none;
  }
}

.tile {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #cbd3ce;
  border-radius: 4px;
  background: var(--paper);
  font-size: clamp(16px, 4.5vw, 23px);
  font-weight: 800;
  user-select: none;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.tile.filled {
  border-color: #718078;
  animation: pop 0.1s ease;
}

.tile.active-row {
  background: #fcfdfc;
}

@keyframes pop {
  50% { transform: scale(1.05); }
}

.tile.reveal {
  animation: reveal 0.42s ease both;
}

@keyframes reveal {
  45% { transform: rotateX(90deg); }
}

.tile.correct,
.key.correct {
  color: #fff;
  background: var(--correct);
  border-color: var(--correct);
}

.tile.present,
.key.present {
  color: #fff;
  background: var(--present);
  border-color: var(--present);
}

.tile.absent,
.key.absent {
  color: #fff;
  background: var(--absent);
  border-color: var(--absent);
}

.keyboard {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  touch-action: manipulation;
}

.keyboard-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 5px;
}

.hint-dock {
  min-height: 106px;
  display: flex;
  align-items: end;
  justify-content: flex-end;
  padding-top: 12px;
}

.hint-cat-button {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: transform 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}

.hint-cat-button:hover {
  transform: translateY(-3px);
}

.hint-cat-button img {
  width: 96px;
  height: 96px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 5px 8px rgba(16, 60, 42, 0.16));
}

@media (min-width: 900px) {
  .word-board {
    position: relative; /* 고양이 독(.hint-dock)의 앵커 — 보드 우하단에 자동 고정 */
  }

  .hint-dock {
    position: absolute;
    z-index: 2;
    bottom: 0;
    right: 0;
    width: 128px;
    min-height: 0;
    padding: 0;
  }

  .hint-cat-button,
  .hint-cat-button img {
    width: 128px;
    height: 128px;
  }
}

.key {
  min-width: 0;
  height: 54px;
  padding: 0 2px;
  border: 0;
  border-radius: 4px;
  color: var(--ink);
  background: var(--key);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.key-spacer {
  height: 54px;
}

.key:hover:not(:disabled) {
  filter: brightness(0.96);
}

.key:active:not(:disabled) {
  transform: translateY(1px);
}

.key.command {
  color: #fff;
  background: var(--green-800);
  font-size: 13px;
}

.key:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.course-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-section {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  box-shadow: 0 5px 18px rgba(16, 60, 42, 0.06);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 15px;
}

.section-heading span,
.section-heading strong {
  color: var(--green-700);
  font-size: 12px;
}

.course-map {
  min-width: 0;
}

.course-current-visual {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  background: var(--surface);
}

.course-current-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.course-current-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0 12px;
  border-bottom: 1px solid var(--line);
}

.course-current-title {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.course-current-title strong {
  color: var(--green-900);
  font-size: 18px;
}

.course-current-title span {
  color: var(--green-700);
  font-size: 12px;
  font-weight: 800;
}

.course-current-status {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.course-map.is-complete .course-current-status {
  color: var(--green-700);
}

.course-steps {
  display: grid;
  grid-template-columns: repeat(18, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  padding-top: 13px;
}

.course-step {
  min-width: 0;
  height: 8px;
  border-radius: 2px;
  background: #d8dfda;
}

.course-step.completed {
  background: var(--green-700);
}

.course-step.current {
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-light);
}

.scorecard-scroll {
  max-height: 270px;
  overflow: auto;
}

.scorecard,
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.scorecard th,
.scorecard td,
.ranking-table th,
.ranking-table td {
  height: 31px;
  padding: 5px 7px;
  border-bottom: 1px solid #e7ece8;
  text-align: right;
  white-space: nowrap;
}

.scorecard th:first-child,
.scorecard td:first-child,
.ranking-table th:nth-child(2),
.ranking-table td:nth-child(2) {
  text-align: left;
}

.scorecard tr.current {
  background: #fff6dc;
}

.scorecard tr.completed td:last-child {
  color: var(--green-700);
  font-weight: 800;
}

.primary-button {
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 5px;
  color: #fff;
  background: var(--green-800);
  font-weight: 800;
  cursor: pointer;
}

.primary-button:hover {
  background: var(--green-700);
}

.secondary-button {
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--green-900);
  background: var(--paper);
  font-weight: 800;
  cursor: pointer;
}

.secondary-button:hover {
  background: var(--surface);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.toast {
  position: fixed;
  z-index: 1200;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
  padding: 11px 16px;
  border-radius: 5px;
  color: #fff;
  background: rgba(24, 33, 29, 0.94);
  box-shadow: var(--shadow);
  text-align: center;
  font-size: 14px;
}

.modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(10, 24, 17, 0.72);
  /* 카드가 화면보다 커져도 위아래가 잘리지 않고 오버레이가 스크롤되도록 */
  overflow-y: auto;
}

.modal-card {
  position: relative;
  isolation: isolate;
  width: min(100%, 470px);
  /* iOS 사파리에서 100vh는 주소창 숨김 기준이라 실제 화면보다 커짐 → dvh로 보정 */
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  /* 카드 내부 스크롤이 경계에 닿아도 페이지 고무줄 효과로 번지지 않도록 */
  overscroll-behavior: contain;
  /* flex 중앙정렬에서 카드가 컨테이너보다 클 때 상단이 잘려 접근불가되는 문제 방지 */
  margin: auto;
  padding: 30px;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.validation-card {
  width: min(100%, 390px);
  padding: 26px;
  text-align: center;
}

.validation-card h2 {
  font-size: 24px;
}

.validation-message {
  margin: 14px 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.validation-word {
  display: block;
  min-width: 0;
  margin: 0 0 20px;
  padding: 13px 12px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--green-900);
  background: var(--surface);
  font-size: 22px;
  line-height: 1.25;
}

.validation-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.validation-actions button {
  width: 100%;
  min-width: 0;
}

.hint-card {
  width: min(100%, 400px);
  padding: 28px;
  text-align: center;
}

.hint-card h2 {
  font-size: 25px;
}

.hint-description {
  margin: 10px 28px 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.hint-status {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 10px;
  color: var(--muted);
  background: var(--surface);
  font-size: 14px;
}

.hint-error {
  color: var(--danger);
}

.hint-recommendations {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.hint-word {
  min-width: 0;
  padding: 15px 5px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 5px;
  color: var(--green-900);
  background: #fffaf0;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.hint-word:hover {
  border-color: var(--gold);
  background: #fff4d6;
}

.result-card {
  width: min(100%, 430px);
  padding: 38px 34px 34px;
  text-align: center;
}

.celebration-active > :not(.result-celebration):not(.modal-close) {
  position: relative;
  z-index: 1;
}

.celebration-active > .modal-close {
  z-index: 2;
}

.result-celebration {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.celebration-particle {
  --particle-color: var(--gold);
  --particle-delay: 0ms;
  --particle-shift: 8px;
  --particle-shift-start: -8px;
  --particle-turn: 180deg;
  position: absolute;
  top: var(--particle-y);
  left: var(--particle-x);
  display: block;
  background: var(--particle-color);
  opacity: 0;
  will-change: transform, opacity;
}

.celebration-particle.is-confetti {
  width: 7px;
  height: 13px;
  animation: pixel-confetti 1.75s steps(8, end) var(--particle-delay) both;
}

.celebration-particle.is-streak {
  width: 18px;
  height: 4px;
  animation: pixel-streak 1.25s steps(6, end) var(--particle-delay) both;
}

.celebration-particle.is-spark {
  width: 6px;
  height: 6px;
  box-shadow: 7px 0 0 var(--particle-color), 0 7px 0 var(--particle-color);
  animation: birdie-spark 0.75s steps(4, end) var(--particle-delay) both;
}

.celebration-hole-in-one,
.celebration-eagle {
  animation: result-card-pulse 0.72s steps(4, end) 2;
}

.celebration-hole-in-one #hole-result-title,
.celebration-eagle #hole-result-title,
.celebration-hole-in-one .final-hole-result,
.celebration-eagle .final-hole-result {
  animation: result-title-pulse 0.68s steps(3, end) 2;
}

.celebration-birdie #hole-result-title,
.celebration-birdie .final-hole-result {
  animation: birdie-title-pulse 0.55s steps(3, end) 1;
}

@keyframes pixel-confetti {
  0% { opacity: 0; transform: translate3d(0, -10px, 0) rotate(0); }
  16% { opacity: 0.95; }
  78% { opacity: 0.85; }
  100% { opacity: 0; transform: translate3d(var(--particle-shift), 84px, 0) rotate(var(--particle-turn)); }
}

@keyframes pixel-streak {
  0% { opacity: 0; transform: translate3d(var(--particle-shift-start), 0, 0) scaleX(0.35); }
  22% { opacity: 0.9; }
  100% { opacity: 0; transform: translate3d(var(--particle-shift), 42px, 0) scaleX(1.35); }
}

@keyframes birdie-spark {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  42% { opacity: 0.9; transform: scale(1); }
}

@keyframes result-card-pulse {
  0%, 100% { box-shadow: var(--shadow); }
  50% { box-shadow: 0 0 0 4px rgba(199, 148, 46, 0.3), 0 16px 38px rgba(16, 60, 42, 0.2); }
}

@keyframes result-title-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.055); }
}

@keyframes birdie-title-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.025); }
}

.result-badge {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  border: 10px double var(--green-700);
  border-radius: 50%;
  background: var(--gold-light);
}

.modal-kicker {
  margin: 0 0 6px;
  color: var(--green-700);
  font-size: 11px;
  font-weight: 800;
}

.modal-card h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.result-score {
  margin: 10px 0 16px;
  color: var(--muted);
  font-size: 19px;
  font-weight: 800;
}

.result-note {
  margin: -7px 0 15px;
  color: #765817;
  font-size: 13px;
  font-weight: 700;
}

#hole-result-title {
  font-size: clamp(36px, 8vw, 52px);
  line-height: 1.15;
}

.result-total {
  margin: 0 0 24px;
  padding: 13px 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--green-800);
  background: var(--surface);
  font-size: 15px;
  font-weight: 800;
}

.result-answer {
  margin: -10px 0 20px;
  padding: 14px 10px;
  border: 2px solid var(--gold);
  color: var(--green-900);
  background: #fff8e5;
  font-size: 23px;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.final-answer {
  margin-top: 0;
}

.result-card .primary-button {
  width: 100%;
  min-height: 50px;
  font-size: 16px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.final-card {
  text-align: center;
}

.final-hole-result {
  margin: 18px 0 0;
  padding: 13px 12px;
  border: 1px solid var(--gold);
  border-radius: 5px;
  background: #fff8e5;
}

.final-hole-result span,
.final-hole-result small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.final-hole-result strong {
  display: block;
  margin: 3px 0;
  color: var(--green-800);
  font-size: 27px;
  line-height: 1.15;
}

.final-score {
  display: flex;
  flex-direction: column;
  margin: 20px 0;
  padding: 17px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.final-score strong {
  color: var(--green-800);
  font-size: 46px;
}

.final-score span {
  color: var(--muted);
  font-size: 13px;
}

.final-summary {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  margin-bottom: 22px;
}

.final-hole {
  min-width: 0;
  padding: 6px 1px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 10px;
}

.final-hole strong {
  display: block;
  margin-top: 2px;
  font-size: 11px;
}

.ranking-card {
  width: min(100%, 560px);
}

.ranking-heading {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin-bottom: 20px;
  padding-right: 32px;
}

.ranking-heading h2 {
  font-size: 25px;
}

.ranking-date-nav {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.ranking-date-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--green-800);
  background: var(--paper);
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}

.ranking-date-button:disabled {
  color: #aeb6b1;
  background: var(--surface);
  cursor: default;
  opacity: 0.7;
}

#ranking-date {
  min-width: 0;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.ranking-loading,
.ranking-error,
.empty-message {
  padding: 34px 10px;
  color: var(--muted);
  text-align: center;
}

.ranking-error {
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid #e6cbc7;
  border-radius: 4px;
  color: var(--danger);
  background: #fff7f5;
  font-size: 13px;
}

.ranking-my-score {
  margin-bottom: 16px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.ranking-my-score-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ranking-my-score-heading h3 {
  flex: 0 0 auto;
  margin: 0;
  font-size: 14px;
}

.ranking-my-score-heading span {
  min-width: 0;
  color: var(--muted);
  text-align: right;
  font-size: 12px;
}

.ranking-my-score-data {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.ranking-my-score-data div {
  min-width: 0;
  text-align: center;
}

.ranking-my-score-data div + div {
  border-left: 1px solid var(--line);
}

.ranking-my-score-data dt {
  color: var(--muted);
  font-size: 11px;
}

.ranking-my-score-data dd {
  margin: 4px 0 0;
  color: var(--green-800);
  font-size: 16px;
  font-weight: 800;
}

.ranking-table th,
.ranking-table td {
  height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

.ranking-table {
  table-layout: fixed;
}

.ranking-table th:first-child,
.ranking-table td:first-child {
  width: 54px;
  text-align: center;
}

.ranking-table th:nth-child(3),
.ranking-table td:nth-child(3),
.ranking-table th:nth-child(4),
.ranking-table td:nth-child(4) {
  width: 58px;
}

.ranking-table tr.me {
  background: #fff6dc;
  font-weight: 800;
}

@media (max-width: 899px) {
  .app-shell {
    padding: 0 12px 20px;
  }

  .game-header {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .round-summary {
    grid-row: 2;
    grid-column: 1 / -1;
    width: 100%;
    margin-bottom: 9px;
  }

  .summary-item {
    min-width: 0;
    flex: 1;
  }

  .game-layout {
    display: block;
    padding-top: 8px;
  }

  .play-area {
    min-height: 0;
    padding: 5px 0 20px;
  }

  .course-sidebar {
    display: none;
  }

  .status-panel {
    min-height: 360px;
    padding: 55px 18px;
  }

  .hole-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 68px 44px auto;
    align-items: center;
    gap: 9px;
    margin-bottom: 10px;
  }

  .current-hole-preview {
    width: 68px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--surface);
  }

  .current-hole-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
  }

  .modal.course-preview-layer {
    display: flex;
    padding: 24px;
    background: rgba(255, 255, 255, 0.94);
  }

  .course-preview-close {
    width: min(88vw, 520px);
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-out;
    -webkit-tap-highlight-color: transparent;
  }

  .course-preview-close img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 12px 20px rgba(16, 60, 42, 0.2));
  }

  .word-board {
    margin-bottom: 18px;
  }

  .board-row {
    width: min(100%, calc(var(--tile-count) * 44px));
  }

  .hint-dock {
    min-height: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
  }

  .hint-cat-button,
  .hint-cat-button img {
    width: 44px;
    height: 44px;
  }

  .hint-cat-button {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--surface);
  }

  .hint-cat-button:hover {
    transform: none;
    background: var(--green-100);
  }

  .hint-cat-button img {
    filter: none;
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding-inline: 8px;
  }

  .game-header {
    min-height: 54px;
  }

  .brand-block h1 {
    font-size: 18px;
  }

  .flag-mark {
    transform: scale(0.86);
    transform-origin: left center;
  }

  .header-button {
    min-height: 34px;
    padding-inline: 6px;
    font-size: 13px;
  }

  .validation-modal {
    padding: 12px;
  }

  .validation-card {
    padding: 22px 18px;
  }

  .hint-card {
    padding: 24px 16px;
  }

  .hint-description {
    margin-inline: 20px;
  }

  .hint-word {
    padding-inline: 3px;
    font-size: 16px;
  }

  .validation-actions {
    grid-template-columns: 1fr;
  }

  .summary-item {
    padding: 5px 6px;
  }

  .hole-title-row h2 {
    font-size: 19px;
  }

  .hole-title-row {
    grid-template-columns: minmax(0, 1fr) 62px 42px auto;
    gap: 7px;
  }

  .current-hole-preview {
    width: 62px;
    height: 44px;
  }

  .hint-cat-button,
  .hint-cat-button img {
    width: 42px;
    height: 42px;
  }

  .tile {
    font-size: 17px;
  }

  .board-row {
    gap: 3px;
  }

  .word-board {
    gap: 3px;
  }

  .completed-message {
    margin-block: 22px;
    padding-block: 28px;
  }

  .keyboard,
  .keyboard-row {
    gap: 3px;
  }

  .key {
    height: 48px;
    padding: 0;
    font-size: 14px;
  }

  .key-spacer {
    height: 48px;
  }

  .key.command {
    font-size: 11px;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    padding: 25px 16px;
  }

  .result-card {
    padding: 30px 16px 22px;
  }

  #hole-result-title {
    font-size: clamp(34px, 12vw, 42px);
  }

  .final-summary {
    grid-template-columns: repeat(6, 1fr);
  }

  .ranking-card {
    padding-inline: 12px;
  }

  .ranking-heading {
    padding-right: 30px;
  }

  .ranking-my-score {
    padding-inline: 10px;
  }

  .ranking-my-score-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .ranking-my-score-heading span {
    text-align: left;
  }

  .ranking-table th,
  .ranking-table td {
    padding-inline: 4px;
    font-size: 11px;
  }
}

@media (max-width: 340px) {
  .key {
    height: 45px;
    font-size: 13px;
  }

  .key-spacer {
    height: 45px;
  }

  .key.command {
    font-size: 10px;
  }

  .tile {
    font-size: 15px;
  }

  .play-date {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .celebration-particle {
    animation: none !important;
    opacity: 0.52;
  }

  .celebration-active,
  .celebration-active #hole-result-title,
  .celebration-active .final-hole-result {
    animation: none !important;
  }

  .celebration-hole-in-one,
  .celebration-eagle {
    box-shadow: 0 0 0 3px rgba(199, 148, 46, 0.28), var(--shadow);
  }
}

/* 라운드 둘러보기(회고) 모드 */
.review-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100%, 560px);
  margin: 0 auto 14px;
}

.review-date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-date-nav strong {
  min-width: 130px;
  color: var(--green-900);
  font-size: 15px;
  text-align: center;
}

.review-exit {
  margin-left: auto;
}

.review-hole-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-hole-nav .secondary-button {
  flex-shrink: 0;
  white-space: nowrap;
}

.review-result {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--green-800);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  overflow-wrap: break-word;
}

.completed-message .secondary-button {
  display: block;
  margin: 10px auto 0;
}

body.review-mode .course-step,
body.review-mode .mobile-hole,
body.review-mode .scorecard tbody tr {
  cursor: pointer;
}

@media (max-width: 520px) {
  .review-date-nav strong {
    min-width: 0;
    flex: 1;
  }

  .review-hole-nav .secondary-button {
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
  }

  .review-result {
    font-size: 13px;
  }
}

/* 캐디 유휴 추천 말풍선 */
.caddie-bubble {
  position: absolute;
  z-index: 6;
  left: 50%;
  transform: translateX(-50%);
  width: min(94%, 380px);
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 10px 26px rgba(16, 60, 42, 0.2);
  animation: caddie-bubble-pop 0.22s ease;
}

.caddie-bubble::after {
  content: '';
  position: absolute;
  top: -9px;
  right: 26px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 9px solid var(--paper);
  filter: drop-shadow(0 -1.5px 0 var(--line));
}

.caddie-bubble-title {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.caddie-bubble-words {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.caddie-bubble-word {
  min-width: 0;
  padding: 10px 4px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 5px;
  color: var(--green-900);
  background: #fffaf0;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.caddie-bubble-word:hover {
  border-color: var(--gold);
  background: #fff4d6;
}

@keyframes caddie-bubble-pop {
  from {
    opacity: 0;
    margin-top: 6px;
  }
  to {
    opacity: 1;
    margin-top: 0;
  }
}

@media (min-width: 900px) {
  .caddie-bubble {
    left: auto;
    right: 0;
    top: 360px;
    width: 250px;
    transform: translateY(calc(-100% - 14px));
  }

  .caddie-bubble::after {
    top: auto;
    bottom: -9px;
    right: 52px;
    border-bottom: 0;
    border-top: 9px solid var(--paper);
    filter: drop-shadow(0 1.5px 0 var(--line));
  }

  .caddie-bubble-words {
    grid-template-columns: 1fr;
  }
}
