


:root {
  --green:        #0b9444;
  --dark-green:   #087336;
  --light-green:  #6fd356;
  --red:          #e94332;
  --dark-red:     #b82a1d;
  --gold:         #ffc534;
  --gold-deep:    #e8920a;
  --lake:         #25b9e8;
  --lake-deep:    #0972c0;
  --cream:        #fff6d9;
  --white:        #ffffff;

  --shadow-card:  0 20px 50px rgba(0,72,108,.22);
  --shadow-btn:   0 8px 0 #087336, 0 12px 24px rgba(0,0,0,.25);
  --shadow-boat:  0 14px 18px rgba(0,77,111,.32);

  --radius-card:  28px;
  --radius-btn:   999px;

  --font-main: "Microsoft JhengHei","Noto Sans TC",Arial,sans-serif;
  --control-panel-bg: rgba(255,255,255,.18);
  --control-panel-blur: 6px;

  --transition-boat: bottom .42s cubic-bezier(.22,.72,.2,1), transform .18s ease;
  --transition-ui:   .15s ease;
}



*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-main);
  background: url('assets/img/bg-desktop.jpg') center top/cover fixed no-repeat;
  color: #24313a;
  overflow-x: hidden;
}


.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 5px 18px rgba(0,0,0,.08);
}
.brand {
  display: flex; align-items: center;
  text-decoration: none; color: #116432; font-weight: 900; gap: 10px;
}
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  height: 38px; width: auto;
  background: transparent; box-shadow: none; border-radius: 0;
}
.logo-mark img {
  display: block; height: 100%; width: auto; max-width: 120px; object-fit: contain;
}
.logo-text { font-size: 16px; }
.nav-links { display: flex; gap: 10px; }
.nav-links a {
  color: #17613a; text-decoration: none; font-weight: 800;
  padding: 8px 12px; border-radius: var(--radius-btn);
  transition: background var(--transition-ui);
}
.nav-links a:hover { background: #e9f8ee; }

header,
.header,
.navbar,
.nav,
nav {
  background: none !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  border: 0 !important;
  filter: none !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: visible !important;
}

header::before,
header::after,
.header::before,
.header::after,
.navbar::before,
.navbar::after,
.nav::before,
.nav::after,
nav::before,
nav::after {
  content: none !important;
  display: none !important;
  background: none !important;
  box-shadow: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}


.game-shell {
  min-height: calc(100svh - 58px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px 16px 28px;
}
.game-stage {
  position: relative;
  width: min(100%, 900px);
  height: min(860px, calc(100svh - 92px));
  min-height: 690px;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: url('assets/img/bg-mobile.jpg') center top/cover no-repeat;
  box-shadow: var(--shadow-card);
  border: 6px solid rgba(255,255,255,.55);
}


.sky-deco {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 16% 13%, rgba(255,255,255,.9) 0 32px, transparent 33px),
    radial-gradient(circle at 80% 16%, rgba(255,255,255,.7) 0 40px, transparent 41px),
    linear-gradient(180deg, rgba(255,255,255,.35), transparent 26%),
    linear-gradient(90deg, rgba(38,128,70,.28) 0 12%, transparent 22% 78%, rgba(38,128,70,.28) 88%);
}

.sky-deco::after {
  content: "";
  position: absolute; bottom: 0; left: 0; right: 0; height: 38%;
  background: repeating-linear-gradient(
    180deg, transparent 0, transparent 14px,
    rgba(255,255,255,.07) 14px, rgba(255,255,255,.07) 16px
  );
  animation: waterShimmer 3.5s linear infinite;
}
@keyframes waterShimmer {
  to { background-position: 0 32px; }
}


.circle-icon {
  position: absolute; z-index: 7;
  width: 46px; height: 46px;
  border: 0; border-radius: var(--radius-btn);
  color: #fff; font-size: 26px; font-weight: 900; cursor: pointer;
  background: linear-gradient(180deg, var(--light-green), var(--dark-green));
  box-shadow: 0 5px 0 #087336, 0 10px 18px rgba(0,0,0,.18);
  transition: transform var(--transition-ui), box-shadow var(--transition-ui);
}
.circle-icon:active { transform: translateY(3px); box-shadow: 0 2px 0 #087336; }
.circle-icon.info { left: 18px; top: 18px; }
.circle-icon.help { right: 18px; top: 18px; }


.title-board {
  position: absolute; z-index: 6;
  top: 20px; left: 50%; transform: translateX(-50%);
  width: min(83%, 680px); text-align: center;
}
.title-image-board { top: 12px; }
.title-board img {
  display: block; width: 100%; height: auto;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.28));
}



