/* ==============================
  Base
============================== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Arial", "Helvetica", sans-serif;
  color: #1f2937;
  background: #f4f8fb;
  line-height: 1.7;
}

body.modal-open {
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

.congrats-lottie {
  width: 280px;
  height: 280px;
  margin: 0 auto 10px;
}

.congrats-lottie dotlottie-wc {
  width: 100%;
  height: 100%;
  display: block;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
}

.game-page {
  width: min(1180px, 92%);
  margin: 0 auto;
  padding: 40px 0 70px;
}

/* ==============================
  Hero
============================== */

.game-hero {
  margin-bottom: 34px;
  padding: 48px 36px;
  text-align: center;
  color: #ffffff;
  background: linear-gradient(135deg, #1e90ff, #4fb3ff);
  border-radius: 28px;
  box-shadow: 0 18px 40px rgba(30, 144, 255, 0.22);
}

.game-hero-small {
  padding: 38px 28px;
}

.game-label {
  display: inline-block;
  margin: 0 0 10px;
  padding: 5px 14px;
  color: #1e90ff;
  background: #ffffff;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.game-hero h1 {
  margin: 20px 0 14px;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1.15;
}

.game-hero p {
  max-width: 760px;
  margin: 0 auto;
  font-size: 1.05rem;
}

/* ==============================
  Game List
============================== */

.game-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.game-card {
  overflow: hidden;
  display: block;
  text-decoration: none;
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.10);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.game-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
}

.game-card-image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e5eef7;
}

.game-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card-body {
  padding: 22px;
}

.game-card-label {
  margin: 0 0 8px;
  color: #1e90ff;
  font-size: 0.85rem;
  font-weight: 700;
}

.game-card h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
  line-height: 1.35;
}

.game-card p {
  margin: 0;
}

.best-time-box {
  margin-top: 16px;
  padding: 12px 14px;
  color: #475569;
  background: #f0f7ff;
  border: 1px solid #cfe7ff;
  border-radius: 14px;
  font-size: 0.95rem;
}

.best-time-box strong {
  color: #1e90ff;
}

/* ==============================
  Spot Game
============================== */

.spot-game {
  padding: 28px;
  background: #ffffff;
  border-radius: 28px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.game-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.status-box {
  padding: 10px 16px;
  text-align: center;
  background: #f0f7ff;
  border: 1px solid #cfe7ff;
  border-radius: 16px;
}

.status-label {
  display: block;
  color: #64748b;
  font-size: 0.8rem;
}

.status-box strong {
  color: #1e90ff;
  font-size: 1.2rem;
}

.stage-title-box {
  margin: 0 0 18px;
  padding: 18px 20px;
  text-align: center;
  background: #f8fafc;
  border-radius: 18px;
}

.stage-label {
  margin: 0 0 4px;
  color: #1e90ff;
  font-size: 0.9rem;
  font-weight: 700;
}

.stage-title-box h2 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  line-height: 1.3;
}

.game-instruction {
  margin: 0 0 24px;
  text-align: center;
  color: #475569;
}

/* PC：左右表示 */
.image-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
}

.image-panel h2 {
  margin: 0 0 10px;
  text-align: center;
  font-size: 1.1rem;
}

