/* おちば神社 */
:root { --accent: #c4452a; --accent-ink: #fff; --accent-soft: #fbe3d6; --gold: #e8a91c; --leaf-bg: #3a1d0e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --accent: #ff8a5c; --accent-ink: #1a0d06; --accent-soft: #3a2018; --gold: #ffc94a; } }
:root[data-theme="dark"] { --accent: #ff8a5c; --accent-ink: #1a0d06; --accent-soft: #3a2018; --gold: #ffc94a; }

/* タイトル */
.ko-hero { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; background: linear-gradient(160deg, #f6c27a, #b5461f 70%, #5a2410); box-shadow: var(--shadow); }
.ko-hero video, .ko-hero .ko-title-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ko-hero-fb { position: absolute; inset: 0; display: grid; place-items: center; font-size: 56px; letter-spacing: 6px; }
.ko-hero-text { position: absolute; left: 0; right: 0; top: 0; padding: 14px 16px 30px; background: linear-gradient(rgba(30,12,4,.6), rgba(30,12,4,0)); color: #fff8ec; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.ko-hero-kicker { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .08em; }
.ko-hero-name { margin: 0; font-family: var(--font-serif); font-weight: 900; font-size: clamp(34px, 9vw, 52px); line-height: 1.15; letter-spacing: .06em; }
.ko-continue { margin: 0; padding: 10px 12px; background: var(--accent-soft); border-radius: var(--radius-sm); font-size: 14px; }
.ko-go { min-height: 56px; font-size: 18px; }
.ko-daily .mn-row { gap: 6px; }

/* 本編：画面いっぱい */
body.ko-full .mn-app { max-width: none; padding: 0; }
body.ko-full .mn-about, body.ko-full #pui-about-btn, body.ko-full .mn-footer { display: none; }
.ko-play { display: flex; flex-direction: column; height: calc(100svh - 52px); min-height: 520px; background: var(--leaf-bg); color: #fff8ec; user-select: none; -webkit-user-select: none; }
.ko-hud { display: flex; align-items: flex-start; gap: 8px; padding: 6px 14px 4px; background: linear-gradient(#2a1208, #3a1d0e); }
.ko-hud-l { flex: 1; min-width: 0; }
.ko-season { display: block; font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ko-numwrap { display: flex; align-items: baseline; gap: 4px; line-height: 1.05; }
.ko-num { font-size: clamp(32px, 10vw, 52px); font-weight: 900; color: #ffd36b; letter-spacing: -.01em; font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 rgba(0,0,0,.35); display: inline-block; transform-origin: left center; }
.ko-num.pop { animation: koPop .25s ease-out; }
@keyframes koPop { 0% { transform: scale(1.08); } 100% { transform: scale(1); } }
.ko-unit { font-size: 18px; font-weight: 700; margin-left: 10px; }
.ko-cps { display: block; font-size: 13px; opacity: .9; }
.ko-chips { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.ko-chip { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--gold); color: #2a1208; white-space: nowrap; }
.ko-timer { text-align: right; }
.ko-timer .ko-num { font-size: 44px; color: #fff; }
.ko-dscore { font-size: clamp(36px, 11vw, 54px); font-weight: 900; color: #ffd36b; }
.ko-field { position: relative; flex: 1 1 auto; min-height: 260px; overflow: hidden; }
.ko-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; cursor: crosshair; max-width: none; }
.ko-banner { position: absolute; left: 50%; top: 18%; transform: translate(-50%, 0); padding: 8px 16px; border-radius: 999px; background: rgba(30,12,4,.78); color: #ffe27a; font-weight: 800; font-size: 16px; white-space: nowrap; pointer-events: none; opacity: 0; max-width: 94%; overflow: hidden; text-overflow: ellipsis; }
.ko-banner.on { animation: koBanner 2.6s ease-out forwards; }
.ko-banner.big { font-size: 48px; padding: 10px 30px; top: 35%; }
@keyframes koBanner { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.9); } 10% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 20% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.ko-bar { display: flex; gap: 6px; padding: 6px 8px; background: #2a1208; align-items: center; overflow-x: auto; scrollbar-width: none; }
.ko-bar::-webkit-scrollbar { display: none; }
.ko-mini { flex: none; min-height: 44px; min-width: 44px; padding: 0 8px; border-radius: 10px; border: 1px solid rgba(255,248,236,.25); background: rgba(255,248,236,.08); color: #fff8ec; font-size: 13px; font-weight: 700; cursor: pointer; }
.ko-story-btn.new { border-color: #ffd36b; color: #ffd36b; box-shadow: 0 0 0 2px rgba(255,211,107,.35); }
.ko-story-btn.new::after { content: '●'; font-size: 9px; vertical-align: top; margin-left: 2px; }
.ko-prest { --p: 0; flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 2px 8px; display: flex; flex-direction: column; justify-content: center; line-height: 1.2; text-align: center; border-radius: 10px; border: 1px solid rgba(255,211,107,.5); color: #ffd36b; font-weight: 800; font-size: 12px; cursor: pointer; overflow: hidden; background: linear-gradient(90deg, rgba(255,211,107,.28) calc(var(--p) * 100%), rgba(255,248,236,.06) calc(var(--p) * 100%)); }
.ko-prest b, .ko-prest small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ko-prest small { font-size: 10.5px; font-weight: 700; opacity: .9; }
.ko-prest.ready { background: var(--gold); color: #2a1208; animation: koGlow 1.4s ease-in-out infinite; }
@keyframes koGlow { 50% { box-shadow: 0 0 0 4px rgba(255,201,74,.35); } }

/* お店 */
.ko-shop { flex: 0 0 auto; height: 33svh; min-height: 220px; display: flex; flex-direction: column; background: var(--surface); color: var(--text); }
.ko-tabs { display: flex; border-bottom: 1px solid var(--line); }
.ko-tab { position: relative; flex: 1; min-height: 44px; padding: 0 2px; border: 0; background: none; font-weight: 700; font-size: 14px; color: var(--text-sub); cursor: pointer; border-bottom: 3px solid transparent; }
.ko-tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.ko-tab .ko-dot { display: none; position: absolute; top: 8px; right: calc(50% - 26px); width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.ko-tab.has .ko-dot { display: block; }
.ko-list { flex: 1; overflow-y: auto; padding: 5px 6px 8px; overscroll-behavior: contain; }
.ko-row { position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 10px; margin-bottom: 4px; min-height: 52px; background: var(--surface-2); overflow: hidden; }
.ko-row.can { background: var(--accent-soft); }
.ko-row.locked { opacity: .55; }
.ko-row.owned { opacity: .8; }
.ko-row-t { flex: 1; min-width: 0; line-height: 1.35; }
.ko-row-t b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ko-row-t small { display: block; font-size: 11.5px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ko-count { color: var(--accent); }
.ko-ico { flex: none; width: 40px; height: 40px; object-fit: contain; border-radius: 10px; }
.ko-ico-fb { display: grid; place-items: center; font-size: 26px; background: var(--surface); }
.ko-buy { flex: none; min-width: 84px; min-height: 44px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 800; cursor: pointer; line-height: 1.1; padding: 4px 8px; }
.ko-buy small { display: block; font-size: 10px; font-weight: 600; }
.ko-buy:disabled { background: var(--line); color: var(--text-sub); cursor: default; }
.ko-afford { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--gold); width: 0; transition: width .3s; }
.ko-bulk { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-bottom: 6px; }
.ko-bulk-b { flex: none; align-self: center; margin: 0 6px; min-height: 36px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 12px; cursor: pointer; color: var(--text); }
.ko-bulk-b.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* 物語・図鑑・結果 */
.ko-story p { font-family: var(--font-serif); font-size: 16px; line-height: 1.95; }
.ko-story-head { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.ko-story-head h2 { margin: 0; font-family: var(--font-serif); }
.ko-face { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--accent-soft); flex: none; }
.ko-face-fb { display: grid; place-items: center; font-size: 30px; }
.ko-scene { width: 100%; border-radius: 12px; display: block; aspect-ratio: 16 / 9; object-fit: cover; }
.ko-rusu { width: 70%; max-width: 260px; border-radius: 14px; margin: 0 auto; display: block; }
.ko-rusu-fb { font-size: 44px; }
.ko-offline-big { margin: 0; font-size: clamp(36px, 10vw, 52px); font-weight: 900; color: var(--gold); line-height: 1.1; }
.ko-offline-big small { font-size: 18px; margin-left: 4px; color: var(--text); }
.ko-ul { padding-left: 1.2em; margin: 0; }
.ko-zukan { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.ko-z { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 8px; border-radius: 12px; background: var(--surface-2); }
.ko-z b { font-size: 13px; }
.ko-z small { font-size: 11px; color: var(--text-sub); line-height: 1.4; }
.ko-z.no { opacity: .5; }
.ko-result .ko-line { font-size: 18px; font-weight: 800; line-height: 1.5; margin: 0; }
.ko-cardimg { width: 100%; border-radius: 12px; box-shadow: var(--shadow); display: block; }
.ko-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ko-ending h2 { font-family: var(--font-serif); margin-top: 10px; }
.ko-ending p { font-family: var(--font-serif); line-height: 1.95; }
.ko-adbox:empty { display: none; }

/* PC：境内を左、お店を右に */
@media (min-width: 900px) {
  .ko-play { display: grid; grid-template-columns: 1fr 400px; grid-template-rows: auto auto 1fr auto; height: calc(100vh - 56px); min-height: 600px; }
  .ko-hud { grid-column: 1; grid-row: 1; }
  .ko-goal { grid-column: 1; grid-row: 2; }
  .ko-field { grid-column: 1; grid-row: 3; }
  .ko-bar { grid-column: 1; grid-row: 4; }
  .ko-shop { grid-column: 2; grid-row: 1 / 5; height: auto; border-left: 1px solid var(--line); }
  .ko-daily-play { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .ko-num.pop, .ko-prest.ready { animation: none; }
  .ko-banner.on { animation: koBannerRM 2.6s linear forwards; }
  @keyframes koBannerRM { 0%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 0); } }
}
.ko-stats .mn-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); line-height: 1.35; }
.ko-stats .mn-stat span { font-size: 12px; color: var(--text-sub); writing-mode: horizontal-tb; }
.ko-stats .mn-stat b { font-size: 17px; }

/* 次の目標 */
.ko-goal { display: flex; align-items: center; gap: 8px; padding: 4px 14px 6px; background: #3a1d0e; color: #fff8ec; font-size: 12px; }
.ko-goal-k { flex: none; font-weight: 800; color: #ffd36b; }
.ko-goal-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ko-goal-track { flex: 0 0 64px; height: 6px; border-radius: 3px; background: rgba(255,248,236,.18); overflow: hidden; }
.ko-goal-bar { display: block; height: 100%; width: 0; background: #ffd36b; transition: width .3s; }
.ko-goal.can .ko-goal-t { color: #ffd36b; font-weight: 800; }
/* 留守からすぐ買う */
.ko-quick { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.ko-quick p { margin: 0; }
.ko-qbtn { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 700; cursor: pointer; }
.ko-qbtn span { flex: 1; text-align: left; }
.ko-qbtn.done { opacity: .6; }
.ko-qbtn .ko-ico { width: 34px; height: 34px; }
.ko-rec { display: inline-block; margin-right: 4px; padding: 0 5px; border-radius: 4px; background: var(--gold); color: #2a1208; font-size: 10px; font-weight: 800; vertical-align: 2px; }