.timer-pill {
  position: absolute;
  z-index: 12;
  top: 132px;
  right: 24px;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 8px 13px;
  border: 3px solid rgba(255,255,255,.82);
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  color: #0f6c3a;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(0,72,108,.16);
}
.timer-pill strong {
  color: #e33124;
  font-size: 28px;
  line-height: 1;
}
.timer-pill small {
  color: #0f6c3a;
  font-size: 14px;
}
.floating-row-btn.is-failed {
  filter: grayscale(.15) drop-shadow(0 10px 12px rgba(0, 59, 90, .22));
}


.reward-goal { display: none; }


.race-panel {
  position: absolute; left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 100%; height: 100%;
  perspective: 760px; overflow: hidden;
  isolation: isolate;
}
.race-panel::before,
.race-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.race-panel::before {
  z-index: 0;
  content: none;
}
.race-panel::after {
  z-index: 1;
  background: url('assets/img/desktop-Tier02.png') center bottom / cover no-repeat;
}
.track-bg {
  position: absolute; left: 50%; bottom: 0;
  width: 100%; height: 100%;
  z-index: 2;
  transform: translateX(-50%);
  transform-origin: bottom center;
  background-image: url('assets/img/desktop-rivertrack06.png'), url('assets/img/rivertrack05.png');
  background-position: center bottom, center bottom;
  background-size: cover, cover;
  background-repeat: no-repeat, no-repeat;
  border: 0;
  box-shadow: none;
}
.track-bg::before {
  content: none;
}
.lane {
  position: absolute; z-index: 2; bottom: -3%; height: 97%; width: 36%;
  transform: rotateX(16deg); transform-origin: bottom center;
  border-radius: 0 0 70px 70px;
}
.left-lane  { left: 14%; }
.right-lane { right: 14%; }

.center-line {
  position: absolute; z-index: 3;
  left: 50%; bottom: 2%; width: 12px; height: 90%;
  transform: translateX(-50%) rotateX(16deg);
  transform-origin: bottom center;
  background: transparent;
  border-radius: var(--radius-btn);
  box-shadow: none;
}
.center-line::before {
  content: none;
}

.milestone {
  display: none;
  position: absolute; left: 50%; transform: translateX(-50%);
  place-items: center;
  width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(180deg, #7bc943, #208b2f);
  border: 4px solid #ffdd62;
  color: #fff; font-size: 24px; font-weight: 900;
  box-shadow: 0 5px 10px rgba(0,0,0,.18);
}
.m1 { bottom: 8%;  }
.m2 { bottom: 34%; }
.m3 { bottom: 58%; }
.m4 { bottom: 80%; }


.track-line-layer {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 0;
  width: 100%;
  height: 100%;
  transform: translateX(-50%);
  pointer-events: none;
}
.finish-line, .start-line {
  position: absolute; left: 50%;
  transform: translateX(-50%) rotateX(16deg);
  transform-origin: bottom center;
  border-radius: 4px; border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.22);
}
.finish-line {
  top: 15.8%; width: 46%; height: 28px;
  background: repeating-conic-gradient(#fff 0 25%, #222 0 50%) 0 0 / 28px 28px;
}
.finish-line::before {
  content: "FINISH"; position: absolute;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 4px 15px; border-radius: var(--radius-btn);
  background: var(--red); color: #fff; font-size: 15px; font-weight: 900;
  box-shadow: 0 4px 10px rgba(92, 18, 12, .24);
}
.start-line {
  bottom: 6.2%; width: 78%; height: 30px;
  background: repeating-conic-gradient(#fff 0 25%, #026be2 0 50%) 0 0 / 30px 30px;
}
.start-line::before {
  content: "START"; position: absolute;
  left: 50%; bottom: auto; top: 50%; transform: translate(-50%, -50%);
  padding: 4px 15px; border-radius: var(--radius-btn);
  background:  #026be2; color: #fff; font-size: 15px; font-weight: 900;
  box-shadow: 0 4px 10px rgba(8, 83, 42, .24);
}


.side-bonus {
  position: absolute;
  z-index: 5;
  display: grid;
  gap: 2px;
  place-items: center;
  min-width: 116px;
  padding: 10px 12px 9px;
  border-radius: 18px;
  background: rgba(255,255,245,.92);
  box-shadow: 0 9px 18px rgba(0,80,120,.14);
  color: #bc4a20;
  font-weight: 900;
  text-align: center;
  pointer-events: none;
  user-select: none;
  animation: cheerFloat 3.2s ease-in-out infinite;
}
.side-bonus::before {
  font-size: 28px;
  line-height: 1;
}
.side-bonus small {
  color: #5d6a56;
  font-size: 11px;
}
.side-bonus b {
  font-size: 13px;
  white-space: nowrap;
}
.bonus-left {
  left: 3%;
}
.bonus-right {
  right: 3%;
}
.bonus-left.top,
.bonus-right.top {
  top: 32%;
}
.bonus-left.mid,
.bonus-right.mid {
  top: 50%;
}
.bonus-left.top::before {
  content: "🎟️";
}
.bonus-right.top::before {
  content: "💪";
}
.bonus-left.mid::before {
  content: "🚣";
}
.bonus-right.mid::before {
  content: "✨";
}
.bonus-right.top,
.bonus-right.mid {
  animation-delay: .8s;
}

.side-bonus {
  width: 108px;
  height: 108px;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background: var(--bonus-image) center / contain no-repeat;
  box-shadow: none;
  color: transparent;
}
.side-bonus::before {
  content: none;
}
.side-bonus b,
.side-bonus small {
  display: none;
}
.bonus-left.top {
  --bonus-image: url('assets/img/bonus-left.png');
}
.bonus-left.mid {
  --bonus-image: url('assets/img/bonus-left2.png');
}
.bonus-right.top {
  --bonus-image: url('assets/img/bonus-right.png');
}
.bonus-right.mid {
  --bonus-image: url('assets/img/bonus-right2.png');
}
@keyframes cheerFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-8px) scale(1.03);
  }
}


