/* ==========================================================
   マンドレイクコレクション ポータル — 共通デザインシステム
   パステル×植物: 黄緑 / 茶 / オフホワイト
   ========================================================== */
:root {
  --c-bg: #f6f3eb;
  --c-paper: #fffdf6;
  --c-ink: #4a3f35;
  --c-ink-soft: #7a6c5d;
  --c-brown: #8b6b4f;
  --c-brown-deep: #6b4f3a;
  --c-leaf: #8fbf6f;
  --c-leaf-deep: #679a4e;
  --c-leaf-pale: #e7f0d8;
  --c-leaf-mist: #f0f5e6;
  --c-gold: #e0b45c;
  --c-gold-pale: #f7ecd2;
  --c-pink: #f2c4ce;
  --c-red: #d97862;
  --c-blue: #9fc3d8;
  --shadow-card: 0 4px 14px rgba(107, 79, 58, 0.10);
  --shadow-pop: 0 8px 24px rgba(107, 79, 58, 0.16);
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 10px;
  --tabbar-h: 62px;
  --font-round: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'M PLUS Rounded 1c', 'Yu Gothic', sans-serif;
}

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

html { font-size: 16px; }

body {
  font-family: var(--font-round);
  background: var(--c-bg) url('../assets/bg/paper.jpg') center / 640px repeat;
  color: var(--c-ink);
  line-height: 1.65;
  letter-spacing: 0.02em;
  min-height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
  position: relative;
}

/* ---------- トップバー ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px;
  background: linear-gradient(rgba(246, 243, 235, 0.96), rgba(246, 243, 235, 0.88) 70%, rgba(246, 243, 235, 0));
}
.topbar__logo { height: 34px; width: auto; }
.topbar__logo img { height: 100%; width: auto; }

.g-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--c-paper);
  border: 2px solid var(--c-gold);
  border-radius: 999px;
  padding: 4px 14px 4px 10px;
  font-weight: 700;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease;
}
.g-pill.bump { animation: gBump 0.4s ease; }
@keyframes gBump { 30% { transform: scale(1.12); } }
.g-pill__icon { width: 18px; height: 18px; }
.g-pill__num { font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.g-pill__unit { font-size: 0.75rem; color: var(--c-brown); font-weight: 700; }

/* ---------- タブバー ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 50;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--c-paper);
  border-top: 1.5px solid var(--c-leaf-pale);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -6px 20px rgba(107, 79, 58, 0.12);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.tabbar__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 0.62rem; font-weight: 700; color: var(--c-ink-soft);
  padding-top: 6px;
}
.tabbar__item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar__item.is-active { color: var(--c-leaf-deep); }
.tabbar__item.is-active svg { filter: drop-shadow(0 2px 4px rgba(103, 154, 78, 0.4)); }

/* ---------- 汎用 ---------- */
main { padding: 4px 16px 24px; }

.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.02rem; font-weight: 800; color: var(--c-brown-deep);
  margin: 22px 2px 10px;
}
.section-title::before {
  content: ''; width: 10px; height: 10px; border-radius: 3px;
  background: var(--c-leaf); transform: rotate(45deg); flex: none;
}
.section-title .sub { font-size: 0.72rem; color: var(--c-ink-soft); font-weight: 500; margin-left: auto; }

.card {
  background: var(--c-paper);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 999px; font-weight: 800; letter-spacing: 0.04em;
  padding: 12px 22px; font-size: 0.95rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s;
  box-shadow: 0 4px 0 rgba(107, 79, 58, 0.18);
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(107, 79, 58, 0.18); }
.btn--leaf { background: linear-gradient(180deg, #9ecb7e, #7cb35d); color: #fff; }
.btn--brown { background: linear-gradient(180deg, #a3805f, #8b6b4f); color: #fff; }
.btn--ghost { background: var(--c-leaf-mist); color: var(--c-leaf-deep); box-shadow: inset 0 0 0 2px var(--c-leaf); }
.btn--sm { padding: 8px 16px; font-size: 0.82rem; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--c-leaf-pale); color: var(--c-leaf-deep);
  font-size: 0.7rem; font-weight: 800; border-radius: 999px; padding: 3px 10px;
}
.chip--gold { background: var(--c-gold-pale); color: #a5762a; }
.chip--pink { background: #fbe4e9; color: #c26a7c; }

/* ---------- トースト ---------- */
.toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 24px); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast {
  background: rgba(74, 63, 53, 0.94); color: #fff8ec;
  padding: 10px 18px; border-radius: 14px; font-size: 0.85rem; font-weight: 700;
  box-shadow: var(--shadow-pop); text-align: center;
  animation: toastIn 0.25s ease, toastOut 0.3s ease 2.4s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------- モーダル ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(74, 63, 53, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  animation: fadeIn 0.2s ease;
}

/* 全画面 画像ビューア */
.img-modal {
  position: fixed; inset: 0; z-index: 88;
  background: rgba(40, 34, 28, 0.9);
  display: flex; align-items: center; justify-content: center;
  padding: calc(56px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  animation: fadeIn 0.2s ease;
}
.img-modal__inner {
  display: flex; flex-direction: column; align-items: center;
  max-width: 100%; max-height: 100%;
}
.img-modal__inner img {
  max-width: 100%; max-height: 82dvh; width: auto; height: auto;
  object-fit: contain; border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.img-modal__cap { color: #fff8ec; font-size: 0.8rem; font-weight: 700; margin-top: 12px; text-align: center; }
.img-modal__close {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 253, 246, 0.16); color: #fff8ec;
  font-size: 1.2rem; font-weight: 900; z-index: 2;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--c-paper); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  width: min(100%, 400px); max-height: 82dvh; overflow-y: auto;
  padding: 22px 20px 20px;
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal h3 { color: var(--c-brown-deep); font-size: 1.05rem; margin-bottom: 10px; text-align: center; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.88); } }

/* ---------- アニメーション ---------- */
@keyframes bounce {
  0%, 100% { transform: translateY(0) scaleY(1); }
  35% { transform: translateY(-14px) scaleY(1.04); }
  50% { transform: translateY(0) scaleY(0.94); }
  62% { transform: translateY(-5px) scaleY(1.01); }
  75% { transform: translateY(0) scaleY(1); }
}
@keyframes wiggle { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes sparkle { 0% { opacity: 0; transform: scale(0.4) rotate(0deg); } 40% { opacity: 1; } 100% { opacity: 0; transform: scale(1.15) rotate(90deg); } }

.silhouette { filter: brightness(0) opacity(0.28); }

.fade-in { animation: fadeUp 0.4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

::-webkit-scrollbar { width: 0; height: 0; }
