/* ==========================================================
   無限コインクリッカー - style.css
   ========================================================== */

:root {
  --color-bg-top: #fff8e1;
  --color-bg-bottom: #ffe4a3;
  --color-box: #fffaf0;
  --color-box-border: #e8a935;
  --color-primary: #d98c00;
  --color-primary-2: #ffcb3d;
  --color-text: #5a4321;
  --color-text-muted: #a9824f;
  --color-border: #f0d296;
  --header-h: 56px;
  --ad-h: 64px;
}

* {
  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);
  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(255, 255, 255, 0.55);
  border-bottom: 2px solid var(--color-border);
  z-index: 20;
}

.back-link {
  color: var(--color-text);
  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.7);
}

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

.game-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--color-primary);
}

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

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

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

.icon-btn.is-muted {
  color: var(--color-text-muted);
}

/* ---------- コインステージ（上半分・固定） ---------- */
.coin-stage {
  position: relative;
  flex: 0 0 44%;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 0.8rem 0.4rem;
  z-index: 10;
}

.stat-row {
  flex: 0 0 auto;
  display: flex;
  gap: 0.6rem;
  width: 100%;
  max-width: 420px;
  justify-content: center;
}

.stat-box {
  background: rgba(255, 255, 255, 0.75);
  border: 2px solid var(--color-border);
  border-radius: 999px;
  padding: 0.35rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

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

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

.stat-box--dps .stat-box__value {
  color: #2f9e5c;
}

/* ---------- コインタップエリア ---------- */
.coin-tap-area {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.coin-btn {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  width: min(46vw, 220px);
  height: min(46vw, 220px);
  touch-action: manipulation;
  transition: transform 0.06s ease;
  filter: drop-shadow(0 10px 22px rgba(217, 140, 0, 0.45));
}

.coin-btn:active {
  transform: scale(0.9);
}

.coin-btn.is-tapped {
  animation: coin-pop 0.16s ease;
}

@keyframes coin-pop {
  0% { transform: scale(1); }
  40% { transform: scale(0.88) rotate(-4deg); }
  100% { transform: scale(1); }
}

.coin-btn__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* ---------- 飛び出す +N エフェクト ---------- */
.float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.float-text {
  position: absolute;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--color-primary);
  text-shadow: 0 1px 0 #fff, 0 2px 6px rgba(217, 140, 0, 0.35);
  transform: translate(-50%, -50%);
  animation: float-up 0.85s ease-out forwards;
  white-space: nowrap;
}

@keyframes float-up {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.9);
  }
  20% {
    transform: translate(-50%, -70%) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -140%) scale(1);
  }
}

/* ---------- ショップパネル（下半分・スクロール） ---------- */
.shop-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.5);
  border-top: 2px solid var(--color-border);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.shop-panel__title {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.6rem 0.9rem 0.3rem;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--color-text);
}

.shop-list {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.2rem 0.7rem 0.6rem;
}

.shop-item {
  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.7rem;
}

.shop-item__icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(217, 140, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.shop-item__info {
  flex: 1 1 auto;
  min-width: 0;
}

.shop-item__name {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.shop-item__owned {
  font-size: 0.68rem;
  font-weight: 800;
  color: #fff;
  background: var(--color-primary-2);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}

.shop-item__desc {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin: 0.15rem 0 0;
}

.shop-item__buy {
  flex: 0 0 auto;
  border: none;
  border-radius: 12px;
  padding: 0.5rem 0.7rem;
  min-width: 84px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-2));
  color: #fff;
  font-weight: 900;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
}

.shop-item__buy:active {
  filter: brightness(0.92);
}

.shop-item__buy:disabled {
  background: #d8cdb8;
  color: #8a7c5e;
  cursor: not-allowed;
}

.shop-item__buy-label {
  font-size: 0.62rem;
  opacity: 0.9;
}

/* ---------- オーバーレイ ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(90, 67, 33, 0.55);
  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(90, 67, 33, 0.35);
}

.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: var(--color-text-muted);
  margin: 0;
  line-height: 1.6;
}

.guide-section__list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

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

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

.overlay__desc {
  color: var(--color-text-muted);
  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);
}

.overlay__btn-row {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.overlay__btn--ghost {
  background: rgba(217, 140, 0, 0.12);
  color: var(--color-primary);
}

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

@media (max-height: 620px) {
  .coin-stage {
    flex-basis: 38%;
    min-height: 170px;
  }
}