.boat {
  position: absolute; z-index: 8;
  bottom: 6.4%; width: 126px; height: 158px;
  filter: drop-shadow(var(--shadow-boat));
  transition: var(--transition-boat);
}
.boat img { display: block; width: 100%; height: auto; pointer-events: none; user-select: none; }


.boat.is-paddling { animation: paddleShake .32s ease; }
@keyframes paddleShake {
  0%   { transform: translateX(-50%) scale(var(--boat-scale, 1)) rotate(0deg); }
  20%  { transform: translateX(-50%) scale(var(--boat-scale, 1)) rotate(-2deg); }
  55%  { transform: translateX(-50%) scale(var(--boat-scale, 1)) rotate(1.5deg); }
  100% { transform: translateX(-50%) scale(var(--boat-scale, 1)) rotate(0deg); }
}


.boat.is-sprinting { filter: drop-shadow(0 0 14px rgba(255,220,50,.8)) drop-shadow(var(--shadow-boat)); }


.boat-body, .dragon-head, .rower, .paddle { display: none; }

.boat-amart  { left: 36%; color: #139447; }
.boat-player { left: 64%; color: #d93626; }

.boat-flag {
  position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%);
  white-space: nowrap; font-size: 15px; font-weight: 900;
  padding: 4px 12px; border-radius: 8px;
  border: 2px solid rgba(255,255,255,.75);
  text-shadow: 0 2px 0 rgba(0,0,0,.18); color: #fff;
}
.boat-amart .boat-flag  { background: var(--red); }
.boat-player .boat-flag { background: var(--green); }



.bottom-controls {
  position: absolute;
  left: 18px; right: 18px; bottom: 10px;
  height: 102px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12px 18px;
  background: var(--control-panel-bg);
  border: 2px solid rgba(255,255,255,.48);
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(0,45,80,.18);
  backdrop-filter: blur(var(--control-panel-blur));
  -webkit-backdrop-filter: blur(var(--control-panel-blur));
}

.bottom-controls .race-progress-row {
  flex: 1 1 auto;
  width: auto;
}

.bottom-controls .race-progress-row > .progress-track {
  flex: 0 1 310px;
  max-width: 330px;
}


.progress-meter {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
  gap: 0;
  flex-shrink: 0;
}
.progress-label { display: none; }

.progress-meter strong {
  position: relative;
  display: grid; place-items: center;
  width: 64px; height: 64px;
  border: 4px solid #f7f7f7; border-radius: 50%;
  background: radial-gradient(circle at 42% 36%, #fff 0 18%, #f4f4f4 42%, #d7d7d7 100%);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.85), 0 5px 12px rgba(0,0,0,.2);
  font-weight: 900; margin-bottom: 0;
}
.progress-meter strong::after {
  content: ""; position: absolute; inset: 5px; border-radius: 50%;
  box-shadow: inset 0 8px 18px rgba(255,255,255,.88); pointer-events: none;
}

#countText {
  font-size: 30px; font-weight: 900; color: #2f66d8;
  position: relative; z-index: 1;
}


.progress-track {
  position: relative;
  flex: 1;
  min-width: 0;
  width: auto;
  height: 22px;          
  padding: 4px;
  border: 4px solid #f4f4f4; border-radius: var(--radius-btn);
  background: #d9d9d9;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.2), 0 3px 0 rgba(255,255,255,.72);
  overflow: hidden;
}

.progress-track span {
  position: absolute; top: 4px; bottom: 4px; left: 4px;
  
  width: calc(var(--progress-ratio, 0) * (100% - 8px));
  height: auto;
  border-radius: var(--radius-btn);
  background: linear-gradient(90deg, #ff9f27 0%, #ff7b22 42%, #ff1f1f 100%);
  box-shadow: inset 0 2px 4px rgba(255,255,255,.55), 0 0 8px rgba(255,92,24,.28);
  transition: width .35s cubic-bezier(.22,.72,.2,1);
}


.floating-row-btn {
  position: relative;
  flex-shrink: 0;
  width: 78px;
  height: 78px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: url('assets/img/btn-paddle.png') center / contain no-repeat;
  cursor: pointer;
  filter: drop-shadow(0 12px 16px rgba(0, 59, 90, .34));
  transform-origin: center;
  transition: transform .12s cubic-bezier(.2,.8,.2,1), filter .12s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.floating-row-btn::after {
  content: "👆";
  position: absolute;
  right: -8px;
  bottom: -4px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 50%;
  background: rgba(255, 244, 176, .95);
  box-shadow: 0 4px 10px rgba(0, 59, 90, .24);
  font-size: 21px;
  line-height: 1;
  pointer-events: none;
  transform-origin: center;
  animation: fingerHintPulse 1.05s ease-in-out infinite;
}
.floating-row-btn:hover {
  transform: scale(1.04);
}
.floating-row-btn:active {
  transform: scale(.9);
  filter: drop-shadow(0 5px 8px rgba(0, 59, 90, .22));
}
.floating-row-btn:disabled {
  cursor: not-allowed;
  pointer-events: none;
}
.floating-row-btn.is-finished {
  filter: drop-shadow(0 0 14px rgba(255, 220, 70, .9)) drop-shadow(0 10px 12px rgba(0, 59, 90, .28));
}
.floating-row-btn:disabled::after,
.floating-row-btn.is-finished::after {
  display: none;
}
.btn-main {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes fingerHintPulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.08); }
}


#bonusToast {
  position: fixed; top: 80px; left: 50%;
  transform: translateX(-50%) translateY(-14px);
  z-index: 50; padding: 12px 28px; border-radius: var(--radius-btn);
  background: rgba(15,15,15,.88); backdrop-filter: blur(8px);
  color: #fff; font-size: 17px; font-weight: 700;
  white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
#bonusToast.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}


.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,36,60,.55); backdrop-filter: blur(6px);
  padding: 20px;
}
.modal[hidden] { display: none; }

