/* マウンティングマウンテン — やわらかいイラスト調（2026-11-27 改訂） */
@font-face { font-family: 'ZenMaru'; src: url('fonts/ZenMaruGothic-Medium.ttf') format('truetype'); font-weight: 400 600; font-display: block; }
@font-face { font-family: 'ZenMaru'; src: url('fonts/ZenMaruGothic-Bold.ttf') format('truetype'); font-weight: 700 900; font-display: block; }

:root {
  --bg: #fff7f0; --card: #ffffff; --ink: #4a3b36; --sub: #8a7068; --accent: #f27a9c; --accent-d: #d95f84;
  --kind: #ffe3ec; --kind-ink: #b5446a; --mount: #fff1cc; --mount-ink: #9a6a12;
  --hp: #6cc25a; --hp-low: #f0a13c; --hp-crit: #ef5f5f; --close: #ff8fb0;
  --shadow: 0 6px 18px rgba(120, 80, 60, .16);
}
* { box-sizing: border-box; }
html { font-size: 17px; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink);
  font-family: 'ZenMaru', 'Hiragino Maru Gothic ProN', sans-serif; font-weight: 500;
  -webkit-user-select: none; user-select: none; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
#game { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.screen { display: none; }
.screen.active { display: block; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }

/* ---- ボタン ---- */
.btn { font-size: 20px; font-weight: 700; padding: 14px 40px; background: var(--accent); color: #fff; border: 0; border-radius: 99px;
  box-shadow: 0 5px 0 var(--accent-d), var(--shadow); cursor: pointer; transition: transform .08s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--accent-d); }
