:root {
  color-scheme: dark;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  --ink: #fffdf7;
  --navy: #160c34;
  --aqua: #53ead7;
  --blue: #5ea9ff;
  --pink: #ff668f;
  --yellow: #ffe16a;
  --violet: #9d75ff;
}

/* A single, quiet entry screen. All motion here finishes; idle costs no frames. */
#game-shell { container-type: inline-size; }
.screen-overlay.home-screen {
  display: block;
  padding: 0;
  color: #28565c;
  background: linear-gradient(170deg, #fffdf6f5, #f8fffb80), var(--game-background);
  backdrop-filter: none;
  transition: opacity 160ms ease, visibility 160ms ease;
}
.home-heading { position: absolute; top: 10%; left: 6%; right: 6%; text-align: center; }
.home-heading h1 { margin: 0; line-height: 0; }
.home-heading img { display: block; width: 100%; height: auto; }
.home-heading p { margin: 8px 0 0; font-size: clamp(18px, 5.5cqw, 24px); font-weight: 750; letter-spacing: .12em; }
.home-friends { position: absolute; top: 31%; left: 3%; width: 94%; height: 32%; object-fit: contain; pointer-events: none; }
.home-actions { position: absolute; top: 65%; left: 12%; right: 12%; }
.home-start {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  width: 100%; min-height: clamp(52px, 15.5cqw, 66px); padding: 12px 26px;
  border: 1px solid #224e56; border-radius: 999px;
  background: #28565c; color: #fffefa; box-shadow: 0 6px 0 #b9d9cf;
  font-size: clamp(17px, 5cqw, 21px); font-weight: 800; letter-spacing: .08em;
  cursor: pointer; transition: transform 120ms ease, box-shadow 120ms ease;
}
.home-start svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.home-start:active { transform: translateY(3px); box-shadow: 0 3px 0 #b9d9cf; }
.home-tools { display: flex; justify-content: space-evenly; gap: 8px; margin-top: 20px; }
.home-tools button {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; min-height: 44px; border: 0; padding: 4px;
  background: transparent; color: #496f72; font-size: 10px; font-weight: 700; cursor: pointer;
}
.home-tools svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.home-tools circle { fill: #f0f9f1; }
.home-tools button.is-off { color: #899d9b; }
.home-tools button.is-off span { text-decoration: line-through; }
.home-screen button:focus-visible, .records-dialog button:focus-visible { outline-color: #28565c; }
.home-screen.is-entering .home-heading, .home-screen.is-entering .home-friends { animation: home-appear 220ms ease-out both; }
@keyframes home-appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
#game-shell.is-title-screen .performance-meter,
body[data-loading-state="loading"] .performance-meter,
body[data-loading-state="loading"] .top-controls,
body[data-loading-state="loading"] .hud,
body[data-loading-state="loading"] .chain-hud { visibility: hidden; }
.home-screen .home-install { position: absolute; left: 7%; bottom: 3%; width: 86%; }
.home-install .pwa-install-prompt {
  display: flex; justify-content: center; gap: 12px; min-height: 40px; padding: 0 26px 0 5px;
  border: 0; background: none; box-shadow: none; animation: none;
}
.home-install .pwa-install-prompt > img,
.home-install .pwa-install-copy > span,
.home-install .pwa-install-copy p { display: none; }
.home-install .pwa-install-copy strong { color: #597779; font-size: 10px; font-weight: 500; }
.home-install .pwa-install-action { min-height: 40px; min-width: 44px; padding: 0; background: none; border: 0; box-shadow: none; color: #28565c; text-decoration: underline; text-underline-offset: 3px; font-size: 10px; }
.home-install .pwa-install-close { top: 4px; right: -3px; color: #648383; }
.records-dialog h2 { margin: 0 0 18px; font-size: 23px; }
.ranking-heading > span { font-size: 9px; font-weight: 800; letter-spacing: .2em; color: #528681; }
.ranking-heading h2 { margin-top: 6px; }
.ranking-tabs, .ranking-periods { display: flex; gap: 5px; margin: 10px 0; }
.ranking-tabs button, .ranking-periods button, .ranking-tools button, .result-online button, #profile-cancel, #move-now { min-height: 42px; border: 0; border-radius: 12px; padding: 8px 12px; background: #e2efec; color: #335f60; font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.ranking-tabs button, .ranking-periods button { flex: 1; }
.ranking-tabs button[aria-pressed="true"], .ranking-periods button[aria-pressed="true"] { background: #2c6466; color: #fff; }
.ranking-list { padding: 0; margin: 10px 0; list-style: none; }
.ranking-row { display: grid; grid-template-columns: 26px minmax(0,1fr) auto 34px; gap: 6px; align-items: center; padding: 10px 5px; min-height: 39px; border-bottom: 1px solid #dfebe8; font-size: 12px; }
.ranking-row.is-me { background: #dff5ea; border-radius: 8px; }
.ranking-rank { color: #759290; font-size: 11px; }
.ranking-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-points { color: #234f53; font-weight: 800; font-variant-numeric: tabular-nums; }
.ranking-chain { font-size: 10px; text-align: right; color: #678c87; }
#ranking-status, #ranking-own { font-size: 11px; line-height: 1.5; margin: 10px 0; }
.ranking-tools { display: flex; justify-content: space-between; margin: 12px 0; }
.ranking-footer { font-size: 9px; }
.ranking-footer a { color: inherit; }
#legacy-records { margin: 12px 0; font-size: 11px; }
.profile-dialog h2 { font-size: 23px; }
.profile-dialog p, .profile-dialog label { font-size: 12px; line-height: 1.7; }
#profile-name { width: 100%; padding: 12px; margin: 8px 0; border: 1px solid #a7ccd5; border-radius: 12px; background: white; color: #234d60; font-size: 16px; }
#profile-error { color: #a63c57; min-height: 1em; }
#profile-cancel { width: 100%; margin-top: 8px; }
.result-online { margin: 8px 0; text-align: center; }
.result-online p { font-size: 11px; margin: 5px 0; }
.result-online button { min-height: 36px; margin: 0 3px; padding: 6px 12px; font-size: 10px; }
.public-document { overflow: auto; min-height: 100vh; height: auto; background: #e6f5f2; color: #234d60; touch-action: auto; }
.public-document main { max-width: 660px; margin: 48px auto; padding: 24px; font: 15px/1.9 system-ui; }
.public-document h1 { font-size: 26px; }
.public-document h2 { font-size: 19px; margin-top: 30px; }
.records-list { list-style: none; padding: 0; margin: 0 0 20px; }
.records-list li { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 4px; border-bottom: 1px solid #dbe8e5; }
.records-list li span { font-size: 12px; color: #839b99; font-variant-numeric: tabular-nums; }
.records-list li strong { color: #28565c; font-size: 26px; font-variant-numeric: tabular-nums; }
.records-dialog > p { margin: 0 0 22px; color: #657d7c; font-size: 10px; line-height: 1.7; }

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #e8f3f5;
  color: var(--ink);
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

#game-shell {
  position: relative;
  width: min(100vw, calc(100dvh * 9 / 15));
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: 9 / 15;
  margin: 0;
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
  --game-background: linear-gradient(180deg in srgb, #d4f6fa, #b8e8f2);
  background: var(--game-background);
  box-shadow: 0 0 70px rgba(41, 98, 119, 0.18);
  touch-action: none;
  user-select: none;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  visibility: hidden;
  pointer-events: none;
  touch-action: none;
}

.p7-full-webgpu-canvas {
  position: absolute !important;
  inset: 0 !important;
  z-index: 1 !important;
  width: 100% !important;
  height: 100% !important;
  display: block;
  pointer-events: none;
  touch-action: none;
  will-change: transform;
}

.performance-meter {
  position: absolute;
  z-index: 40;
  top: 5px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 18px;
  padding: 3px 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(9, 5, 29, 0.68);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 4px 14px rgba(0, 0, 0, 0.2);
  color: rgba(255, 255, 255, 0.62);
  font: 800 8px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.performance-meter strong {
  color: #fff;
  font-weight: 900;
}

.hud {
  position: absolute;
  z-index: 10;
  top: 29px;
  left: 11px;
  right: 11px;
  display: grid;
  grid-template-columns: 1fr 84px 1fr;
  gap: 9px;
  align-items: start;
  pointer-events: none;
}

.hud-card {
  color: #245064;
  min-width: 0;
  height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7px 13px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 19px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.72));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.17), 0 8px 24px rgba(4, 1, 24, 0.3);
  backdrop-filter: blur(12px);
}

.hud-label {
  font-size: 8px;
  line-height: 1;
  letter-spacing: 0.17em;
  opacity: 0.64;
  font-weight: 900;
}

.hud-card > strong {
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: clamp(19px, 5vw, 26px);
  line-height: 0.98;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
}

.hud-card > small {
  margin-top: 4px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.56);
}

.hud-card > small b {
  color: #fff;
}

.life-card {
  align-items: flex-end;
}

#life {
  white-space: nowrap;
  color: #ff779b;
  font-size: clamp(14px, 4vw, 20px);
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px rgba(255, 80, 133, 0.5);
}

#life.is-danger {
  animation: life-pulse 0.5s ease-in-out infinite alternate;
}

.timer-card {
  position: relative;
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  margin-top: -2px;
  filter: drop-shadow(0 8px 15px rgba(4, 1, 24, 0.4));
}

.timer-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-track,
.timer-progress {
  fill: rgba(20, 10, 52, 0.78);
  stroke-width: 6;
}

.timer-track {
  stroke: rgba(255, 255, 255, 0.16);
}

.timer-progress {
  fill: none;
  stroke: var(--aqua);
  stroke-linecap: round;
  stroke-dasharray: 201.06;
  stroke-dashoffset: 0;
  transition: stroke 180ms ease;
}

.timer-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-copy span {
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: 28px;
  font-weight: 1000;
  line-height: 0.86;
}

.timer-copy small {
  margin-top: 6px;
  font-size: 7px;
  font-weight: 1000;
  letter-spacing: 0.18em;
  opacity: 0.56;
}

.timer-card.is-urgent {
  animation: timer-pulse 0.5s ease-in-out infinite alternate;
}

.timer-card.is-urgent .timer-progress {
  stroke: var(--pink);
}

.top-controls {
  position: absolute;
  z-index: 12;
  top: max(111px, calc(env(safe-area-inset-top) + 103px));
  right: 12px;
  display: flex;
  gap: 7px;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 13px;
  background: rgba(22, 11, 55, 0.62);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.16), 0 5px 14px rgba(0, 0, 0, 0.18);
  color: white;
  font-size: 15px;
  font-weight: 1000;
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.icon-button:active {
  transform: scale(0.9);
}

.icon-button.is-off {
  opacity: 0.48;
}

.appearance-launch {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: min(100%, 330px);
  min-height: 44px;
  margin: 0 0 10px;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid #8ceee53b;
  border-radius: 13px;
  background: #f4fffbdc;
  color: #245064;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.appearance-launch small { color: #4f6d7c; font-size: 9px; }
.appearance-dialog {
  width: min(380px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 23px 19px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  color-scheme: light;
  color: #234d60;
  background: #f5fcfdfc;
  border: 1px solid #a7ccd5;
  border-radius: 24px;
  box-shadow: 0 22px 70px #0008;
}
.appearance-dialog::backdrop { background: #03071666; }
.appearance-heading > span { color: #247466; font: 800 8px/1.2 system-ui; letter-spacing: .2em; }
.appearance-heading h2 { margin: 7px 0 6px; font-size: 24px; letter-spacing: .03em; }
.appearance-heading p { margin: 0 0 22px; color: #4f6d7c; font-size: 10px; line-height: 1.6; }
.appearance-dialog fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.appearance-dialog legend { width: 100%; padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 800; }
.appearance-dialog legend small { float: right; font: 700 8px/1.7 system-ui; color: #577383; letter-spacing: .13em; }
.appearance-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.appearance-options button {
  min-width: 0;
  min-height: 83px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 9px 3px;
  border: 1px solid #bdd4dc;
  border-radius: 13px;
  background: #ffffff;
  color: #446578;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.appearance-options button[aria-pressed="true"] {
  color: #164b43;
  border-color: #29927d;
  background: #def6ed;
  box-shadow: inset 0 0 0 1px #29927d55;
}
.background-swatch { width: 44px; height: 30px; border: 1px solid #24506425; border-radius: 6px; }
.appearance-description { margin: 7px 0 0; color: #4f6d7c; font-size: 10px; min-height: 15px; }
.appearance-save-note { margin: 0 0 10px; text-align: center; font-size: 9px; color: #4f6d7c; }
.appearance-dialog button:focus-visible, .appearance-launch:focus-visible { outline-color: #205e70; }
#appearance-close { width: 100%; min-height: 44px; }
.jelly-swatch { display: inline-block; width: 35px; height: 32px; border-radius: 43% 44% 40% 45%; border: 1px solid rgba(187, 255, 246, 0.65); }
.clear-swatch { background: radial-gradient(ellipse at 28% 22%, white 0 8%, transparent 20%), linear-gradient(140deg, #44928e80, #174c6480 50%, #96f5cda0); box-shadow: inset 0 -2px 2px #69eccb77; }
.rich-swatch { background: radial-gradient(ellipse at 28% 22%, white 0 7%, transparent 22%), linear-gradient(150deg, #54cfae, #255262 62%, #8add95); box-shadow: inset 0 -3px 4px #65ffd866; }
.soft-swatch { border-color: #bde2d6; background: radial-gradient(ellipse at 30% 20%, #bae9df, #82c5b9 60%, #65a899); }
@media (max-width: 340px) {
  .appearance-dialog { padding: 18px 14px 14px; }
  .appearance-launch { padding-inline: 10px; }
  .appearance-launch small { font-size: 8px; }
}

.charge-hud {
  position: absolute;
  z-index: 10;
  left: 18px;
  right: 18px;
  bottom: max(14px, env(safe-area-inset-bottom));
  pointer-events: none;
}

.charge-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 0 5px 6px;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-weight: 1000;
}

#charge-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  color: #91fff1;
}

#power-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
}

.charge-track {
  height: 17px;
  padding: 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(13, 6, 39, 0.74);
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.3), 0 5px 15px rgba(2, 1, 16, 0.24);
}

.charge-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #45dfd0, #64b5ff 47%, #a978ff 72%, #ffdd64);
  box-shadow: 0 0 16px rgba(92, 229, 218, 0.6);
  transform-origin: left center;
  transition: width 80ms linear;
}

.is-powered .charge-fill {
  animation: rainbow-bar 0.72s linear infinite;
}

.is-powered #charge-label,
.is-powered #power-label {
  color: #fff28b;
  text-shadow: 0 0 12px rgba(255, 220, 70, 0.72);
}

#play-hint {
  margin: 8px 0 0;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #315b6b;
  background: #f6fcfce6;
  border-radius: 8px;
  padding: 4px 6px;
}

.impact-callout {
  position: absolute;
  z-index: 22;
  top: 23%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translate(-50%, 15px) scale(0.65) rotate(-4deg);
  pointer-events: none;
}

.impact-callout.is-visible {
  animation: impact-pop 0.95s cubic-bezier(0.16, 1.3, 0.3, 1) both;
}

.impact-callout strong {
  white-space: nowrap;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: clamp(31px, 9vw, 52px);
  line-height: 0.96;
  color: #fff;
  -webkit-text-stroke: 2px #5933ba;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #452591, 0 12px 26px rgba(11, 3, 52, 0.5);
}

.impact-callout span {
  margin-top: 8px;
  padding: 5px 13px;
  border-radius: 999px;
  background: #fff;
  color: #5833bd;
  font-size: 12px;
  font-weight: 1000;
}

.rush-banner {
  position: absolute;
  z-index: 24;
  top: 43%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4) rotate(-7deg);
  pointer-events: none;
}

.rush-banner.is-visible {
  animation: rush-pop 1.45s cubic-bezier(0.16, 1.22, 0.3, 1) both;
}

.rush-banner span,
.rush-banner small {
  padding: 4px 11px;
  border-radius: 999px;
  background: #fff;
  color: #ec3d76;
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: 0.14em;
}

.rush-banner strong {
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: clamp(65px, 20vw, 100px);
  font-weight: 1000;
  line-height: 0.88;
  color: #fff086;
  -webkit-text-stroke: 4px #f24482;
  paint-order: stroke fill;
  text-shadow: 0 7px 0 #6336b5, 0 18px 40px rgba(249, 45, 116, 0.46);
}

.countdown {
  position: absolute;
  z-index: 25;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: clamp(105px, 34vw, 180px);
  font-weight: 1000;
  color: #fff;
  -webkit-text-stroke: 4px #5f3ac8;
  paint-order: stroke fill;
  text-shadow: 0 9px 0 #402288, 0 21px 50px rgba(9, 2, 43, 0.56);
  pointer-events: none;
}

.countdown.is-visible {
  animation: countdown-pop 0.72s cubic-bezier(0.16, 1.12, 0.3, 1) both;
}

.countdown.is-urgent {
  letter-spacing: -0.08em;
  color: #fff8a3;
  -webkit-text-stroke-color: #ff467f;
  text-shadow: 0 10px 0 #6f2eb0, 0 24px 58px rgba(255, 47, 114, 0.58);
}

.countdown.is-urgent.is-visible {
  animation: urgent-countdown-pop 0.99s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.countdown.is-time-up {
  white-space: nowrap;
  font-size: clamp(54px, 18vw, 96px);
  letter-spacing: -0.055em;
  color: #fff8a3;
  -webkit-text-stroke-color: #ff467f;
  text-shadow: 0 7px 0 #6f2eb0, 0 20px 50px rgba(255, 47, 114, 0.5);
}

.countdown.is-time-up.is-visible {
  animation: time-up-enter 0.38s cubic-bezier(0.16, 1.18, 0.3, 1) both;
}

.screen-overlay {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(18, 8, 47, 0.26), rgba(12, 5, 34, 0.78));
  backdrop-filter: blur(4px);
  transition: opacity 230ms ease, visibility 230ms ease;
}

.screen-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-screen {
  z-index: 60;
  gap: clamp(15px, 3vh, 22px);
  background: linear-gradient(170deg, #fffdf6f5, #f8fffb80), var(--game-background);
  color: #28565c;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.loading-screen p {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.loading-wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: clamp(24px, 8vw, 38px);
  font-weight: 1000;
  letter-spacing: 0.04em;
  color: #f7ffff;
  text-shadow: 0 6px 22px rgba(83, 234, 215, 0.34);
}

.loading-wordmark b {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: #351b73;
  background: linear-gradient(145deg, #fff38a, #ff91b8);
  box-shadow: 0 7px 20px rgba(255, 102, 143, 0.34);
}

.loading-bar {
  width: min(48%, 220px);
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #cdded5;
  box-shadow: none;
}

.loading-bar-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #4f9f93;
  box-shadow: none;
  transition: width 220ms ease;
}

.loading-percent {
  min-height: 1.2em;
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
  color: #718e87;
}

.loading-retry { min-height: 44px; padding: 10px 28px; border: 0; border-radius: 99px; color: white; background: #28565c; cursor: pointer; }
.loading-screen.is-hidden .loading-puni { animation: none; }

.loading-start {
  display: none;
  min-width: 190px;
  border: 0;
  border-radius: 999px;
  padding: 15px 30px;
  font-weight: 1000;
  font-size: 18px;
  letter-spacing: 0.06em;
  color: #23104f;
  background: linear-gradient(135deg, #87f6e5, #82a8ff 56%, #ff9fbd);
  box-shadow: 0 11px 30px rgba(83, 234, 215, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.62);
}

.loading-start:active:not(:disabled) {
  transform: translateY(2px) scale(0.98);
}

.loading-screen.is-ready .loading-bar,
.loading-screen.is-ready .loading-percent {
  display: none;
}

.loading-screen.is-ready .loading-start,
.loading-screen.is-error .loading-start {
  display: inline-block;
  animation: loading-start-pop 480ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.loading-screen.is-error .loading-puni {
  animation-play-state: paused;
  filter: grayscale(0.5);
}

.loading-puni {
  position: relative;
  width: 76px;
  height: 61px;
  border-radius: 50% 50% 46% 54%;
  background: linear-gradient(145deg, #d7fff2, #70cbbc);
  box-shadow: inset 11px 11px 17px rgba(255, 255, 255, 0.37), 0 12px 20px #82b4a433;
  animation: loading-squish 0.78s ease-in-out infinite alternate;
}

.loading-puni::after {
  content: "";
  position: absolute;
  top: 9px;
  left: 14px;
  width: 27px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.43);
  transform: rotate(-20deg);
}

.loading-puni i {
  position: absolute;
  z-index: 1;
  top: 28px;
  width: 6px;
  height: 9px;
  border-radius: 50%;
  background: #26164e;
}

.loading-puni i:first-child { left: 25px; }
.loading-puni i:last-child { right: 25px; }

.title-screen {
  justify-content: flex-start;
  padding: max(30px, calc(env(safe-area-inset-top) + 22px)) 20px max(18px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 20%, rgba(117, 239, 255, 0.15), transparent 35%),
    linear-gradient(180deg, rgba(4, 18, 63, 0.18), rgba(7, 8, 38, 0.76));
}

.title-logo {
  width: min(100%, 410px);
  text-align: center;
  filter: drop-shadow(0 12px 25px rgba(5, 1, 26, 0.35));
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.34em;
  color: #8effef;
}

.title-logo h1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  line-height: 0.82;
  transform: rotate(-2deg);
}

.title-logo h1 span {
  font-size: clamp(42px, 12.5vw, 70px);
  font-weight: 1000;
  letter-spacing: -0.08em;
  color: #fff;
  -webkit-text-stroke: 2px rgba(75, 45, 167, 0.76);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 #5034aa;
}

.title-logo h1 b {
  display: block;
  margin-top: 8px;
  padding: 7px 22px 10px;
  border-radius: 46% 54% 48% 52% / 55% 45% 55% 45%;
  background: linear-gradient(135deg, #ffdd5f, #ff6d82 52%, #a566f2);
  box-shadow: inset 0 3px rgba(255, 255, 255, 0.32), 0 7px 0 #7e376e;
  font-size: clamp(38px, 11vw, 62px);
  color: #fff;
  -webkit-text-stroke: 2px rgba(116, 47, 104, 0.65);
  paint-order: stroke fill;
}

.title-kana {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
  opacity: 0.76;
}

.rule-strip {
  width: min(100%, 430px);
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 7px;
  margin: 13px 0 14px;
  padding: 10px 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.11), 0 18px 48px rgba(4, 1, 25, 0.26);
  backdrop-filter: blur(12px);
}

.rule-strip > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.rule-strip > i {
  color: rgba(255, 255, 255, 0.35);
  font-size: 27px;
  font-style: normal;
  font-weight: 300;
}

.rule-strip p {
  margin: 0;
  text-align: center;
  font-size: 10px;
  line-height: 1.42;
  font-weight: 900;
}

.rule-puni {
  width: 49px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 48% 52% 45% 55%;
  box-shadow: inset 7px 8px 9px rgba(255, 255, 255, 0.35), 0 7px 12px rgba(4, 1, 25, 0.25);
  color: #fff;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: 21px;
  font-style: normal;
  font-weight: 1000;
}

.rule-puni.pull { background: linear-gradient(145deg, #73dfff, #5a63e7); }
.rule-puni.hit { background: linear-gradient(145deg, #ffe979, #ff8c58); }
.rule-puni.out {
  background: linear-gradient(145deg, #ff86a3, #d44cd4);
  animation: rule-pop 1.25s ease-in-out infinite alternate;
}

.primary-button {
  min-width: min(100%, 310px);
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  padding: 11px 28px;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(135deg, #53e4d6, #6578ef 51%, #ff668c);
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.38), 0 7px 0 #493282, 0 17px 31px rgba(5, 1, 34, 0.44);
  color: white;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.primary-button span,
.primary-button:not(:has(span)) {
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 1000;
  letter-spacing: 0.04em;
}

.primary-button small {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  opacity: 0.78;
}

.primary-button:hover {
  filter: brightness(1.07);
}

.primary-button:active {
  transform: translateY(5px) scale(0.98);
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.34), 0 2px 0 #493282, 0 8px 15px rgba(5, 1, 34, 0.36);
}

.primary-button.small {
  min-width: 220px;
  min-height: 54px;
  font-size: 18px;
}

.title-tip {
  max-width: 340px;
  margin: 13px 0 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.55;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.67);
}

.compact-overlay,
.result-screen {
  background: rgba(10, 4, 31, 0.72);
  backdrop-filter: blur(12px);
}

.dialog-card,
.result-card {
  width: min(100%, 410px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 35px 27px 29px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 34px;
  background: linear-gradient(155deg, rgba(62, 43, 124, 0.96), rgba(23, 12, 57, 0.97));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), 0 26px 70px rgba(3, 1, 19, 0.58);
}

.dialog-icon {
  width: 67px;
  height: 61px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 50%;
  background: linear-gradient(145deg, #72efdd, #7760e7);
  box-shadow: inset 8px 8px 10px rgba(255, 255, 255, 0.3), 0 8px 16px rgba(0, 0, 0, 0.22);
  font-size: 26px;
  font-weight: 1000;
}

.dialog-card h2,
.result-card h2 {
  margin: 0;
  font-size: 24px;
}

.dialog-card p {
  margin: 10px 0 28px;
  text-align: center;
  font-size: 12px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.7);
}

.text-button {
  margin-top: 21px;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.result-card {
  position: relative;
  padding-top: 45px;
}

.result-ribbon {
  position: absolute;
  top: -18px;
  padding: 9px 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffdf60, #ff668b);
  box-shadow: 0 6px 0 #853767, 0 14px 28px rgba(10, 2, 42, 0.38);
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: 0.1em;
}

.result-grade {
  width: 75px;
  height: 69px;
  display: grid;
  place-items: center;
  margin-bottom: 5px;
  border-radius: 48% 52% 44% 56%;
  background: linear-gradient(145deg, #fff483, #ff786e);
  box-shadow: inset 9px 9px 12px rgba(255, 255, 255, 0.38), 0 7px 0 #813b83;
  color: #fff;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: 44px;
  font-weight: 1000;
  text-shadow: 0 3px 0 rgba(103, 49, 118, 0.5);
  transform: rotate(-4deg);
}

#result-score {
  margin: 8px 0 3px;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: clamp(49px, 15vw, 74px);
  line-height: 1;
  letter-spacing: -0.03em;
  color: #fff5a4;
  text-shadow: 0 5px 0 #6442b8;
}

.result-local-record {
  margin: 7px 0 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.result-local-record strong {
  margin-left: 5px;
  color: #9cfff0;
  font-size: 13px;
}

.new-best {
  padding: 4px 11px;
  border-radius: 999px;
  background: #ff668a;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.12em;
  animation: new-best-pulse 0.65s ease-in-out infinite alternate;
}

.new-best.is-hidden {
  visibility: hidden;
}

.result-stats {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 22px 0 14px;
}

.result-stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 11px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.result-stats span {
  font-size: 8px;
  font-weight: 1000;
  letter-spacing: 0.11em;
  opacity: 0.58;
}

.result-stats strong {
  margin-top: 4px;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: 26px;
}

#result-comment {
  min-height: 18px;
  margin: 0 0 23px;
  font-size: 12px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.72);
}

#game-shell.is-shaking {
  animation: screen-shake 0.25s linear;
}

#game-shell.is-rush .p7-full-webgpu-canvas {
  filter: saturate(1.16) brightness(1.04);
}

@keyframes loading-squish {
  from { transform: translateY(-7px) scale(0.92, 1.08); }
  to { transform: translateY(7px) scale(1.09, 0.87); }
}

@keyframes timer-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.07); }
}

@keyframes life-pulse {
  from { transform: scale(0.96); filter: brightness(0.9); }
  to { transform: scale(1.08); filter: brightness(1.3); }
}

@keyframes rule-pop {
  from { transform: scale(0.93) rotate(-5deg); }
  to { transform: scale(1.08) rotate(5deg); }
}

@keyframes impact-pop {
  0% { opacity: 0; transform: translate(-50%, 18px) scale(0.55) rotate(-8deg); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1.2) rotate(3deg); }
  72% { opacity: 1; transform: translate(-50%, -5px) scale(1) rotate(-2deg); }
  100% { opacity: 0; transform: translate(-50%, -27px) scale(0.9) rotate(1deg); }
}

@keyframes rush-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.35) rotate(-11deg); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.14) rotate(4deg); }
  76% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
  100% { opacity: 0; transform: translate(-50%, -55%) scale(1.18) rotate(2deg); }
}

@keyframes countdown-pop {
  0% { opacity: 0; transform: scale(0.38) rotate(-8deg); }
  23% { opacity: 1; transform: scale(1.08) rotate(2deg); }
  74% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.27); }
}

@keyframes urgent-countdown-pop {
  0% { opacity: 0; transform: scale(0.42) rotate(-5deg); }
  15% { opacity: 1; transform: scale(1.1) rotate(2deg); }
  74% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.16); }
}

@keyframes time-up-enter {
  0% { opacity: 0; transform: scale(0.62) rotate(-4deg); }
  70% { opacity: 1; transform: scale(1.06) rotate(1deg); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes rainbow-bar {
  from { filter: hue-rotate(0deg) brightness(1.08); }
  to { filter: hue-rotate(360deg) brightness(1.08); }
}

@keyframes new-best-pulse {
  from { transform: scale(0.96) rotate(-1deg); }
  to { transform: scale(1.06) rotate(1deg); }
}

@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-5px, 3px) rotate(-0.4deg); }
  40% { transform: translate(5px, -2px) rotate(0.4deg); }
  60% { transform: translate(-3px, -1px); }
  80% { transform: translate(3px, 2px); }
}

@media (max-height: 690px) {
  .title-screen { padding-top: max(54px, calc(env(safe-area-inset-top) + 42px)); }
  .title-logo h1 span { font-size: clamp(38px, 11vw, 58px); }
  .title-logo h1 b { font-size: clamp(32px, 9vw, 49px); margin-top: 6px; }
  .title-kana { margin-top: 13px; }
  .rule-strip { margin: 20px 0 20px; padding: 10px 8px; }
  .rule-puni { width: 47px; height: 42px; font-size: 17px; }
  .title-tip { margin-top: 14px; }
  .hud { grid-template-columns: 1fr 72px 1fr; }
  .hud-card { height: 56px; }
  .timer-card { width: 70px; height: 70px; }
  .timer-copy span { font-size: 24px; }
  .top-controls { top: max(97px, calc(env(safe-area-inset-top) + 89px)); }
}

@media (max-width: 370px) {
  .hud { left: 8px; right: 8px; gap: 6px; grid-template-columns: 1fr 68px 1fr; }
  .hud-card { padding-inline: 9px; border-radius: 16px; }
  .timer-card { width: 68px; height: 68px; }
  .top-controls { right: 8px; }
  .charge-hud { left: 12px; right: 12px; }
}

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

/* PUNIKORO 6 — chain puzzle specific components */
.best-card { align-items: flex-end; }

.title-art {
  position: relative;
  width: 100%;
  min-height: 112px;
  display: grid !important;
  place-items: center;
  margin: 0;
  transform: none !important;
  line-height: 1;
}

.title-art img {
  width: min(100%, 390px);
  height: auto;
  display: block;
  filter: saturate(1.08) drop-shadow(0 10px 13px rgba(4, 17, 66, 0.42));
}

.title-art b {
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: clamp(58px, 16vw, 78px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border-radius: 46% 54% 52% 48%;
  background: linear-gradient(145deg, #fff46f 0%, #ff9a4c 45%, #ff5f92 100%);
  box-shadow: inset 8px 9px 12px rgba(255, 255, 255, 0.42), 0 6px 0 #9e396d, 0 13px 25px rgba(21, 12, 73, 0.42);
  color: #fff;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: clamp(43px, 12vw, 62px);
  font-weight: 1000;
  -webkit-text-stroke: 2px rgba(116, 47, 104, 0.52);
  paint-order: stroke fill;
  transform: translateX(-50%) rotate(-5deg);
}

.title-kana { margin-top: 4px; }

.local-score-card {
  width: min(100%, 390px);
  margin-top: 8px;
  padding: 8px 11px 9px;
  border: 1px solid rgba(192, 247, 255, 0.24);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(7, 37, 88, 0.67), rgba(35, 20, 85, 0.66));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.14), 0 8px 24px rgba(3, 10, 43, 0.22);
  backdrop-filter: blur(10px);
}

.local-score-card > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 3px 6px;
}

.local-score-card > div span {
  color: #9cfff0;
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: 0.16em;
}

.local-score-card > div small {
  color: rgba(255, 255, 255, 0.48);
  font-size: 8px;
  font-weight: 800;
}

.local-score-card ol {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.local-score-card li {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
}

.local-score-card li span {
  color: rgba(255, 255, 255, 0.5);
  font-size: 7px;
  font-weight: 1000;
  text-transform: uppercase;
}

.local-score-card li strong {
  overflow: hidden;
  color: #fff4a6;
  font: 1000 12px/1 ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  text-overflow: ellipsis;
}
.rule-puni.pink { background: linear-gradient(145deg, #ff91a9, #f34c79); }
.rule-puni.aqua { background: linear-gradient(145deg, #78f1e5, #21bcb5); }
.rule-puni.burst {
  background: linear-gradient(145deg, #ffe67c, #ff7c69);
  animation: rule-pop 1.4s ease-in-out infinite alternate;
}

#game-shell.is-title-idle .title-screen .rule-puni,
#game-shell.is-result-idle .new-best {
  animation: none;
}

.chain-hud {
  position: absolute;
  z-index: 10;
  left: 18px;
  right: 18px;
  bottom: max(14px, env(safe-area-inset-bottom));
  pointer-events: none;
}

.chain-callout {
  --chain-ink: #285be2;
  --chain-light: #ddfbff;
  position: absolute;
  z-index: 22;
  top: 20%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translate(-50%, 18px) scale(0.72) rotate(-4deg);
  pointer-events: none;
}

.chain-callout[data-level="3"] { --chain-ink: #8a35cb; --chain-light: #f9dcff; }
.chain-callout[data-level="4"] { --chain-ink: #d55329; --chain-light: #fff29e; }
.chain-callout.is-visible { will-change: opacity, transform; }
.chain-callout.is-total strong { font-size: clamp(28px, 8vw, 42px); letter-spacing: -0.04em; }
.chain-callout strong {
  white-space: nowrap;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: clamp(70px, 22vw, 110px);
  line-height: 0.95;
  color: var(--chain-light);
  -webkit-text-stroke: 3px var(--chain-ink);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--chain-ink), 0 9px 0 #ffffffbd, 0 12px 24px #36387340;
}
.chain-callout span {
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #fff;
  color: var(--chain-ink);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 1000;
  box-shadow: 0 3px 0 var(--chain-ink);
}

.score-feedback { position: absolute; inset: 0; z-index: 21; pointer-events: none; overflow: hidden; }
.score-popup { position: absolute; width: 48%; max-width: 205px; text-align: center; transform: translateX(-50%); }
.score-popup strong { display: block; color: #fff; font: 950 clamp(23px, 6.5vw, 31px)/1.1 ui-rounded, system-ui, sans-serif; -webkit-text-stroke: 2px #2b527f; paint-order: stroke fill; text-shadow: 0 2px 0 #2b527f; }
.score-popup span { display: inline-block; margin-top: 3px; padding: 3px 6px; border-radius: 6px; background: #fffffff2; color: #243d60; font-size: clamp(9px, 2.6vw, 11px); font-weight: 800; line-height: 1.35; }
.score-popup[data-kind="burst"] strong { color: #fff3a8; -webkit-text-stroke-color: #9c451e; text-shadow: 0 2px 0 #9c451e; }
.score-popup[data-kind="rainbow"] strong { color: #f8ddff; -webkit-text-stroke-color: #753992; text-shadow: 0 2px 0 #753992; }
.score-breakdown { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; margin-top: 10px; padding: 8px 0; border-block: 1px solid #ffffff22; gap: 6px; }
.score-breakdown div { display: flex; flex-direction: column; gap: 3px; }
.score-breakdown span { font-size: 9px; color: #d4ece8; }
.score-breakdown strong { font-size: clamp(12px, 3.6vw, 17px); color: #fff; font-variant-numeric: tabular-nums; }

@keyframes loading-start-pop {
  0% { opacity: 0; transform: scale(0.72); }
  100% { opacity: 1; transform: scale(1); }
}

@media (max-height: 580px) {
  .title-screen { padding: 24px 12px 10px; }
  .eyebrow { margin-bottom: 1px; font-size: 8px; }
  .title-art { min-height: 94px; }
  .title-art img { width: min(100%, 315px); }
  .title-art b { width: 52px; bottom: -1px; margin: 0; font-size: 40px; }
  .title-kana { margin-top: 1px; font-size: 10px; }
  .local-score-card { margin-top: 5px; padding: 6px 8px; }
  .local-score-card > div { padding-bottom: 4px; }
  .local-score-card li { padding: 5px 6px; }
  .rule-strip { margin: 7px 0 9px; padding: 7px 6px; }
  .rule-puni { width: 40px; height: 36px; font-size: 15px; }
  .rule-strip p { font-size: 8px; }
  .primary-button { min-height: 54px; padding-block: 8px; }
  .primary-button span { font-size: 19px; }
  .title-tip { display: none; }
}

/* v1.4 — cinematic soft-body title and modern result sequence */
#game-shell.is-title-screen .hud,
#game-shell.is-title-screen .top-controls,
#game-shell.is-title-screen .chain-hud,
#game-shell.is-result-screen .hud,
#game-shell.is-result-screen .top-controls,
#game-shell.is-result-screen .chain-hud {
  opacity: 0;
  transition: opacity 240ms ease;
}

#game-shell.is-time-freeze .p7-full-webgpu-canvas {
  animation: board-time-freeze 820ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

#game-shell.is-time-freeze::after {
  content: "";
  position: absolute;
  z-index: 27;
  inset: 0;
  opacity: 0;
  background:
    linear-gradient(180deg, transparent 0 48%, rgba(152, 247, 255, 0.2) 50%, transparent 52%),
    radial-gradient(circle at 50% 48%, transparent 0 24%, rgba(56, 219, 219, 0.1) 48%, rgba(3, 8, 31, 0.48) 100%);
  pointer-events: none;
  animation: board-freeze-flash 760ms ease-out both;
}

.title-screen {
  position: absolute;
  gap: 0;
  overflow: hidden;
  padding: max(25px, calc(env(safe-area-inset-top) + 18px)) 18px max(15px, env(safe-area-inset-bottom));
  background: var(--game-background);
  backdrop-filter: none;
}

.title-screen::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: -22%;
  width: 145%;
  aspect-ratio: 1;
  border: 1px solid rgba(104, 244, 230, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 110px rgba(35, 209, 201, 0.1), inset 0 0 100px rgba(103, 88, 242, 0.08);
  transform: translateX(-50%) perspective(300px) rotateX(67deg);
  pointer-events: none;
}

.title-atmosphere {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.title-atmosphere i {
  position: absolute;
  border: 1px solid rgba(139, 255, 243, 0.13);
  border-radius: 50%;
  opacity: 0.5;
}

.title-atmosphere i:nth-child(1) { width: 270px; height: 270px; top: -98px; left: -145px; }
.title-atmosphere i:nth-child(2) { width: 210px; height: 210px; top: 74px; right: -150px; }
.title-atmosphere i:nth-child(3) { width: 330px; height: 330px; bottom: -245px; left: 10%; }

.title-logo,
.local-score-card,
.rule-strip,
.title-screen > .primary-button,
.title-meta,
.title-tip {
  position: relative;
  z-index: 2;
}

.title-logo {
  width: min(100%, 400px);
  filter: drop-shadow(0 18px 35px rgba(1, 5, 25, 0.42));
}

.title-system-line {
  width: min(100%, 346px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto 8px;
  color: #4a7080;
  font: 800 8px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.12em;
}

.title-system-line span,
.title-system-line em {
  display: flex;
  align-items: center;
  gap: 6px;
  font-style: normal;
}

.title-system-line span i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7dffdf;
  box-shadow: 0 0 12px #57edda;
}

.title-system-line em { color: #7dffdf; }

.title-formation {
  position: absolute;
  z-index: 0;
  top: 15px;
  left: 50%;
  width: min(104vw, 410px);
  height: 145px;
  transform: translateX(-50%);
  pointer-events: none;
}

.title-seed {
  --tx: 0px;
  --ty: 0px;
  --mx: 0px;
  --my: 0px;
  --seed-color: #69eee0;
  position: absolute;
  z-index: 1;
  top: 55%;
  left: 50%;
  width: 54px;
  height: 45px;
  opacity: 0;
  border-radius: 48% 52% 44% 56% / 58% 44% 56% 42%;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.88) 0 7%, transparent 9%),
    linear-gradient(145deg, color-mix(in srgb, var(--seed-color), white 18%), var(--seed-color));
  box-shadow: inset 8px 8px 12px rgba(255, 255, 255, 0.25), 0 12px 28px rgba(6, 3, 38, 0.28);
  transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty)));
}

.seed-a { --tx: -145px; --ty: -23px; --mx: -61px; --my: -8px; --seed-color: #ff718f; width: 49px; height: 42px; }
.seed-b { --tx: -92px; --ty: 49px; --mx: -39px; --my: 17px; --seed-color: #ffd85f; width: 61px; height: 49px; }
.seed-c { --tx: -28px; --ty: -42px; --mx: -12px; --my: -14px; --seed-color: #6fe9dc; width: 45px; height: 52px; }
.seed-d { --tx: 55px; --ty: 48px; --mx: 23px; --my: 16px; --seed-color: #9a78ff; width: 58px; height: 46px; }
.seed-e { --tx: 125px; --ty: -34px; --mx: 53px; --my: -12px; --seed-color: #5ce4da; width: 48px; height: 55px; }
.seed-f { --tx: 151px; --ty: 37px; --mx: 63px; --my: 13px; --seed-color: #ff7698; width: 42px; height: 40px; }

.title-liquid-mark {
  position: absolute;
  z-index: 0;
  inset: 24px 7px 0;
  opacity: 0;
  background: linear-gradient(90deg, #7effe6 0%, #7aa7ff 36%, #b77aff 60%, #ff7096 82%, #ffe16a 100%);
  filter: blur(12px) saturate(1.25);
  -webkit-mask: url("./assets/branding/punikoro6-logo-v150-1100.png") center / contain no-repeat;
  mask: url("./assets/branding/punikoro6-logo-v150-1100.png") center / contain no-repeat;
}

.eyebrow {
  position: relative;
  z-index: 3;
  margin-bottom: 2px;
  color: #397680;
  font-size: 8px;
  letter-spacing: 0.36em;
}

.title-art {
  z-index: 2;
  min-height: 109px;
}

.title-art img {
  position: relative;
  z-index: 2;
  width: min(100%, 380px);
  filter: saturate(1.04) contrast(1.04) drop-shadow(0 10px 20px rgba(26, 21, 90, 0.42));
}

.title-art b {
  z-index: 4;
  bottom: -1px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.7) 0 9%, transparent 11%),
    linear-gradient(145deg, #fff37a, #ff9c52 42%, #ff5d8b 78%, #bb54dc);
  box-shadow: inset 10px 9px 15px rgba(255, 255, 255, 0.26), 0 8px 0 #8c316b, 0 20px 34px rgba(17, 7, 57, 0.5);
}

.title-kana {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 4px 0 0;
}

.title-kana span {
  color: #245064;
  font-size: 11px;
  letter-spacing: 0.2em;
}

.title-kana small {
  color: #527485;
  font: 800 7px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.14em;
}

.title-screen .local-score-card {
  margin-top: 10px;
  border-radius: 15px;
  border-color: rgba(137, 245, 236, 0.18);
  background: linear-gradient(135deg, rgba(6, 29, 68, 0.66), rgba(25, 15, 70, 0.7));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 13px 32px rgba(1, 5, 25, 0.25);
}

.title-screen .rule-strip {
  margin: 10px 0 11px;
  padding: 9px;
  border-radius: 18px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(3, 18, 54, 0.54);
  backdrop-filter: blur(16px);
}

.title-screen .rule-puni {
  width: 45px;
  height: 41px;
}

.cinematic-button {
  position: relative;
  min-height: 60px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 17px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.18), transparent 32%),
    linear-gradient(135deg, #28cfc5, #5f73e9 50%, #e64c88);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.38), 0 5px 0 #30266f, 0 17px 38px rgba(2, 5, 35, 0.45);
  isolation: isolate;
}

.cinematic-button::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -80%;
  left: -45%;
  width: 32%;
  height: 260%;
  background: rgba(255, 255, 255, 0.22);
  transform: rotate(24deg);
}

.cinematic-button > i {
  position: absolute;
  right: 18px;
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  font-style: normal;
}

.title-meta {
  width: min(100%, 310px);
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 10px;
  color: #527485;
  font: 800 7px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.08em;
}

.title-meta span::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 5px;
  border-radius: 50%;
  background: #68e6d8;
  box-shadow: 0 0 7px rgba(104, 230, 216, 0.7);
  vertical-align: middle;
}

.title-screen .title-tip { margin-top: 9px; font-size: 9px; color: #426575; text-shadow: none; }

.title-screen.is-entering .title-seed { animation: title-seed-merge 980ms var(--seed-delay, 0ms) cubic-bezier(0.22, 0.8, 0.25, 1) both; }
.title-screen.is-entering .seed-a { --seed-delay: 0ms; }
.title-screen.is-entering .seed-b { --seed-delay: 70ms; }
.title-screen.is-entering .seed-c { --seed-delay: 35ms; }
.title-screen.is-entering .seed-d { --seed-delay: 110ms; }
.title-screen.is-entering .seed-e { --seed-delay: 50ms; }
.title-screen.is-entering .seed-f { --seed-delay: 140ms; }
.title-screen.is-entering .title-liquid-mark { animation: title-liquid-form 1.18s 390ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.title-screen.is-entering .title-art img { animation: title-art-lock 1.05s 650ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.title-screen.is-entering .title-art b { animation: title-six-squish 760ms 950ms cubic-bezier(0.2, 1.45, 0.3, 1) both; }
.title-screen.is-entering .title-system-line,
.title-screen.is-entering .eyebrow { animation: title-detail-in 620ms 1.05s ease-out both; }
.title-screen.is-entering .title-kana,
.title-screen.is-entering .local-score-card,
.title-screen.is-entering .rule-strip,
.title-screen.is-entering .cinematic-button,
.title-screen.is-entering .title-meta,
.title-screen.is-entering .title-tip { animation: title-panel-rise 650ms var(--panel-delay, 1.08s) cubic-bezier(0.16, 1, 0.3, 1) both; }
.title-screen.is-entering .local-score-card { --panel-delay: 1.02s; }
.title-screen.is-entering .rule-strip { --panel-delay: 1.10s; }
.title-screen.is-entering .cinematic-button { --panel-delay: 1.18s; }
.title-screen.is-entering .title-meta { --panel-delay: 1.24s; }
.title-screen.is-entering .title-tip { --panel-delay: 1.30s; }

.result-screen {
  overflow: hidden;
  padding: max(21px, env(safe-area-inset-top)) 18px max(17px, env(safe-area-inset-bottom));
  background:
    linear-gradient(90deg, rgba(106, 243, 229, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(106, 243, 229, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 50% 45%, rgba(78, 229, 218, 0.14), transparent 40%),
    rgba(3, 7, 27, 0.8);
  background-size: 32px 32px, 32px 32px, auto, auto;
  backdrop-filter: blur(14px) saturate(0.82);
}

.result-freeze {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
}

.result-freeze::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.26;
  background: repeating-linear-gradient(180deg, transparent 0 4px, rgba(176, 255, 246, 0.05) 5px);
}

.result-freeze > span {
  position: absolute;
  top: 13px;
  color: rgba(175, 255, 246, 0.48);
  font: 800 7px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.12em;
}

.freeze-ring {
  position: absolute;
  width: 92%;
  aspect-ratio: 1;
  border: 1px solid rgba(103, 242, 230, 0.18);
  border-radius: 50%;
  opacity: 0;
}

.ring-two { width: 64%; border-color: rgba(255, 108, 154, 0.14); }

.freeze-line {
  position: absolute;
  top: 50%;
  width: 43%;
  height: 1px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(139, 255, 243, 0.55));
}

.line-left { left: 0; }
.line-right { right: 0; transform: rotate(180deg); }

.result-card {
  position: relative;
  z-index: 2;
  width: min(100%, 388px);
  padding: 19px 20px 17px;
  overflow: hidden;
  border: 1px solid rgba(185, 255, 247, 0.2);
  border-radius: 27px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.09), transparent 34%),
    linear-gradient(160deg, rgba(13, 44, 80, 0.94), rgba(20, 13, 61, 0.96) 58%, rgba(39, 12, 55, 0.97));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), 0 30px 80px rgba(0, 2, 18, 0.62);
}

.result-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -25%;
  width: 28%;
  height: 100%;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  transform: skewX(-16deg);
  pointer-events: none;
}

.result-overline {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #85f5e7;
  font: 900 8px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.12em;
}

.result-overline em { color: rgba(255, 255, 255, 0.38); font-style: normal; }

.result-card h2 {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 10px 0 9px;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  line-height: 0.8;
  letter-spacing: -0.06em;
}

.result-card h2 span {
  font-size: clamp(42px, 12vw, 58px);
  color: #fff;
  text-shadow: 0 6px 24px rgba(85, 236, 222, 0.25);
}

.result-card h2 b {
  color: #ff7397;
  font-size: clamp(23px, 7vw, 34px);
  letter-spacing: 0.02em;
}

.result-summary {
  width: 100%;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
}

.result-rank,
.result-score-block {
  min-width: 0;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.055);
}

.result-rank { align-items: center; }
.result-rank span,
.result-score-block > span {
  color: rgba(207, 255, 249, 0.52);
  font: 900 7px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.12em;
}

.result-rank strong {
  margin-top: 5px;
  color: #fff084;
  font: 1000 49px/0.9 ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  text-shadow: 0 4px 0 #7e3b89, 0 8px 20px rgba(255, 97, 143, 0.32);
}

.result-score-block {
  position: relative;
  align-items: flex-start;
  padding: 11px 14px;
}

#result-score {
  max-width: 100%;
  margin: 6px 0 0;
  overflow: hidden;
  color: #fff;
  font: 1000 clamp(39px, 12vw, 57px)/0.9 ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.055em;
  text-overflow: ellipsis;
  text-shadow: 0 5px 0 #4a43a2;
}

.result-score-block .new-best {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 4px 7px;
  border-radius: 7px;
  background: #ff668e;
}

.result-local-record {
  width: 100%;
  margin: 8px 2px 0;
  text-align: right;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.result-stats {
  gap: 8px;
  margin: 10px 0 9px;
}

.result-stats div {
  min-height: 55px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.result-stats strong { font-size: 23px; }

#result-comment {
  width: 100%;
  min-height: 17px;
  margin: 0 0 13px;
  color: rgba(231, 255, 252, 0.7);
  font-size: 10px;
  text-align: left;
}

.result-screen .cinematic-button { min-width: 100%; min-height: 55px; }
.result-screen .text-button { margin-top: 10px; font: 900 9px/1 ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: 0.12em; }

.result-screen.is-entering { animation: result-backdrop-in 660ms ease-out both; }
.result-screen.is-entering .ring-one { animation: result-ring-lock 920ms 80ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.result-screen.is-entering .ring-two { animation: result-ring-lock 760ms 150ms cubic-bezier(0.16, 1, 0.3, 1) both reverse; }
.result-screen.is-entering .freeze-line { animation: result-line-lock 600ms 260ms ease-out both; }
.result-screen.is-entering .result-card { animation: result-card-lock 780ms 380ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.result-screen.is-entering .result-card::after { animation: result-card-scan 780ms 980ms ease-out both; }
.result-screen.is-entering .result-overline,
.result-screen.is-entering h2,
.result-screen.is-entering .result-summary,
.result-screen.is-entering .result-local-record,
.result-screen.is-entering .result-stats,
.result-screen.is-entering #result-comment,
.result-screen.is-entering .cinematic-button,
.result-screen.is-entering .text-button { animation: result-item-in 520ms var(--result-delay, 770ms) cubic-bezier(0.16, 1, 0.3, 1) both; }
.result-screen.is-entering h2 { --result-delay: 720ms; }
.result-screen.is-entering .result-summary { --result-delay: 800ms; }
.result-screen.is-entering .result-local-record { --result-delay: 850ms; }
.result-screen.is-entering .result-stats { --result-delay: 900ms; }
.result-screen.is-entering #result-comment { --result-delay: 960ms; }
.result-screen.is-entering .cinematic-button { --result-delay: 1.02s; }
.result-screen.is-entering .text-button { --result-delay: 1.08s; }

@keyframes title-seed-merge {
  0% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.35, 1.45) rotate(-13deg); }
  18% { opacity: 0.96; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1.12, 0.82) rotate(6deg); }
  58% { opacity: 0.92; transform: translate(calc(-50% + var(--mx)), calc(-50% + var(--my))) scale(0.86, 1.12) rotate(-3deg); }
  82% { opacity: 0.68; transform: translate(-50%, -50%) scale(0.42, 1.34) rotate(2deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.08, 1.7); }
}

@keyframes title-liquid-form {
  0% { opacity: 0; filter: blur(18px) saturate(1.4); transform: scale(0.24, 0.12); }
  38% { opacity: 0.9; filter: blur(9px) saturate(1.35); transform: scale(1.08, 0.72); }
  62% { opacity: 0.82; filter: blur(4px) saturate(1.3); transform: scale(0.96, 1.09); }
  82% { opacity: 0.65; filter: blur(1px) saturate(1.2); transform: scale(1.015, 0.985); }
  100% { opacity: 0.16; filter: blur(0) saturate(1.12); transform: scale(1); }
}

@keyframes title-art-lock {
  0% { opacity: 0; clip-path: inset(44% 44% 44% 44% round 50%); filter: blur(10px) saturate(1.6); transform: scale(0.78, 0.3); }
  52% { opacity: 1; clip-path: inset(0 0 0 0 round 20%); filter: blur(1px) saturate(1.22); transform: scale(1.04, 0.91); }
  76% { transform: scale(0.985, 1.035); }
  100% { opacity: 1; clip-path: inset(0 0 0 0 round 0); filter: saturate(1.04) contrast(1.04) drop-shadow(0 10px 20px rgba(26, 21, 90, 0.42)); transform: scale(1); }
}

@keyframes title-six-squish {
  0% { opacity: 0; transform: translateX(-50%) scale(0.2, 1.7) rotate(-14deg); }
  45% { opacity: 1; transform: translateX(-50%) scale(1.16, 0.78) rotate(3deg); }
  70% { transform: translateX(-50%) scale(0.93, 1.08) rotate(-7deg); }
  100% { opacity: 1; transform: translateX(-50%) scale(1) rotate(-5deg); }
}

@keyframes title-detail-in { from { opacity: 0; letter-spacing: 0.62em; } to { opacity: 1; } }
@keyframes title-panel-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes board-time-freeze { 0% { filter: saturate(1) brightness(1); } 42% { filter: saturate(1.45) brightness(1.2) contrast(1.08); } 100% { filter: saturate(0.28) brightness(0.62) contrast(1.14) blur(1.5px); } }
@keyframes board-freeze-flash { 0% { opacity: 0; transform: scaleY(0.08); } 22% { opacity: 1; transform: scaleY(1); } 100% { opacity: 0.42; transform: scaleY(1); } }
@keyframes result-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes result-ring-lock { 0% { opacity: 0; transform: scale(1.55) rotate(-18deg); } 54% { opacity: 0.65; } 100% { opacity: 0.2; transform: scale(0.82) rotate(0); } }
@keyframes result-line-lock { from { opacity: 0; transform: scaleX(0); } to { opacity: 0.7; transform: scaleX(1); } }
@keyframes result-card-lock { 0% { opacity: 0; clip-path: inset(48% 5% 48% 5% round 8px); transform: scale(1.08, 0.2); } 52% { opacity: 1; clip-path: inset(0 0 0 0 round 27px); transform: scale(0.98, 1.025); } 100% { opacity: 1; clip-path: inset(0 0 0 0 round 27px); transform: scale(1); } }
@keyframes result-card-scan { 0% { left: -25%; opacity: 0; } 20% { opacity: 1; } 100% { left: 110%; opacity: 0; } }
@keyframes result-item-in { from { opacity: 0; transform: translateY(13px); } to { opacity: 1; transform: translateY(0); } }

@media (max-height: 690px) {
  .title-screen { padding-top: max(24px, calc(env(safe-area-inset-top) + 16px)); }
  .title-art { min-height: 96px; }
  .title-art img { width: min(100%, 330px); }
  .title-art b { width: 54px; font-size: 41px; }
  .title-kana small { display: none; }
  .title-screen .local-score-card { margin-top: 6px; padding-block: 6px; }
  .title-screen .rule-strip { margin: 7px 0 8px; padding: 7px; }
  .title-screen .rule-puni { width: 39px; height: 36px; font-size: 16px; }
  .title-screen .cinematic-button { min-height: 52px; }
  .title-screen .title-meta { margin-top: 7px; }
  .title-screen .title-tip { display: none; }
  .result-card { padding: 16px 18px 13px; }
  .result-card h2 { margin-block: 8px; }
  .result-summary { grid-template-columns: 68px 1fr; }
  .result-rank, .result-score-block { min-height: 78px; }
  .result-rank strong { font-size: 41px; }
  #result-score { font-size: clamp(35px, 11vw, 49px); }
  .result-stats { margin-block: 8px; }
  .result-stats div { min-height: 48px; padding-block: 7px; }
  #result-comment { margin-bottom: 10px; }
  .result-screen .cinematic-button { min-height: 49px; }
}

@media (max-width: 370px) {
  .title-system-line { width: 94%; }
  .title-meta { gap: 9px; }
  .result-card { padding-inline: 15px; }
  .result-summary { grid-template-columns: 62px 1fr; gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  #game-shell.is-time-freeze .p7-full-webgpu-canvas { filter: saturate(0.4) brightness(0.68); }
  .title-seed,
  .title-liquid-mark,
  .result-freeze { display: none; }
}

/* v1.7 — install guidance that stays outside active gameplay */
.pwa-install-slot {
  position: relative;
  z-index: 6;
  width: min(100%, 330px);
}

.pwa-install-slot:empty {
  display: none;
}

.title-screen .pwa-install-slot {
  margin-top: 8px;
}

.result-card .pwa-install-slot {
  width: 100%;
  margin-bottom: 8px;
}

.pwa-install-prompt {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 7px 31px 7px 8px;
  border: 1px solid rgba(180, 255, 247, 0.28);
  border-radius: 16px;
  background:
    linear-gradient(125deg, rgba(41, 203, 196, 0.22), transparent 38%),
    linear-gradient(150deg, rgba(13, 27, 74, 0.98), rgba(35, 17, 83, 0.98));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.16), 0 10px 24px rgba(0, 0, 0, 0.28);
  animation: pwa-install-in 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
  pointer-events: auto;
}

.pwa-install-prompt.is-hidden {
  display: none;
}

.pwa-install-prompt > img {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  box-shadow: 0 5px 12px rgba(3, 5, 31, 0.3);
}

.pwa-install-copy {
  min-width: 0;
}

.pwa-install-copy > span {
  display: block;
  margin-bottom: 3px;
  color: rgba(166, 255, 245, 0.62);
  font: 900 7px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.16em;
}

.pwa-install-copy strong {
  display: block;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pwa-install-copy p {
  margin: 3px 0 0;
  color: rgba(237, 255, 253, 0.68);
  font-size: 8px;
  font-weight: 800;
  line-height: 1.35;
}

.pwa-install-action {
  min-width: 75px;
  min-height: 40px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  background: linear-gradient(135deg, #38d9ce, #6f72ef 58%, #e75f98);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 4px 12px rgba(2, 5, 35, 0.28);
  color: #fff;
  font-size: 9px;
  font-weight: 950;
  line-height: 1.2;
}

.pwa-install-action:disabled {
  opacity: 0.55;
}

.pwa-install-close {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 32px;
  height: 32px;
  padding: 0 0 2px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  font-size: 15px;
  line-height: 1;
}

.pwa-install-guide {
  z-index: 75;
  background: rgba(5, 4, 24, 0.76);
}

.pwa-install-guide .dialog-card {
  width: min(100%, 330px);
  padding: 24px 22px 20px;
}

.pwa-install-guide .dialog-card > img {
  width: 72px;
  height: 72px;
  margin-bottom: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  box-shadow: 0 12px 28px rgba(2, 5, 35, 0.34);
}

.pwa-install-guide-steps {
  width: 100%;
  display: grid;
  gap: 8px;
  margin: 5px 0 18px;
  padding: 12px 12px 12px 34px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
  background: rgba(3, 10, 39, 0.46);
  text-align: left;
  color: rgba(248, 255, 254, 0.84);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
}

#game-shell.is-pwa-prompt-on-title .title-meta,
#game-shell.is-pwa-prompt-on-title .title-tip,
#game-shell.is-pwa-prompt-on-result #result-comment {
  display: none;
}

@keyframes pwa-install-in {
  from { opacity: 0; transform: translateY(9px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 350px), (max-height: 610px) {
  .pwa-install-prompt {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 6px;
    min-height: 52px;
    padding: 6px 29px 6px 7px;
    border-radius: 14px;
  }
  .pwa-install-prompt > img { width: 40px; height: 40px; border-radius: 11px; }
  .pwa-install-copy strong { font-size: 11px; }
  .pwa-install-copy p { display: none; }
  .pwa-install-action { min-width: 68px; min-height: 40px; padding-inline: 6px; font-size: 8px; }
  .pwa-install-guide .dialog-card { padding: 18px 17px 16px; }
  .pwa-install-guide .dialog-card > img { width: 58px; height: 58px; border-radius: 17px; }
  .pwa-install-guide-steps { margin-bottom: 13px; padding-block: 9px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .pwa-install-prompt { animation: none; }
}

/* v1.5 — original Punikoro6 identity */
.loading-wordmark {
  width: min(64%, 270px);
  display: block;
}

.loading-wordmark img {
  width: 100%;
  height: auto;
  display: block;
  filter: none;
}

.title-art {
  min-height: 105px;
}

.title-art img {
  width: min(100%, 382px);
  filter: saturate(1.05) contrast(1.035) drop-shadow(0 12px 22px rgba(13, 187, 222, 0.22));
}

@media (max-height: 690px) {
  .title-art { min-height: 91px; }
  .title-art img { width: min(100%, 330px); }
}

@media (max-height: 580px) {
  .title-art { min-height: 84px; }
  .title-art img { width: min(100%, 300px); }
}