.modal-card {
  position: relative; width: min(100%, 400px);
  padding: 40px 32px 32px; border-radius: 28px;
  background: linear-gradient(160deg, #fff 0%, #f0fff6 100%);
  box-shadow: 0 30px 60px rgba(0,60,100,.25), 0 0 0 4px rgba(255,255,255,.6);
  text-align: center;
  animation: modalPop .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modalPop {
  from { transform: scale(.82); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.modal-x {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: #f0f0f0; color: #555; font-size: 20px; cursor: pointer;
  transition: background var(--transition-ui);
}
.modal-x:hover { background: #e0e0e0; }
.modal.is-locked .modal-x { display: none; }
.modal-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
}
.modal-icon:empty {
  display: none;
}
.modal-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.modal-card h3 { margin: 0 0 10px; font-size: 26px; color: #0f3a20; }
.modal-card p  { margin: 0 0 24px; font-size: 17px; color: #3a5040; line-height: 1.6; }
.modal-retry-tomorrow {
  display: inline-block;
  margin-top: 8px;
  color: #e33124;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.2;
}
.modal.is-winning .modal-card {
  width: min(100%, 520px);
  padding: 24px 22px 30px;
  background: transparent;
  box-shadow: none;
}
.modal.is-winning .modal-icon,
.modal.is-winning .modal-card h3 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.modal.is-winning .modal-card p {
  margin: 0 0 4px;
  line-height: 1;
}
.modal-winning-card {
  display: block;
  width: min(100%, 640px);
  height: auto;
  margin: 0 auto;
}
.modal.is-winning .modal-action {
  position: relative;
  top: -56px;
  margin-bottom: -56px;
}

.modal-action {
  display: inline-block;
  width: 220px;
  padding: 13px 0;
  border: 0;
  border-radius: var(--radius-btn);
  background: linear-gradient(180deg, #3edb72, var(--green));
  color: #fff; font-family: var(--font-main);
  font-size: 18px; font-weight: 900; cursor: pointer;
  box-shadow: 0 5px 0 var(--dark-green), 0 10px 18px rgba(0,64,36,.2);
  transition: transform .1s ease, box-shadow .1s ease, background .12s ease;
}
.modal-action:hover { background: linear-gradient(180deg, #52e882, #0fa852); }
.modal-action:disabled {
  cursor: default;
  opacity: 1;
  background: linear-gradient(180deg, #168c48, #0f6f34);
  box-shadow: 0 5px 0 #064b24, 0 10px 18px rgba(0, 64, 36, .2);
}
.modal.is-locked .modal-action {
  display: none;
}
.modal-action:active, .modal-action.is-pressed {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--dark-green);
  background: #0f6f34;
}

.modal-home-link {
  display: block;
  width: 220px;
  margin: 14px auto 0;
  padding: 13px 0;
  border-radius: var(--radius-btn);
  background: linear-gradient(180deg, #ff5a4d, #e33124);
  color: #fff;
  font-family: var(--font-main);
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 5px 0 #a91f16, 0 10px 18px rgba(128, 20, 14, .22);
  transition: transform .1s ease, box-shadow .1s ease;
}
.modal-home-link:hover {
  transform: translateY(-1px);
}
.modal-home-link:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #a91f16;
}
.modal-home-link[hidden] {
  display: none;
}

#confetti {
  position: fixed; inset: 0; pointer-events: none;
  z-index: 9999; display: none; overflow: visible;
}
#confetti.is-playing { display: block; }
.confetti-lottie { position: absolute; inset: 0; overflow: visible; }
.confetti-lottie > svg, #confetti > svg {
  width: 100%; height: 100%; overflow: visible;
}


.content-card {
  max-width: 800px; margin: 0 auto 32px;
  padding: 32px 36px; border-radius: 24px;
  background: rgba(255,255,255,.82); backdrop-filter: blur(8px);
  box-shadow: 0 8px 30px rgba(0,60,100,.1);
}
.content-card h2 {
  margin: 0 0 18px; font-size: 22px; color: var(--dark-green);
  border-bottom: 3px solid var(--gold); padding-bottom: 10px;
}
.notice-card ol { margin: 0; padding-left: 22px; line-height: 1.9; }
.notice-card a  { color: var(--green); }

.race-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
  justify-content: center;
}

.race-progress-row > .race-status-panel {
  flex: 0 0 316px;
  position: static;
  inset: auto;
  width: 316px;
  min-width: 316px;
  max-width: 316px;
  min-height: 62px;
  padding: 8px 10px;
  gap: 9px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  align-self: center;
  box-sizing: border-box;
  transform: none;
  margin: 0;
  z-index: auto;
  overflow: visible;
}

.race-status-panel {
  z-index: 45;
  border: 3px solid #fff4b0;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 236, 72, .96), rgba(255, 132, 26, .92));
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .85),
    0 0 0 2px rgba(255, 255, 255, .68),
    0 14px 24px rgba(0, 59, 90, .32);
  pointer-events: none;
}

.race-status-panel .status-line {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  width: auto;
  min-width: 0;
  height: 46px;
  min-height: 46px;
  padding: 5px 7px;
  border-radius: 7px;
  color: #fff7c7;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(117, 34, 18, .2)),
    #158044;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .2),
    inset 0 -2px 0 rgba(0, 0, 0, .18);
}

.race-status-panel .status-line + .status-line {
  border-left: 0;
  border-top: 2px solid rgba(255, 244, 176, .52);
  border-top-left-radius: 7px;
  border-top-right-radius: 7px;
}

.race-progress-row .status-timer { width: 154px; }
.race-progress-row .status-count { width: 124px; }

.race-status-panel .status-timer {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(117, 34, 18, .18)),
    #168c48;
}

.race-status-panel .status-line > span {
  flex: 0 0 auto;
  color: #fff4b0;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0;
  text-align: right;
  text-transform: uppercase;
}

.race-status-panel .status-value-box {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  width: 98px;
  min-width: 98px;
  max-width: 98px;
  height: 39px;
  min-height: 39px;
  padding: 3px 7px;
  border-radius: 8px;
  box-sizing: border-box;
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .15), rgba(0, 0, 0, .2)),
    rgba(7, 92, 48, .9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .22),
    inset 0 -2px 0 rgba(0, 0, 0, .22),
    0 0 0 1px rgba(255, 244, 176, .28);
}

.race-progress-row .status-count .status-value-box {
  width: 74px;
  min-width: 74px;
  max-width: 74px;
}

.race-status-panel small {
  align-self: end;
  font-size: 12px;
  font-weight: 800;
  color: #dff8ef;
}

.race-status-panel #timerText,
.race-status-panel #countText {
  display: inline-block;
  min-width: 0;
  width: auto;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 30px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0;
  transform: none;
}

.race-status-panel #timerText {
  color: #fff36b;
  text-shadow: 0 3px 0 rgba(126, 29, 12, .52);
}