.btn.sub2 { font-size: 15px; padding: 9px 16px; background: #fff; color: var(--ink); box-shadow: 0 3px 0 #ead9cf, var(--shadow); }
.btn.warn { background: #ef5f5f; color: #fff; box-shadow: 0 5px 0 #c94444; }

/* ---- タイトル ---- */
#title { text-align: center; padding-bottom: 24px; }
.titleArt { height: 44vh; min-height: 260px; overflow: hidden; border-radius: 0 0 32px 32px; box-shadow: var(--shadow); }
.titleArt svg { width: 100%; height: 100%; display: block; }
#title h1 { font-size: 38px; line-height: 1.2; margin: 18px 0 0; color: var(--accent); font-weight: 900; letter-spacing: 2px;
  text-shadow: 0 3px 0 #fff, 0 6px 0 rgba(242, 122, 156, .25); }
#title .sub { margin: 6px 0 20px; font-size: 17px; color: var(--sub); }
#title .menu { display: flex; flex-direction: column; align-items: center; gap: 14px; }
#title .settings { margin-top: 20px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0 10px; }
.hint { font-size: 14px; color: var(--sub); line-height: 1.7; margin: 10px 0 0; }
.credit { font-size: 12px; }

/* ---- マップ ---- */
#map.active { display: flex; flex-direction: column; min-height: 100dvh; }
.hud { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; padding: 12px 14px 8px; font-size: 15px; font-weight: 700; }
.hud span { white-space: nowrap; }
.hud #hudStats { color: var(--sub); font-weight: 500; }
.mapWrap { position: relative; margin: 0 8px; }
#mapCanvas { width: 100%; display: block; border-radius: 18px; box-shadow: var(--shadow); touch-action: none; }
.box { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 14px 18px; margin: 8px; min-height: 92px;
  position: relative; line-height: 1.7; font-size: 18px; }
.box p { margin: 0; white-space: pre-line; }
.box .next { position: absolute; right: 14px; bottom: 6px; font-size: 14px; color: var(--accent); animation: blink 1s steps(2) infinite; }
.box.static { min-height: 0; font-size: 15px; }
#dialog { position: absolute; left: 0; right: 0; bottom: 0; margin: 8px; cursor: pointer; }
@keyframes blink { 50% { opacity: 0; } }
#map .pad { flex: 1; display: flex; align-items: center; justify-content: space-between; padding: 14px 20px 26px; }
.dpad { display: grid; grid-template-columns: 76px 76px 76px; grid-template-rows: 70px 70px 70px; gap: 6px; }
.dpad button { font-size: 24px; background: #fff; color: var(--sub); border: 0; border-radius: 20px; box-shadow: 0 5px 0 #ead9cf, var(--shadow); touch-action: manipulation; }
.dpad button:active { transform: translateY(4px); box-shadow: 0 1px 0 #ead9cf; }
.dpad [data-dir=up] { grid-column: 2; grid-row: 1; }
.dpad [data-dir=left] { grid-column: 1; grid-row: 2; }
.dpad [data-dir=right] { grid-column: 3; grid-row: 2; }
.dpad [data-dir=down] { grid-column: 2; grid-row: 3; }
.abtn { width: 112px; height: 112px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 24px; font-weight: 700;
  box-shadow: 0 6px 0 var(--accent-d), var(--shadow); touch-action: manipulation; }
.abtn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--accent-d); }
.tapmark { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 3px solid #fff; border-radius: 50%; pointer-events: none; animation: tapfade .5s forwards; }
@keyframes tapfade { to { transform: scale(1.8); opacity: 0; } }

/* ---- 対戦 ---- */
#battle { position: relative; }
.stage { position: relative; height: 430px; overflow: hidden; }
.bbg, .bbg svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sprite { position: absolute; transition: transform .6s ease, filter .6s; }
.sprite .art, .sprite .art svg { width: 100%; height: 100%; display: block; }
.sprite.enemy { right: 14px; top: 96px; width: 150px; height: 182px; }
.sprite.me { left: 14px; bottom: 0; width: 170px; height: 206px; }
.sprite.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-8px) rotate(-2deg); } 75% { transform: translateX(8px) rotate(2deg); } }
.sprite.slump { transform: translateY(40px) scaleY(.8) rotate(-6deg); filter: grayscale(.85) brightness(1.05); }
.sprite.happy { animation: hop .45s ease 3; }
@keyframes hop { 50% { transform: translateY(-14px); } }
.sprite.rage { animation: rage .5s ease-in-out infinite; }
.sprite.rage.slump { animation: none; }
@keyframes rage { 50% { filter: drop-shadow(0 0 12px #ff5a5a) saturate(1.3); transform: translateY(-3px); } }
.sprite .sigh, .sprite .heart { position: absolute; top: -6px; left: 60%; font-size: 20px; opacity: 0; transition: opacity .4s; white-space: nowrap; font-weight: 700; }
.sprite .sigh { color: #7a8a9a; }
.sprite .heart { color: var(--accent); font-size: 30px; }
.sprite.slump .sigh, .sprite.happy .heart { opacity: 1; }
.info { position: absolute; background: rgba(255, 255, 255, .94); border-radius: 18px; padding: 10px 14px; box-shadow: var(--shadow); }
.enemyInfo { left: 12px; top: 14px; width: 232px; }
.playerInfo { right: 12px; bottom: 22px; width: 196px; }
.info .name { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tag { font-size: 12px; font-weight: 700; background: #6fa8dc; color: #fff; padding: 2px 9px; border-radius: 99px; }
.bar { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 7px; color: var(--sub); }
.bar label { width: 62px; }
.gauge { flex: 1; height: 11px; background: #f0e4dc; border-radius: 99px; overflow: hidden; }
.gauge i { display: block; height: 100%; width: 100%; border-radius: 99px; background: var(--hp); transition: width .45s ease; }
.gauge.pink i { background: linear-gradient(90deg, #ffb3c8, var(--close)); }
.small { font-size: 13px; text-align: right; color: var(--sub); margin-top: 4px; }
#bMsg { min-height: 96px; cursor: pointer; margin-top: 10px; }
.moves { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 12px 22px; }
.moves button { font-size: 17px; font-weight: 700; text-align: left; padding: 11px 13px; min-height: 70px; border: 0; border-radius: 16px; cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .07); transition: transform .08s; }
.moves button:active { transform: translateY(3px); box-shadow: none; }
.moves button small { display: block; font-size: 12px; font-weight: 500; margin-top: 4px; opacity: .8; }
.moves button.kind { background: var(--kind); color: var(--kind-ink); }
.moves button.mount { background: var(--mount); color: var(--mount-ink); }
.moves button.forget { outline: 3px solid #ef5f5f; outline-offset: -3px; }
.moves button:disabled { opacity: .45; cursor: default; }
.result { position: absolute; left: 14px; right: 14px; top: 150px; z-index: 5; text-align: center; padding: 22px 14px; border-radius: 24px;
  box-shadow: 0 10px 30px rgba(120, 80, 60, .25); cursor: pointer; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); background: #fff; }
.result .big { font-size: 32px; font-weight: 900; letter-spacing: 1px; margin-bottom: 8px; }
.result p { margin: 0; white-space: pre-line; line-height: 1.7; font-size: 17px; }
.result .next { position: absolute; right: 14px; bottom: 6px; font-size: 14px; animation: blink 1s steps(2) infinite; }
.result.mount { background: #fff6da; } .result.mount .big { color: #e0812a; }
.result.friend { background: #ffeef4; } .result.friend .big { color: var(--accent); }
.result.lose { background: #eef0f3; } .result.lose .big { color: #7a8a9a; }
@keyframes pop { 0% { transform: scale(.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ---- クリア ---- */
#clear { text-align: center; padding: 16px 0 28px; }
#clear h2 { margin: 8px 0 14px; color: var(--accent); font-size: 24px; font-weight: 900; }
.ending { margin: 0 12px; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); }
.ending svg { width: 100%; display: block; }
#clear .box { text-align: left; }
#clear .box hr { border: 0; border-top: 2px dashed #f0e4dc; margin: 10px 0; }
#clear .btn { margin: 8px 6px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  background: rgba(74, 59, 54, .92); color: #fff; padding: 10px 18px; font-size: 15px; border-radius: 99px; white-space: nowrap; }

.shareRow { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 14px 0 4px; }
.btn.share { background: #4a3b36; box-shadow: 0 5px 0 #2f2420, var(--shadow); }
.btn.share:disabled { opacity: .6; }

/* ---- 気づき帳 ---- */
.chipBtn { border: 0; background: #fff; color: var(--accent); font-weight: 700; font-size: 13px; padding: 5px 12px; border-radius: 99px; box-shadow: 0 2px 0 #ead9cf, var(--shadow); }
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(74, 59, 54, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 480px; max-height: 88dvh; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); text-align: center; animation: up .25s ease; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet h3 { margin: 0 0 6px; color: var(--accent); font-size: 22px; font-weight: 900; }
.sheet .lead { font-size: 14px; color: var(--sub); line-height: 1.7; margin: 0 0 10px; }
.bookCount { font-weight: 700; margin-bottom: 10px; }
.bookList { display: grid; gap: 8px; margin-bottom: 14px; text-align: left; }
.kata { background: #fff; border-radius: 16px; padding: 10px 14px; box-shadow: 0 3px 10px rgba(120, 80, 60, .1); }
.kata b { color: var(--accent-d); font-size: 16px; }
.kata p { margin: 4px 0; font-size: 14px; line-height: 1.6; }
.kata small { color: var(--sub); font-size: 12px; }
.kata.off { background: #f4ece6; box-shadow: none; }
.kata.off b, .kata.off p { color: #b8a49c; }
.closing { color: var(--accent-d); font-weight: 700; line-height: 1.8; }
#bookBtn2 { margin-top: 12px; }
