/* ==========================================
   Ring Toss Game — kouki Design System
   ========================================== */

/* ---- Game Shell ---- */
.boss {
  position: relative;
  overflow: hidden;
  opacity: 0;
  transition: opacity 500ms;
  background: #06394e;
}
.boss.show {
  opacity: 1;
}

/* ---- 3D Canvas Area ---- */
.canvas-box {
  position: relative;
  aspect-ratio: 640 / 800;
  background-image:
    linear-gradient(180deg, rgba(3, 83, 118, 0.06), rgba(1, 38, 58, 0.2)),
    url(assets/imgs/ocean-grotto.webp);
  background-size: cover;
  background-position: center bottom;
  overflow: hidden;
  border-radius: 1rem 1rem 0 0;
  box-shadow:
    inset 0 -30px 80px rgba(0, 35, 54, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.canvas-box canvas {
  display: block;
}

/* ---- Control Bar ---- */
.control-box {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 18px 12px;
  background:
    radial-gradient(circle at 50% -20%, rgba(99, 231, 224, 0.24), transparent 48%),
    linear-gradient(180deg, #073d53 0%, #052d43 100%);
  border-top: 1px solid rgba(173, 246, 241, 0.22);
  border-radius: 0 0 1rem 1rem;
}
.control-box > div {
  display: flex;
  align-items: center;
  justify-content: center;
}
.control-box > div.btn-box {
  flex-direction: column;
  gap: 8px;
}

/* Throw buttons — large circular, blue accent */
.control-box .btn {
  width: 76px;
  height: 76px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,0.48), transparent 22%),
    linear-gradient(145deg, #31d8cf 0%, #087c9f 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 180ms ease;
  box-shadow:
    0 8px 24px rgba(0, 16, 33, 0.34),
    inset 0 1px 0 rgba(255,255,255,0.35);
  outline: none;
  transform: translateY(-3px);
}
.control-box .btn:hover {
  box-shadow:
    0 12px 34px rgba(0, 16, 33, 0.42),
    inset 0 1px 0 rgba(255,255,255,0.45);
  transform: translateY(-4px);
}
.control-box .btn:active {
  transform: translateY(0);
  box-shadow:
    0 2px 10px rgba(7, 88, 255, 0.2);
  transition: all 60ms ease;
}
.control-box .btn:focus-visible,
.control-box .btn2:focus-visible,
.success .new-game:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
  box-shadow:
    0 0 0 6px rgba(7, 88, 255, 0.72),
    0 8px 24px rgba(0, 16, 33, 0.34);
}

/* Utility buttons — pill shaped */
.control-box .btn2 {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(195, 246, 241, 0.28);
  background: rgba(4, 38, 57, 0.5);
  color: #d8fbf8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 160ms ease;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(8, 17, 26, 0.05);
}
.control-box .btn2:hover {
  border-color: rgba(255,255,255,0.6);
  color: #ffffff;
  background: rgba(36, 187, 187, 0.2);
}
.control-box .btn2 + .btn2 {
  margin-top: 0;
}
.control-box .btn2.music-btn.play {
  background: rgba(52, 216, 208, 0.2);
  border-color: #69eee6;
  color: #ffffff;
}
.control-box .btn2.motion-btn.active {
  background: linear-gradient(135deg, #f2ca73, #ff9f7f);
  border-color: rgba(255,255,255,0.75);
  color: #39220b;
}
.control-box .btn2:disabled {
  cursor: default;
  opacity: 0.58;
}

/* ---- Bubble Animation ---- */
@keyframes pao-animation {
  0%   { transform: translateY(0);    opacity: 0; }
  10%  { transform: translateY(-10vh); opacity: 0.4; }
  90%  { transform: translateY(-100vh); opacity: 0.8; }
  100% { transform: translateY(-110vh); opacity: 0; }
}
@-webkit-keyframes pao-animation {
  0%   { -webkit-transform: translateY(0);    opacity: 0; }
  10%  { -webkit-transform: translateY(-10vh); opacity: 0.4; }
  90%  { -webkit-transform: translateY(-100vh); opacity: 0.8; }
  100% { -webkit-transform: translateY(-110vh); opacity: 0; }
}

.back-box {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}
.back-box .pao {
  position: absolute;
  bottom: -20px;
  width: 42px;
  height: 120px;
  opacity: 0;
  animation-duration: 3s;
  animation-timing-function: linear;
  -webkit-animation-duration: 3s;
  -webkit-animation-timing-function: linear;
}
.back-box .pao i {
  position: absolute;
  bottom: 0;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(220, 255, 252, 0.9);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.75), rgba(104,225,224,0.08) 55%, rgba(255,255,255,0.2));
  box-shadow: inset 0 0 6px rgba(255,255,255,0.5);
}
.back-box .pao i:nth-child(2) { left: 20px; bottom: 34px; width: 18px; height: 18px; }
.back-box .pao i:nth-child(3) { left: 5px; bottom: 75px; width: 8px; height: 8px; }
.back-box .pao.pao-move {
  animation-name: pao-animation;
  -webkit-animation-name: pao-animation;
}