.race-status-panel #countText {
  color: #ffffff;
  text-shadow: 0 3px 0 rgba(8, 83, 42, .48);
}

.race-status-panel #timerText.is-ticking {
  animation: timerScorePop .24s ease;
}

.race-status-panel #timerText.is-urgent {
  color: #ff4a32;
  animation: timerUrgentPulse .45s ease-in-out infinite;
}

.race-status-panel.is-urgent {
  border-color: #ff4a32;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .18),
    inset 0 -4px 0 rgba(0, 0, 0, .18),
    0 6px 0 #7b1b11,
    0 0 18px rgba(255, 74, 50, .7),
    0 14px 24px rgba(0, 48, 54, .22);
  animation: scoreboardAlert .5s ease-in-out infinite;
}

.race-progress-row > .race-status-panel.race-status-danger {
  animation: raceStatusDangerPulse .42s ease-in-out infinite alternate;
}

.race-progress-row > .race-status-panel.race-status-danger .status-value-box {
  box-shadow: 0 0 0 2px rgba(255, 238, 92, .75), 0 0 12px rgba(255, 83, 45, .85);
}

.race-progress-row > .race-status-panel.race-status-danger .status-timer .status-value-box {
  animation: raceTimerShake .16s linear infinite, raceTimerAlarmGlow .42s ease-in-out infinite alternate;
  transform-origin: center;
}

