/* Browser default reset: document body only */
body {
  margin: 0;
  padding: 0;
  border: 0;
}

:root {
  --stage-max-width: 1000px;
  --move-duration: 1400ms;
  --move-delay: 220ms;
}
* { box-sizing: border-box; }
#LS_MAIN {
  position: relative;
  margin: 0;
  padding: 130px 12px;
  color: #1e293b;
  text-align: center;
  background-image: url('../img/bg_01.webp');
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.screen[hidden] { display: none !important; }
#gameScreen {
  min-height: calc(100vh - 40px);
  min-height: calc(100dvh - 40px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.global-corner-logo {
  position: absolute;
  z-index: 8000;
  height: auto;
  pointer-events: none;
}
#LS_MAIN .global-corner-logo-right {
  right: clamp(8px, 2vw, 24px);
  bottom: 32px;
  width: min(18vw, 140px);
}

h2 { margin: 0 0 14px; font-size: clamp(24px, 4vw, 36px); }
.title-screen {
  position: relative;
  min-height: calc(100vh - 40px);
  display: grid;
  place-items: center;
}
.title-card {
  width: min(96vw, 1600px);
  height: 95vh;
  height: 95dvh;
  padding: clamp(18px, 3vw, 36px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 32px;
  background: transparent;
  box-shadow: none;
}
.title-logo {
  width: 100%;
  max-width: 800px;
  margin: 0 auto clamp(14px, 2vw, 24px);
}
.title-logo img,
.title-visual img {
  display: block;
  width: 100%;
  height: auto;
}
.title-visual {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto clamp(20px, 3vw, 34px);
}
.primary-button.title-start-button {
  position: relative;
  min-width: 400px;
  padding: 23px 68px;
  border: 3px solid #fff;
  border-radius: 999px;
  color: #65401f;
  background: linear-gradient(180deg, #fff8b8 0%, #ffd86f 100%);
  box-shadow: 0 6px 0 #dca948, 0 11px 24px rgba(111, 78, 30, .22), inset 0 2px 0 rgba(255, 255, 255, .85);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: .08em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .9);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}
.primary-button.title-start-button::before,
.primary-button.title-start-button::after {
  content: '★';
  position: absolute;
  top: 50%;
  color: #ff8ca8;
  font-size: 21px;
  transform: translateY(-50%);
}
.primary-button.title-start-button::before { left: 30px; }
.primary-button.title-start-button::after { right: 30px; }
.primary-button.title-start-button:hover {
  background: linear-gradient(180deg, #fffbc9 0%, #ffe184 100%);
  filter: brightness(1.02);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 0 #dca948, 0 14px 26px rgba(111, 78, 30, .24), inset 0 2px 0 rgba(255, 255, 255, .9);
}
.primary-button.title-start-button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #dca948, 0 6px 14px rgba(111, 78, 30, .18), inset 0 2px 0 rgba(255, 255, 255, .9);
}
.primary-button, .modal-content button {
  min-width: 180px;
  padding: 14px 28px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: #2563eb;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}
.primary-button:hover, .modal-content button:hover { background: #1d4ed8; }
.primary-button:focus-visible, .modal-content button:focus-visible {
  outline: 4px solid #93c5fd;
  outline-offset: 3px;
}
#status, #timer { margin: 0 0 16px; font-size: clamp(18px, 3vw, 24px); font-weight: 700; }
#status { min-height: 1.5em; }
#timer { color: #e11d48; }
#timer.warning { color: #dc2626; animation: blink .5s infinite; }
@keyframes blink { 50% { opacity: .4; } }
.stage {
  position: relative;
  width: min(100%, var(--stage-max-width));
  height: 95vh;
  height: 95dvh;
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 5px 18px rgba(15, 23, 42, .08);
  touch-action: manipulation;
  user-select: none;
}
.hide-box {
  position: absolute;
  left: 5%;
  top: 5%;
  width: 90%;
  height: 90%;
  z-index: 10;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  pointer-events: none;
}
.hide-box img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
}
.character {
  position: absolute;
  z-index: 20;
  width: clamp(46px, 8vw, 82px);
  height: clamp(46px, 8vw, 82px);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: default;
  pointer-events: none;
  transition: left var(--move-duration) cubic-bezier(.45, 0, .2, 1), top var(--move-duration) cubic-bezier(.45, 0, .2, 1), transform 250ms ease, opacity 250ms ease;
  will-change: left, top;
}
.character img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.character.is-hiding, .character.game-ready, .character.found { z-index: 5; }
.character.game-ready { cursor: pointer; pointer-events: auto; }
.character.game-ready:hover { transform: translate(-50%, -50%) scale(1.12); }
.character.game-ready:focus-visible { outline: 4px solid #fff; box-shadow: 0 0 0 7px #2563eb; }
.character.found { opacity: .82; cursor: default; pointer-events: none; }
.discovery-ring {
  position: absolute;
  z-index: 50;
  width: clamp(90px, 16vw, 155px);
  height: clamp(90px, 16vw, 155px);
  border: clamp(4px, .6vw, 6px) solid gold;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  animation: ring-appear 800ms ease forwards, ring-pulse 1300ms infinite 800ms;
}
@keyframes ring-appear {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes ring-pulse { 0%,100% { box-shadow: 0 0 10px gold; } 50% { box-shadow: 0 0 30px gold; } }
.miss-mark {
  position: absolute;
  z-index: 100;
  color: #ff3333;
  font-size: clamp(40px, 8vw, 80px);
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.2);
  animation: miss-animation 800ms ease forwards;
}
@keyframes miss-animation {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2); }
  40% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}
.description { margin: 18px 12px 0; color: #64748b; font-size: clamp(14px, 2vw, 16px); }
.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .7);
}
.modal.is-open { display: flex; }
.modal-content {
  position: relative;
  z-index: 10001;
  width: min(92vw, 720px);
  height: 95vh;
  height: 95dvh;
  max-height: 95vh;
  max-height: 95dvh;
  padding: clamp(14px, 2.5dvh, 28px) clamp(18px, 4vw, 40px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  animation: popup 300ms ease;
}
.modal-content h3 {
  width: 100%;
  margin: 0 0 clamp(8px, 1.5dvh, 14px);
}
.modal-content h3 span {
  display: block;
  margin-top: clamp(6px, 1dvh, 10px);
  padding-bottom: clamp(5px, .8dvh, 8px);
  color: #FF3B8E;
  font-size: clamp(20px, 5vw, 24px);
  font-weight: 700;
  line-height: 1.45;
}
.result-status-title {
  display: block;
  width: min(80%, 350px);
  height: auto;
  margin: 0 auto;
}
.result-case-title {
  display: block;
  width: min(72%, 390px);
  max-height: 11dvh;
  height: auto;
  margin: 0 auto clamp(6px, 1dvh, 10px);
  object-fit: contain;
}
.result-case-title[hidden] { display: none; }
.result-shape-image {
  display: block;
  width: min(78%, 480px);
  max-height: 35dvh;
  height: auto;
  margin: 0 auto clamp(10px, 1.6dvh, 18px);
  object-fit: contain;
}
.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(8px, 1.2dvh, 14px);
}
.result-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 210px;
  padding: 14px 24px;
  border: 3px solid #fff;
  border-radius: 999px;
  color: #65401f;
  background: linear-gradient(180deg, #fff8b8 0%, #ffd86f 100%);
  box-shadow: 0 5px 0 #dca948, 0 9px 20px rgba(111, 78, 30, .2);
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}
.result-product-link {
  display: inline-flex;
  align-items: end;
  justify-content: center;
  min-width: 210px;
  padding: 14px 24px;
  border: 3px solid #fff;
  border-radius: 999px;
  color: #65401f;
  background: linear-gradient(180deg, #fff8b8 0%, #ffd86f 100%);
  box-shadow: 0 5px 0 #dca948, 0 9px 20px rgba(111, 78, 30, .2);
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}
.result-actions button:hover,
.result-product-link:hover {
  background: linear-gradient(180deg, #fffbc9 0%, #ffe184 100%);
  transform: translateY(-2px);
}
#restartButton {
  line-height: 1;
  color: #185a3a;
  background: linear-gradient(180deg, #c9f7cb 0%, #78d989 100%);
  box-shadow: 0 5px 0 #45a85f, 0 9px 20px rgba(35, 122, 70, .22);
}
#restartButton ruby {
  position: relative;
  display: inline-block;
  line-height: 1;
  vertical-align: baseline;
  ruby-position: unset;
}
#restartButton rt {
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: max-content;
  font-size: .5em;
  line-height: 1;
  transform: translate(-50%, .05em);
}
#restartButton:hover {
  background: linear-gradient(180deg, #dcf9d9 0%, #8fe49d 100%);
  box-shadow: 0 7px 0 #45a85f, 0 12px 22px rgba(35, 122, 70, .24);
}
.result-product-link {
  color: #8a2453;
  background: linear-gradient(180deg, #ffd4e6 0%, #ff82b8 100%);
  box-shadow: 0 5px 0 #dc4f8c, 0 9px 20px rgba(180, 55, 112, .22);
}
.result-product-link:hover {
  background: linear-gradient(180deg, #ffe2ee 0%, #ff98c5 100%);
  box-shadow: 0 7px 0 #dc4f8c, 0 12px 22px rgba(180, 55, 112, .24);
}

@keyframes popup { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
.celebration-canvas {
  position: fixed;
  inset: 0;
  z-index: 10000;
  width: 100%;
  height: 100%;
  pointer-events: none;
}


@media (max-width: 767px) {
  .title-screen {
    height: auto;
    min-height: 0;
    max-height: none;
  }
  .title-card {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  #LS_MAIN { padding-top: 80px; padding-bottom: 80px; }
  
#LS_MAIN .global-corner-logo-right { width: min(25vw, 110px); }

  .title-card {
    width: 100%;
    padding: 14px 8px 40px;
  }
  .title-logo { width: 100%; }
  .title-visual { width: 100%; }
  .primary-button.title-start-button {
    min-width: min(400px, calc(100vw - 32px));
    padding: 13px 32px;
    font-size: 21px;
  }

  .stage {
    height: 70vh;
    height: 70dvh;
  }

  #stage #status,
  #stage #timer {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  #LS_MAIN { padding: 80px 8px; }
  .stage { border-radius: 10px; }
  .description { margin-top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  :root { --move-duration: 1ms; --move-delay: 0ms; }
  .character, .discovery-ring, .miss-mark, .modal-content {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
  }
}

.howto-screen {
  min-height: calc(100vh - 40px);
  display: grid;
  place-items: center;
}
.howto-card {
  width: min(92vw, 1000px);
  min-height: min(72vh, 560px);
  padding: clamp(28px, 6vw, 48px) clamp(20px, 6vw, 44px);
  border: 2px solid #cbd5e1;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 16px 40px rgba(15, 23, 42, .12);
  display: flex;
  flex-direction: column;
}
.howto-step { margin: 14px 0 0; color: #64748b; font-size: 14px; font-weight: 700; }
.howto-card h3 {
  margin: 0 0 28px;
  padding: 0 12px 10px;
  color: #FF3B8E;
  border-bottom: 2px dotted currentColor;
  font-size: clamp(25px, 5vw, 36px);
}
.howto-content { flex: 1; display: grid; place-items: center; }
.howto-text { margin: 0; font-size: clamp(18px, 3.5vw, 24px); font-weight: 700; line-height: 1.8; }
.howto-content-01 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3vw, 32px);
}
.howto-character-image {
  display: block;
  width: min(80%, 400px);
  max-width: 400px;
  height: auto;
}
.howto-content-02,
.howto-content-03 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3vw, 32px);
}
.howto-image {
  display: block;
  width: min(80%, 600px);
  max-width: 600px;
  height: auto;
}

.howto-actions { margin-top: 32px; }
.howto-actions .primary-button {
  position: relative;
  min-width: 240px;
  padding: 17px 38px;
  border: 3px solid #fff;
  border-radius: 999px;
  color: #65401f;
  background: linear-gradient(180deg, #fff8b8 0%, #ffd86f 100%);
  box-shadow: 0 5px 0 #dca948, 0 9px 20px rgba(111, 78, 30, .2), inset 0 2px 0 rgba(255, 255, 255, .85);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: .08em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .9);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}
.howto-actions .primary-button::before,
.howto-actions .primary-button::after {
  content: '★';
  position: absolute;
  top: 50%;
  color: #ff8ca8;
  font-size: 15px;
  transform: translateY(-50%);
}
.howto-actions .primary-button::before { left: 20px; }
.howto-actions .primary-button::after { right: 20px; }
.howto-actions .primary-button:hover {
  background: linear-gradient(180deg, #fffbc9 0%, #ffe184 100%);
  filter: brightness(1.02);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 7px 0 #dca948, 0 12px 22px rgba(111, 78, 30, .22), inset 0 2px 0 rgba(255, 255, 255, .9);
}
.howto-actions .primary-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #dca948, 0 5px 12px rgba(111, 78, 30, .18), inset 0 2px 0 rgba(255, 255, 255, .9);
}


#LS_MAIN.case_01 { background-image: url('../img/bg_01.webp'); }
#LS_MAIN.case_02 { background-image: url('../img/bg_02.webp'); }
#LS_MAIN.case_03 { background-image: url('../img/bg_03.webp'); }


/* Result screen states */
#LS_MAIN.case_01 .result-clear .modal-content { }
#LS_MAIN.case_01 .result-gameover .modal-content { }
#LS_MAIN.case_02 .result-clear .modal-content { }
#LS_MAIN.case_02 .result-gameover .modal-content { }
#LS_MAIN.case_03 .result-clear .modal-content { }
#LS_MAIN.case_03 .result-gameover .modal-content { }


/* Game start countdown */
.start-countdown {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(0, 0, 0, .32);
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
}
.start-countdown.is-active { opacity: 1; visibility: visible; }
.start-countdown-text {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(130px, 28vw, 260px);
  min-height: clamp(130px, 28vw, 260px);
  padding: 20px;
  color: #fff;
  font-size: clamp(72px, 18vw, 180px);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 4px 12px rgba(0, 0, 0, .35), 0 0 30px rgba(255, 255, 255, .35);
}
.start-countdown.is-start .start-countdown-text {
  min-width: 0;
  min-height: 0;
  font-size: clamp(52px, 12vw, 120px);
  white-space: nowrap;
}
.start-countdown-text.is-pop { animation: countdown-pop 700ms ease; }
@keyframes countdown-pop {
  0% { opacity: 1; transform: scale(.4); }
  30% { opacity: 1; transform: scale(1.18); }
  65% { opacity: 1; transform: scale(1); }
  100% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .start-countdown { transition-duration: 1ms !important; }
  .start-countdown-text.is-pop { animation-duration: 1ms !important; }
}

ruby { ruby-position: over; }
rt { font-size: .5em; font-weight: 500; line-height: 1; }

#LS_MAIN, #LS_MAIN button, #LS_MAIN input, #LS_MAIN select, #LS_MAIN textarea { font-family: 'M PLUS Rounded 1c', sans-serif; }


/* Game HUD layout */
#stage #status,
#stage #timer {
  position: absolute;
  top: 16px;
  z-index: 30;
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.35;
  pointer-events: none;
}

#stage #status {
  left: 16px;
  text-align: left;
}

#stage #timer {
  right: 16px;
  text-align: right;
}

@media (max-width: 600px) {
  #stage #status,
  #stage #timer {
    top: 10px;
    padding: 6px 9px;
    font-size: 13px;
  }

  #stage #status { left: 10px; }
  #stage #timer { right: 10px; }
}

.result-title-link { display:inline-block; margin-top:clamp(18px,2.4dvh,26px); padding:4px 2px 2px; color:#64748b; font-size:clamp(14px,2.2vw,16px); font-weight:700; line-height:1.5; text-decoration:underline dotted; text-underline-offset:5px; }
.result-title-link:hover { color:#FF3B8E; }

.result-characters { width:min(100%,520px); margin:clamp(12px,1.8dvh,18px) auto 0; display:flex; align-items:flex-end; justify-content:center; gap:clamp(6px,1.2vw,12px); }
.result-characters[hidden]{display:none}.result-characters img{display:block;width:clamp(46px,7vw,76px);height:clamp(46px,7vw,76px);object-fit:contain}

#resultModal { overflow-y:auto; overflow-x:hidden; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; padding-block:2.5dvh; }
#resultModal .modal-content { height:auto; min-height:0; max-height:none; flex-shrink:0; }

@media (max-width:767px){
 #resultModal.is-open{display:flex;align-items:flex-start;justify-content:center;padding-top:max(20px,env(safe-area-inset-top));padding-right:12px;padding-bottom:max(20px,env(safe-area-inset-bottom));padding-left:12px}
 #resultModal .modal-content{margin:0 auto}
 #resultModal .result-actions{gap:14px}
 .result-title-link{margin-top:16px;font-size:14px}
 .result-characters{width:min(100%,360px);margin-top:10px;gap:4px}
 .result-characters img{width:clamp(42px,13vw,58px);height:clamp(42px,13vw,58px)}
 .howto-actions .primary-button{min-width:170px;width:auto;padding:9px 34px;font-size:15px;line-height:1.3;white-space:nowrap}
 #gameStartButton{min-width:210px}
}

#LS_HEADER.is-fixed {
  background-color: rgba(255, 255, 255, 0);
}