/* ---- Water jets ---- */
@keyframes jet-left-fire {
  0% { opacity: 0; transform: rotate(36deg) scaleY(0.2); }
  18% { opacity: 0.9; transform: rotate(36deg) scaleY(1); }
  100% { opacity: 0; transform: rotate(36deg) translateY(-46px) scaleY(1.15); }
}
@keyframes jet-right-fire {
  0% { opacity: 0; transform: rotate(-36deg) scaleY(0.2); }
  18% { opacity: 0.9; transform: rotate(-36deg) scaleY(1); }
  100% { opacity: 0; transform: rotate(-36deg) translateY(-46px) scaleY(1.15); }
}
.water-jet {
  position: absolute;
  bottom: 5.5%;
  z-index: 3;
  width: 36px;
  height: 112px;
  opacity: 0;
  transform-origin: 50% 100%;
  background: linear-gradient(180deg, rgba(185,255,250,0), rgba(143,239,235,0.34) 62%, rgba(232,255,253,0.76));
  border-radius: 50% 50% 35% 35%;
  filter: drop-shadow(0 0 8px rgba(113, 240, 234, 0.55));
}
.water-jet-left {
  left: 6%;
  transform: rotate(36deg);
}
.water-jet-right {
  right: 6%;
  transform: rotate(-36deg);
}
.water-jet-left.is-firing {
  animation: jet-left-fire 520ms ease-out;
}
.water-jet-right.is-firing {
  animation: jet-right-fire 520ms ease-out;
}
.water-jet i {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid rgba(237,255,254,0.9);
  border-radius: 50%;
  background: rgba(178,245,242,0.22);
}
.water-jet i:nth-child(1) { left: 4px; bottom: 16px; }
.water-jet i:nth-child(2) { right: 2px; bottom: 32px; width: 12px; height: 12px; }
.water-jet i:nth-child(3) { left: 10px; bottom: 52px; width: 6px; height: 6px; }
.water-jet i:nth-child(4) { right: 8px; bottom: 72px; }
.water-jet i:nth-child(5) { left: 3px; bottom: 91px; width: 5px; height: 5px; }

/* ---- Fish Animation ---- */
@keyframes yu-r {
  0%   { transform: translateX(0) scaleX(1); }
  100% { transform: translateX(calc(100vw + 180px)) scaleX(1); }
}
@-webkit-keyframes yu-r {
  0%   { -webkit-transform: translateX(0) scaleX(1); }
  100% { -webkit-transform: translateX(calc(100vw + 180px)) scaleX(1); }
}
@keyframes yu-l {
  0%   { transform: translateX(0) scaleX(-1); }
  100% { transform: translateX(calc(-100vw - 180px)) scaleX(-1); }
}
@-webkit-keyframes yu-l {
  0%   { -webkit-transform: translateX(0) scaleX(-1); }
  100% { -webkit-transform: translateX(calc(-100vw - 180px)) scaleX(-1); }
}

.back-box .yu {
  position: absolute;
  height: auto;
  left: -130px;
  opacity: 0.68;
  animation-duration: 7s;
  animation-timing-function: linear;
  -webkit-animation-duration: 7s;
  -webkit-animation-timing-function: linear;
}
.back-box .fish-turquoise {
  width: 74px;
  animation-duration: 8.4s;
  -webkit-animation-duration: 8.4s;
}
.back-box .fish-coral {
  width: 92px;
  opacity: 0.78;
  animation-duration: 6.8s;
  -webkit-animation-duration: 6.8s;
}
.back-box .fish-pearl {
  width: 58px;
  opacity: 0.52;
  animation-duration: 10.2s;
  -webkit-animation-duration: 10.2s;
  filter: blur(0.15px);
}