.race-progress-row > .race-status-panel.race-status-danger #timerText {
  color: #fff36a;
  text-shadow: 0 1px 0 rgba(99, 42, 0, .55), 0 0 8px rgba(255, 68, 37, .95);
}

.race-status-panel #countText.is-counting {
  animation: countScorePop .18s ease;
}

.floating-row-btn {
  outline: 5px solid rgba(255, 234, 145, .98);
  outline-offset: -8px;
}

.floating-row-btn.is-rowing {
  animation: rowButtonHit .22s cubic-bezier(.2,.8,.2,1);
}

#progressFill {
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, .55),
    0 0 8px rgba(255, 92, 24, .28);
}

#progressFill.is-progress-hit {
  filter: brightness(1.35) saturate(1.25);
}

.race-progress-row > .progress-track {
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, .2),
    0 7px 14px rgba(0, 59, 90, .18);
}

.race-original-timer,
.race-original-count {
  display: none !important;
}

@keyframes raceStatusDangerPulse {
  from { filter: brightness(1); }
  to { filter: brightness(1.16) saturate(1.18); }
}

@keyframes raceTimerShake {
  0% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(-1.5px) rotate(-1deg); }
  50% { transform: translateX(1.5px) rotate(1deg); }
  75% { transform: translateX(-1px) rotate(-0.6deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

@keyframes raceTimerAlarmGlow {
  from { box-shadow: 0 0 0 2px rgba(255, 238, 92, .75), 0 0 10px rgba(255, 83, 45, .75); }
  to { box-shadow: 0 0 0 2px rgba(255, 250, 145, .95), 0 0 18px rgba(255, 49, 31, .95); }
}

@keyframes timerScorePop {
  0% { transform: scale(1); }
  45% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

@keyframes timerUrgentPulse {
  0%, 100% {
    transform: scale(1);
    text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
  }
  50% {
    transform: scale(1.14);
    text-shadow: 0 0 12px rgba(255, 74, 50, .65), 0 2px 0 rgba(0, 0, 0, .35);
  }
}

@keyframes scoreboardAlert {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.035); }
}

@keyframes countScorePop {
  0% { transform: scale(1); }
  45% { transform: scale(1.26); }
  100% { transform: scale(1); }
}

@keyframes rowButtonHit {
  0% { transform: scale(1); }
  36% { transform: scale(.82); }
  72% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@media (max-width: 720px) {
  body       {
    padding-bottom: 24px;
    background: url('assets/img/bg-desktop.jpg') center top/cover fixed no-repeat;
  }
  :root {
    --mobile-game-scale: .90;
    --mobile-controls-bottom: max(10px, env(safe-area-inset-bottom));
    --mobile-controls-offset-y: -50px;
  }
  .game-shell {
    min-height: auto;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 10px 14px;
    zoom: var(--mobile-game-scale);
  }
  .game-stage {
    height: clamp(500px, calc(100svh - 170px), 680px);
    min-height: 500px;
    border-width: 4px;
    border-radius: 22px;
    background: url('assets/img/bg-mobile.jpg') center top/cover no-repeat;
  }
  .race-panel::after { background-image: url('assets/img/mobile-Tier02.png'); }
  .track-bg {
    background-image: url('assets/img/mobile-rivertrack06.png'), url('assets/img/rivertrack05.png');
    background-size: 72% auto, 720% auto;
    background-position: center calc(100% + 18px), center bottom;
  }
  .title-image-board { top: 28px; width: 78%; }
  .race-panel { bottom: 0; height: 100%; }
  .boat       { width: 76px; height: 116px; }
  .boat-amart  { left: 35.5%; }
  .boat-player { left: 64.5%; }
  .boat-flag   { font-size: 12px; padding: 4px 9px; bottom: -4px; border-radius: 8px; }
  .track-line-layer {
    width: 68%;
    height: auto;
    aspect-ratio: 1080 / 2050;
  }
  .start-line  { bottom: 18%; width: 102%; height: clamp(24px, 6.4vw, 32px); }
  .finish-line { top: 13%; width: 44%; height: clamp(20px, 5.6vw, 28px); }
  .finish-line::before,
  .start-line::before { top: 50%; }

  .bottom-controls {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: min(calc(100% - 18px), 390px);
    margin: 0 auto;
    height: 116px;
    display: grid;
    grid-template-columns: minmax(104px, 1fr) 98px minmax(104px, 1fr);
    grid-template-rows: 1fr;
    justify-items: center;
    align-items: center;
    padding: 10px 12px;
    gap: 8px;
    z-index: 35;
    transform: translateY(var(--mobile-controls-offset-y));
  }
  .bottom-controls > .progress-meter {
    display: none;
  }
  .race-progress-row {
    display: contents;
  }
  .race-progress-row > .race-status-panel {
    grid-column: 1;
    grid-row: 1;
    position: static;
    width: 100%;
    min-width: 0;
    max-width: 128px;
    height: 86px;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    align-items: stretch;
    justify-content: center;
    gap: 3px;
    padding: 4px;
    margin: 0;
    border-width: 2px;
    border-radius: 12px;
    transform: none;
  }
  .race-progress-row .status-line {
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 0;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 3px;
    align-items: center;
    padding: 3px 4px;
    border-radius: 8px;
    overflow: hidden;
  }
  .race-progress-row .status-line + .status-line {
    border-top: 1px solid rgba(255, 244, 176, .42);
    border-left: 0;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
  }
  .race-progress-row .status-line > span {
    font-size: 10px;
    line-height: 1;
    text-align: center;
  }
  .race-progress-row .status-value-box {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 25px;
    min-height: 25px;
    padding: 1px 4px 3px;
    gap: 2px;
    border-radius: 8px;
    overflow: hidden;
  }
  .race-progress-row #timerText,
  .race-progress-row #countText {
    font-size: clamp(17px, 5.4vw, 22px);
    line-height: .95;
  }
  .race-progress-row .status-count #countText {
    font-size: clamp(17px, 5.3vw, 22px);
  }
  .race-progress-row .status-value-box small {
    font-size: 8px;
    line-height: 1;
    white-space: nowrap;
  }
  .progress-meter { width: 56px; }
  .progress-meter strong { width: 52px; height: 52px; }
  #countText { font-size: 24px; }
  .progress-track {
    grid-column: 3;
    grid-row: 1;
    width: 100%;
    max-width: 124px;
    height: 22px;
    padding: 4px;
    align-self: center;
  }
  .progress-track span {
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(var(--progress-ratio, 0) * (100% - 8px));
  }
  .floating-row-btn {
    grid-column: 2;
    grid-row: 1;
    width: 94px;
    height: 94px;
    justify-self: center;
    align-self: center;
  }
  .floating-row-btn:active {
    transform: scale(.84);
    filter:
      drop-shadow(0 0 5px rgba(255, 218, 66, .45))
      drop-shadow(0 6px 10px rgba(0, 59, 90, .25));
  }
  .floating-row-btn.is-rowing {
    animation: mobileRowButtonHit .22s cubic-bezier(.2,.8,.2,1);
  }

  @keyframes mobileRowButtonHit {
    0% { transform: scale(1); }
    36% { transform: scale(.82); }
    72% { transform: scale(1.12); }
    100% { transform: scale(1); }
  }

  .side-bonus {
    width: 78px;
    height: 78px;
  }
  .modal-action,
  .modal-home-link {
    width: min(220px, 100%);
  }
  .modal.is-winning {
    padding: 8px;
  }
  .modal.is-winning .modal-card {
    width: min(100%, 680px);
    padding: 12px 0 24px;
  }
  .modal.is-winning .modal-card p {
    margin-bottom: 0;
  }
  .modal-winning-card {
    width: min(100%, calc(100vw - 16px));
    max-height: calc(100svh - 112px);
    object-fit: contain;
  }
  .modal.is-winning .modal-action {
    top: -48px;
    margin-bottom: -48px;
  }
}


