/* 鳥あつめ：生成りの紙・セージグリーン・くすんだ金・テラコッタ（ライト固定） */
:root {
  --paper: #f7f1e3;
  --paper2: #efe6d0;
  --ink: #3d4a3a;
  --sub: #6b5a3e;
  --sage: #7f9a76;
  --sage-d: #5d7656;
  --gold: #b08d4a;
  --gold-l: #e2cc8f;
  --terra: #c0714f;
  --line: #d8c9a3;
  --shadow: 0 6px 18px rgba(80, 64, 30, .14);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Zen Kaku Gothic New', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
.paper {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, .7), transparent 60%),
    radial-gradient(ellipse at 0% 100%, rgba(127, 154, 118, .12), transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(192, 113, 79, .08), transparent 50%),
    var(--paper);
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.screen { max-width: 480px; margin: 0 auto; padding: 20px 16px 48px; }

/* ロゴ */
.logo { text-align: center; padding: 18px 0 10px; }
.logo-orn {
  width: 180px; height: 26px; margin: 0 auto 6px;
  background:
    radial-gradient(circle at 50% 50%, var(--gold) 0 4px, transparent 5px),
    linear-gradient(90deg, transparent, var(--gold) 30%, transparent 46%, transparent 54%, var(--gold) 70%, transparent) center / 100% 1.5px no-repeat;
}
.logo h1 {
  font-family: 'Shippori Mincho B1', serif; font-weight: 800;
  font-size: 46px; letter-spacing: .18em; margin: 0; line-height: 1.2;
  color: var(--sage-d);
  text-indent: .18em;
}
.logo-en { font-family: 'Marcellus SC', serif; color: var(--gold); letter-spacing: .2em; font-size: 13px; margin: 4px 0 6px; }
.logo-sub { font-family: 'Shippori Mincho B1', serif; font-weight: 700; color: var(--sub); margin: 0; font-size: 15px; }

/* 飾り枠つきのパネル */
.panel {
  position: relative;
  background: rgba(255, 252, 244, .86);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}
.panel::before {
  content: ''; position: absolute; inset: 5px; border: 1px solid rgba(176, 141, 74, .45);
  border-radius: 14px; pointer-events: none;
}
.stats { display: grid; grid-template-columns: 1fr 1fr; text-align: center; padding: 14px; }
.stats > div + div { border-left: 1px solid var(--line); }
.stat-num { font-family: 'Shippori Mincho B1', serif; font-weight: 800; font-size: 34px; color: var(--sage-d); }
.stat-unit { font-size: 14px; color: var(--sub); margin-left: 4px; }
.stat-label { display: block; font-size: 12px; color: var(--sub); letter-spacing: .1em; }
.progress { height: 6px; background: var(--paper2); border-radius: 3px; overflow: hidden; margin: -6px 6px 0; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--sage), var(--gold)); transition: width .6s; }

.today { text-align: center; }
.today h2, .book-title {
  font-family: 'Shippori Mincho B1', serif; font-weight: 800; color: var(--sage-d);
  font-size: 22px; margin: 0 0 4px; letter-spacing: .08em;
}
.today p { margin: 0 0 14px; color: var(--sub); font-size: 15px; }