.game-hud {
  position: absolute;
  z-index: 5;
  top: 14px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 28px);
  padding: 8px 12px;
  transform: translateX(-50%);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  background: rgba(2, 34, 51, 0.58);
  color: #e8fffd;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}
.game-hud__dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #6ff4e9;
  box-shadow: 0 0 10px rgba(111,244,233,0.8);
}
.back-box .yu.yu-movetoright {
  animation-name: yu-r;
  -webkit-animation-name: yu-r;
}
.back-box .yu.yu-movetoleft {
  animation-name: yu-l;
  -webkit-animation-name: yu-l;
}

/* ---- First-time Info Tip ---- */
.first-info {
  position: absolute;
  box-sizing: border-box;
  opacity: 0;
  transform: translateY(10px);
  padding: 16px 20px;
  z-index: 12;
  top: 16px;
  left: 16px;
  right: 16px;
  border-radius: 0.75rem;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line-strong, rgba(8, 17, 26, 0.1));
  color: var(--ink, #08111a);
  box-shadow: 0 8px 32px rgba(8, 17, 26, 0.08);
  transition: all 400ms ease;
}
.first-info.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Success Overlay ---- */
.success {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  opacity: 0;
  pointer-events: none;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 12;
  background: rgba(1, 28, 43, 0.58);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 1rem;
  transition: opacity 400ms ease;
}
.success.show {
  opacity: 1;
  pointer-events: auto;
}
.success .info {
  position: relative;
  z-index: 2;
  padding: 28px 32px;
  background: rgba(255, 252, 241, 0.94);
  border-radius: 1rem;
  border: 1px solid var(--line-strong, rgba(8, 17, 26, 0.1));
  box-shadow: 0 24px 70px rgba(18, 37, 63, 0.12);
  text-align: center;
  transform: scale(0.9, 0.9);
  transition: transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.success.show .info {
  transform: scale(1, 1);
}
.success .info .title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink, #08111a);
  margin-bottom: 4px;
}
.success .info div {
  font-size: 14px;
  color: var(--muted, #667085);
  line-height: 1.5;
}
.success .success-back {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
}
.success .new-game {
  position: relative;
  z-index: 2;
  padding: 10px 28px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #ff8d83, #e65d80);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 180ms ease;
  box-shadow: 0 6px 22px rgba(7, 88, 255, 0.28);
  opacity: 0;
  transform: translateY(8px);
}
.success.show .new-game {
  opacity: 1;
  transform: translateY(0);
  transition: all 400ms cubic-bezier(0.34, 1.56, 0.64, 1) 100ms;
}
.success .new-game:hover {
  box-shadow: 0 10px 32px rgba(7, 88, 255, 0.38);
  transform: translateY(-2px);
}
.success .new-game:active {
  box-shadow: 0 2px 10px rgba(7, 88, 255, 0.2);
  transform: translateY(0);
}

/* ---- Love (Heart) Animation ---- */
@keyframes love-move {
  0%   { opacity: 0; transform: translateY(0); }
  10%  { opacity: 1; transform: translateY(-5px); }
  90%  { opacity: 1; transform: translateY(-45px); }
  100% { opacity: 0; transform: translateY(-50px); }
}
@-webkit-keyframes love-move {
  0%   { opacity: 0; -webkit-transform: translateY(0); }
  10%  { opacity: 1; -webkit-transform: translateY(-5px); }
  90%  { opacity: 1; -webkit-transform: translateY(-45px); }
  100% { opacity: 0; -webkit-transform: translateY(-50px); }
}

.success .love-icon {
  position: absolute;
  z-index: 3;
  color: #ff6c91;
  font-size: 28px;
  line-height: 1;
  opacity: 0;
  filter: drop-shadow(0 0 6px rgba(255, 80, 120, 0.5));
}

@media (max-width: 520px) {
  .control-box {
    padding: 14px 8px max(14px, env(safe-area-inset-bottom));
  }
  .control-box .btn {
    width: 68px;
    height: 68px;
    font-size: 13px;
  }
  .control-box .btn2 {
    padding: 6px 10px;
    font-size: 11px;
  }
}
.success .love-icon.love-move {
  animation-name: love-move;
  animation-duration: 1.2s;
  animation-timing-function: linear;
  -webkit-animation-name: love-move;
  -webkit-animation-duration: 1.2s;
  -webkit-animation-timing-function: linear;
}
