:root {
  color-scheme: dark;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --ink: #251412;
  --paper: #fff7df;
  --red: #c52d22;
  --gold: #e7b94d;
  --night: #151018;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  overflow: auto;
  color: var(--paper);
  background:
    radial-gradient(circle at 18% 12%, rgba(223, 60, 39, 0.28), transparent 22rem),
    radial-gradient(circle at 88% 18%, rgba(231, 185, 77, 0.22), transparent 20rem),
    linear-gradient(130deg, #150c14 0%, #251015 42%, #0b1821 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(90deg, rgba(255, 244, 202, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(255, 244, 202, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(230px, 290px) minmax(0, 1fr);
  gap: 14px;
  width: min(1520px, calc(100vw - 24px));
  height: min(860px, calc(100svh - 24px));
  min-height: 620px;
  padding: 0;
}

.festival-side {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 16px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 247, 223, 0.06) 50%, transparent 50%) 0 0 / 28px 100%,
    linear-gradient(180deg, rgba(196, 45, 34, 0.94), rgba(91, 21, 24, 0.94));
  border: 1px solid rgba(255, 247, 223, 0.24);
  border-radius: 8px;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.34);
}

.lantern-row {
  display: flex;
  justify-content: space-between;
  min-height: 46px;
  padding-top: 4px;
}

.lantern-row span {
  width: 30px;
  height: 42px;
  background:
    linear-gradient(90deg, transparent 20%, rgba(93, 23, 17, 0.35) 21% 24%, transparent 25% 75%, rgba(93, 23, 17, 0.35) 76% 79%, transparent 80%),
    radial-gradient(ellipse at center, #fff6ba 0 30%, #f2c75e 58%, #b73125 100%);
  border-radius: 50% / 42%;
  box-shadow: 0 0 28px rgba(255, 184, 63, 0.48);
}

.title-block p {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.18em;
}

.title-block h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.05;
  text-wrap: balance;
  text-shadow: 0 3px 0 rgba(56, 13, 10, 0.5);
}

.score-board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.score-board div,
.fish-list,
button,
.message {
  border: 1px solid rgba(255, 247, 223, 0.24);
  border-radius: 8px;
  background: rgba(35, 16, 18, 0.5);
  backdrop-filter: blur(10px);
}

.score-board div {
  min-width: 0;
  padding: 8px 6px;
  text-align: center;
}

.score-board span,
.fish-list span {
  display: block;
  font-size: 12px;
  opacity: 0.8;
}

.score-board strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1;
}

#time.is-warning {
  color: #fff1a2;
  text-shadow:
    0 0 12px rgba(255, 229, 100, 0.9),
    0 0 24px rgba(255, 63, 38, 0.8);
  animation: timer-warning 0.62s ease-in-out infinite alternate;
}

@keyframes timer-warning {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.18);
  }
}

.fish-list {
  display: grid;
  gap: 6px;
  padding: 9px;
}

.fish-list div {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 6px;
}

.fish-list i {
  width: 18px;
  height: 12px;
  border-radius: 60% 45% 45% 60%;
  box-shadow: inset -5px 0 rgba(255, 255, 255, 0.22);
}

.fish-list .gold {
  background: linear-gradient(90deg, #fff2a8, #d99a18);
}

.fish-list .black {
  background: linear-gradient(90deg, #5d6874, #070707);
}

.fish-list .red {
  background: linear-gradient(90deg, #ff9b62, #c51614);
}

button {
  width: 100%;
  min-height: 46px;
  margin-top: auto;
  color: #33120e;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 46%),
    linear-gradient(90deg, #ffe38b, #e7b94d);
  box-shadow: 0 10px 24px rgba(32, 13, 9, 0.28);
}

button:active {
  transform: translateY(1px);
}

.control-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin-top: auto;
}

#musicButton {
  min-height: 38px;
  color: #fff7df;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 54%),
    linear-gradient(90deg, rgba(35, 16, 18, 0.75), rgba(87, 33, 24, 0.78));
  box-shadow: 0 7px 18px rgba(32, 13, 9, 0.22);
}

.pond-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1.58;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(93, 40, 18, 0.98), rgba(45, 18, 10, 0.98)) padding-box,
    repeating-linear-gradient(
      90deg,
      #e43328 0 34px,
      #fff4d2 34px 68px,
      #d92322 68px 102px,
      #ffe8a6 102px 136px
    ) border-box;
  border: 14px solid transparent;
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 5px rgba(255, 222, 139, 0.28),
    inset 0 0 0 13px rgba(72, 29, 12, 0.72),
    0 28px 84px rgba(0, 0, 0, 0.42);
}

