:root {
  --paper: #fbf6ec;
  --card: #ffffff;
  --ink: #23302b;
  --sub: #5d6b65;
  --line: #e6dcc8;
  --green: #1f5a44;
  --green-soft: #e3efe8;
  --orange: #e8792a;
  --orange-soft: #fdebdb;
  --gold: #c9962b;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #efe7d6;
  color: var(--ink);
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.app { max-width: 480px; min-height: 100%; margin: 0 auto; background: var(--paper); position: relative; display: flex; flex-direction: column; }
.view { flex: 1; padding: 16px 16px 96px; }

/* 下のタブ */
.tabs { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs[hidden] { display: none; }
.tab { padding: 14px 4px; font-size: 14px; color: var(--sub); font-weight: 600; position: relative; }
.tab.is-active { color: var(--green); }
.tab.is-active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--green); }
.tab .dot { position: absolute; top: 8px; right: 22%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--orange); color: #fff; font-size: 11px; line-height: 18px; }

/* 共通 */
h1 { font-size: 22px; margin: 0 0 8px; line-height: 1.4; }
h2 { font-size: 16px; margin: 24px 0 8px; }
p { margin: 0 0 12px; }
.sub { color: var(--sub); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.btn { display: block; width: 100%; padding: 14px; border-radius: 12px; background: var(--green); color: #fff; font-weight: 700; font-size: 16px; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; }
.btn.orange { background: var(--orange); }
.btn.ghost { background: transparent; color: var(--green); border: 1px solid var(--green); }
.btn.small { padding: 8px 12px; font-size: 13px; width: auto; display: inline-block; }
.testnote { font-size: 12px; color: var(--sub); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 16px; }

/* はじめの画面と診断 */
.hero-img { display: block; width: 180px; height: 180px; object-fit: contain; margin: 8px auto 0; }
.field { display: block; margin: 16px 0; }
.field span { display: block; font-weight: 700; margin-bottom: 6px; }
.field input, .field textarea { width: 100%; font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
.field textarea { min-height: 120px; resize: vertical; }
.choices { display: grid; gap: 8px; }
.choice { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.choice.is-on { border-color: var(--green); background: var(--green-soft); font-weight: 700; }
.steps { font-size: 13px; color: var(--sub); margin-bottom: 4px; }

/* ホーム */
.top { position: relative; margin: -16px -16px 0; padding: 16px 16px 20px; background: var(--green) center top / cover no-repeat; color: #fff; overflow: hidden; }
.top::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 60, 45, .78), rgba(20, 60, 45, .5) 60%, rgba(20, 60, 45, .82)); }
.top > * { position: relative; z-index: 1; }
.top-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.pill { background: rgba(255, 255, 255, .18); border-radius: 999px; padding: 4px 10px; font-weight: 700; }
.who { display: flex; align-items: flex-end; gap: 12px; margin-top: 10px; }
.mascot { width: 104px; height: 104px; object-fit: contain; flex: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .25)); }
.who-item { width: 40px; height: 40px; object-fit: contain; margin-left: -34px; margin-bottom: 60px; flex: none; }
.power-label { font-size: 13px; opacity: .9; }
.power { font-size: 46px; font-weight: 800; line-height: 1.1; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.power small { font-size: 14px; font-weight: 600; opacity: .8; }
.bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .25); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: #ffd27a; border-radius: 4px; transition: width .6s ease; }
.radar-card { display: grid; grid-template-columns: 150px 1fr; gap: 8px; align-items: center; margin-top: 16px; }
.radar { width: 150px; height: 150px; }
.statlist { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.statlist li { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px dotted var(--line); }
.statlist b { font-variant-numeric: tabular-nums; }

/* クエスト */
.quest { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.quest .kind { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.quest.submit .kind { background: var(--orange-soft); color: var(--orange); }
.quest.boss { border-color: var(--gold); background: #fff9ea; }
.quest.boss .kind { background: var(--gold); color: #fff; }
.quest .body { flex: 1; min-width: 0; }
.quest .name { font-weight: 700; font-size: 15px; line-height: 1.45; }
.quest .gain { font-size: 12px; color: var(--orange); font-weight: 700; margin-top: 2px; }
.quest.is-done { opacity: .55; }
.quest.is-done .name { text-decoration: line-through; }
.quest .check { flex: none; font-size: 12px; color: var(--green); font-weight: 800; }

/* モーダル */
.modal { position: fixed; inset: 0; background: rgba(25, 35, 30, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.modal[hidden] { display: none; }
.sheet { width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; background: var(--paper); border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .22s ease; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet .close { float: right; color: var(--sub); font-size: 14px; padding: 4px 8px; }

/* ごほうびの演出 */
.reward { text-align: center; }
.reward .burst { font-size: 15px; font-weight: 800; color: var(--orange); }
.reward .big { font-size: 54px; font-weight: 800; color: var(--green); line-height: 1.1; font-variant-numeric: tabular-nums; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
.reward .delta { display: inline-block; margin: 6px 0 14px; padding: 4px 12px; border-radius: 999px; background: var(--orange); color: #fff; font-weight: 800; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.rin { text-align: left; background: var(--green-soft); border-radius: 14px; padding: 12px 14px; margin: 12px 0; font-size: 14px; }
.rin b { display: block; font-size: 12px; color: var(--green); margin-bottom: 2px; }
.got { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0 16px; font-size: 13px; font-weight: 700; }
.got span { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.fx i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ガチャ */
.gacha { text-align: center; }
.chest { width: 200px; height: 200px; object-fit: contain; margin: 8px auto; display: block; }
.chest.shake { animation: shake .7s ease; }
@keyframes shake { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-8deg) scale(1.04); } 40% { transform: rotate(8deg) scale(1.08); } 60% { transform: rotate(-6deg) scale(1.1); } 80% { transform: rotate(6deg) scale(1.06); } }
.prize { margin: 12px 0; padding: 16px; border-radius: var(--radius); background: #fff; border: 2px solid var(--line); animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
.prize.jackpot { border-color: var(--gold); background: #fff9ea; }
.prize img { width: 96px; height: 96px; object-fit: contain; }
.prize .pname { font-size: 20px; font-weight: 800; }
.owned { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.owned button { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px; font-size: 12px; min-height: 64px; }
.owned button.is-on { border-color: var(--green); background: var(--green-soft); font-weight: 700; }
.owned img { width: 44px; height: 44px; object-fit: contain; display: block; margin: 0 auto 2px; }

/* ピース */
.puzzle { position: relative; width: 100%; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: #2d4a40 center / cover no-repeat; }
.puzzle .grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); }
.puzzle .cell { background: #f1e9d8; border: 1px solid var(--line); display: grid; place-items: center; color: #b9ad94; font-weight: 800; transition: opacity .6s ease; }
.puzzle .cell.open { opacity: 0; }

/* 成長 */
.chart { width: 100%; height: 160px; }
.log { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.log li { padding: 8px 0; border-bottom: 1px dotted var(--line); }
.log .when { color: var(--sub); font-size: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tools { display: grid; gap: 8px; margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
