/* MBTI牧草物語（bks）v0.2 2026-10-21 — 全画面・縦持ち優先（390×844）。文字は14px以上 */
html, body.bksb { margin: 0; padding: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body.bksb { background: #cfeec0; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.bks, .bks * { box-sizing: border-box; }
.bks { position: fixed; inset: 0; display: flex; justify-content: center; font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif; font-weight: 700; color: #4a3423; font-size: 15px; touch-action: manipulation; }
.bks button { font: inherit; color: inherit; touch-action: manipulation; cursor: pointer; border: 0; background: none; padding: 0; }
.bks img { -webkit-user-drag: none; pointer-events: none; }
.bks-boot { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: linear-gradient(180deg, #bfe7ff, #e8f7d4); }
.bks-boot b { font-size: 30px; color: #fff; letter-spacing: .1em; text-shadow: 0 3px 0 #7cb85a, 0 6px 14px rgba(60, 100, 40, .3); }
.bks-boot i { width: 40px; height: 40px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: bksSpin .8s linear infinite; }
.bks-boot small { font-size: 14px; color: #5d7a46; }
@keyframes bksSpin { to { transform: rotate(360deg); } }

.bks-app { position: relative; width: 100%; max-width: 520px; height: 100%; display: flex; flex-direction: column; background: #9fd27a; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); overflow: hidden; }

/* ---------- 上の帯 ---------- */
.bks-hud { flex: none; height: 48px; display: flex; align-items: center; gap: 8px; padding: 4px 10px; background: linear-gradient(180deg, #fff8e4, #f7e7c2); border-bottom: 3px solid #b98a55; font-size: 15px; z-index: 3; }
.bks-hud .d { line-height: 1.1; white-space: nowrap; }
.bks-hud .d small { display: block; font-size: 14px; color: #8a6a45; }
.bks-hud .w { padding: 2px 8px; border-radius: 10px; background: #e5f4ff; color: #2b6aa0; font-size: 14px; white-space: nowrap; }
.bks-hud .w.rain { background: #dfe6f0; color: #4b5f7a; }
.bks-hud .w.cloud { background: #eeeeee; color: #6a6a6a; }
.bks-hud .g { margin-left: auto; white-space: nowrap; color: #8a5a10; }
.bks-hud .st { width: 70px; flex: none; }
.bks-hud .st small { display: block; font-size: 14px; color: #3d8a3d; line-height: 1; }
.bks-hud .st i { display: block; height: 8px; border-radius: 4px; background: #e6d8bd; overflow: hidden; margin-top: 3px; }
.bks-hud .st i b { display: block; height: 100%; background: linear-gradient(90deg, #6cc04a, #a6e06a); transition: width .2s; }
.bks-hud .st.low i b { background: linear-gradient(90deg, #e86a4a, #f2a65a); }

/* ---------- 地図 ---------- */
.bks-view { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #6aa84f; }
.bks-view canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; touch-action: none; }
.bks-toast { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); max-width: 92%; padding: 8px 14px; border-radius: 14px; background: rgba(255, 252, 240, .95); box-shadow: 0 3px 0 rgba(120, 80, 40, .25); font-size: 15px; text-align: center; pointer-events: none; opacity: 0; transition: opacity .25s; z-index: 4; }
.bks-toast.on { opacity: 1; }
.bks-place { position: absolute; left: 8px; bottom: 8px; padding: 3px 10px; border-radius: 10px; background: rgba(60, 40, 20, .55); color: #fff; font-size: 14px; pointer-events: none; }
.bks-box { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.bks-bars { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.bks-bars:before, .bks-bars:after { content: ""; position: absolute; left: 0; right: 0; height: 0; background: #111; transition: height .4s; }
.bks-bars:before { top: 0; } .bks-bars:after { bottom: 0; }
.bks-bars.on:before, .bks-bars.on:after { height: 12%; }

/* ---------- 道具の帯 ---------- */
.bks-belt { flex: none; display: flex; align-items: center; gap: 5px; padding: 6px 8px; background: #f7e7c2; border-top: 3px solid #b98a55; z-index: 3; }
.bks-slot { position: relative; width: 46px; height: 46px; flex: none; border-radius: 10px; background: #fffaf0; box-shadow: inset 0 0 0 2px #d9bf93; }
.bks-slot.on { box-shadow: inset 0 0 0 3px #e2733a, 0 0 0 2px #ffd39a; background: #fff3dc; }
.bks-slot .ic { position: absolute; inset: 3px; }
.bks-slot .n { position: absolute; right: 2px; bottom: 0; font-size: 14px; color: #5a3a1a; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.bks-slot .can { position: absolute; left: 3px; right: 3px; bottom: 2px; height: 4px; border-radius: 2px; background: #cde; overflow: hidden; }
.bks-slot .can b { display: block; height: 100%; background: #4aa0e6; }
.bks-slot.item .ic.empty { inset: 8px; border: 2px dashed #d9bf93; border-radius: 8px; }
.bks-use { margin-left: auto; flex: 1 1 auto; max-width: 110px; min-width: 76px; height: 50px; border-radius: 25px !important; background: linear-gradient(180deg, #ffb05a, #f0782f) !important; color: #fff !important; font-size: 17px !important; box-shadow: 0 4px 0 #b9541c; text-shadow: 0 1px 0 rgba(0, 0, 0, .2); white-space: nowrap; }
.bks-use:active { transform: translateY(2px); box-shadow: 0 2px 0 #b9541c; }
.bks-nav { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px 8px 8px; background: #f7e7c2; z-index: 3; }
.bks-nav button { height: 40px; border-radius: 12px; background: #fffaf0; box-shadow: 0 3px 0 #d0b07c; font-size: 15px; }
.bks-nav button:active { transform: translateY(2px); box-shadow: 0 1px 0 #d0b07c; }

/* ---------- 絵の切り出し（背景の位置で束から1つ） ---------- */
.spr { background-repeat: no-repeat; image-rendering: auto; }

/* ---------- 窓（会話・パネル） ---------- */
.bks-layer { position: absolute; inset: 0; z-index: 20; display: none; } /* タイトル(15)より上・精算(30)より下 */
.bks-layer.on { display: block; }
.bks-dim { position: absolute; inset: 0; background: rgba(40, 30, 20, .35); }
.bks-win { border-style: solid; border-width: 22px 26px; border-image: var(--frame) 40 48 fill / 22px 26px stretch; background-clip: padding-box; }
.bks-win.nofr { border: 3px solid #a0703c; border-radius: 16px; background: #fffaf0; }
.bks-talk { position: absolute; left: 6px; right: 6px; bottom: 8px; min-height: 150px; }
.bks-talk .face { position: absolute; left: 6px; bottom: calc(100% - 14px); width: 150px; height: 150px; background-size: 200% 200%; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .2)); transition: transform .2s; }
.bks-talk .face.jump { animation: bksJump .5s; }
@keyframes bksJump { 30% { transform: translateY(-14px); } 60% { transform: translateY(0); } 80% { transform: translateY(-5px); } }
.bks-talk .nm { position: absolute; left: 150px; bottom: calc(100% - 8px); padding: 3px 12px; border-radius: 10px; background: #8a5a2b; color: #fff; font-size: 15px; }
.bks-talk .tx { font-size: 16px; line-height: 1.65; min-height: 3.3em; white-space: pre-wrap; }
.bks-talk .more { position: absolute; right: 2px; bottom: -6px; font-size: 14px; color: #a0703c; animation: bksBlink 1s infinite; }
@keyframes bksBlink { 50% { opacity: .2; } }
.bks-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.bks-choices button, .bks-btn { min-height: 44px; padding: 8px 14px; border-radius: 14px; background: #fff3dc; box-shadow: inset 0 0 0 2px #d9a560, 0 3px 0 #c89a5a; font-size: 16px; text-align: center; }
.bks-btn.main { background: linear-gradient(180deg, #8fd36a, #5fb042); color: #fff; box-shadow: 0 3px 0 #3f8a2c; }
.bks-btn.stamp { background: linear-gradient(180deg, #ffd6ec, #f7a9cf); box-shadow: 0 3px 0 #c9709a; color: #6a2346; }
.bks-btn:disabled { opacity: .45; }
.bks-btn.sm { min-height: 36px; padding: 4px 10px; font-size: 15px; }

.bks-panel { position: absolute; left: 8px; right: 8px; top: 8px; bottom: 8px; display: flex; flex-direction: column; background: #fffaf0; border: 3px solid #a0703c; border-radius: 18px; box-shadow: 0 6px 0 rgba(90, 60, 30, .3); overflow: hidden; }
.bks-panel h2 { margin: 0; padding: 12px 48px 10px 14px; font-size: 18px; background: #f7e7c2; border-bottom: 2px solid #d9bf93; }
.bks-panel .x { position: absolute; right: 8px; top: 7px; width: 36px; height: 36px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 2px #d9bf93; font-size: 20px; line-height: 36px; text-align: center; }
.bks-panel .body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 12px 16px; }
.bks-panel .foot { flex: none; padding: 8px 12px; border-top: 2px solid #eadbbc; display: flex; gap: 8px; align-items: center; }
.bks-panel p { margin: 6px 0; line-height: 1.6; }
.bks-note { font-size: 14px; color: #8a6a45; line-height: 1.55; }
.bks-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed #e4cfa6; }
.bks-row .ic { width: 44px; height: 44px; flex: none; }
.bks-row .t { flex: 1; min-width: 0; line-height: 1.35; }
.bks-row .t small { display: block; font-size: 14px; color: #8a6a45; font-weight: 700; }
.bks-row .p { white-space: nowrap; color: #8a5a10; }
.bks-row .p.s { color: #b0326e; }
.bks-sec { margin: 14px 0 4px; font-size: 16px; color: #7a4a1a; }
.bks-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.bks-cell { position: relative; aspect-ratio: 1; border-radius: 10px; background: #fff; box-shadow: inset 0 0 0 2px #e4cfa6; }
.bks-cell.on { box-shadow: inset 0 0 0 3px #e2733a; background: #fff3dc; }
.bks-cell .ic { position: absolute; inset: 4px; }
.bks-cell .n { position: absolute; right: 3px; bottom: 1px; font-size: 14px; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.bks-qty { display: flex; align-items: center; gap: 4px; }
.bks-qty button { width: 34px; height: 34px; border-radius: 10px; background: #fff3dc; box-shadow: inset 0 0 0 2px #d9a560; font-size: 18px; }
.bks-qty b { min-width: 28px; text-align: center; }
.bks-hearts { display: inline-flex; gap: 1px; vertical-align: middle; }
.bks-hearts .h { width: 17px; height: 17px; }
.bks-face { width: 56px; height: 56px; flex: none; border-radius: 50%; background-color: #fff3dc; background-size: 200% 200%; box-shadow: inset 0 0 0 2px #e4cfa6; }
.bks-wallet { padding: 8px 12px; border-radius: 12px; background: #ffeef7; color: #8a2a5a; }

/* ---------- 一枚絵・物語 ---------- */
.bks-story { position: absolute; inset: 0; background: #2a2018; display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 9; }
.bks-story .pic { width: 100%; aspect-ratio: 16/9; background-size: cover; background-position: center; }
.bks-story .bks-talk { position: absolute; }
.bks-pictext { position: absolute; left: 0; right: 0; top: calc(50% + 28vw); padding: 0 18px; color: #fff8e4; font-size: 17px; line-height: 1.7; text-align: center; text-shadow: 0 2px 4px #000; }

/* ---------- タイトル ---------- */
.bks-title { position: absolute; inset: 0; z-index: 15; background-color: #cfe9b4; background-size: cover; background-position: center top; display: flex; flex-direction: column; align-items: center; }
.bks-title h1 { margin: calc(env(safe-area-inset-top, 0px) + 92px) 0 0; width: min(84%, 420px); line-height: 0; }
.bks-title h1 img { width: 100%; height: auto; filter: drop-shadow(0 4px 8px rgba(80, 50, 20, .3)); }
.bks-title .menu { margin-top: auto; margin-bottom: 9%; width: min(80%, 320px); display: flex; flex-direction: column; gap: 12px; }
.bks-title .menu .bks-btn { min-height: 52px; font-size: 18px; }
.bks-title .ver { position: absolute; right: 8px; bottom: 6px; font-size: 14px; color: #fff; text-shadow: 0 1px 2px #000; }
.bks-pickhero { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bks-pickhero button { border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 3px #e4cfa6; padding: 6px; }
.bks-pickhero button.on { box-shadow: inset 0 0 0 4px #e2733a; background: #fff3dc; }
.bks-pickhero .f { width: 100%; aspect-ratio: 1; background-size: 200% 200%; }
.bks-input { width: 100%; height: 46px; border-radius: 12px; border: 2px solid #d9a560; padding: 0 12px; font: inherit; font-size: 17px; background: #fff; }

/* ---------- 精算 ---------- */
.bks-settle { position: absolute; inset: 0; z-index: 30; background: linear-gradient(180deg, #2c3c66, #4b4f86 60%, #7d6a9a); background-size: cover; background-position: center; color: #fff8e4; display: flex; flex-direction: column; align-items: center; padding: 22px 16px; overflow: hidden; }
.bks-settle h2 { margin: 6px 0 2px; font-size: 22px; }
.bks-settle .sub { font-size: 15px; opacity: .85; }
.bks-settle .list { width: 100%; max-width: 420px; flex: 1; overflow-y: auto; margin: 14px 0; }
.bks-settle .it { display: flex; align-items: center; gap: 10px; padding: 6px 10px; margin: 4px 0; border-radius: 12px; background: rgba(255, 255, 255, .12); animation: bksIn .35s ease-out both; }
.bks-settle .it .ic { width: 40px; height: 40px; flex: none; }
.bks-settle .it .t { flex: 1; }
.bks-settle .it .v { font-size: 17px; color: #ffe08a; }
@keyframes bksIn { from { opacity: 0; transform: translateX(-24px); } }
.bks-settle .tot { font-size: 30px; color: #ffe08a; text-shadow: 0 2px 0 #8a5a10; margin: 4px 0 10px; }
.bks-settle .best { font-size: 16px; color: #ffd6ec; height: 22px; }
.bks-settle .bks-btn { min-width: 220px; }
.bks-conf { position: absolute; top: -40px; width: 22px; height: 22px; background-size: 400% 400%; animation: bksFall 3.2s linear forwards; pointer-events: none; }
@keyframes bksFall { to { transform: translateY(110vh) rotate(540deg); } }
.bks-morning { position: absolute; inset: 0; z-index: 31; background: linear-gradient(180deg, #ffe9b8, #fff8e4); background-size: cover; background-position: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; text-align: center; animation: bksFade .5s both; }
.bks-morning b { font-size: 26px; }
.bks-morning .ev { font-size: 16px; line-height: 1.7; color: #6a4a2a; }
@keyframes bksFade { from { opacity: 0; } }

/* ---------- 季節の扉 ---------- */
.bks-door { position: absolute; inset: 0; z-index: 40; background: #fff; overflow: hidden; }
.bks-door .pic { position: absolute; inset: 0; background-size: cover; background-position: center; animation: bksDoor 4s ease-in forwards; }
@keyframes bksDoor { 0% { transform: scale(1); opacity: 0; } 15% { opacity: 1; } 70% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }
.bks-door .petal { position: absolute; width: 26px; height: 26px; background-size: 400% 400%; animation: bksWind 3.6s linear forwards; }
@keyframes bksWind { from { transform: translate(0, 0) rotate(0); } to { transform: translate(-120vw, 40vh) rotate(720deg); } }

@media (max-height: 680px) { .bks-hud { height: 44px; } .bks-slot { width: 40px; height: 40px; } .bks-use { height: 44px; } .bks-nav button { height: 36px; } .bks-talk .face { width: 120px; height: 120px; } .bks-talk .nm { left: 120px; } }
@media (min-width: 521px) { .bks-app { box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 10px 40px rgba(0, 0, 0, .15); } }

/* ---------- v0.2: 絵のアイコン（ui-icons）・音のボタン ---------- */
.bks-ui { display: inline-block; width: 20px; height: 20px; flex: none; vertical-align: -4px; margin-right: 3px; background-repeat: no-repeat; }
.bks-hud .w { display: inline-flex; align-items: center; }
.bks-hud .g { display: inline-flex; align-items: center; }
.bks-hud .st small { display: flex; align-items: center; }
.bks-hud .st small .bks-ui { width: 16px; height: 16px; margin-right: 2px; }
.bks-nav .bks-ui.nav { width: 18px; height: 18px; vertical-align: -3px; }
.bks-wallet { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.bks-wallet .bks-btn { margin-left: auto; text-decoration: none; color: #6a2346; min-height: 32px; padding: 4px 12px; font-size: 14px; }
.bks-morning .bks-ui { width: 22px; height: 22px; }
.bks-snd { position: absolute; right: 8px; top: calc(env(safe-area-inset-top, 0px) + 56px); z-index: 16; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 250, 240, .9) !important; color: #7a4a1a !important; box-shadow: 0 2px 0 rgba(120, 80, 40, .3); display: flex; align-items: center; justify-content: center; }
.bks-snd.off { color: #b9a58a !important; }
.bks-panel a { color: #b0326e; }
@media (max-height: 680px) { .bks-snd { top: calc(env(safe-area-inset-top, 0px) + 50px); } }

/* ---------- v0.2.1: スティック・今日の目標・スキップ・操作の設定・横向き ---------- */
.bks { height: var(--bks-vh, 100%); bottom: auto; }
.bks-stick { position: absolute; z-index: 6; width: 0; height: 0; left: 26%; top: 74%; pointer-events: none; display: none; }
.bks-stick.on, .bks-stick.rest { display: block; }
.bks-stick i, .bks-stick b { position: absolute; border-radius: 50%; }
.bks-stick i { left: -50px; top: -50px; width: 100px; height: 100px; background: rgba(255, 255, 255, .22); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .7), 0 2px 10px rgba(0, 0, 0, .15); }
.bks-stick b { left: -24px; top: -24px; width: 48px; height: 48px; background: radial-gradient(circle at 40% 35%, #fffaf0, #f2d9a8); box-shadow: 0 3px 0 rgba(120, 80, 40, .4); }
.bks-stick.rest { opacity: .38; }
.bks-stick.rest.hint { opacity: .85; animation: bksStickHint 1.6s ease-in-out infinite; }
.bks-stick.rest.hint b { animation: bksKnob 1.6s ease-in-out infinite; }
.bks-stick span { position: absolute; left: -80px; width: 160px; top: 56px; text-align: center; font-size: 14px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); display: none; }
.bks-stick.rest.hint span { display: block; }
@keyframes bksKnob { 0%, 100% { transform: translate(0, 0); } 30% { transform: translate(24px, -10px); } 65% { transform: translate(-18px, 14px); } }
@keyframes bksStickHint { 50% { opacity: .6; } }
.bks-toast { top: 52px; }
.bks-goal { position: absolute; left: 8px; top: 8px; max-width: calc(100% - 62px); padding: 6px 12px 6px 8px; border-radius: 14px; background: rgba(255, 250, 236, .94); box-shadow: 0 3px 0 rgba(120, 80, 40, .25); font-size: 14px; line-height: 1.4; z-index: 4; pointer-events: none; display: none; }
.bks-goal.on { display: block; animation: bksFade .3s both; }
.bks-goal b { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 8px; background: #f0782f; color: #fff; font-size: 14px; }
.bks-skip { position: absolute; right: 0; bottom: calc(100% + 6px); min-height: 36px; padding: 4px 12px !important; border-radius: 18px; background: rgba(255, 250, 236, .95) !important; box-shadow: 0 2px 0 rgba(120, 80, 40, .3); font-size: 14px !important; color: #7a4a1a !important; }
.bks-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0; }
.bks-seg .bks-btn.on { background: linear-gradient(180deg, #ffb05a, #f0782f); color: #fff; box-shadow: 0 3px 0 #b9541c; }
.bks-use.soft { filter: saturate(.55); opacity: .9; }
.ctl-stick .bks-use { height: 56px; max-width: 124px; font-size: 18px !important; }
.bks-morning .fest { max-width: 420px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .7); font-size: 14px; line-height: 1.6; color: #7a4a1a; }
@media (max-height: 680px) { .ctl-stick .bks-use { height: 48px; } .bks-stick i { left: -42px; top: -42px; width: 84px; height: 84px; } .bks-stick b { left: -20px; top: -20px; width: 40px; height: 40px; } }
/* 横向きのスマホ（高さが低い）: 地図を広く・道具と「使う」は右の列（右手の親指） */
@media (orientation: landscape) and (max-height: 520px) {
	.bks-app { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto; padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
	.bks-hud { grid-column: 1 / -1; grid-row: 1; height: 40px; }
	.bks-view { grid-column: 1; grid-row: 2 / 4; }
	.bks-belt { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: repeat(3, 42px); grid-auto-rows: 42px; align-content: center; gap: 5px; border-top: 0; border-left: 3px solid #b98a55; padding: 6px 8px; }
	.bks-slot { width: 42px; height: 42px; }
	.bks-belt .bks-use { grid-column: 1 / -1; grid-row: span 1; width: 100%; max-width: none; min-width: 0; height: 46px; margin: 2px 0 0; }
	.bks-nav { grid-column: 2; grid-row: 3; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px 8px 6px; border-left: 3px solid #b98a55; }
	.bks-nav button { height: 34px; font-size: 14px; }
	.bks-snd { top: calc(env(safe-area-inset-top, 0px) + 48px); right: calc(env(safe-area-inset-right, 0px) + 172px); }
	.bks-talk .face { width: 110px; height: 110px; } .bks-talk .nm { left: 110px; } .bks-talk { min-height: 120px; }
	.bks-title h1 { margin-top: 12px; width: min(40%, 300px); }
	.bks-title .menu { margin-bottom: 4%; }
	.bks-panel { left: 12%; right: 12%; }
}