/* ボタン */
.btn {
  display: block; width: 100%; padding: 14px 18px; margin: 10px 0 0;
  border-radius: 999px; border: 1.5px solid var(--gold);
  background: #fffaf0; color: var(--sub);
  font-family: 'Shippori Mincho B1', serif; font-weight: 800; font-size: 17px; letter-spacing: .06em;
  transition: transform .15s, box-shadow .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(180deg, #8eaa84, var(--sage-d));
  border-color: #4d6447; color: #fffdf6;
  box-shadow: 0 4px 0 #4d6447, var(--shadow);
}
.btn.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #4d6447; }
.btn.ghost { background: transparent; }
.btn.small { display: inline-block; width: auto; font-size: 13px; padding: 8px 14px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.dev { text-align: center; margin-top: 28px; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; color: var(--sub); font-size: 14px; }
.back { background: none; border: 0; padding: 6px 0; color: var(--sage-d); font-weight: 700; }

/* クイズ */
.quiz-q { font-family: 'Shippori Mincho B1', serif; font-weight: 800; font-size: 20px; line-height: 1.6; margin: 4px 0 16px; }
.choices { display: grid; gap: 10px; }
.choice {
  text-align: left; padding: 13px 16px; border-radius: 14px;
  border: 1.5px solid var(--line); background: #fffdf7; font-size: 16px; font-weight: 700; line-height: 1.5;
}
.choice:active { background: var(--paper2); }
.choice.ok { border-color: var(--sage-d); background: #e7efdf; }
.choice.ng { border-color: var(--terra); background: #f7e3d8; }
.choice:disabled { cursor: default; }
.answer { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; animation: fadeUp .4s; }
.verdict { font-family: 'Shippori Mincho B1', serif; font-weight: 800; font-size: 24px; margin: 0 0 8px; text-align: center; }
.verdict.ok { color: var(--sage-d); }
.verdict.ng { color: var(--terra); }
.ans-body { display: flex; gap: 14px; align-items: flex-start; }
.ans-body img { width: 96px; border-radius: 6px; box-shadow: var(--shadow); flex: none; }
.ans-body p { margin: 0; font-size: 15px; }
.ans-body .ans-src { margin-top: 8px; font-size: 12px; color: var(--sub); }
.ans-src a, .credit a { color: var(--sage-d); }
.credit { font-size: 12px; color: var(--sub); text-align: center; margin: 22px 4px 0; line-height: 1.7; }

/* パック */
.pack-hint { text-align: center; color: var(--sub); font-family: 'Shippori Mincho B1', serif; font-weight: 700; margin: 4px 0 10px; }
.stage { position: relative; height: min(118vw, 520px); display: grid; place-items: center; }
.pack-wrap {
  position: relative; width: min(66vw, 300px); aspect-ratio: 2 / 3;
  touch-action: none; user-select: none; -webkit-user-select: none;
  filter: drop-shadow(0 10px 16px rgba(80, 64, 30, .25));
  animation: float 3s ease-in-out infinite;
}
.pack-top, .pack-body { position: absolute; left: 0; right: 0; background: url(pack.webp) no-repeat; background-size: 100% auto; }
.pack-top { top: 0; height: 14%; background-position: top; transform-origin: 100% 100%; }
.pack-body { top: 14%; bottom: 0; background-position: 0 100%; }
.tear-line {
  position: absolute; left: 6%; right: 6%; top: 14%; height: 4px; margin-top: -2px;
  background: repeating-linear-gradient(90deg, rgba(176, 141, 74, .7) 0 8px, transparent 8px 14px);
  border-radius: 2px;
}
.tear-line span { display: block; height: 100%; width: 0; background: var(--terra); border-radius: 2px; box-shadow: 0 0 8px var(--terra); }
.pack-wrap.opening { animation: none; }
.pack-wrap.opening .pack-top { animation: flyTop .7s ease-in forwards; }
.pack-wrap.opening .tear-line { opacity: 0; transition: opacity .2s; }
.pack-wrap.dropping { animation: none; transition: transform .7s ease-in, opacity .7s; transform: translateY(70%); opacity: 0; }

.reveal { position: absolute; inset: 0; display: grid; place-items: center; perspective: 1200px; }
.flip {
  position: relative; width: min(66vw, 300px); aspect-ratio: 2 / 3;
  transform-style: preserve-3d; transition: transform .9s cubic-bezier(.3, 1.4, .5, 1);
  cursor: pointer;
}
.rise { animation: rise .8s cubic-bezier(.2, .9, .3, 1.1) both; }
.flip.flipped { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 10px; overflow: hidden; box-shadow: 0 12px 28px rgba(60, 48, 20, .3); }
.face img { width: 100%; height: 100%; display: block; }
.face.front { transform: rotateY(180deg); }
.flip.r3.flipped .face.front { box-shadow: 0 0 0 2px var(--gold-l), 0 0 36px 10px rgba(226, 204, 143, .9), 0 12px 28px rgba(60, 48, 20, .3); }
.flip.r2.flipped .face.front { box-shadow: 0 0 22px 4px rgba(127, 154, 118, .6), 0 12px 28px rgba(60, 48, 20, .3); }
.sparkles { position: absolute; inset: 0; pointer-events: none; }
.sparkles i {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 20%, var(--gold-l) 40%, transparent 70%);
  animation: spark 1.4s ease-out forwards;
}
.sparkles i.leaf { border-radius: 0 70% 0 70%; background: var(--sage); width: 9px; height: 14px; }

.got { text-align: center; animation: fadeUp .5s; }
.got-new { display: inline-block; margin: 6px 0 0; padding: 0 12px; border-radius: 999px; background: var(--terra); color: #fff; font-family: 'Marcellus SC', serif; letter-spacing: .15em; font-size: 13px; }
.got-name { font-family: 'Shippori Mincho B1', serif; font-weight: 800; font-size: 22px; margin: 4px 0 0; }
.got-rare { color: var(--gold); margin: 0; letter-spacing: .2em; }

/* 図鑑 */
.book-title { text-align: center; }
.filters { display: flex; gap: 6px; justify-content: center; margin: 10px 0 14px; flex-wrap: wrap; }
.filters button { border: 1px solid var(--line); background: #fffaf0; border-radius: 999px; padding: 4px 14px; font-size: 14px; color: var(--sub); }
.filters button.on { background: var(--sage-d); border-color: var(--sage-d); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cell { position: relative; border: 0; padding: 0; background: none; border-radius: 6px; overflow: hidden; aspect-ratio: 2 / 3; box-shadow: 0 3px 8px rgba(80, 64, 30, .16); }
.cell img { width: 100%; height: 100%; display: block; }
.cell.none img { filter: grayscale(.6) brightness(1.05) opacity(.55); }
.cell .no { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-family: 'Marcellus SC', serif; color: #fff; font-size: 14px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.cell .cnt { position: absolute; right: 4px; top: 4px; background: var(--sage-d); color: #fff; font-size: 11px; border-radius: 999px; padding: 0 7px; }

.modal { position: fixed; inset: 0; background: rgba(61, 74, 58, .55); display: grid; place-items: center; z-index: 10; padding: 16px; animation: fadeIn .2s; }
.modal-in { width: min(92vw, 400px); text-align: center; }
.modal-in img { width: 100%; border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
.modal-meta { color: #fffdf6; margin: 8px 0 0; font-size: 14px; }
.modal .btn { background: #fffaf0; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 20; animation: fadeUp .3s; }

@keyframes float { 50% { transform: translateY(-8px); } }
@keyframes flyTop { to { transform: translate(60%, -160%) rotate(28deg); opacity: 0; } }
@keyframes rise { from { transform: translateY(40%) scale(.9); opacity: 0; } }
@keyframes spark { from { transform: translate(0, 0) scale(.4); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(140deg); opacity: 0; } }
@keyframes fadeUp { from { transform: translateY(10px); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