@media (min-width: 1080px) {
  .title-image-board { width: min(72%, 560px); }
  .boat { width: 128px; height: 184px; }
  .bottom-controls { height: 106px; gap: 16px; padding: 12px 20px; }
  .floating-row-btn { width: 86px; height: 86px; }
  .progress-track { height: 26px; }
  .progress-meter strong { width: 70px; height: 70px; }
  #countText { font-size: 34px; }
}
@media (min-width: 769px) {
  .race-panel {
    --desktop-track-width: 80%;
    --desktop-track-aspect: 1560 / 1650;
    --desktop-track-drop:50px;
  }

  .track-bg,
  .track-line-layer {
    width: var(--desktop-track-width);
    height: auto;
    aspect-ratio: var(--desktop-track-aspect);
    bottom: calc(-1 * var(--desktop-track-drop));
  }

  .track-bg {
    background-size: 100% 100%, 100% 100%;
  }

  body.has-fixed-race-controls {
    padding-bottom: 128px;
  }

  .game-shell {
    min-height: calc(100dvh - 24px);
    height: auto;
    margin-bottom: 40px;
    overflow: visible;
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }

  .game-stage {
    position: relative;
    width: min(72vw, 780px);
    height: clamp(760px, calc((100dvh - 96px) / .86), 900px);
    margin-top: -26px;
    margin-bottom: 0;
    transform: scale(.86);
    transform-origin: top center;
  }

  .title-image-board {
    top: 8px;
    width: min(68%, 520px);
  }

  .race-panel {
    bottom: 0;
    height: 100%;
  }

  .start-line {
    bottom: 6.2%;
    width: 78%;
  }

  .finish-line {
    top: 10%;
    width: 30%;
  }

  .boat-flag {
    bottom: -8px;
    padding: 7px 18px;
    border-width: 3px;
    border-radius: 10px;
    font-size: 19px;
    box-shadow: 0 5px 12px rgba(0, 45, 80, .24);
  }

  body.has-fixed-race-controls .bottom-controls {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: max(14px, env(safe-area-inset-bottom));
    width: min(78vw, 760px);
    height: 108px;
    z-index: 35;
    transform: translateX(-50%);
    padding: 12px 18px;
    background: var(--control-panel-bg);
    box-shadow: 0 12px 30px rgba(0,45,80,.22);
    border: 2px solid rgba(255,255,255,.52);
    border-radius: 24px;
    backdrop-filter: blur(var(--control-panel-blur));
    -webkit-backdrop-filter: blur(var(--control-panel-blur));
    animation: raceControlsFloat 3.2s ease-in-out infinite;
  }

  body.has-fixed-race-controls .bottom-controls > .progress-meter {
    display: none;
  }

  .content-card {
    width: min(72vw, 780px);
  }

  body.has-fixed-race-controls .bottom-controls:has(.floating-row-btn:active),
  body.has-fixed-race-controls .bottom-controls:has(.floating-row-btn.is-rowing),
  body.has-fixed-race-controls .bottom-controls.is-rowing {
    animation-play-state: paused;
  }

  @keyframes raceControlsFloat {
    0%, 100% {
      transform: translateX(-50%) translateY(0);
    }
    50% {
      transform: translateX(-50%) translateY(-5px);
    }
  }
}
