/* =============================================================
   シーズン果物ショップ - ゲーム内UIスタイル
   ダーク背景＋金縁カードのゲームらしいデザイン
   ============================================================= */

:root {
  --bg:            #0e0b08;
  --card-bg-top:   #312010;
  --card-bg-bot:   #1c1008;
  --border:        #8b6510;
  --border-light:  #c8960e;
  --text:          #f0d898;
  --text-muted:    #9a8060;
  --text-dim:      #6a5040;
  --btn-bg:        #7a4e08;
  --btn-border:    #c8820a;
  --btn-text:      #ffe090;
  --btn-disabled:  #2e2218;
  --sold-overlay:  rgba(0,0,0,0.65);
  --gold:          #f0b800;
  --red:           #d04030;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* =====================================================
   ヘッダー
   ===================================================== */
.shop-header {
  background: linear-gradient(180deg, #221508 0%, #150e05 100%);
  border-bottom: 2px solid var(--border);
  padding: 12px 16px 10px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-top {
  margin-bottom: 8px;
}

.app-title {
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.02em;
}

.fruits-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}

.fruits-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fruits-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

#fruitsInput {
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border-light);
  color: var(--gold);
  font-size: 1.4rem;
  font-weight: 900;
  font-family: inherit;
  width: 110px;
  text-align: right;
  outline: none;
  padding: 2px 4px;
}

.fruit-icon { font-size: 1.3rem; }

.spent-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.spent-row strong { color: var(--text); }

/* =====================================================
   グリッド
   ===================================================== */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px 10px 30px;
  max-width: 520px;
  margin: 0 auto;
}

/* =====================================================
   アイテムカード
   ===================================================== */
.item-card {
  background: linear-gradient(170deg, var(--card-bg-top), var(--card-bg-bot));
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    inset 0 1px 0 rgba(200,150,14,0.15),
    0 4px 12px rgba(0,0,0,0.6);
  position: relative;
  transition: border-color 0.2s;
}
.item-card:not(.sold-out):hover {
  border-color: var(--border-light);
}

/* 画像エリア */
.card-image {
  position: relative;
  background: linear-gradient(135deg, #1a0f05, #0a0704);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}

.item-emoji {
  font-size: 2.6rem;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8));
  user-select: none;
}

/* 画像アイテム：正方形エリアいっぱいに表示 */
.item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* 数量バッジ（右下） */
.qty-badge {
  position: absolute;
  bottom: 4px;
  right: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  background: rgba(0,0,0,0.7);
  padding: 1px 4px;
  border-radius: 3px;
}

/* カード本文 */
.card-body {
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.item-name {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  text-align: center;
  min-height: calc(1.3em * 2);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.exchanges {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
}
.exchanges .ex-count {
  color: var(--text);
  font-weight: 700;
}

/* 価格ラベル */
.price-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 0 2px;
  border-top: 1px solid rgba(139, 101, 16, 0.4);
}

.price-fruit { font-size: 0.85rem; }

.price-num {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--btn-text);
  letter-spacing: 0.02em;
}

/* ＋/－ コントロール */
.qty-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  background: linear-gradient(180deg, #9a6510 0%, #5a3a08 100%);
  border: 1px solid var(--btn-border);
  border-radius: 5px;
  color: var(--btn-text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.12s, transform 0.08s;
  line-height: 1;
  flex-shrink: 0;
}
.qty-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #c07e14 0%, #7a4e08 100%);
}
.qty-btn:active:not(:disabled) { transform: scale(0.92); }
.qty-btn:disabled {
  background: var(--btn-disabled);
  border-color: #3a2810;
  color: var(--text-dim);
  cursor: not-allowed;
}

.qty-count {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 900;
  color: var(--text);
  min-width: 20px;
  text-align: center;
}

/* 売り切れオーバーレイ：画像エリアだけに適用（ボタンは暗くしない） */
.item-card.sold-out .card-image::after {
  content: "交換済";
  position: absolute;
  inset: 0;
  background: var(--sold-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--text-muted);
  pointer-events: none;
}


/* =====================================================
   PC幅
   ===================================================== */
@media (min-width: 480px) {
  .item-emoji { font-size: 3rem; }
  .item-name  { font-size: 0.75rem; }
  .exchanges  { font-size: 0.72rem; }
  .buy-btn    { font-size: 0.88rem; padding: 7px 4px; }
}
