/* ==========================================================
   街角のちいさな落としもの -Tiny Finders- - style.css
   ========================================================== */

:root {
  --color-bg-top: #3a2b1e;
  --color-bg-bottom: #1c140d;
  --color-box: #fff6e6;
  --color-box-border: #c98a3e;
  --color-primary: #e0762a;
  --color-primary-2: #ffb85c;
  --color-good: #4caf6d;
  --color-text: #4a3421;
  --color-text-light: #fff3dc;
  --color-text-muted: #a98a63;
  --color-border: #6b4b30;
  --header-h: 56px;
  --ad-h: 58px;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, var(--color-bg-top), var(--color-bg-bottom));
  color: var(--color-text-light);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* ---------- ヘッダー ---------- */
.game-header {
  height: var(--header-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.8rem;
  background: rgba(20, 13, 6, 0.75);
  border-bottom: 2px solid var(--color-box-border);
  z-index: 20;
}

.back-link {
  color: var(--color-text-light);
  text-decoration: none;
  font-size: 1.3rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

.back-link:active {
  background: rgba(255, 255, 255, 0.2);
}

.game-title {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--color-primary-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-light);
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.22);
}

.icon-btn.is-muted {
  color: rgba(255, 243, 220, 0.55);
}

/* ---------- HUD ---------- */
.stat-row {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem 0.3rem;
  z-index: 10;
}

.stat-box {
  flex: 0 1 auto;
  min-width: 140px;
  background: rgba(20, 13, 6, 0.55);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 0.3rem 0.5rem;
  text-align: center;
  line-height: 1.25;
}

.stat-box__label {
  display: block;
  font-size: 0.6rem;
  font-weight: bold;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.stat-box__value {
  display: block;
  font-size: 0.98rem;
  font-weight: 900;
  color: var(--color-primary-2);
  white-space: nowrap;
}

/* ---------- 探索シーン（ピンチズーム/ドラッグ対応） ---------- */
.scene-viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #0f0a05;
  touch-action: none;
}

.scene-content {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.scene-bg {
  display: block;
  image-rendering: pixelated;
  -webkit-user-drag: none;
  pointer-events: none;
}

.scene-item {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  image-rendering: pixelated;
}

.scene-item.is-found {
  animation: found-pop 0.5s ease-out forwards;
}

@keyframes found-pop {
  0% { filter: brightness(1.6) drop-shadow(0 0 16px rgba(255, 240, 160, 0.9)); transform: translate(-50%, -50%) scale(1.35); }
  100% { filter: brightness(1) drop-shadow(0 0 0 rgba(255, 240, 160, 0)); transform: translate(-50%, -50%) scale(1); opacity: 0.35; }
}

.found-glow {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 240, 170, 0.95) 0%, rgba(255, 200, 100, 0.5) 40%, rgba(255, 200, 100, 0) 72%);
  opacity: 0;
}

.found-glow.is-active {
  animation: found-glow-pulse 0.9s ease-out forwards;
}

@keyframes found-glow-pulse {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }
}

.miss-ripple {
  position: absolute;
  width: 46px;
  height: 46px;
  margin-left: -23px;
  margin-top: -23px;
  border: 3px solid rgba(255, 120, 120, 0.85);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

.miss-ripple.is-active {
  animation: miss-ripple-anim 0.5s ease-out forwards;
}

@keyframes miss-ripple-anim {
  0% { opacity: 0.9; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(1.6); }
}

.zoom-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  font-size: 0.7rem;
  font-weight: bold;
  color: var(--color-text-light);
  background: rgba(20, 13, 6, 0.6);
  border: 1px dashed rgba(255, 255, 255, 0.35);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.zoom-hint.is-hidden {
  opacity: 0;
}

.found-banner {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  z-index: 9;
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff3dc;
  text-shadow: 0 3px 0 rgba(150, 90, 20, 0.8), 0 6px 16px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
}

.found-banner.is-visible {
  animation: found-banner-anim 1.1s ease-out forwards;
}

@keyframes found-banner-anim {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  40% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* ---------- お題カード ---------- */
.target-bar {
  flex: 0 0 auto;
  padding: 0.5rem 0.7rem;
  background: rgba(20, 13, 6, 0.55);
  border-top: 2px solid var(--color-border);
}

.target-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--color-box);
  border: 2px solid var(--color-box-border);
  border-radius: 16px;
  padding: 0.5rem 0.8rem;
  max-width: 420px;
  margin: 0 auto;
}

.target-card__icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
}

.target-card__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.target-card__label {
  font-size: 0.62rem;
  font-weight: bold;
  color: var(--color-text-muted);
}

.target-card__name {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 広告スペース ---------- */
.ad-slot {
  flex: 0 0 var(--ad-h);
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 2px dashed var(--color-border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  overflow: hidden;
}

/* ---------- オーバーレイ ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 2, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 1rem;
}

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

.overlay__box {
  text-align: center;
  padding: 1.8rem 2rem;
  background: var(--color-box);
  border: 3px solid var(--color-box-border);
  border-radius: 22px;
  max-width: 85%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  color: var(--color-text);
}

.overlay__box--wide {
  max-width: min(92%, 460px);
  max-height: 88%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.guide-section {
  text-align: left;
  margin: 1rem 0;
}

.guide-section__title {
  font-size: 0.92rem;
  color: var(--color-primary);
  margin: 0 0 0.4rem;
}

.guide-section__text {
  font-size: 0.82rem;
  color: #6b5236;
  margin: 0;
  line-height: 1.6;
}

.guide-section__list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: #6b5236;
  line-height: 1.7;
}

.guide-section__list li {
  margin-bottom: 0.3rem;
}

.overlay__title {
  font-size: 1.4rem;
  font-weight: 900;
  margin: 0 0 0.5rem;
  color: var(--color-primary);
}

.overlay__result-emoji {
  font-size: 2.4rem;
  margin: 0 0 0.2rem;
}

.overlay__desc {
  color: #6b5236;
  margin: 0 0 1.3rem;
  font-size: 0.9rem;
  font-weight: bold;
}

.overlay__btn {
  border: none;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-2));
  color: #fff;
  font-weight: bold;
  font-size: 0.95rem;
  padding: 0.8rem 1.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.overlay__btn:active {
  filter: brightness(0.92);
}

@media (max-height: 620px) {
  .target-card__icon {
    width: 38px;
    height: 38px;
  }
  .ad-slot {
    --ad-h: 42px;
    font-size: 0.64rem;
  }
}
