:root {
  --pink-700: #ec407a;
  --pink-600: #f06292;
  --pink-400: #f48fb1;
  --pink-250: #f8bbd0;
  --pink-120: #fce7f3;
  --pink-60: #fff7fb;
  --paper: rgba(255, 255, 255, 0.9);
  --paper-strong: rgba(255, 255, 255, 0.96);
  --text: #222;
  --shadow: 0 18px 40px rgba(122, 37, 74, 0.22);
}

* {
  box-sizing: border-box;
  letter-spacing: 0 !important;
}

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

body {
  margin: 0;
  overflow: hidden;
  font-family: "BIZ UDPGothic", "BIZ UDGothic", "Meiryo", system-ui, sans-serif;
  background: #f7dce8;
  color: var(--text);
  touch-action: manipulation;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: default;
}

[hidden] {
  display: none !important;
}

.app {
  width: 100vw;
  height: 100dvh;
}

.screen {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  background-image: url("./Images/BackGrounds/GameStartBackGround.png");
  background-size: cover;
  background-position: center;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.unity-frame {
  position: relative;
  width: min(1280px, 94vw);
  background: var(--paper);
  border: 1px solid rgba(255, 111, 161, 0.9);
  border-radius: 48px;
  box-shadow: var(--shadow);
}

.title-frame {
  min-height: min(720px, 86dvh);
  padding: 48px 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.title-image {
  width: min(760px, 76vw);
  height: 180px;
  object-fit: contain;
  margin: 0 0 60px;
}

.start-buttons {
  width: min(420px, 80vw);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.start-button,
.continue-button,
.ok-button,
.back-button,
.start-button:disabled {
  font-weight: 700;
}

.start-button,
.continue-button {
  width: 100%;
  height: 76px;
  border-radius: 48px;
  font-size: 32px;
  letter-spacing: 0;
}

.start-button,
.ok-button,
.back-button {
  background: var(--pink-600);
  color: #fff;
}

.continue-button {
  background: rgba(255, 255, 255, 0.95);
  color: var(--pink-600);
  border: 4px solid var(--pink-250);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 80px 18px 18px;
  background: rgba(0, 0, 0, 0.16);
}

.auth-box {
  width: min(360px, 100%);
  padding: 18px;
  background: #fff;
  border: 1px solid #aaa;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.auth-title {
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 700;
}

.auth-message {
  margin-bottom: 16px;
  color: #333;
  font-size: 14px;
  line-height: 1.6;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.form-row label {
  width: 90px;
  flex: 0 0 90px;
  font-size: 14px;
}

.form-row input {
  min-width: 0;
  flex: 1;
  padding: 8px;
  border: 1px solid #aaa;
  border-radius: 4px;
  font-size: 16px;
}

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.button-row button {
  min-width: 74px;
  padding: 7px 16px;
  border-radius: 4px;
  background: #f2f2f2;
  color: #222;
}

.button-row #loginButton {
  background: var(--pink-600);
  color: #fff;
}

.error-message {
  display: none;
  margin-top: 8px;
  color: #d81b60;
  font-size: 13px;
}

.image-select-frame {
  min-height: min(900px, 95dvh);
  padding: 22px 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: auto;
}

.setting-frame {
  min-height: min(720px, 92dvh);
  padding: 48px 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.confirm-frame {
  min-height: min(800px, 94dvh);
  padding: 34px 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: auto;
}

.back-button {
  position: absolute;
  top: 28px;
  left: 42px;
  height: 48px;
  padding: 0 32px;
  border-radius: 24px;
  font-size: 22px;
}

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0 24px;
  text-align: center;
}

.main-title {
  margin: 0;
  color: var(--pink-600);
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
}

.game-setting-root .main-title {
  font-size: 52px;
}

.sub-title {
  margin: 6px 0 0;
  color: var(--pink-700);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
}

.selected-count-card {
  width: min(420px, 78vw);
  min-height: 60px;
  margin: 8px 0 21px;
  padding: 8px 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  background: var(--pink-60);
  border: 2px solid var(--pink-250);
  border-radius: 24px;
}

.selected-count-text {
  color: var(--pink-600);
  font-size: 18px;
  font-weight: 800;
}

.selected-count-value {
  color: var(--pink-700);
  font-size: 28px;
  font-weight: 800;
}

.viewer-layout {
  width: 100%;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 84px;
  align-items: center;
}

.nav-button,
.preview-nav-button {
  background-color: var(--pink-600);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 58%;
}

.nav-button {
  width: 60px;
  height: 60px;
  justify-self: center;
  border-radius: 20px;
}

.prev-button {
  background-image: url("./Images/Common/Chevron/left.svg");
}

.next-button {
  background-image: url("./Images/Common/Chevron/right.svg");
}

.main-panel {
  min-width: 0;
  padding: 16px 22px;
  background: var(--paper-strong);
  border: 1px solid rgba(255, 111, 161, 0.82);
  border-radius: 36px;
}

.panel-top {
  min-height: 56px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.favorite-area {
  min-width: 0;
  display: flex;
  align-items: flex-start;
}

.icon-button {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border: 2px solid var(--pink-250);
  border-radius: 18px;
  background-color: var(--pink-120);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 70%;
}

.favorite-button {
  background-image: url("./Images/Common/Star/offStar.svg");
}

.favorite-button.is-active {
  background-image: url("./Images/Common/Star/onStar.svg");
}

.delete-button,
.modal-close-button {
  background-image: url("./Images/Common/delete.svg");
}

.favorite-description {
  width: min(380px, 52vw);
  min-height: 54px;
  margin: 0 0 0 12px;
  padding-top: 6px;
  color: var(--pink-600);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
}

.preview-frame {
  width: min(540px, 72vw);
  height: 360px;
  margin: 0 auto;
  padding: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fffafb;
  border: 2px solid var(--pink-250);
  border-radius: 28px;
}

.preview-frame.has-image {
  background: #fff;
}

.preview-image,
.image-preview-item img,
.image-modal-image img,
.main-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.image-add-placeholder {
  width: 270px;
  height: 182px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--pink-60);
  border: 2px solid var(--pink-250);
  border-radius: 22px;
}

.plus-mark {
  width: 68px;
  height: 68px;
  margin-bottom: 10px;
  background: #fff url("./Images/Common/plus.svg") center / 58% no-repeat;
  border: 2px solid var(--pink-250);
  border-radius: 50%;
}

.add-image-label {
  color: var(--pink-600);
  font-size: 22px;
  font-weight: 800;
}

.guide-label {
  margin: 10px 0 0;
  color: var(--pink-700);
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}

.slot-dots {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.slot-dot {
  width: 18px;
  height: 18px;
  padding: 0;
  background: #fff;
  border: 2px solid var(--pink-250);
  border-radius: 50%;
}

.slot-dot.current {
  width: 22px;
  height: 22px;
  background: var(--pink-600);
  border-color: var(--pink-700);
}

.slot-dot.has-image {
  background: #f9bfd2;
  border-color: var(--pink-400);
}

.slot-dot.is-favorite {
  background: #f4b400;
  border-color: var(--pink-250);
}

.slot-dot.current.is-favorite {
  border-color: var(--pink-700);
}

.footer {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.validation-error {
  min-height: 30px;
  margin: 12px 0 4px;
  color: var(--pink-700);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
}

.ok-button {
  width: 280px;
  height: 76px;
  border-radius: 28px;
  font-size: 30px;
  letter-spacing: 0;
}

.file-input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.settings-grid {
  width: 100%;
}

.settings-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.panel {
  min-width: 0;
  min-height: 180px;
  padding: 12px 34px 32px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 111, 161, 0.9);
  border-radius: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.panel-title {
  margin: 0 0 8px;
  color: var(--pink-600);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0;
}

.time-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.time-input {
  width: 128px;
  height: 76px;
  border: 3px solid var(--pink-250);
  border-radius: 24px;
  background: #fff;
  color: #222;
  font-size: 32px;
  font-weight: 800;
  text-align: center;
}

.time-label {
  margin-right: 8px;
  color: var(--pink-600);
  font-size: 26px;
  font-weight: 800;
}

.cards {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.select-card {
  min-width: 0;
  flex: 1 1 0;
  height: 76px;
  padding: 0 8px;
  background: #fff;
  color: var(--pink-600);
  border: 3px solid var(--pink-250);
  border-radius: 24px;
  font-size: 24px;
  font-weight: 800;
}

.select-card.selected,
.select-card:hover {
  background: #f8d5e8;
  border-color: var(--pink-400);
  color: var(--pink-700);
}

.preview-section {
  width: min(1080px, 100%);
  min-height: 210px;
  margin: 4px 0 26px;
  padding: 18px 24px;
  background: var(--paper-strong);
  border: 1px solid rgba(255, 111, 161, 0.82);
  border-radius: 32px;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 70px;
  justify-content: center;
  align-items: center;
}

.image-preview-list {
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.preview-nav-button {
  width: 54px;
  height: 54px;
  justify-self: center;
  border-radius: 18px;
}

.image-preview-item {
  width: 138px;
  height: 112px;
  padding: 0;
  background: #fffafb;
  border: 3px solid var(--pink-250);
  border-radius: 20px;
  overflow: hidden;
}

.image-preview-item.is-favorite-preview {
  border: 4px solid #f5c542;
}

.missing-preview-label {
  margin: 0;
  color: var(--pink-700);
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}

.info-grid {
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 340px));
  justify-content: center;
  gap: 12px 24px;
}

.info-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.info-label {
  margin-bottom: 8px;
  color: var(--pink-600);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
}

.info-value {
  width: 100%;
  min-height: 58px;
  padding: 12px 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--pink-60);
  color: var(--pink-700);
  border: 2px solid var(--pink-250);
  border-radius: 29px;
  font-size: 23px;
  font-weight: 800;
  text-align: center;
}

.confirm-frame .start-button {
  width: 290px;
  height: 72px;
  border-radius: 36px;
  font-size: 30px;
  letter-spacing: 0;
}

.confirm-frame .start-button:disabled {
  background: #dcaabc;
}

.image-modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.35);
}

.image-modal-frame {
  position: relative;
  width: min(760px, 94vw);
  height: min(620px, 88dvh);
  padding: 52px 30px 30px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid var(--pink-250);
  border-radius: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-close-button {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background-color: var(--pink-120);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 68%;
}

.modal-title {
  margin: 0 0 20px;
  color: var(--pink-600);
  font-size: 26px;
  font-weight: 800;
}

.image-modal-image {
  width: min(660px, 100%);
  min-height: 0;
  flex: 1;
  background: #fffafb;
  border: 2px solid var(--pink-250);
  border-radius: 24px;
  overflow: hidden;
}

.play-root {
  align-items: stretch;
  padding: 3dvh 0 2dvh;
}

.play-frame {
  width: 100%;
  height: 100%;
}

.stage {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.play-body {
  width: 100%;
  height: 88%;
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(150px, 15%) minmax(0, 70%) minmax(150px, 15%);
  justify-content: center;
  align-items: stretch;
}

.side-rail {
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.left-rail-spacer {
  flex: 1 1 auto;
}

.main-image-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.main-image {
  width: 100%;
  height: 100%;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(18, 18, 24, 0.78);
  border: 4px solid var(--pink-250);
  border-radius: 36px;
  overflow: hidden;
}

.countdown-label {
  width: min(168px, 72%);
  min-width: 132px;
  height: 62px;
  padding: 12px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  color: var(--pink-700);
  border: 2px solid var(--pink-250);
  border-radius: 31px;
  font-size: 32px;
  font-weight: 800;
}

.final-countdown-label {
  width: min(168px, 72%);
  min-width: 132px;
  height: 126px;
  padding: 12px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  color: var(--pink-700);
  border: 3px solid var(--pink-250);
  border-radius: 63px;
  font-size: 78px;
  font-weight: 800;
}

.moving-object-frame {
  position: relative;
  --moving-object-base-bottom: -40;
  --moving-object-travel: 150;
  width: min(190px, 64%);
  min-width: 150px;
  height: min(520px, 64%);
  min-height: 440px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid var(--pink-250);
  border-radius: 30px;
}

.moving-box-image {
  position: absolute;
  inset: 0;
  background-image: url("./Images/Play/Black/box.png");
  background-size: 190% auto;
  background-repeat: no-repeat;
  background-position: center;
}

.moving-object {
  position: absolute;
  left: -10%;
  bottom: -40px;
  width: 120%;
  height: 100%;
  object-fit: contain;
}

.play-control-panel {
  width: min(188px, 70%);
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.play-control-button {
  width: 100%;
  min-height: 54px;
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--pink-700);
  border: 2px solid var(--pink-250);
  border-radius: 27px;
  font-size: 17px;
  font-weight: 800;
}

.play-control-button.is-active {
  background: #f8d5e8;
  border-color: var(--pink-700);
}

.finish-button {
  background: var(--pink-600);
  color: #fff;
  border-color: var(--pink-600);
}

.image-color-effect {
  position: absolute;
  top: 42%;
  width: 250px;
  height: 250px;
  object-fit: contain;
  pointer-events: none;
  opacity: 1;
}

.image-color-left {
  left: 8%;
  transform: rotate(-15deg);
}

.image-color-right {
  right: 8%;
  transform: rotate(15deg);
}

.image-color-effect.is-fading {
  opacity: 0;
  transition: opacity 1.1s linear;
}

.play-bottom-area {
  width: 70%;
  min-height: 70px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.play-error-label {
  max-width: 820px;
  min-height: 48px;
  margin: 0;
  padding: 12px 26px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--pink-700);
  border-radius: 24px;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

.finish-actions {
  display: flex;
  gap: 24px;
  opacity: 0;
  transition: opacity 320ms ease;
}

.finish-actions.is-visible {
  opacity: 1;
}

.finish-action-button {
  width: 180px;
  height: 62px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--pink-700);
  border: 2px solid var(--pink-250);
  border-radius: 31px;
  font-size: 22px;
  font-weight: 800;
}

.play-control-panel .finish-actions {
  width: 100%;
  flex-direction: column;
  gap: 10px;
}

.play-control-panel .finish-action-button {
  width: 100%;
}

.replay-button {
  background: var(--pink-600);
  color: #fff;
  border-color: var(--pink-600);
}

@media (max-width: 820px) {
  html,
  body {
    height: 100%;
    overscroll-behavior: none;
  }

  body {
    overflow: hidden;
  }

  .app,
  .screen {
    height: 100dvh;
    min-height: 100dvh;
  }

  .screen {
    align-items: stretch;
    padding: 0;
  }

  .unity-frame {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .title-frame {
    padding: calc(env(safe-area-inset-top) + 32px) 24px calc(env(safe-area-inset-bottom) + 32px);
    background: rgba(255, 255, 255, 0.82);
    justify-content: center;
  }

  .title-image {
    width: min(86vw, 440px);
    height: min(140px, 22dvh);
    margin-bottom: 38px;
  }

  .start-buttons {
    width: min(342px, 86vw);
    gap: 16px;
  }

  .start-button,
  .continue-button {
    height: 62px;
    border-radius: 31px;
    font-size: 24px;
  }

  .image-select-frame,
  .setting-frame,
  .confirm-frame {
    padding: calc(env(safe-area-inset-top) + 10px) 12px calc(env(safe-area-inset-bottom) + 84px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(255, 255, 255, 0.88);
  }

  .back-button {
    position: fixed;
    z-index: 10;
    top: calc(env(safe-area-inset-top) + 10px);
    left: 12px;
    height: 38px;
    padding: 0 16px;
    border-radius: 19px;
    font-size: 16px;
    box-shadow: 0 8px 18px rgba(236, 64, 122, 0.22);
  }

  .header {
    flex: 0 0 auto;
    margin: 44px 0 10px;
  }

  .main-title,
  .game-setting-root .main-title {
    font-size: 30px;
    line-height: 1.12;
  }

  .sub-title {
    margin-top: 4px;
    font-size: 11px;
  }

  .selected-count-card {
    position: fixed;
    z-index: 10;
    top: calc(env(safe-area-inset-top) + 10px);
    right: 12px;
    width: auto;
    min-height: 38px;
    margin: 0;
    padding: 4px 13px;
    gap: 0;
    border-radius: 19px;
    background: rgba(255, 247, 251, 0.96);
    box-shadow: 0 8px 18px rgba(236, 64, 122, 0.14);
  }

  .selected-count-text {
    display: none;
  }

  .selected-count-value {
    font-size: 17px;
  }

  .viewer-layout {
    position: relative;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    justify-content: center;
  }

  .main-panel {
    position: relative;
    width: 100%;
    min-height: 0;
    padding: 10px 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
  }

  .panel-top {
    position: absolute;
    z-index: 4;
    top: 18px;
    left: 18px;
    right: 18px;
    min-height: 44px;
    margin: 0;
    align-items: center;
    pointer-events: none;
  }

  .panel-top .icon-button {
    pointer-events: auto;
  }

  .favorite-description,
  .guide-label {
    display: none;
  }

  .icon-button {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    border-radius: 14px;
    background-color: rgba(252, 231, 243, 0.95);
    box-shadow: 0 8px 18px rgba(236, 64, 122, 0.16);
  }

  .preview-frame {
    width: min(100%, 430px);
    height: min(calc(100dvh - 250px), 124vw);
    min-height: 0;
    margin: 0 auto;
    padding: 8px;
    flex: 0 1 auto;
    aspect-ratio: 3 / 4;
    border-radius: 24px;
    background: #fff;
  }

  .preview-frame.has-image {
    background: #111018;
  }

  .image-add-placeholder {
    width: min(220px, 72%);
    height: 160px;
    border-radius: 20px;
  }

  .plus-mark {
    width: 56px;
    height: 56px;
  }

  .add-image-label {
    font-size: 18px;
  }

  .nav-button {
    position: absolute;
    z-index: 5;
    top: calc(50% - 32px);
    width: 42px;
    height: 64px;
    border-radius: 18px;
    background-color: rgba(240, 98, 146, 0.92);
    box-shadow: 0 10px 22px rgba(236, 64, 122, 0.22);
  }

  .viewer-layout > .prev-button {
    left: 5px;
  }

  .viewer-layout > .next-button {
    right: 5px;
  }

  .slot-dots {
    max-width: min(100%, 360px);
    margin: 10px auto 0;
    padding: 0 48px;
    flex-wrap: wrap;
    gap: 7px;
  }

  .slot-dot {
    width: 13px;
    height: 13px;
  }

  .slot-dot.current {
    width: 18px;
    height: 18px;
  }

  .footer {
    position: sticky;
    z-index: 6;
    bottom: calc(env(safe-area-inset-bottom) * -1);
    width: calc(100% + 24px);
    margin: 10px -12px calc((env(safe-area-inset-bottom) + 84px) * -1);
    padding: 10px 12px calc(env(safe-area-inset-bottom) + 12px);
    background: linear-gradient(to top, rgba(255, 255, 255, 0.96) 72%, rgba(255, 255, 255, 0));
  }

  .validation-error {
    margin: 10px 0 0;
    font-size: 14px;
  }

  .ok-button,
  .confirm-frame .start-button {
    width: min(292px, 82vw);
    height: 56px;
    border-radius: 28px;
    font-size: 22px;
  }

  .settings-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .settings-row {
    display: contents;
  }

  .panel {
    min-height: 0;
    padding: 12px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
  }

  .panel-title {
    margin-bottom: 10px;
    font-size: 22px;
  }

  .time-area {
    gap: 6px;
    margin-top: 0;
  }

  .time-input {
    width: min(92px, 25vw);
    height: 56px;
    border-radius: 18px;
    font-size: 24px;
  }

  .time-label {
    margin-right: 4px;
    font-size: 18px;
  }

  .cards {
    gap: 8px;
    margin-top: 0;
  }

  .select-card {
    height: 52px;
    padding: 0 6px;
    border-radius: 18px;
    font-size: 16px;
    line-height: 1.15;
    white-space: normal;
  }

  .preview-section {
    position: relative;
    width: 100%;
    min-height: 0;
    margin: 0 0 14px;
    padding: 12px 8px;
    display: block;
    border-radius: 24px;
  }

  .image-preview-list {
    justify-content: flex-start;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 2px 42px;
  }

  .image-preview-item {
    width: 96px;
    height: 132px;
    flex: 0 0 96px;
    border-radius: 16px;
    scroll-snap-align: center;
  }

  .preview-nav-button {
    position: absolute;
    z-index: 2;
    top: calc(50% - 23px);
    width: 34px;
    height: 46px;
    border-radius: 14px;
  }

  .preview-section > .prev-button {
    left: 8px;
  }

  .preview-section > .next-button {
    right: 8px;
  }

  .info-grid {
    width: 100%;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .info-label {
    margin-bottom: 5px;
    font-size: 14px;
  }

  .info-value {
    min-height: 46px;
    padding: 8px 10px;
    border-radius: 18px;
    font-size: 14px;
  }

  .image-modal-frame {
    width: calc(100vw - 24px);
    height: calc(100dvh - 44px);
    padding: 50px 14px 14px;
    border-radius: 24px;
  }

  .modal-title {
    margin-bottom: 12px;
    font-size: 20px;
  }

  .modal-close-button {
    top: 12px;
    right: 12px;
  }

  .play-root {
    padding: 0;
  }

  .play-frame,
  .stage,
  .play-body {
    width: 100%;
    height: 100dvh;
    min-height: 0;
  }

  .stage {
    display: block;
  }

  .play-body {
    position: relative;
    display: block;
  }

  .side-rail {
    display: contents;
  }

  .main-image-wrap {
    position: absolute;
    inset: calc(env(safe-area-inset-top) + 58px) 8px calc(env(safe-area-inset-bottom) + 128px);
    width: auto;
    height: auto;
  }

  .main-image {
    border-width: 2px;
    border-radius: 24px;
    box-shadow: 0 18px 36px rgba(15, 10, 20, 0.28);
  }

  .countdown-label,
  .final-countdown-label {
    position: absolute;
    z-index: 8;
    top: calc(env(safe-area-inset-top) + 12px);
    left: 12px;
    width: auto;
    min-width: 94px;
    height: 42px;
    padding: 7px 14px;
    border-radius: 21px;
    font-size: 20px;
    box-shadow: 0 10px 22px rgba(236, 64, 122, 0.18);
  }

  .final-countdown-label {
    left: 50%;
    width: 76px;
    min-width: 76px;
    height: 76px;
    padding: 0;
    transform: translateX(-50%);
    border-radius: 50%;
    font-size: 44px;
  }

  .moving-object-frame {
    position: absolute;
    z-index: 6;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom) + 108px);
    width: 46px;
    min-width: 46px;
    height: 154px;
    min-height: 0;
    border-radius: 16px;
    opacity: 0.9;
    box-shadow: 0 10px 22px rgba(236, 64, 122, 0.18);
  }

  .play-control-panel {
    position: absolute;
    z-index: 8;
    left: 8px;
    right: 8px;
    bottom: calc(env(safe-area-inset-bottom) + 58px);
    width: auto;
    min-width: 0;
    display: grid;
    grid-template-columns: 1.08fr 1fr 1fr;
    gap: 8px;
  }

  .play-control-button {
    min-height: 50px;
    padding: 6px 4px;
    border-radius: 17px;
    font-size: 13px;
    line-height: 1.18;
    box-shadow: 0 10px 22px rgba(236, 64, 122, 0.16);
  }

  .image-color-effect {
    width: 112px;
    height: 112px;
  }

  .image-color-left {
    left: 5%;
  }

  .image-color-right {
    right: 5%;
  }

  .play-bottom-area {
    position: absolute;
    z-index: 9;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-height: calc(env(safe-area-inset-bottom) + 52px);
    padding: 0 10px calc(env(safe-area-inset-bottom) + 6px);
    pointer-events: none;
  }

  .play-bottom-area > * {
    pointer-events: auto;
  }

  .finish-actions {
    width: 100%;
    justify-content: center;
    gap: 10px;
  }

  .finish-action-button {
    width: min(148px, 42vw);
    height: 48px;
    border-radius: 24px;
    font-size: 17px;
  }

  .play-error-label {
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 20px;
    font-size: 14px;
  }
}

@media (max-width: 390px) {
  .main-title,
  .game-setting-root .main-title {
    font-size: 27px;
  }

  .preview-frame {
    height: min(calc(100dvh - 246px), 118vw);
  }

  .select-card {
    font-size: 14px;
  }

  .play-control-button {
    font-size: 12px;
  }

  .moving-object-frame {
    width: 40px;
    min-width: 40px;
    height: 138px;
  }
}

/* Final responsive pass */
.screen {
  overflow: hidden;
}

.image-select-frame,
.setting-frame,
.confirm-frame {
  max-height: calc(100dvh - 28px);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.image-select-frame {
  padding-top: clamp(16px, 2dvh, 22px);
  padding-bottom: clamp(14px, 2dvh, 22px);
}

.image-select-root .header {
  margin-bottom: clamp(10px, 1.8dvh, 20px);
}

.image-select-root .selected-count-card {
  min-height: 54px;
  margin: 6px 0 clamp(10px, 1.8dvh, 18px);
}

.image-select-root .main-panel {
  padding: clamp(12px, 1.6dvh, 16px) 22px;
}

.image-select-root .panel-top {
  min-height: 50px;
  margin-bottom: 8px;
}

.image-select-root .preview-frame {
  height: clamp(280px, 39dvh, 360px);
}

.confirm-root .image-preview-item {
  width: 120px;
  height: 156px;
}

@media (min-width: 821px) and (max-width: 1100px) {
  .screen {
    padding: 16px;
  }

  .unity-frame {
    width: min(960px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    border-radius: 34px;
  }

  .title-frame {
    padding: 40px 34px;
  }

  .image-select-frame,
  .setting-frame,
  .confirm-frame {
    padding: 24px 28px;
  }

  .back-button {
    top: 24px;
    left: 28px;
    height: 44px;
    padding: 0 26px;
    border-radius: 22px;
    font-size: 20px;
  }

  .main-title,
  .game-setting-root .main-title {
    font-size: 42px;
  }

  .viewer-layout {
    grid-template-columns: 64px minmax(0, 1fr) 64px;
  }

  .nav-button,
  .preview-nav-button {
    width: 56px;
    height: 56px;
  }

  .image-select-root .preview-frame {
    width: min(520px, 64vw);
    height: min(54dvh, 620px);
  }

  .settings-row {
    gap: 18px;
    margin-bottom: 18px;
  }

  .panel {
    min-height: 156px;
    padding: 12px 18px 22px;
  }

  .panel-title {
    font-size: 28px;
  }

  .select-card {
    font-size: 20px;
  }

  .preview-section {
    grid-template-columns: 58px minmax(0, 1fr) 58px;
  }

  .info-grid {
    width: min(680px, 100%);
  }
}

@media (max-width: 820px) {
  .image-select-frame,
  .setting-frame,
  .confirm-frame {
    max-height: none;
    padding: calc(env(safe-area-inset-top) + 10px) 12px calc(env(safe-area-inset-bottom) + 18px);
  }

  .image-select-root .header,
  .game-setting-root .header,
  .confirm-root .header {
    margin: 44px 0 14px;
  }

  .image-select-root .viewer-layout {
    flex: 0 0 auto;
    align-items: flex-start;
    margin: 0;
  }

  .image-select-root .main-panel {
    padding: 8px;
    border: 1px solid rgba(255, 111, 161, 0.82);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
  }

  .image-select-root .preview-frame {
    width: min(100%, 430px);
    height: min(68dvh, calc(100dvh - 310px), 760px);
    min-height: min(360px, calc(100dvh - 296px));
    margin: 0 auto;
  }

  .image-select-root .slot-dots {
    position: static;
    inset: auto;
    max-width: min(100%, 360px);
    margin: 10px auto 0;
    padding: 0 48px;
  }

  .image-select-root .nav-button {
    top: 50%;
    transform: translateY(-50%);
  }

  .image-select-root .viewer-layout > .prev-button {
    left: max(8px, env(safe-area-inset-left));
  }

  .image-select-root .viewer-layout > .next-button {
    right: max(8px, env(safe-area-inset-right));
  }

  .image-select-root .footer,
  .game-setting-root .footer,
  .confirm-root .footer {
    position: static;
    width: 100%;
    margin: clamp(12px, 2dvh, 18px) 0 0;
    padding: 0;
    background: transparent;
  }

  .game-setting-root .setting-frame,
  .confirm-root .confirm-frame {
    justify-content: flex-start;
  }

  .game-setting-root .settings-grid {
    width: min(100%, 430px);
    margin: 0 auto;
    padding: 0;
    gap: 10px;
    background: transparent;
    border: 0;
  }

  .game-setting-root .settings-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
  }

  .game-setting-root .panel {
    width: 100%;
    min-height: 0;
    padding: 12px;
  }

  .game-setting-root .cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  }

  .game-setting-root .select-card {
    width: 100%;
  }

  .confirm-root .preview-section {
    margin: 0 0 14px;
  }

  .confirm-root .image-preview-item {
    width: 96px;
    height: 132px;
    flex: 0 0 96px;
  }

  .confirm-root .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 390px) {
  .image-select-root .header,
  .game-setting-root .header,
  .confirm-root .header {
    margin-bottom: 12px;
  }

  .image-select-root .preview-frame {
    height: min(62dvh, calc(100dvh - 294px), 420px);
    min-height: min(300px, calc(100dvh - 286px));
  }

  .image-select-root .slot-dots {
    gap: 6px;
    padding: 0 44px;
  }

  .ok-button,
  .confirm-frame .start-button {
    width: min(292px, calc(100vw - 64px));
  }
}

/* Mobile one-hand operation */
.play-pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent;
}

.play-pause-icon {
  position: relative;
  width: 82px;
  height: 82px;
  display: block;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: rgba(20, 18, 24, 0.46);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
  opacity: 0;
  transform: scale(0.88);
  transition: opacity 220ms ease, transform 220ms ease;
}

.play-pause-overlay.is-visible .play-pause-icon {
  opacity: 1;
  transform: scale(1);
}

@media (min-width: 821px) and (hover: hover) and (pointer: fine) {
  .main-image-wrap:hover .play-pause-icon,
  .play-pause-overlay:focus .play-pause-icon,
  .play-pause-overlay:focus-visible .play-pause-icon {
    opacity: 1;
    transform: scale(1);
  }

  .main-image-wrap:hover .play-pause-overlay {
    cursor: pointer;
  }
}

.play-pause-icon::before,
.play-pause-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
}

.play-pause-icon.is-pause::before,
.play-pause-icon.is-pause::after {
  width: 10px;
  height: 32px;
  background: #fff;
  border-radius: 4px;
  transform: translate(-15px, -50%);
}

.play-pause-icon.is-pause::after {
  transform: translate(5px, -50%);
}

.play-pause-icon.is-play::before {
  width: 0;
  height: 0;
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  border-left: 28px solid #fff;
  transform: translate(-10px, -50%);
}

.play-pause-icon.is-play::after {
  display: none;
}

@media (max-width: 600px) {
  .game-setting-root .setting-frame,
  .confirm-root .confirm-frame {
    min-height: 100dvh;
    padding-bottom: calc(env(safe-area-inset-bottom) + 22px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  .game-setting-root .settings-grid {
    margin-top: auto;
    margin-bottom: auto;
  }

  .game-setting-root .panel {
    padding: 12px 12px 14px;
  }

  .game-setting-root .footer,
  .image-select-root .footer,
  .confirm-root .footer {
    margin-top: 0;
    padding-bottom: 4px;
  }

  .image-select-root .footer {
    margin-top: auto;
    padding-bottom: calc(env(safe-area-inset-bottom) + 22px);
  }

  .confirm-root .preview-section {
    margin: clamp(62px, 11dvh, 98px) 0 12px;
  }

  .confirm-root .info-grid {
    margin: 0 auto 14px;
    gap: 9px;
  }

  .confirm-root .image-preview-list {
    justify-content: flex-start;
  }

  .confirm-root .validation-error {
    min-height: 22px;
    margin: 0 0 8px;
  }

  .play-control-panel {
    position: absolute;
    z-index: 8;
    left: auto;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom) + 62px);
    width: min(150px, 40vw);
    min-width: 0;
    display: block;
  }

  .play-control-button {
    width: 100%;
    min-height: 52px;
    padding: 8px 10px;
    border-radius: 18px;
    font-size: 14px;
  }

  .moving-object-frame {
    left: 18px;
    right: auto;
    bottom: calc(env(safe-area-inset-bottom) + 140px);
    width: 46px;
    min-width: 46px;
    height: 154px;
    pointer-events: none;
  }

  .play-pause-icon {
    width: 76px;
    height: 76px;
  }
}

/* Play and confirm responsive refinements */
@media (min-width: 601px) {
  .confirm-root .preview-section {
    width: min(100%, 980px);
    min-height: clamp(168px, 22dvh, 220px);
    margin: 0 0 clamp(16px, 2dvh, 24px);
    padding: 14px clamp(10px, 2vw, 22px);
    display: grid;
    grid-template-columns: clamp(42px, 7vw, 60px) minmax(0, 1fr) clamp(42px, 7vw, 60px);
    align-items: center;
    overflow: hidden;
  }

  .confirm-root .image-preview-list {
    min-width: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 128px));
    justify-content: center;
    align-items: center;
    gap: clamp(8px, 1.5vw, 14px);
    overflow: hidden;
    scroll-snap-type: none;
  }

  .confirm-root .image-preview-item {
    width: 100%;
    max-width: 128px;
    height: clamp(132px, 20dvh, 168px);
    flex: 0 0 auto;
    border-radius: 18px;
    scroll-snap-align: unset;
  }

  .confirm-root .preview-nav-button {
    position: static;
    width: clamp(42px, 6vw, 54px);
    height: clamp(46px, 6vw, 54px);
    justify-self: center;
    transform: none;
  }

  .confirm-root .preview-section > .prev-button,
  .confirm-root .preview-section > .next-button {
    left: auto;
    right: auto;
  }

  .confirm-root .missing-preview-label {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .moving-object-frame {
    left: max(18px, calc(env(safe-area-inset-left) + 18px));
    right: auto;
    bottom: calc(env(safe-area-inset-bottom) + 136px);
    width: clamp(64px, 10vw, 82px);
    min-width: 64px;
    height: clamp(240px, 38dvh, 300px);
    min-height: 0;
    border-radius: 18px;
    pointer-events: none;
  }

  .play-control-panel {
    left: auto;
    right: max(12px, calc(env(safe-area-inset-right) + 12px));
    bottom: calc(env(safe-area-inset-bottom) + 62px);
    width: min(156px, 36vw);
    min-width: 0;
    display: block;
  }

  .play-control-panel.is-finished {
    left: max(12px, calc(env(safe-area-inset-left) + 12px));
    right: auto;
    width: min(312px, calc(100vw - 24px));
  }

  .play-control-panel .finish-actions {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
  }

  .play-control-panel .finish-action-button {
    width: auto;
    min-width: 0;
    height: 50px;
    flex: 1 1 0;
    padding: 0 10px;
    font-size: clamp(15px, 2.4vw, 18px);
  }
}

@media (min-width: 601px) and (max-width: 820px) {
  .confirm-root .preview-section {
    min-height: 176px;
  }

  .confirm-root .image-preview-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
  }

  .confirm-root .image-preview-item {
    width: 100%;
    max-width: 104px;
    height: 136px;
    justify-self: center;
  }
}

@media (max-width: 600px) {
  .confirm-root .confirm-frame {
    padding-bottom: 0;
  }

  .confirm-root .footer {
    margin-top: auto;
    padding-bottom: calc(env(safe-area-inset-bottom) + 30px);
  }

  .moving-object-frame {
    bottom: calc(env(safe-area-inset-bottom) + 132px);
    width: clamp(64px, 17vw, 76px);
    height: clamp(240px, 35dvh, 300px);
  }

  .play-control-panel.is-finished {
    bottom: calc(env(safe-area-inset-bottom) + 54px);
    width: min(300px, calc(100vw - 24px));
  }

  .play-control-panel .finish-actions {
    gap: 8px;
  }
}

/* Final pass: horizontal confirm list and resilient play stage */
@media (min-width: 821px) {
  .play-root {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .play-frame,
  .stage {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .stage {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .play-body {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .main-image-wrap,
  .main-image {
    min-width: 0;
    min-height: 0;
  }

  .main-image img {
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    object-fit: contain;
  }

  .play-bottom-area {
    min-height: clamp(44px, 7dvh, 70px);
  }
}

@media (min-width: 601px) {
  .confirm-root .preview-section {
    width: min(100%, 1080px);
    min-height: clamp(174px, 22dvh, 224px);
    display: grid;
    grid-template-columns: clamp(42px, 6vw, 60px) minmax(0, 1fr) clamp(42px, 6vw, 60px);
    overflow: hidden;
  }

  .confirm-root .image-preview-list {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: clamp(10px, 1.4vw, 16px);
    padding: 4px 6px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
  }

  .confirm-root .image-preview-list::-webkit-scrollbar {
    height: 8px;
  }

  .confirm-root .image-preview-list::-webkit-scrollbar-thumb {
    background: rgba(240, 98, 146, 0.45);
    border-radius: 999px;
  }

  .confirm-root .image-preview-item {
    width: clamp(132px, 15vw, 168px);
    max-width: none;
    height: clamp(132px, 15vw, 168px);
    flex: 0 0 clamp(132px, 15vw, 168px);
    border-radius: 20px;
    scroll-snap-align: center;
  }
}

@media (min-width: 601px) and (max-width: 820px) {
  .confirm-root .image-preview-list {
    display: flex;
    gap: 10px;
  }

  .confirm-root .image-preview-item {
    width: clamp(130px, 20vw, 150px);
    height: clamp(130px, 20vw, 150px);
    flex-basis: clamp(130px, 20vw, 150px);
  }
}

@media (max-width: 820px) {
  .moving-object-frame {
    --moving-object-travel: 85;
  }

  .play-control-panel.is-finished {
    left: auto;
    right: max(12px, calc(env(safe-area-inset-right) + 12px));
    width: min(300px, calc(100vw - 24px));
  }

  .play-control-panel .finish-actions {
    justify-content: flex-end;
  }
}

/* Confirm screen horizontal strip fix */
@media (min-width: 601px) {
  .confirm-root .confirm-frame {
    align-items: stretch;
  }

  .confirm-root .header,
  .confirm-root .info-grid,
  .confirm-root .validation-error,
  .confirm-root .footer {
    align-self: center;
  }

  .confirm-root .preview-section {
    align-self: stretch;
    width: auto;
    max-width: none;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
    grid-template-columns: clamp(44px, 5vw, 64px) minmax(0, 1fr) clamp(44px, 5vw, 64px);
  }

  .confirm-root .image-preview-list {
    width: 100%;
    min-width: 0;
    max-width: none;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
  }

  .confirm-root .image-preview-item {
    width: clamp(136px, 13vw, 172px);
    height: auto;
    aspect-ratio: 1 / 1;
    max-width: none;
    flex: 0 0 clamp(136px, 13vw, 172px);
    scroll-snap-align: center;
  }
}