.pond-wrap::before,
.pond-wrap::after {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  content: "";
}

.pond-wrap::before {
  inset: 6px;
  border: 6px solid rgba(121, 55, 19, 0.82);
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 232, 151, 0.38),
    inset 0 0 24px rgba(61, 24, 9, 0.46);
}

.pond-wrap::after {
  top: 16px;
  left: 18px;
  right: 18px;
  height: 28px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 7% 50%, #ffdd67 0 9px, #b61f19 10px 15px, transparent 16px),
    radial-gradient(circle at 25% 50%, #ffdd67 0 9px, #b61f19 10px 15px, transparent 16px),
    radial-gradient(circle at 43% 50%, #ffdd67 0 9px, #b61f19 10px 15px, transparent 16px),
    radial-gradient(circle at 61% 50%, #ffdd67 0 9px, #b61f19 10px 15px, transparent 16px),
    radial-gradient(circle at 79% 50%, #ffdd67 0 9px, #b61f19 10px 15px, transparent 16px),
    radial-gradient(circle at 96% 50%, #ffdd67 0 9px, #b61f19 10px 15px, transparent 16px),
    linear-gradient(90deg, rgba(80, 23, 13, 0), rgba(80, 23, 13, 0.64), rgba(80, 23, 13, 0));
  filter: drop-shadow(0 3px 3px rgba(34, 12, 8, 0.34));
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: none;
  touch-action: none;
  background: #43c8d3;
}

.gold-cutin {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-10%);
}

.gold-cutin::before {
  position: absolute;
  inset: -20%;
  content: "";
  background:
    radial-gradient(circle at 30% 50%, rgba(255, 255, 220, 0.9), transparent 18%),
    linear-gradient(105deg, transparent 0 18%, rgba(255, 228, 103, 0.9) 19% 24%, transparent 25% 34%, rgba(255, 75, 33, 0.72) 35% 42%, transparent 43% 100%),
    linear-gradient(90deg, rgba(20, 5, 4, 0.16), rgba(91, 11, 3, 0.82), rgba(255, 174, 34, 0.56), rgba(13, 6, 7, 0.2));
}

.gold-cutin::after {
  position: absolute;
  inset: 10% -10%;
  content: "";
  border-top: 2px solid rgba(255, 255, 225, 0.7);
  border-bottom: 2px solid rgba(255, 255, 225, 0.58);
  transform: skewY(-7deg);
}

.gold-cutin img {
  position: relative;
  z-index: 2;
  width: min(78%, 900px);
  filter:
    drop-shadow(0 0 14px rgba(255, 255, 195, 0.9))
    drop-shadow(0 22px 30px rgba(70, 18, 0, 0.7));
  transform: translateX(14%) scale(0.82) rotate(-2deg);
}

.cutin-streaks {
  position: absolute;
  inset: -20%;
  z-index: 1;
  background:
    repeating-linear-gradient(
      107deg,
      transparent 0 28px,
      rgba(255, 255, 255, 0.55) 29px 31px,
      transparent 32px 58px
    );
  opacity: 0;
}

.cutin-copy {
  position: absolute;
  left: min(8vw, 90px);
  top: 17%;
  z-index: 3;
  display: grid;
  gap: 6px;
  color: #fff8be;
  text-shadow:
    0 4px 0 rgba(120, 23, 6, 0.85),
    0 0 28px rgba(255, 232, 70, 0.86);
  transform: rotate(-6deg);
}

.cutin-copy span {
  width: max-content;
  padding: 4px 10px;
  color: #401306;
  font-weight: 900;
  background: linear-gradient(90deg, #fff6b2, #eab83d);
  border: 1px solid rgba(255, 255, 255, 0.75);
}

.cutin-copy strong {
  font-size: clamp(40px, 9vw, 112px);
  line-height: 0.9;
}

.gold-cutin.is-active {
  animation: cutin-panel 1.65s ease both;
}

.gold-cutin.is-active img {
  animation: cutin-fish 1.65s cubic-bezier(0.12, 0.75, 0.17, 1) both;
}

.gold-cutin.is-active .cutin-streaks {
  animation: cutin-streaks 1.65s ease both;
}

.gold-cutin.is-active .cutin-copy {
  animation: cutin-copy 1.65s ease both;
}

@keyframes cutin-panel {
  0% {
    opacity: 0;
    transform: translateX(-105%) skewX(-12deg);
  }
  16%,
  72% {
    opacity: 1;
    transform: translateX(0) skewX(0);
  }
  100% {
    opacity: 0;
    transform: translateX(105%) skewX(-10deg);
  }
}

@keyframes cutin-fish {
  0% {
    transform: translateX(95%) scale(0.62) rotate(-7deg);
  }
  22%,
  70% {
    transform: translateX(14%) scale(0.9) rotate(-2deg);
  }
  100% {
    transform: translateX(-48%) scale(0.88) rotate(-4deg);
  }
}

@keyframes cutin-streaks {
  0% {
    opacity: 0;
    transform: translateX(-18%);
  }
  18%,
  76% {
    opacity: 0.72;
    transform: translateX(8%);
  }
  100% {
    opacity: 0;
    transform: translateX(28%);
  }
}

@keyframes cutin-copy {
  0%,
  12% {
    opacity: 0;
    transform: translateX(-34px) rotate(-6deg) scale(0.9);
  }
  24%,
  70% {
    opacity: 1;
    transform: translateX(0) rotate(-6deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(36px) rotate(-6deg) scale(1.04);
  }
}

.bread-cutin {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}

.bread-cutin::before {
  position: absolute;
  inset: -10%;
  content: "";
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 244, 177, 0.92), transparent 18%),
    repeating-conic-gradient(from 0.04turn, rgba(255, 238, 123, 0.9) 0 4deg, rgba(220, 65, 24, 0.78) 4deg 8deg, rgba(255, 255, 255, 0.12) 8deg 12deg),
    linear-gradient(110deg, rgba(64, 18, 12, 0.92), rgba(203, 55, 32, 0.84), rgba(255, 203, 80, 0.74), rgba(62, 28, 12, 0.86));
  transform: skewY(-4deg) scale(1.08);
}

.bread-badge {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: min(42vw, 300px);
  aspect-ratio: 1;
  border: 8px solid rgba(255, 245, 195, 0.96);
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.9), transparent 14%),
    linear-gradient(145deg, #fff3b8, #d9953a 54%, #8e4217);
  box-shadow:
    0 0 0 14px rgba(181, 42, 25, 0.5),
    0 0 42px rgba(255, 238, 122, 0.86),
    0 26px 52px rgba(33, 13, 4, 0.64);
  transform: translateX(28%) rotate(9deg);
}

.bread-badge::before,
.bread-badge::after,
.bread-badge i {
  position: absolute;
  content: "";
}

.bread-badge::before {
  width: 68%;
  height: 56%;
  border-radius: 46% 46% 34% 34%;
  background:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.68), transparent 15%),
    linear-gradient(160deg, #fff3bd, #d88933 56%, #98501b);
  box-shadow:
    inset 0 -10px 0 rgba(124, 55, 18, 0.22),
    0 8px 18px rgba(74, 30, 9, 0.26);
}

.bread-badge::after {
  width: 58%;
  height: 34%;
  transform: translateY(26%);
  border-radius: 10px 10px 22px 22px;
  background: linear-gradient(180deg, #fbdc91, #a9571f);
}

.bread-badge i {
  z-index: 2;
  width: 42%;
  height: 8%;
  transform: translateY(-10%) rotate(-12deg);
  border-top: 4px solid rgba(125, 60, 20, 0.36);
  border-bottom: 4px solid rgba(255, 246, 202, 0.3);
  border-radius: 999px;
}

.bread-glow {
  position: absolute;
  inset: -18%;
  z-index: 1;
  background:
    repeating-linear-gradient(95deg, transparent 0 22px, rgba(255, 255, 255, 0.38) 23px 25px, transparent 26px 46px);
  opacity: 0;
}

.bread-copy {
  position: absolute;
  left: 6%;
  bottom: 13%;
  z-index: 3;
  color: #fff3c4;
  text-shadow:
    0 4px 0 rgba(84, 39, 13, 0.92),
    0 0 24px rgba(255, 206, 94, 0.72);
  transform: rotate(-5deg);
}

.bread-copy span {
  display: inline-block;
  padding: 4px 10px;
  color: #4a210c;
  font-weight: 900;
  background: linear-gradient(90deg, #fff0ad, #e0a94d);
  border: 1px solid rgba(255, 255, 255, 0.75);
}

.bread-copy strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(46px, 9vw, 112px);
  line-height: 0.92;
}

.bread-copy b {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 14px;
  color: #5d190e;
  font-size: clamp(22px, 4vw, 46px);
  line-height: 1;
  background: linear-gradient(90deg, #fff8be, #ffbf3d);
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  box-shadow: 0 7px 0 rgba(118, 41, 12, 0.52);
}

.bread-cutin.is-active {
  animation: bread-panel 1.65s ease both;
}

.bread-cutin.is-active .bread-badge {
  animation: bread-badge-pop 1.65s cubic-bezier(0.1, 0.82, 0.2, 1) both;
}

.bread-cutin.is-active .bread-glow {
  animation: cutin-streaks 1.65s ease both;
}

@keyframes bread-panel {
  0% {
    opacity: 0;
    transform: translateY(100%) skewY(8deg);
  }
  18%,
  74% {
    opacity: 1;
    transform: translateY(0) skewY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-100%) skewY(8deg);
  }
}

@keyframes bread-badge-pop {
  0% {
    opacity: 0;
    transform: translateX(90%) scale(0.46) rotate(28deg);
  }
  24%,
  72% {
    opacity: 1;
    transform: translateX(28%) scale(1.08) rotate(9deg);
  }
  100% {
    opacity: 0;
    transform: translateX(-34%) scale(0.94) rotate(-10deg);
  }
}

.countdown {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  color: #fff7df;
  font-size: clamp(72px, 18vw, 190px);
  font-weight: 900;
  text-shadow:
    0 6px 0 rgba(69, 21, 12, 0.7),
    0 0 36px rgba(255, 228, 108, 0.75);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.86);
}

.countdown.is-active {
  opacity: 1;
  animation: countdown-pop 0.82s ease both;
}

@keyframes countdown-pop {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  22%,
  74% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

.clear-overlay {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 20px;
  color: #fff7df;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 242, 157, 0.36), transparent 28%),
    linear-gradient(135deg, rgba(67, 12, 15, 0.78), rgba(12, 74, 92, 0.76));
  transition: opacity 220ms ease;
}

.clear-overlay.is-visible {
  pointer-events: auto;
  opacity: 1;
}

.clear-overlay div {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(560px, 100%);
  max-height: calc(100% - 24px);
  padding: 18px;
  text-align: center;
  background: rgba(35, 16, 18, 0.72);
  border: 1px solid rgba(255, 247, 223, 0.34);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
}

.clear-overlay span {
  color: #ffe38b;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.clear-overlay strong {
  font-size: clamp(36px, 7vw, 72px);
  line-height: 0.98;
  text-shadow:
    0 5px 0 rgba(103, 27, 13, 0.7),
    0 0 28px rgba(255, 227, 139, 0.7);
}

.clear-photo {
  position: relative;
  display: grid;
  place-items: center;
  width: min(340px, 86%);
  margin: 0;
}

.clear-photo img {
  display: block;
  width: 100%;
  max-height: min(44vh, 420px);
  object-fit: cover;
  object-position: center 22%;
  border: 5px solid rgba(255, 238, 171, 0.92);
  border-radius: 8px;
  box-shadow:
    0 0 0 2px rgba(137, 41, 18, 0.72),
    0 18px 38px rgba(0, 0, 0, 0.42);
}

.clear-overlay p {
  margin: 0;
  color: #fff0a2;
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 900;
  line-height: 1.7;
  text-shadow: 0 3px 0 rgba(103, 27, 13, 0.72);
}

.clear-overlay a {
  position: absolute;
  left: 50%;
  top: 50%;
  display: inline-grid;
  place-items: center;
  width: min(82%, 260px);
  min-height: 54px;
  padding: 0 18px;
  color: #33120e;
  font-weight: 900;
  text-decoration: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent 44%),
    linear-gradient(90deg, #fff0a2, #e7b94d);
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 8px;
  box-shadow:
    0 0 0 4px rgba(127, 34, 16, 0.42),
    0 12px 26px rgba(42, 13, 4, 0.45);
  transform: translate(-50%, -50%);
}

.message {
  position: absolute;
  left: 50%;
  bottom: 22px;
  display: grid;
  gap: 6px;
  width: min(560px, calc(100% - 34px));
  padding: 14px 16px;
  color: var(--paper);
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.message.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.message strong {
  font-size: 16px;
}

.message span {
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.86;
}

@media (max-width: 860px) {
  body {
    overflow: auto;
    align-items: start;
  }

  .game-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(100vw - 12px, 720px);
    height: calc(100svh - 12px);
    min-height: 0;
    padding: 6px 0;
    gap: 6px;
  }

  .festival-side {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 6px;
    padding: 8px;
  }

  .lantern-row {
    display: none;
  }

  .title-block {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
  }

  .title-block p {
    display: none;
  }

  .title-block h1 {
    overflow: hidden;
    font-size: clamp(18px, 5.4vw, 26px);
    line-height: 1;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: left;
  }

  .score-board {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }

  .score-board div {
    padding: 5px 4px;
  }

  .score-board span {
    font-size: 10px;
  }

  .score-board strong {
    font-size: clamp(15px, 4.6vw, 20px);
  }

  .fish-list {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 5px;
  }

  .fish-list div {
    grid-template-columns: 14px 1fr auto;
    gap: 4px;
  }

  .fish-list i {
    width: 14px;
    height: 9px;
  }

  .fish-list span {
    font-size: 10px;
  }

  .fish-list b {
    grid-column: auto;
    font-size: 10px;
  }

  button {
    width: auto;
    min-width: 96px;
    min-height: 38px;
    margin-top: 0;
    padding: 0 10px;
  }

  .control-row {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 96px;
    gap: 6px;
    margin-top: 0;
  }

  #musicButton {
    min-width: 86px;
  }

  .pond-wrap {
    width: 100%;
    height: 100%;
    min-height: min(62svh, 520px);
    aspect-ratio: 1.18;
    border-width: 6px;
  }

  .gold-cutin img {
    width: 112%;
  }

  .cutin-copy {
    left: 18px;
    top: 12%;
  }

  .bread-badge {
    width: min(62vw, 250px);
    transform: translateX(12%) rotate(9deg);
  }

  .bread-copy {
    left: 18px;
    bottom: 12%;
  }

  .clear-overlay {
    padding: 14px;
  }

  .clear-overlay div {
    gap: 10px;
    padding: 18px;
  }

  .clear-overlay a {
    width: min(84%, 250px);
  }
}