.image-frame {
  position: relative;
  overflow: hidden;
  background: #eef5fb;
  border: 4px solid #ffffff;
  border-radius: 20px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.image-frame img {
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.answer-frame {
  cursor: pointer;
  touch-action: manipulation;
}

/* 正解した時に出る丸 */
.found-marker {
  position: absolute;
  border: 4px solid #ff3b30;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: markerPop 0.28s ease;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.75);
}

@keyframes markerPop {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }

  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

/* ミスした時の表示 */
.miss-effect {
  position: absolute;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.miss-effect::before,
.miss-effect::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 0;
  width: 3px;
  height: 22px;
  background: #334155;
  border-radius: 999px;
}

.miss-effect::before {
  transform: rotate(45deg);
}

.miss-effect::after {
  transform: rotate(-45deg);
}

/* ==============================
  Clear / Result
============================== */

.clear-message,
.result-message {
  display: none;
  margin-top: 28px;
  padding: 28px;
  text-align: center;
  border-radius: 22px;
}

.clear-message {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.result-message {
  background: #f8fafc;
  border: 1px solid #dbeafe;
}

.clear-message.is-show,
.result-message.is-show {
  display: block;
}

.clear-message h2,
.result-message h2 {
  margin: 0 0 8px;
  font-size: 1.8rem;
}

.clear-message h2 {
  color: #15803d;
}

.result-message h2 {
  color: #1e90ff;
}

.clear-message p,
.result-message p {
  margin: 0 0 18px;
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.primary-btn {
  border: none;
  color: #ffffff;
  background: #1e90ff;
}

.secondary-btn {
  color: #1e90ff;
  background: #ffffff;
  border: 1px solid #bfdbfe;
}

.primary-btn:hover,
.secondary-btn:hover {
  opacity: 0.9;
}

.total-result-box {
  width: min(480px, 100%);
  margin: 20px auto;
  padding: 18px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.total-result-box p {
  margin: 0 0 8px;
}

.best-time-message {
  color: #475569;
  font-weight: 700;
}

.best-time-message.is-new-best {
  color: #dc2626;
}

.result-table-wrap {
  overflow-x: auto;
  margin-top: 22px;
  background: #ffffff;
  border-radius: 18px;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.result-table th,
.result-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 0.95rem;
}

.result-table th {
  color: #334155;
  background: #eaf4ff;
}

.result-table td {
  color: #475569;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

/* ==============================
  Note
============================== */

.game-note {
  margin-top: 34px;
  padding: 28px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.game-note h2 {
  margin: 0 0 12px;
}

.game-note p {
  margin: 0 0 14px;
}

/* ==============================
  Responsive
============================== */

@media (max-width: 900px) {
  .game-status {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {

  .game-page {
    width: min(94%, 680px);
    padding-top: 24px;
  }

  .game-hero {
    padding: 34px 22px;
    border-radius: 22px;
  }

  .spot-game {
    padding: 20px;
    border-radius: 22px;
  }

  /* スマホ：上下表示 */
  .image-compare {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .image-panel h2 {
    font-size: 1rem;
  }

  .image-frame {
    border-radius: 16px;
  }

  .clear-message,
  .result-message {
    padding: 24px 18px;
  }

  .result-actions {
    flex-direction: column;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .game-status {
    gap: 10px;
  }

  .status-box {
    padding: 8px 10px;
  }

  .status-box strong {
    font-size: 1rem;
  }
}

/* ==============================
  Modal Clear / Result
============================== */

.game-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
  align-items: center;
  justify-content: center;
}

.game-modal.is-show {
  display: flex;
}

.game-modal-card {
  width: min(620px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 34px 28px;
  text-align: center;
  background: #ffffff;
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  animation: modalPop 0.24s ease;
}

.stage-clear-card {
  border: 1px solid #bbf7d0;
  background: linear-gradient(180deg, #f0fdf4, #ffffff);
}

.result-modal-card {
  width: min(1040px, 94vw);
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
}

.modal-label {
  display: inline-block;
  margin: 0 0 8px;
  padding: 5px 14px;
  color: #1e90ff;
  background: #eaf4ff;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.stage-clear-card .modal-label {
  color: #15803d;
  background: #dcfce7;
}

.game-modal-card h2 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
}

.stage-clear-card h2 {
  color: #15803d;
}

.result-modal-card h2 {
  color: #1e90ff;
}

.modal-time {
  margin: 0 0 22px;
  font-size: 1.1rem;
}

.modal-time strong {
  color: #1e90ff;
  font-size: 1.25rem;
}

@keyframes modalPop {
  0% {
    transform: translateY(12px) scale(0.96);
    opacity: 0;
  }

  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* 既存のclear-message / result-messageの下表示を無効化 */
.clear-message,
.result-message {
  margin-top: 0;
}

/* 結果表はモーダル内で見やすく */
.result-modal .result-table-wrap {
  max-height: 42vh;
  overflow: auto;
  margin-top: 22px;
}

.result-modal .total-result-box {
  margin: 20px auto;
}

/* スマホ調整 */
@media (max-width: 768px) {
  .game-modal {
    padding: 16px;
    align-items: center;
  }

  .game-modal-card {
    padding: 28px 18px;
    border-radius: 22px;
  }

  .result-modal-card {
    width: 96vw;
    max-height: 88vh;
  }

  .result-modal .result-table-wrap {
    max-height: 36vh;
  }
}

/* ==============================
  Hint
============================== */

.hint-wrap {
  display: grid;
  gap: 14px;
  margin: 0 auto 24px;
}

.hint-area {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: 14px 18px;
  text-align: center;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 18px;
}

.hint-area.is-show {
  display: flex;
  flex-wrap: wrap;
}

.last-hint-area {
  background: #fff7ed;
  border-color: #fed7aa;
}

.hint-message {
  margin: 0;
  color: #9a3412;
  font-weight: 700;
}

.hint-btn {
  border: none;
  padding: 10px 18px;
  color: #ffffff;
  background: #f97316;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.hint-btn:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

.hint-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint-marker {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: rgba(255, 230, 80, 0.32);
  box-shadow:
    0 0 0 10px rgba(255, 230, 80, 0.22),
    0 0 34px rgba(255, 210, 0, 0.9);
  animation: hintPulse 1s ease-in-out infinite;
}

@keyframes hintPulse {
  0%,
  100% {
    opacity: 0.45;
    transform: translate(-50%, -50%) scale(0.92);
  }

  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.16);
  }
}

/* Difficulty表示が5列になるための調整 */
.game-status {
  grid-template-columns: repeat(5, minmax(110px, 1fr));
}

@media (max-width: 980px) {
  .game-status {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 620px) {
  .game-status {
    grid-template-columns: repeat(2, 1fr);
  }

  .hint-area {
    padding: 12px;
  }

  .hint-btn {
    width: 100%;
    max-width: 220px;
  }
  
}