:root {
  --ink: #3a2a3e;
  --ink2: #6a5670;
  --paper: #fbf4e6;
  --paper2: #f3e6cc;
  --gold: #d9a441;
  --gold2: #f6d27a;
  --rose: #e87a9a;
  --sky: #7cc4e8;
  --night: #1d1a2b;
  --panel: rgba(251, 244, 230, 0.97);
  --shadow: 0 10px 40px rgba(20, 10, 30, 0.45);
  --r: 14px;
  --font: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Yu Gothic', sans-serif;
  --px: 2px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; }
body { font-family: var(--font); color: var(--ink); -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; color: inherit; cursor: pointer; }
#stage { position: fixed; inset: 0; overflow: hidden; }
#game { position: absolute; left: 0; top: 0; image-rendering: pixelated; image-rendering: crisp-edges; }
#overlay { position: absolute; left: 0; top: 0; pointer-events: none; }
.hidden { display: none !important; }
#fade { position: absolute; inset: 0; background: #0c0a14; opacity: 0; pointer-events: none; z-index: 90; }
#fade.on { opacity: 1; pointer-events: all; }

/* ローディング */
#loading { position: absolute; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, #2c2440, #120f1c); transition: opacity .5s; }
#loading.done { opacity: 0; pointer-events: none; }
.ld-title { color: #f6e7c8; font-weight: 700; letter-spacing: .3em; margin-bottom: 14px; font-size: 14px; }
.ld-bar { width: 240px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
.ld-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold2)); transition: width .2s; }
.ld-err { color: #fdd; text-align: center; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
#hud > * { pointer-events: auto; }
.hud-tl { position: absolute; left: 12px; top: 10px; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.hud-face { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; border: 3px solid #fff6e0; box-shadow: 0 2px 8px rgba(0,0,0,.4), inset 0 0 0 2px var(--gold); background: linear-gradient(#ffe8f0, #f6c6d6); }
.hud-face img { width: 100%; height: 100%; object-fit: cover; }
.hud-bars { display: flex; flex-direction: column; gap: 4px; }
.hud-lv { color: #fff; font-weight: 900; font-size: 12px; text-shadow: 0 1px 2px #000, 0 0 4px rgba(0,0,0,.6); }
.hud-lv b { font-size: 16px; margin-left: 3px; }
.bar { position: relative; height: 12px; width: 180px; border-radius: 7px; background: rgba(30,20,40,.75); border: 2px solid rgba(255,246,224,.9); overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.bar .fill { position: absolute; inset: 0; width: 100%; transition: width .25s; }
.bar.hp .fill { background: linear-gradient(180deg, #9ff0a8, #39b65a); }
.bar.hp.low .fill { background: linear-gradient(180deg, #ffb0a0, #e0503a); animation: pulse 0.8s infinite; }
.bar .num { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 9px; font-weight: 900; color: #fff; text-shadow: 0 1px 1px #000; }
.bar.exp { height: 5px; width: 140px; border-width: 1px; }
.bar.exp .fill { background: linear-gradient(90deg, #b9a0ff, #7ad0ff); }
@keyframes pulse { 50% { filter: brightness(1.4); } }
.hud-tr { position: absolute; right: 12px; top: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; }
.hud-clock, .hud-money { background: rgba(30, 22, 44, .72); color: #fff6e0; padding: 4px 12px; border-radius: 20px; font-weight: 700; font-size: 13px; display: flex; gap: 8px; align-items: center; border: 1px solid rgba(255,230,180,.35); backdrop-filter: blur(4px); }
.v-time { font-family: 'DotGothic16', monospace; font-size: 15px; }
.ic-sun { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle, #fff6b0, #ffb340); box-shadow: 0 0 8px #ffd34a; }
.ic-sun.evening { background: radial-gradient(circle, #ffd0a0, #ff7a40); box-shadow: 0 0 8px #ff8a40; }
.ic-sun.moon { background: radial-gradient(circle at 35% 35%, #fff, #c8d8ff); box-shadow: 0 0 8px #a8c0ff; }
.coin { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff4b0, #e0a020); border: 1px solid #a06a10; }
.minimap { width: 120px; height: 90px; border-radius: 10px; border: 2px solid rgba(255,246,224,.85); image-rendering: pixelated; box-shadow: 0 2px 8px rgba(0,0,0,.4); opacity: .92; }
.hud-quick { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 6px; align-items: flex-end; }
.qs { position: relative; width: 50px; height: 50px; border-radius: 12px; background: rgba(30,22,44,.7); border: 2px solid rgba(255,246,224,.5); display: flex; align-items: center; justify-content: center; transition: transform .12s; cursor: pointer; }
.qs.sel { border-color: var(--gold2); background: rgba(80,60,30,.8); transform: translateY(-4px); box-shadow: 0 0 12px rgba(246,210,122,.7); }
.qs img { width: 40px; height: 40px; image-rendering: pixelated; }
.qs .uses { position: absolute; right: 2px; bottom: 0; font-size: 12px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000, 0 0 2px #000; }
.qs .uses.empty { color: #ff8080; }
.qs-name { position: absolute; bottom: 58px; left: 50%; transform: translateX(-50%); white-space: nowrap; color: #fff; font-weight: 700; font-size: 12px; text-shadow: 0 1px 3px #000; pointer-events: none; }
.hud-banner { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); text-align: center; color: #fff; opacity: 0; pointer-events: none; }
.hud-banner.on { animation: banner 3.4s ease forwards; }
.bn-name { font-family: 'Kaisei Decol', serif; font-size: 30px; font-weight: 700; letter-spacing: .12em; text-shadow: 0 2px 10px rgba(0,0,0,.8), 0 0 20px rgba(255,220,150,.5); }
.bn-sub { font-size: 13px; letter-spacing: .3em; opacity: .9; text-shadow: 0 1px 4px #000; }
.bn-name::before, .bn-name::after { content: ''; display: inline-block; width: 40px; height: 2px; background: linear-gradient(90deg, transparent, #ffe6b0); vertical-align: middle; margin: 0 14px; }
.bn-name::after { background: linear-gradient(90deg, #ffe6b0, transparent); }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, 10px); } 15%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.hud-toasts, .ui-toasts { position: absolute; right: 14px; top: 150px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; z-index: 85; }
body:has(#dialog.show) .ui-toasts { z-index: 93; }
.ui-toasts { top: 70px; }
.toast { background: rgba(30,22,44,.88); color: #fff6e0; padding: 7px 14px; border-radius: 10px; font-size: 13px; font-weight: 700; border-left: 4px solid var(--sky); animation: tin .3s ease; transition: opacity .5s, transform .5s; max-width: 70vw; }
.toast.out { opacity: 0; transform: translateX(20px); }
.toast.warn { border-color: #ff9f6b; }
.toast.quest, .toast.recipe { border-color: var(--gold2); }
.toast.level { border-color: #b9a0ff; }
.toast.friend { border-color: var(--rose); }
@keyframes tin { from { opacity: 0; transform: translateX(20px); } }
.hud-gets { position: absolute; left: 14px; bottom: 90px; display: flex; flex-direction: column; gap: 5px; pointer-events: none; }
.get, .ui-toasts .get { display: flex; align-items: center; gap: 8px; background: linear-gradient(90deg, rgba(30,22,44,.9), rgba(30,22,44,.5)); color: #fff; padding: 4px 14px 4px 6px; border-radius: 10px; animation: gin .35s ease; transition: opacity .5s, transform .5s; border-left: 3px solid #9fe0a0; }
.get.rare { border-left-color: var(--gold2); box-shadow: 0 0 12px rgba(246,210,122,.4); }
.get.out { opacity: 0; transform: translateX(-20px); }
.get img { width: 32px; height: 32px; image-rendering: pixelated; }
.gn { font-weight: 700; font-size: 13px; }
.gq { font-size: 11px; opacity: .85; }
.gq b { color: var(--gold2); }
@keyframes gin { from { opacity: 0; transform: translateX(-20px); } }
.hud-prompt { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 6px; background: rgba(255,250,240,.95); color: var(--ink); padding: 3px 10px 3px 4px; border-radius: 16px; font-weight: 700; font-size: 12px; box-shadow: 0 3px 10px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .15s; white-space: nowrap; }
.hud-prompt.on { opacity: 1; pointer-events: auto; cursor: pointer; }
.hud-prompt .pk { background: var(--ink); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 10px; }
.hud-prompt .pn { color: var(--ink2); font-size: 11px; }
.hud-prompt::after { content: ''; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-top-color: rgba(255,250,240,.95); border-bottom: 0; }
.hud-boss { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); width: min(520px, 80vw); opacity: 0; transition: opacity .4s; pointer-events: none; }
.hud-boss.on { opacity: 1; }
body:has(#dialog.show) .hud-boss { bottom: auto; top: 18px; } /* 戦闘中の台詞の間は体力バーを上へ（会話枠に隠れないように） */
.hud-boss .bname { color: #fff; text-align: center; font-weight: 900; text-shadow: 0 1px 4px #000; margin-bottom: 3px; letter-spacing: .1em; }
.bar.boss { width: 100%; height: 14px; }
.bar.boss .fill { background: linear-gradient(180deg, #ffb0d0, #d0407a); }
.hud-menu-btn { position: absolute; right: 12px; bottom: 14px; width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,246,224,.7); background: rgba(30,22,44,.7); color: #fff; font-size: 20px; }

/* ---------- タッチ ---------- */
#touch { position: absolute; inset: 0; pointer-events: none; z-index: 25; }
.stick { position: absolute; left: 22px; bottom: 30px; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.12), rgba(255,255,255,.05)); border: 2px solid rgba(255,255,255,.25); pointer-events: auto; touch-action: none; }
.knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; background: rgba(255,250,240,.55); border: 2px solid rgba(255,255,255,.8); }
.tbtns { position: absolute; right: 14px; bottom: 26px; width: 190px; height: 170px; pointer-events: none; }
.tb { position: absolute; pointer-events: auto; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); background: rgba(30,22,44,.5); color: #fff; font-weight: 900; font-size: 12px; touch-action: none; }
.tb.on { background: rgba(246,210,122,.6); }
.tb-attack { right: 0; bottom: 30px; width: 72px; height: 72px; font-size: 14px; background: rgba(232,122,154,.45); }
.tb-dodge { right: 82px; bottom: 0; width: 56px; height: 56px; }
.tb-item { right: 80px; bottom: 72px; width: 56px; height: 56px; background: rgba(124,196,232,.4); }
.tb-act { right: 14px; bottom: 112px; width: 56px; height: 56px; background: rgba(159,224,160,.4); }
.tb-prev, .tb-next { width: 34px; height: 34px; bottom: 136px; font-size: 11px; }
.tb-prev { right: 150px; }
.tb-next { right: 114px; bottom: 140px; }
body:has(#touch:not(.hidden)) .hud-quick { bottom: auto; top: 76px; left: 14px; transform: none; }
body:has(#touch:not(.hidden)) .hud-quick .qs { width: 42px; height: 42px; }
body:has(#touch:not(.hidden)) .hud-quick .qs img { width: 32px; height: 32px; }
body:has(#touch:not(.hidden)) .qs-name { bottom: auto; top: 46px; left: 0; transform: none; }
body:has(#touch:not(.hidden)) .hud-gets { bottom: 180px; }
body:has(#touch:not(.hidden)) .hud-menu-btn { bottom: auto; top: 150px; }

/* ---------- 会話 ---------- */
#dialog { position: absolute; inset: 0; z-index: 91; /* 暗転（#fade 90）の上にも台詞を出す（暗闇の中の語り） */ pointer-events: auto; opacity: 0; transition: opacity .16s; }
#dialog.show { opacity: 1; }
.dlg-portraits { position: absolute; inset: 0; pointer-events: none; }
.pt { position: absolute; bottom: 0; height: min(92vh, 900px); max-width: 52vw; object-fit: contain; object-position: bottom; opacity: 0; transition: opacity .25s, transform .3s, filter .25s; filter: drop-shadow(0 8px 24px rgba(0,0,0,.35)); }
.pt-l { left: 2vw; transform: translateX(-30px); }
.pt-r { right: 2vw; transform: translateX(30px); }
.pt.on { opacity: 1; transform: none; }
.pt.dim { filter: brightness(.55) saturate(.7) drop-shadow(0 8px 24px rgba(0,0,0,.35)); }
.dlg-box { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(900px, 94vw); min-height: 132px; background: linear-gradient(180deg, rgba(255,252,244,.97), rgba(248,238,218,.97)); border-radius: 18px; padding: 26px 32px 20px; box-shadow: var(--shadow), inset 0 0 0 2px #fff, inset 0 0 0 4px rgba(217,164,65,.55); font-size: 18px; line-height: 1.75; }
.dlg-box::before { content: ''; position: absolute; inset: 8px; border-radius: 12px; border: 1px dashed rgba(217,164,65,.45); pointer-events: none; }
.dlg-box.narr { background: linear-gradient(180deg, rgba(30,22,44,.92), rgba(22,16,34,.92)); color: #f6ecd8; box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,230,180,.3); }
.dlg-name { position: absolute; left: 28px; top: -16px; background: var(--nc, var(--rose)); color: #fff; font-weight: 900; padding: 4px 20px; border-radius: 16px; font-size: 16px; box-shadow: 0 3px 8px rgba(0,0,0,.25); border: 2px solid #fff; letter-spacing: .05em; }
.dlg-text em { font-style: normal; color: #d0507a; font-weight: 900; }
.dlg-box.narr .dlg-text em { color: var(--gold2); }
.dlg-next { position: absolute; right: 26px; bottom: 10px; color: var(--gold); animation: bob 0.8s infinite; font-size: 14px; }
@keyframes bob { 50% { transform: translateY(4px); } }
.dlg-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; align-items: center; }
.dlg-choice { min-width: 60%; padding: 10px 24px; border-radius: 24px; border: 2px solid rgba(217,164,65,.6); background: #fffaf0; font-size: 16px; font-weight: 700; transition: all .12s; }
.dlg-box.narr .dlg-choice { background: rgba(255,250,240,.1); color: #fff; }
.dlg-choice.sel, .dlg-choice:hover { background: linear-gradient(90deg, var(--gold2), #ffe8b0); color: var(--ink); border-color: var(--gold); transform: scale(1.03); }

/* ---------- パネル ---------- */
#ui { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
#ui > * { pointer-events: auto; }
.panel { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(12,8,20,.55); opacity: 0; transition: opacity .18s; backdrop-filter: blur(2px); }
.panel.show { opacity: 1; }
.pn-inner { width: min(560px, 94vw); max-height: 92vh; display: flex; flex-direction: column; background: var(--panel); border-radius: 20px; box-shadow: var(--shadow), inset 0 0 0 2px #fff, inset 0 0 0 5px rgba(217,164,65,.5); transform: translateY(12px) scale(.98); transition: transform .2s; overflow: hidden; }
.panel.show .pn-inner { transform: none; }
.panel.wide .pn-inner { width: min(1100px, 96vw); height: min(90vh, 760px); }
.pn-head { display: flex; align-items: center; padding: 14px 18px 10px 24px; background: linear-gradient(180deg, rgba(246,210,122,.35), transparent); border-bottom: 1px solid rgba(217,164,65,.35); }
.pn-title { flex: 1; font-family: 'Kaisei Decol', serif; font-size: 22px; font-weight: 700; color: #5a3a3a; letter-spacing: .08em; }
.pn-close { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(217,164,65,.6); background: #fff; font-size: 16px; }
.pn-body { flex: 1; overflow: auto; padding: 14px 20px 20px; min-height: 0; }
.btn { padding: 9px 18px; border-radius: 22px; border: 2px solid rgba(217,164,65,.7); background: #fffaf0; font-weight: 700; font-size: 14px; transition: all .12s; }
.btn:hover:not([disabled]), .btn:focus-visible { background: #fff1d0; transform: translateY(-1px); }
.btn.primary { background: linear-gradient(180deg, #ffd98a, #f0b04a); border-color: #c8862a; color: #4a2a10; box-shadow: 0 3px 0 #b07020; }
.btn.primary:hover:not([disabled]) { filter: brightness(1.06); }
.btn[disabled] { opacity: .4; cursor: default; }
button:focus-visible, .nav:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.tab { padding: 6px 14px; border-radius: 16px; border: 2px solid rgba(217,164,65,.45); background: rgba(255,255,255,.6); font-weight: 700; font-size: 13px; }
.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.al-empty, .empty { color: var(--ink2); text-align: center; padding: 30px 10px; font-size: 14px; }
.muted { color: var(--ink2); font-size: 13px; }
.ic { width: 32px; height: 32px; image-rendering: pixelated; flex: none; }
.ic.big { width: 64px; height: 64px; }
.ic.huge { width: 128px; height: 128px; }
.ic-missing { display: inline-block; background: rgba(0,0,0,.08); border-radius: 6px; }
.badge { font-size: 10px; font-weight: 900; padding: 1px 6px; border-radius: 8px; background: var(--rose); color: #fff; }
.badge.first { background: #a8a0b8; }
.badge.eq { background: #5a8ad0; }
.badge.sh { background: #c88a3a; }
.badge.qk { background: #3aa070; }
.rank { display: inline-block; font-weight: 900; color: #fff; background: linear-gradient(135deg, #f6c060, #e07a40); border-radius: 6px; padding: 0 6px; font-size: 12px; }
.ech { display: inline-block; font-size: 11px; font-weight: 900; padding: 0 6px; border-radius: 8px; background: var(--ec); color: #fff; margin-right: 2px; text-shadow: 0 1px 1px rgba(0,0,0,.4); }
.tch { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #efe4f8; border: 1px solid #c8b0e0; margin: 1px; color: #5a3a7a; }
.tch.t2 { background: #e4f0ff; border-color: #90b8e8; color: #2a4a7a; }
.tch.t3 { background: linear-gradient(135deg, #fff2c0, #ffd8a0); border-color: #e0a040; color: #6a3a10; }
button.tch { cursor: pointer; font-size: 12px; padding: 4px 10px; }
button.tch.on { background: var(--ink); color: #fff; border-color: var(--ink); box-shadow: 0 0 0 2px var(--gold2); }

/* 錬金 */
.al-layout { display: grid; grid-template-columns: 300px 1fr; gap: 14px; height: 100%; min-height: 0; }
.al-left { display: flex; flex-direction: column; min-height: 0; }
.al-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; }
.al-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; border: 2px solid transparent; background: rgba(255,255,255,.65); text-align: left; font-weight: 700; font-size: 14px; }
.al-row.on { border-color: var(--gold); background: #fff3d6; }
.al-row.cant { opacity: .55; }
.al-name { flex: 1; }
.al-can { color: #3aa070; font-size: 12px; }
.al-right { overflow: auto; min-height: 0; padding-right: 4px; }
.al-head { display: flex; gap: 12px; align-items: center; }
.al-title { font-size: 20px; font-weight: 900; }
.al-desc { font-size: 13px; color: var(--ink2); }
.al-sec { margin: 12px 0 6px; font-weight: 900; font-size: 14px; color: #7a4a3a; border-left: 4px solid var(--gold); padding-left: 8px; }
.al-sec small { font-weight: 500; color: var(--ink2); margin-left: 6px; font-size: 11px; }
.al-slots { display: flex; gap: 8px; flex-wrap: wrap; }
.al-slot { width: 112px; min-height: 104px; border-radius: 14px; border: 2px dashed rgba(217,164,65,.7); background: rgba(255,255,255,.55); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; }
.al-slot.filled { border-style: solid; background: #fff; }
.al-slot.opt { border-color: #b8b0c8; }
.as-need { font-size: 11px; font-weight: 700; color: var(--ink2); text-align: center; line-height: 1.2; min-height: 26px; }
.as-plus { font-size: 26px; color: var(--gold); margin-top: 6px; }
.as-q { font-size: 11px; font-weight: 900; }
.al-lines { display: flex; flex-direction: column; gap: 10px; }
.al-lh { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.al-le { font-weight: 900; color: var(--ec); min-width: 3em; }
.al-lv { font-weight: 900; font-size: 16px; }
.al-leff { font-weight: 700; } .al-leff i { color: #a8a0b0; font-weight: 500; }
.al-gauge { position: relative; height: 14px; border-radius: 8px; background: rgba(0,0,0,.08); margin: 4px 0 16px; }
.al-gfill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; background: linear-gradient(90deg, color-mix(in srgb, var(--ec) 50%, #fff), var(--ec)); transition: width .3s; box-shadow: 0 0 8px var(--ec); }
.al-tick { position: absolute; top: -3px; width: 4px; height: 20px; margin-left: -2px; background: #b8a890; border-radius: 2px; }
.al-tick.on { background: var(--gold); box-shadow: 0 0 6px var(--gold2); }
.al-tick span { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 900; color: var(--ink2); }
.al-tip { display: none; position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--ink); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 6px; }
.al-tick:hover .al-tip { display: block; }
.al-result { display: flex; gap: 14px; align-items: center; margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: #fff7e4; border: 1px solid rgba(217,164,65,.4); flex-wrap: wrap; }
.al-q b { font-size: 24px; color: #c0602a; }
.al-stat { font-size: 13px; font-weight: 700; }
.al-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.picker .pn-inner, .result .pn-inner { width: min(620px, 94vw); }
.pk-list { display: flex; flex-direction: column; gap: 4px; max-height: 56vh; overflow: auto; }
.pk-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; border: 2px solid transparent; background: rgba(255,255,255,.7); text-align: left; }
.pk-row.on { border-color: var(--gold); }
.pk-info { flex: 1; }
.pk-name { font-weight: 700; font-size: 14px; }
.pk-q { font-size: 11px; text-align: right; } .pk-q b { display: block; font-size: 18px; }
.pk-foot { margin-top: 10px; text-align: right; }
.pk-sort { display: flex; gap: 4px; margin-bottom: 8px; }
.rs-card { position: relative; text-align: center; padding: 10px; overflow: hidden; }
.rs-shine { position: absolute; left: 50%; top: 70px; width: 300px; height: 300px; margin: -150px; background: conic-gradient(from 0deg, transparent, rgba(255,220,140,.4), transparent 30%, rgba(255,220,140,.4), transparent 60%, rgba(255,220,140,.4), transparent); animation: spin 8s linear infinite; border-radius: 50%; }
@keyframes spin { to { transform: rotate(360deg); } }
.rs-card .ic.huge { position: relative; animation: popin .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes popin { from { transform: scale(.2); opacity: 0; } }
.rs-name { position: relative; font-size: 22px; font-weight: 900; margin-top: 6px; }
.rs-q { position: relative; font-size: 15px; } .rs-q b { font-size: 26px; color: #c0602a; }
.rs-stat, .rs-eff, .rs-tr { position: relative; font-size: 13px; margin: 6px 0; }
.rs-card .btn { position: relative; margin-top: 10px; min-width: 120px; }
.craft-anim { position: absolute; inset: 0; z-index: 70; background: radial-gradient(circle, rgba(40,20,60,.6), rgba(10,5,20,.9)); display: flex; align-items: center; justify-content: center; animation: fadein .3s; }
.craft-anim.done { opacity: 0; transition: opacity .3s; }
.ca-circle { position: absolute; width: 360px; height: 360px; border-radius: 50%; border: 3px solid rgba(255,220,150,.8); box-shadow: 0 0 30px rgba(255,200,120,.6), inset 0 0 30px rgba(255,200,120,.4); animation: spin 2s linear infinite, grow 1.8s ease-out; background: repeating-conic-gradient(from 0deg, rgba(255,230,170,.18) 0 8deg, transparent 8deg 30deg); }
.ca-cauldron { position: absolute; width: 160px; height: 160px; background: url(../assets/ui/cauldron.webp) center/contain no-repeat; image-rendering: pixelated; animation: wobble .3s infinite; }
.ca-orb { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: 0 0 20px var(--c), 0 0 40px var(--c); animation: orbit 1.8s ease-in forwards; animation-delay: calc(var(--i) * -0.6s); }
.ca-flash { position: absolute; inset: 0; background: #fff; opacity: 0; animation: flash 1.8s ease-in forwards; }
@keyframes grow { from { transform: scale(.3); opacity: 0; } }
@keyframes wobble { 50% { transform: scale(1.04, .97); } }
@keyframes orbit { 0% { transform: rotate(0deg) translateX(160px) rotate(0deg); } 100% { transform: rotate(720deg) translateX(0) rotate(-720deg); } }
@keyframes flash { 0%, 85% { opacity: 0; } 92% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fadein { from { opacity: 0; } }
.bk-list { display: flex; flex-direction: column; gap: 6px; }
.bk-row { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.6); padding: 6px 10px; border-radius: 10px; }
.bk-name { font-weight: 900; } .bk-need { font-size: 12px; color: var(--ink2); }

/* 持ち物 */
.bg-top { display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch; margin-bottom: 10px; }
.bg-equip { display: flex; gap: 6px; }
.eq { width: 92px; padding: 6px 4px; border-radius: 12px; border: 2px solid rgba(217,164,65,.5); background: #fff; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.eq-n { font-size: 10px; font-weight: 900; color: var(--ink2); }
.eq-name { font-size: 11px; font-weight: 700; text-align: center; line-height: 1.2; }
.bg-quick { display: flex; gap: 4px; align-items: center; background: rgba(255,255,255,.5); border-radius: 12px; padding: 4px 8px; }
.bq-t { font-size: 11px; font-weight: 900; writing-mode: vertical-rl; color: var(--ink2); }
.qk { position: relative; width: 52px; height: 52px; border-radius: 10px; border: 2px solid rgba(217,164,65,.5); background: #fff; display: flex; align-items: center; justify-content: center; }
.qk span { position: absolute; left: 3px; top: 0; font-size: 10px; font-weight: 900; color: var(--ink2); }
.bg-stats { display: grid; grid-template-columns: repeat(2, auto); gap: 2px 14px; font-size: 13px; align-content: center; background: rgba(255,255,255,.5); border-radius: 12px; padding: 6px 12px; }
.bg-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-height: 0; height: calc(100% - 110px); }
.bg-left { display: flex; flex-direction: column; min-height: 0; }
.bg-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 3px; }
.bg-row { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 10px; border: 2px solid transparent; background: rgba(255,255,255,.65); text-align: left; font-size: 13px; font-weight: 700; }
.bg-row.on { border-color: var(--gold); background: #fff3d6; }
.bg-name { flex: 1; }
.bg-q { font-weight: 900; min-width: 2.4em; text-align: right; }
.bg-uses { font-size: 11px; color: var(--ink2); }
.bg-detail { overflow: auto; background: rgba(255,255,255,.55); border-radius: 14px; padding: 12px 14px; }
.dt-head { display: flex; gap: 10px; align-items: center; }
.dt-name { font-size: 18px; font-weight: 900; }
.dt-cat { font-size: 12px; color: var(--ink2); }
.dt-q { margin: 6px 0; font-size: 13px; } .dt-q b { font-size: 18px; }
.dt-desc { font-size: 13px; line-height: 1.6; margin: 6px 0; }
.dt-stat { font-size: 13px; font-weight: 700; color: #2a6a4a; }
.dt-eff, .dt-tr { font-size: 12px; margin-top: 6px; }
.tline { margin: 3px 0; }
.dt-act { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

/* お店 */
.sh-top { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.sh-rank { min-width: 200px; } .sh-rn { font-weight: 900; font-size: 18px; color: #8a4a2a; }
.bar.shx { width: 200px; height: 8px; border-width: 1px; } .bar.shx .fill { background: linear-gradient(90deg, #ffd98a, #f0904a); }
.sh-info { font-size: 13px; }
.sh-price { display: flex; gap: 4px; align-items: center; font-size: 13px; font-weight: 700; }
.sh-help { font-size: 12px; color: var(--ink2); margin: 8px 0; }
.sh-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; padding: 12px; border-radius: 14px; background: linear-gradient(180deg, #c89a68, #a87448); box-shadow: inset 0 -6px 0 #7a5030; }
.sh-slot { min-height: 120px; border-radius: 10px; border: 2px solid rgba(255,240,210,.5); background: rgba(255,248,232,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px; }
.sh-slot.sel { box-shadow: 0 0 0 3px var(--gold2); }
.sh-slot img { width: 48px; height: 48px; image-rendering: pixelated; }
.ss-name { font-size: 12px; font-weight: 900; text-align: center; }
.ss-p { font-size: 16px; font-weight: 900; color: #a0502a; } .ss-p small { font-size: 10px; }
.ss-c { font-size: 10px; color: var(--ink2); }
.ss-empty { color: #b8a890; font-weight: 700; }
.sh-sec { margin: 12px 0 6px; font-weight: 900; font-size: 14px; }
.sh-list { display: flex; flex-direction: column; gap: 3px; max-height: 34vh; overflow: auto; }
.sh-row { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 10px; border: 2px solid transparent; background: rgba(255,255,255,.65); font-size: 13px; font-weight: 700; text-align: left; }
.sh-n { flex: 1; } .sh-q { font-size: 12px; } .sh-pr { font-weight: 900; color: #a0502a; min-width: 4em; text-align: right; }
.sh-report { margin-top: 10px; font-size: 12px; color: var(--ink2); }

/* 依頼・開拓 */
.qb-list, .vl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.qcard, .vcard { background: #fffdf6; border-radius: 14px; padding: 12px 14px; border: 2px solid rgba(217,164,65,.35); box-shadow: 0 3px 0 rgba(217,164,65,.25); display: flex; flex-direction: column; gap: 6px; }
.qcard.ok { border-color: #5ab07a; }
.qcard.story { background: linear-gradient(180deg, #fff6e0, #fffdf6); border-color: var(--gold); }
.qc-head { display: flex; gap: 8px; align-items: center; }
.qc-face { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: top; background: #f0e0e8; border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(217,164,65,.5); }
.qc-title { font-weight: 900; font-size: 15px; } .qc-giver { font-size: 11px; color: var(--ink2); }
.qc-desc { font-size: 13px; line-height: 1.55; }
.qc-need, .qc-rw { font-size: 12px; font-weight: 700; }
.qc-prog { color: #3a8a5a; }
.qc-hint { font-size: 11px; color: #c0602a; font-weight: 700; }
.qcard .btn { align-self: flex-end; }
.vl-top { display: flex; gap: 20px; font-size: 14px; margin-bottom: 6px; }
.vl-sec { margin: 12px 0 6px; font-weight: 900; color: #7a4a3a; border-left: 4px solid var(--gold); padding-left: 8px; }
.vc-name { font-weight: 900; font-size: 16px; }
.vc-desc { font-size: 13px; line-height: 1.5; }
.vc-eff { font-size: 12px; color: #2a6a8a; font-weight: 700; }
.vc-cost { list-style: none; padding: 0; margin: 0; font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.vc-cost li { display: flex; align-items: center; gap: 4px; } .vc-cost li b { margin-left: auto; }
.vc-cost li.ok b { color: #3a8a5a; } .vc-cost li.ng b { color: #c04040; }
.vc-cost img { width: 24px; height: 24px; image-rendering: pixelated; }
.vcard .btn { align-self: flex-end; }
.vcard.building { background: #f4f8ff; }
.vl-built { display: flex; flex-wrap: wrap; gap: 6px; } .vb { background: #fff; border-radius: 10px; padding: 3px 10px; font-size: 12px; font-weight: 700; border: 1px solid rgba(217,164,65,.4); }

/* メニュー */
.menu-grid { display: flex; flex-direction: column; gap: 12px; }
.menu-status { display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, #fff0f4, #fff8e8); border-radius: 14px; padding: 10px; }
.ms-face { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--gold); }
.ms-name { font-weight: 900; font-size: 18px; } .ms-name span { font-size: 13px; color: var(--ink2); }
.ms-row { font-size: 13px; } .ms-row.ch { color: #a0502a; font-weight: 700; }
.menu-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mbtn { padding: 14px 6px; border-radius: 14px; border: 2px solid rgba(217,164,65,.5); background: #fff; font-weight: 700; font-size: 14px; }
.mbtn:hover:not([disabled]) { background: #fff3d6; }
.mbtn[disabled] { opacity: .35; }
.slots .pn-body { display: flex; flex-direction: column; gap: 8px; }
.slot { text-align: left; padding: 12px 16px; border-radius: 14px; border: 2px solid rgba(217,164,65,.5); background: #fff; }
.slot[disabled] { opacity: .5; }
.sl-n { font-weight: 900; color: var(--gold); font-size: 12px; } .sl-d { font-size: 15px; } .sl-t { font-size: 11px; color: var(--ink2); } .sl-e { color: var(--ink2); }
.set-row { display: flex; gap: 12px; align-items: center; margin: 10px 0; font-weight: 700; } .set-row input { flex: 1; }
.set-help table { font-size: 13px; border-collapse: collapse; width: 100%; } .set-help td { padding: 3px 6px; border-bottom: 1px dashed rgba(217,164,65,.35); } .set-help h4 { margin: 14px 0 6px; }
.note { background: rgba(255,255,255,.6); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; } .note h4 { margin: 0 0 4px; } .note p { margin: 0; font-size: 13px; line-height: 1.6; }
.person { display: flex; gap: 12px; background: rgba(255,255,255,.6); border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; }
.person img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; object-position: top; background: #f0e0e8; flex: none; }
.person h4 { margin: 0; } .person h4 small { color: var(--ink2); font-weight: 500; } .person p { margin: 4px 0 0; font-size: 12px; line-height: 1.5; }
.hearts { color: var(--rose); letter-spacing: 2px; } .hearts span { color: #e0d0d8; }
.vstat { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 10px; font-size: 14px; }

/* 地図 */
.mapview .pn-inner { width: min(1100px, 96vw); height: min(90vh, 800px); }
.map-wrap { overflow: auto; height: 100%; border-radius: 12px; background: #1a1626; }
.map-cv { display: block; width: auto; max-width: none; height: auto; image-rendering: pixelated; margin: 0 auto; } /* 枠より小さいときは中央に */
.map-legend { font-size: 12px; color: var(--ink2); margin-top: 6px; }

/* アトリエ */
.atelier { position: absolute; inset: 0; opacity: 0; transition: opacity .3s; overflow: hidden; }
.atelier.show { opacity: 1; }
.at-bg { position: absolute; inset: -2%; background-size: cover; background-position: center; animation: drift 30s ease-in-out infinite alternate; }
.atelier.night .at-bg { filter: brightness(.42) saturate(.75) hue-rotate(-12deg) contrast(1.05); transition: filter .8s; }
.atelier .at-bg { transition: filter .8s; }
@keyframes drift { to { transform: scale(1.04) translate(-1%, -1%); } }
.at-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at 60% 50%, transparent 40%, rgba(20,10,30,.55)), linear-gradient(90deg, rgba(20,10,30,.35), transparent 40%); }
.at-top { position: absolute; left: 20px; top: 16px; display: flex; gap: 10px; }
.at-day, .at-money { background: rgba(30,22,44,.75); color: #fff6e0; border-radius: 20px; padding: 6px 16px; font-weight: 700; display: flex; gap: 10px; align-items: center; border: 1px solid rgba(255,230,180,.35); }
.at-title { position: absolute; left: 24px; top: 60px; font-family: 'Kaisei Decol', serif; font-size: 34px; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.6); letter-spacing: .15em; }
.at-chara { position: absolute; left: 0; bottom: 0; height: 92%; width: 46%; pointer-events: none; }
.at-hero { position: absolute; left: 4%; bottom: 0; height: 100%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 10px 30px rgba(0,0,0,.4)); animation: breathe 4s ease-in-out infinite; transform-origin: bottom; }
@keyframes breathe { 50% { transform: scaleY(1.008); } }
.at-talk { position: absolute; left: 30%; bottom: 7%; width: min(420px, 40vw); background: rgba(255,252,244,.95); border-radius: 16px; padding: 12px 16px; box-shadow: var(--shadow); font-size: 14px; line-height: 1.6; }
.att-name { font-weight: 900; color: var(--rose); font-size: 12px; }
.at-menu { position: absolute; right: 3%; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; width: min(300px, 40vw); }
.at-btn { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; text-align: left; padding: 9px 14px; border-radius: 16px; border: 2px solid rgba(255,240,210,.7); background: linear-gradient(90deg, rgba(255,252,244,.95), rgba(255,246,228,.88)); box-shadow: 0 4px 14px rgba(0,0,0,.3); transition: transform .12s; }
.at-btn:hover, .at-btn:focus-visible { transform: translateX(-6px); background: linear-gradient(90deg, #fff, #fff1d0); }
.ab-ic { grid-row: span 2; font-size: 24px; display: flex; align-items: center; }
.ab-t { font-weight: 900; font-size: 16px; } .ab-s { font-size: 11px; color: var(--ink2); } .ab-s em { color: var(--rose); font-style: normal; font-weight: 900; }
.at-btn.out { background: linear-gradient(90deg, rgba(220,240,255,.95), rgba(240,250,255,.9)); }

/* 朝 */
.morning .pn-inner { width: min(520px, 94vw); }
.mr-weather { font-weight: 700; margin-bottom: 8px; }
.mr-sales h4, .mr-built h4 { margin: 8px 0 4px; }
.mr-sales ul { list-style: none; margin: 0; padding: 0; } .mr-sales li { display: flex; gap: 10px; font-size: 13px; padding: 2px 0; border-bottom: 1px dashed rgba(217,164,65,.3); } .mr-sales li span { color: var(--ink2); margin-left: auto; } .mr-sales li b { min-width: 4em; text-align: right; }
.mr-total { font-size: 16px; margin-top: 6px; text-align: right; } .mr-total b { font-size: 22px; color: #c0602a; }
.mr-tip { font-size: 13px; text-align: right; }
.mr-trend { margin-top: 10px; background: #fff3d6; border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.mr-ok { display: block; margin: 14px auto 0; }

/* タイトル */
.title-screen { position: absolute; inset: 0; opacity: 0; transition: opacity .8s; overflow: hidden; background: #120f1c; }
.title-screen.show { opacity: 1; }
.ts-bg { position: absolute; inset: -3%; background-size: cover; background-position: center; animation: drift 40s ease-in-out infinite alternate; }
.ts-glow { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,10,40,.1), rgba(20,10,40,.05) 50%, rgba(20,10,40,.6)); }
.ts-logo { position: absolute; left: 50%; top: 9%; transform: translateX(-50%); text-align: center; color: #fff; width: 96vw; }
.ts-logo h1 { margin: 0; font-family: 'Kaisei Decol', serif; font-size: clamp(34px, 6.5vw, 76px); letter-spacing: .08em; text-shadow: 0 3px 0 #b0607a, 0 6px 20px rgba(60,20,60,.6), 0 0 40px rgba(255,220,240,.6); line-height: 1.15; }
.ts-sub { font-size: clamp(12px, 1.6vw, 18px); letter-spacing: .4em; font-weight: 700; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.ts-en { font-size: clamp(11px, 1.4vw, 16px); letter-spacing: .5em; margin-top: 6px; font-weight: 700; color: #ffe8b8; text-shadow: 0 2px 6px rgba(0,0,0,.7); }
.ts-menu { position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; width: min(280px, 70vw); }
.ts-btn { padding: 12px; border-radius: 26px; border: 2px solid rgba(255,240,210,.85); background: rgba(30,22,44,.55); color: #fff; font-size: 17px; font-weight: 900; letter-spacing: .2em; backdrop-filter: blur(6px); transition: all .15s; }
.ts-btn:hover:not([disabled]), .ts-btn:focus-visible { background: rgba(255,240,210,.9); color: var(--ink); }
.ts-btn[disabled] { opacity: .4; }
.ts-foot { position: absolute; bottom: 10px; width: 100%; text-align: center; color: rgba(255,255,255,.7); font-size: 11px; }

/* 章・CG・クレジット */
.chapter-card { position: absolute; inset: 0; z-index: 92; /* 暗転（#fade 90）の中でも見える */ display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(ellipse, rgba(30,20,50,.85), rgba(10,6,20,.95)); opacity: 0; transition: opacity .6s; pointer-events: none; color: #fff; }
.chapter-card.show { opacity: 1; }
.cc-n { font-size: 16px; letter-spacing: .6em; color: var(--gold2); font-weight: 700; }
.cc-name { font-family: 'Kaisei Decol', serif; font-size: clamp(26px, 5vw, 48px); margin-top: 10px; letter-spacing: .12em; text-shadow: 0 0 30px rgba(255,210,150,.5); }
.cg { position: absolute; inset: 0; z-index: 55; background: #000; opacity: 0; transition: opacity .8s; pointer-events: none; display: flex; align-items: center; justify-content: center; }
.cg.show { opacity: 1; }
body:has(.cg.show:not(.noimg)) .pt { opacity: 0; } /* 一枚絵の間は立ち絵を下げる（絵の中の人物と二重にならないように） */
.cg img { width: 100%; height: 100%; object-fit: cover; animation: drift 20s ease-in-out infinite alternate; }
.credits { position: absolute; inset: 0; z-index: 95; background: #0c0a14; opacity: 0; transition: opacity 1s; overflow: hidden; color: #f6ecd8; }
.credits.show { opacity: 1; }
.cr-roll { position: absolute; left: 0; right: 0; top: 100%; text-align: center; animation: roll 60s linear forwards; }
.cr-title { font-family: 'Kaisei Decol', serif; font-size: 40px; margin-bottom: 60px; }
.cr-roll h3 { color: var(--gold2); margin: 40px 0 8px; letter-spacing: .2em; font-size: 15px; }
.cr-roll p { margin: 4px 0; font-size: 16px; }
.cr-end { margin-top: 120px; font-size: 22px; letter-spacing: .2em; }
@keyframes roll { to { transform: translateY(calc(-100% - 100vh)); } }

/* ---------- スマホ縦 ---------- */
@media (max-width: 760px), (orientation: portrait) {
  .dlg-box { font-size: 15px; padding: 22px 18px 14px; min-height: 110px; bottom: 10px; }
  .pt { height: 62vh; max-width: 76vw; bottom: 120px; }
  .pt-l { left: -6vw; } .pt-r { right: -6vw; }
  /* スマホ縦: フィールドの会話では立ち絵を小さくし、話していない人と地の文の間は下げる（人物の配置が見えるように） */
  body:has(#touch:not(.hidden)) .pt { height: 42vh; max-width: 56vw; }
  body:has(#touch:not(.hidden)) .pt-l { left: -10vw; } body:has(#touch:not(.hidden)) .pt-r { right: -10vw; } /* 画面の中央（主人公）にかからないよう外へ寄せる */
  body:has(.ch4-radar) .pt { height: 38vh; max-width: 56vw; } /* 第4章の五響の図（上半分）に立ち絵がかからないように */
  .pt.dim, #dialog:has(.dlg-box.narr) .pt { opacity: 0; }
  body:has(#dialog.show) #touch { opacity: 0; visibility: hidden; transition: opacity .2s; }
  .al-layout, .bg-layout { grid-template-columns: 1fr; height: auto; }
  .al-list { max-height: 30vh; }
  .bg-list { max-height: 34vh; }
  .panel.wide .pn-inner { height: 94vh; }
  .menu-btns { grid-template-columns: repeat(2, 1fr); }
  .at-menu { right: 50%; transform: translateX(50%); top: auto; bottom: 12px; width: 92vw; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .at-btn { padding: 6px 10px; grid-template-columns: 30px 1fr; }
  .ab-ic { font-size: 18px; } .ab-t { font-size: 14px; }
  .at-btn.out { grid-column: span 2; }
  .at-chara { width: 90%; height: 62%; bottom: 36%; left: 5%; }
  .at-talk { left: 4%; bottom: auto; top: 110px; width: 92vw; font-size: 13px; }
  .at-title { font-size: 24px; top: 56px; }
  .bar { width: 130px; } .bar.exp { width: 100px; }
  .hud-face { width: 44px; height: 44px; }
  .minimap { width: 90px; height: 68px; }
  .bn-name { font-size: 22px; }
  .qb-list, .vl-list { grid-template-columns: 1fr; }
  .stick { width: 110px; height: 110px; }
}

/* =================== 追加: 春待ちの灯とトワネの大釜 =================== */
#stage.shake { animation: stshake .12s linear infinite; }
@keyframes stshake { 0% { transform: translate(0, 0); } 25% { transform: translate(-3px, 2px); } 50% { transform: translate(2px, -2px); } 75% { transform: translate(-2px, -1px); } 100% { transform: translate(0, 0); } }
.ld-name { font-family: 'Kaisei Decol', serif; color: #fff1d6; font-size: clamp(18px, 4vw, 28px); letter-spacing: .1em; margin-bottom: 18px; text-shadow: 0 0 20px rgba(255,200,120,.45); text-align: center; padding: 0 16px; }

/* HUD */
.hud-face { position: relative; }
.hud-face-fb { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 20px; color: #b0506a; z-index: 0; }
.hud-face img { position: relative; z-index: 1; }
.hud-face img.missing { display: none; }
.hud-money small, .at-money small, .at-warm small { font-size: 10px; opacity: .8; margin-left: -4px; }
.v-weather { font-size: 14px; line-height: 1; }
.v-weather.w-rain { color: #9fd0ff; } .v-weather.w-snow, .v-weather.w-blizzard { color: #e8f4ff; } .v-weather.w-fog { color: #d8d0e8; } .v-weather.w-windy { color: #a8f0c0; } .v-weather.w-sunny { color: #ffd860; }
.qs { border-color: color-mix(in srgb, var(--vc, #fff) 70%, #fff6e0); background: radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--vc, #888) 35%, transparent), rgba(30,22,44,.72) 70%); border-radius: 14px 14px 18px 18px; }
.qs-cap { position: absolute; left: 50%; top: -6px; width: 20px; height: 7px; margin-left: -10px; border-radius: 3px; background: linear-gradient(#e8c890, #a87840); border: 1px solid rgba(255,246,224,.7); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.qs.sel { border-color: var(--vc); background: radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--vc) 60%, transparent), rgba(80,60,30,.85) 75%); box-shadow: 0 0 14px color-mix(in srgb, var(--vc) 80%, transparent), 0 0 0 2px var(--gold2); }
.qs-empty { width: 14px; height: 14px; border-radius: 50%; background: color-mix(in srgb, var(--vc) 40%, transparent); opacity: .6; }
.hud-cold { display: none; align-items: center; gap: 4px; color: #e8f4ff; font-size: 10px; font-weight: 900; text-shadow: 0 1px 2px #000; }
.hud-cold.on { display: flex; }
.bar.cold { width: 110px; height: 7px; border-width: 1px; }
.bar.cold .fill { background: linear-gradient(90deg, #ffb070, #ffe0a0); }
.hud-cold.low .fill { background: linear-gradient(90deg, #a0d0ff, #e0f0ff); animation: pulse .7s infinite; }
.hud-boss .bsub { color: #ffe0f0; text-align: center; font-size: 11px; letter-spacing: .3em; text-shadow: 0 1px 3px #000; min-height: 0; }
.hud-boss .bname { font-family: 'Kaisei Decol', serif; font-size: 18px; }
.bar.boss { height: 16px; border-color: rgba(255,230,240,.95); }
.bar.boss .lag { position: absolute; inset: 0; width: 100%; background: rgba(255,240,200,.75); }
.hud-boss.stun .bname::after { content: ' ― 隙あり！'; color: var(--gold2); font-size: 13px; }
.toast.rumble { border-color: #ff9a50; background: rgba(60,26,20,.92); }
.toast.warmth { border-color: #ffc070; }
.toast.money { border-color: var(--gold); }

/* 会話 */
.pt.missing { display: none; }
.dlg-ctrl { position: absolute; right: 18px; top: -15px; display: flex; gap: 6px; z-index: 2; }
.dlg-ctrl button { font-size: 10px; font-weight: 900; letter-spacing: .08em; padding: 3px 9px; border-radius: 10px; border: 2px solid #fff; background: rgba(58,42,62,.85); color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.dlg-ctrl button.on { background: var(--gold); color: #3a2010; }
#dialog.skipping .dc-skip { background: var(--gold); color: #3a2010; }
.dlg-box.narr .dlg-ctrl { display: flex; }
.dlg-text { min-height: 2em; }

/* 工房（ひだまり調合店） */
.at-top { right: 20px; flex-wrap: wrap; align-items: center; }
.at-warm { background: rgba(60,34,20,.78); color: #ffe6b8; border-radius: 20px; padding: 4px 14px 4px 8px; font-weight: 700; display: flex; gap: 8px; align-items: center; border: 1px solid rgba(255,200,120,.5); box-shadow: 0 0 12px rgba(255,170,80,.25); }
.warm-ic, .ic-missing.warm-ic { width: 24px; height: 24px; }
.ic-missing.warm-ic { display: inline-block; border-radius: 6px 6px 9px 9px; background: radial-gradient(circle at 50% 70%, #ffd890, #e88a40 70%); box-shadow: 0 0 8px #ffb860; }
.at-sys { margin-left: auto; display: flex; gap: 6px; }
.at-mini { padding: 5px 12px; border-radius: 16px; border: 1px solid rgba(255,230,180,.5); background: rgba(30,22,44,.7); color: #fff6e0; font-size: 12px; font-weight: 700; }
.at-mini:hover, .at-mini:focus-visible { background: rgba(255,240,210,.9); color: var(--ink); }
.at-title { display: flex; flex-direction: column; top: 64px; }
.at-title small { font-family: var(--font); font-size: 13px; letter-spacing: .1em; color: #ffe8c0; margin-top: 2px; }
.at-shelf { position: absolute; left: 30%; top: 70px; width: min(300px, 30vw); background: linear-gradient(180deg, rgba(110,70,40,.82), rgba(80,50,30,.88)); border: 2px solid rgba(255,220,170,.55); border-radius: 12px; padding: 8px 10px 6px; box-shadow: 0 6px 20px rgba(0,0,0,.35), inset 0 -5px 0 rgba(50,30,15,.6); }
.as-vials { display: flex; flex-wrap: wrap; gap: 3px; align-items: flex-end; min-height: 26px; }
.as-vials i { width: 10px; height: 18px; border-radius: 3px 3px 5px 5px; background: linear-gradient(180deg, rgba(255,255,255,.5) 0 18%, var(--c) 18% 100%); background-size: 100% var(--h); background-repeat: no-repeat; background-position: bottom; border: 1px solid rgba(255,255,255,.55); box-shadow: 0 0 6px color-mix(in srgb, var(--c) 70%, transparent); animation: vglow 3s ease-in-out infinite; animation-delay: var(--d); }
@keyframes vglow { 50% { filter: brightness(1.35); } }
.as-empty { color: rgba(255,230,200,.6); font-size: 11px; }
.as-label { color: #ffe6c0; font-size: 12px; font-weight: 700; margin-top: 4px; text-align: right; } .as-label b { font-size: 15px; color: #fff; }
.at-talk { display: flex; gap: 10px; align-items: center; }
.att-face { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; object-position: top; background: #f8e8d8; border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(217,164,65,.5); flex: none; }
.att-body { flex: 1; min-width: 0; }
.at-btn[disabled] { opacity: .5; cursor: default; }
.at-btn[disabled]:hover { transform: none; }
/* 工房めぐり（docs/scenario ch1_atelier_tour）: 台詞に合わせてボタン・小棚を光らせる。会話中でも薄くしない */
.atelier .at-hl { opacity: 1 !important; position: relative; z-index: 4; animation: athl 1.1s ease-in-out infinite; }
@keyframes athl { 0%, 100% { box-shadow: 0 0 0 3px rgba(255,214,120,.9), 0 0 18px 6px rgba(255,200,90,.65); } 50% { box-shadow: 0 0 0 5px rgba(255,236,170,1), 0 0 30px 12px rgba(255,210,110,.85); } }
body:has(#dialog.show) .atelier .at-menu:has(.at-hl) { opacity: 1; }
body:has(#dialog.show) .atelier .at-menu:has(.at-hl) .at-btn:not(.at-hl) { opacity: .3; }
.ab-ic { justify-content: center; }

/* メニュー */
.ms-face { position: relative; width: 80px; height: 80px; border-radius: 50%; overflow: hidden; flex: none; background: linear-gradient(#ffe8f0, #f6c6d6); display: flex; align-items: center; justify-content: center; }
.ms-face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ms-face span { font-weight: 900; font-size: 28px; color: #b0506a; }
.mbtn small { display: block; font-size: 10px; color: var(--ink2); font-weight: 500; }
.mbtn.bell { background: linear-gradient(180deg, #fffaf0, #fff0d0); }
.set-seg { display: flex; gap: 4px; flex-wrap: wrap; }
.set-row > .set-seg { flex: 1; }

/* 朝 */
.mr-fc { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.fc { display: flex; flex-direction: column; align-items: center; min-width: 58px; padding: 4px 8px; border-radius: 12px; background: rgba(255,255,255,.65); border: 1px solid rgba(217,164,65,.35); }
.fc.today { background: #fff3d6; border-color: var(--gold); }
.fc-d { font-size: 10px; color: var(--ink2); font-weight: 700; } .fc-i { font-size: 20px; line-height: 1.2; } .fc-n { font-size: 11px; font-weight: 700; }
.fc.w-rain .fc-i { color: #3a8ad0; } .fc.w-sunny .fc-i { color: #e8a020; } .fc.w-windy .fc-i { color: #40a070; } .fc.w-cloudy .fc-i { color: #8a8aa0; }
.mr-weather { font-size: 13px; }
.mr-rumble { margin-top: 4px; color: #b04a20; font-weight: 700; }
.mr-tired { margin-top: 4px; color: #6a5670; }
.mr-sec { margin-top: 10px; background: rgba(255,255,255,.5); border-radius: 12px; padding: 6px 12px; }
.mr-sec h4 { margin: 4px 0; }
.mr-sales li { align-items: center; } .mr-sales li img { width: 24px; height: 24px; }
.mr-n { flex: 1; } .mr-sales li .mr-q { margin-left: 0; color: var(--ink2); font-size: 12px; }
.empty.small { padding: 6px; }
.mr-voices p { margin: 4px 0; font-size: 12px; color: #6a4a3a; } .mr-voices small { margin-left: 6px; color: var(--ink2); }
.mr-warm { display: flex; gap: 10px; align-items: center; background: linear-gradient(90deg, rgba(255,224,170,.6), rgba(255,255,255,.4)); }
.mr-warm.up { box-shadow: 0 0 0 2px rgba(255,190,100,.6); }
.mr-warm .ic-missing.warm-ic, .mr-warm .warm-ic { width: 32px; height: 32px; }
.mw-n { font-weight: 900; } .mw-n b { color: #d06a20; font-size: 18px; } .mw-n span { font-size: 12px; color: var(--ink2); font-weight: 700; margin-left: 4px; }
.mw-t { font-size: 12px; }
.mb-done { font-weight: 900; color: #2a7a4a; } .mb-prog { font-size: 13px; } .mb-prog span { color: var(--ink2); margin-left: 6px; }
.morning .pn-body { padding-top: 10px; }

/* 風見標 */
.tv-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tv-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; border: 2px solid rgba(217,164,65,.5); background: #fff; text-align: left; font-weight: 700; }
.tv-row:hover, .tv-row:focus-visible { background: #eef8ff; }
.tv-ic { color: #3ab0e0; } .tv-n { flex: 1; } .tv-r { font-size: 12px; color: var(--ink2); }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; } .lg-me { color: #e0509a; } .map-legend .ft { color: #2a90c0; }
.mapview .pn-body { display: flex; flex-direction: column; } .mapview .map-wrap { flex: 1; min-height: 0; }

/* タイトル */
.ts-logo h1 wbr { display: inline; }
.ts-sparks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ts-sparks i { position: absolute; left: var(--x); bottom: -10px; width: 5px; height: 5px; border-radius: 50%; background: #ffe6a0; box-shadow: 0 0 10px #ffc860, 0 0 20px #ffb040; opacity: 0; animation: spark var(--d) linear infinite; animation-delay: calc(var(--i) * -0.7s); }
@keyframes spark { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: .9; } 100% { transform: translate(30px, -105vh); opacity: 0; } }
.cg.noimg { background: radial-gradient(ellipse at 50% 60%, #3a2c50, #0c0a14); }

/* クレジット */
.credits { z-index: 96; }
.cr-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 120%, rgba(255,180,90,.25), transparent 60%), radial-gradient(ellipse at 50% -20%, rgba(120,140,255,.18), transparent 60%); }
.cr-title { line-height: 1.3; padding: 0 16px; font-size: clamp(26px, 5vw, 40px); }
.cr-roll p small { display: block; font-size: 12px; opacity: .7; }
.cr-roll img { max-width: min(480px, 80vw); border-radius: 10px; margin: 20px auto; display: block; }
.cr-skip { position: absolute; right: 14px; bottom: 10px; font-size: 11px; color: rgba(255,255,255,.4); }

/* 後日談 */
.ending { position: absolute; inset: 0; z-index: 95; background: #0c0a14; opacity: 0; transition: opacity 1.2s; color: #fff8ea; }
.ending.show { opacity: 1; }
.ed-cg { position: absolute; inset: 0; }
.ed-cg img { width: 100%; height: 100%; object-fit: cover; animation: drift 24s ease-in-out infinite alternate; }
.ed-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,6,20,.15), rgba(10,6,20,.2) 40%, rgba(10,6,20,.85)); }
.ed-card { position: absolute; left: 50%; bottom: 8%; transform: translate(-50%, 16px); width: min(760px, 92vw); text-align: center; opacity: 0; transition: opacity .8s, transform .8s; }
.ed-card.show { opacity: 1; transform: translate(-50%, 0); }
.ed-face { display: none; width: 96px; height: 96px; border-radius: 50%; object-fit: cover; object-position: top; border: 3px solid #fff; box-shadow: 0 0 0 3px var(--gold), 0 6px 20px rgba(0,0,0,.5); background: #f6e6d8; margin: 0 auto 8px; }
.ending.has-face .ed-face { display: block; }
.ed-label { color: var(--gold2); letter-spacing: .4em; font-size: 12px; font-weight: 700; min-height: 1em; }
.ed-title { font-family: 'Kaisei Decol', serif; font-size: clamp(22px, 4vw, 34px); margin: 4px 0 10px; text-shadow: 0 0 20px rgba(255,200,120,.5); min-height: .5em; }
.ed-text { font-size: clamp(14px, 2.2vw, 18px); line-height: 1.9; text-shadow: 0 2px 6px rgba(0,0,0,.8); }
.ed-next { position: absolute; right: 24px; bottom: 16px; color: var(--gold2); animation: bob .8s infinite; }

/* ---------- 最終調合 ---------- */
.finalcraft { position: absolute; inset: 0; z-index: 57; opacity: 0; transition: opacity .8s; overflow: hidden; color: #fff8ea; }
.finalcraft.show { opacity: 1; }
.fc-bg { position: absolute; inset: -3%; background: #1a1020 center/cover; filter: brightness(.45) saturate(1.2) blur(2px); }
.fc-shade { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 55%, rgba(255,170,80,.28), rgba(20,10,30,.6) 55%, rgba(10,5,20,.9)); }
.fc-cv { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.fc-head { position: absolute; left: 0; right: 0; top: 14px; text-align: center; z-index: 2; }
.fc-title { font-family: 'Kaisei Decol', serif; font-size: clamp(24px, 4vw, 36px); letter-spacing: .3em; text-shadow: 0 0 18px rgba(255,200,120,.7); }
.fc-sub { font-size: 12px; letter-spacing: .2em; color: #ffe0b0; }
.fc-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -58%); width: min(620px, 94vw); height: min(330px, 44vh); display: flex; align-items: flex-end; justify-content: center; z-index: 2; }
.fc-pot { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 200px; height: 170px; pointer-events: none; }
.fc-pot-img { position: absolute; inset: 0; background: url(../assets/ui/cauldron.webp) center bottom/contain no-repeat, radial-gradient(ellipse at 50% 80%, rgba(255,190,110,.35), transparent 60%); filter: drop-shadow(0 0 20px rgba(255,180,90,.6)); }
.fc-glow { position: absolute; left: 50%; top: 20%; width: 150px; height: 60px; margin-left: -75px; border-radius: 50%; background: radial-gradient(ellipse, rgba(255,230,160,.9), rgba(255,160,60,.3) 60%, transparent 70%); animation: pulse 1.6s infinite; }
.fc-pot.splash .fc-glow { animation: potsplash .9s ease-out; }
@keyframes potsplash { 0% { transform: scale(1); } 30% { transform: scale(1.8, 2.4); filter: brightness(1.8); } 100% { transform: scale(1); } }
.fc-gauges { position: absolute; inset: 0 0 64px 0; display: flex; justify-content: space-between; align-items: stretch; padding: 0 8px; }
.fc-tube { position: relative; width: 38px; border-radius: 19px; background: rgba(20,12,30,.65); border: 2px solid rgba(255,240,220,.65); box-shadow: inset 0 0 12px rgba(0,0,0,.6); overflow: visible; }
.fc-tube:nth-child(3) { visibility: visible; }
.fc-fill { position: absolute; left: 3px; right: 3px; bottom: 3px; height: 0; border-radius: 16px; background: linear-gradient(0deg, var(--ec), color-mix(in srgb, var(--ec) 45%, #fff)); box-shadow: 0 0 14px var(--ec); }
.fc-tube.near .fc-fill { animation: pulse 1s infinite; }
.fc-tube.full { border-color: var(--gold2); box-shadow: 0 0 18px var(--ec), inset 0 0 12px rgba(0,0,0,.4); }
.fc-val { position: absolute; left: 50%; top: -20px; transform: translateX(-50%); font-family: 'DotGothic16', monospace; font-size: 12px; color: #fff; text-shadow: 0 1px 2px #000; }
.fc-en { position: absolute; left: 50%; bottom: -24px; transform: translateX(-50%); font-weight: 900; font-size: 16px; color: var(--ec); text-shadow: 0 0 6px rgba(0,0,0,.9), 0 1px 0 #000; }
.fc-line { position: absolute; left: -6px; right: -6px; bottom: calc(80% - 1px); height: 0; border-top: 2px dashed rgba(255,230,170,.75); pointer-events: none; }
.fc-line span { position: absolute; right: -2px; top: -18px; font-size: 10px; color: #ffe6b0; letter-spacing: .2em; }
.fc-line.lit { border-top: 3px solid #ffe8a0; box-shadow: 0 0 14px #ffd060, 0 0 30px #ffb040; }
.fc-calc { position: absolute; left: 50%; top: -6px; transform: translate(-50%, -100%); display: none; gap: 6px; font-family: 'DotGothic16', monospace; font-size: 11px; background: rgba(10,14,30,.8); border: 1px solid rgba(160,200,255,.5); border-radius: 10px; padding: 4px 8px; box-shadow: 0 0 16px rgba(120,170,255,.35); }
.fc-calc.show { display: flex; }
.fc-calc div { display: flex; flex-direction: column; align-items: center; min-width: 50px; }
.fc-calc b { color: var(--ec); } .fc-calc i { font-style: normal; color: #9ab0d8; font-size: 9px; } .fc-calc .ok span { color: #ffe8a0; }
.finalcraft.calcing .fc-center { animation: hum .25s linear infinite; }
@keyframes hum { 50% { transform: translate(calc(-50% + 1px), -58%); } }
.fc-say { position: absolute; top: 76px; display: flex; gap: 10px; align-items: center; max-width: min(460px, 46vw); background: rgba(255,252,244,.96); color: var(--ink); border-radius: 16px; padding: 8px 14px 8px 8px; box-shadow: var(--shadow); opacity: 0; transform: translateY(-8px); transition: opacity .3s, transform .3s; z-index: 4; pointer-events: none; }
.fc-say.show { opacity: 1; transform: none; }
.fc-say img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; object-position: top; background: #e8eef8; border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(90,110,170,.5); flex: none; }
.fc-say b { font-size: 12px; color: #4a5a9a; } .fc-say p { margin: 2px 0 0; font-size: 14px; line-height: 1.55; font-weight: 700; }
.fc-say-c { right: 2vw; } .fc-say-k { left: 2vw; } .fc-say-k b { color: var(--rose); } .fc-say-k img { background: #ffe8f0; box-shadow: 0 0 0 2px rgba(232,122,154,.5); }
.fc-slots { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(980px, 96vw); display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; z-index: 2; }
.fc-slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px 10px; border-radius: 16px; border: 2px solid color-mix(in srgb, var(--vc) 60%, #fff); background: linear-gradient(180deg, rgba(30,20,44,.85), rgba(20,12,30,.92)); color: #fff6e6; text-align: center; transition: transform .2s, box-shadow .2s, opacity .3s; }
.fc-slot[disabled] { opacity: .55; cursor: default; }
.fc-slot.next { opacity: 1; box-shadow: 0 0 0 3px var(--vc), 0 0 26px var(--vc); animation: nextpulse 1.2s ease-in-out infinite; }
@keyframes nextpulse { 50% { transform: translateY(-4px); } }
.fc-slot.done { opacity: .85; border-color: var(--gold2); }
.fc-slot.done .fs-go { visibility: hidden; }
.fs-vial { position: relative; width: 26px; height: 36px; border-radius: 5px 5px 10px 10px; border: 2px solid rgba(255,255,255,.8); background: rgba(255,255,255,.12); overflow: hidden; margin-bottom: 4px; }
.fs-vial i { position: absolute; left: 0; right: 0; bottom: 0; height: 75%; background: var(--vc); box-shadow: 0 0 10px var(--vc); transition: height .6s; }
.fc-slot.done .fs-vial i, .fc-slot.pouring .fs-vial i { height: 0; }
.fs-n { font-size: 10px; letter-spacing: .2em; color: color-mix(in srgb, var(--vc) 60%, #fff); font-weight: 900; }
.fs-t { font-weight: 900; font-size: 15px; }
.fs-i { font-size: 11px; line-height: 1.45; color: #e8dcc8; min-height: 2.9em; }
.fs-go { margin-top: 4px; padding: 2px 16px; border-radius: 12px; background: var(--vc); color: #fff; font-weight: 900; font-size: 12px; text-shadow: 0 1px 1px rgba(0,0,0,.4); }
.fc-orb { position: absolute; width: 22px; height: 22px; margin: -11px; border-radius: 50%; background: var(--vc); box-shadow: 0 0 20px var(--vc), 0 0 40px var(--vc); z-index: 5; transition: left .7s cubic-bezier(.4,0,.6,1), top .7s cubic-bezier(.2,-0.6,.6,1); pointer-events: none; }
.fc-stir { position: absolute; left: 50%; bottom: 24%; transform: translate(-50%, 10px) scale(.9); z-index: 6; font-size: 22px; padding: 14px 44px; opacity: 0; pointer-events: none; transition: opacity .4s, transform .4s; letter-spacing: .2em; }
.fc-stir.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); animation: stirglow 1.2s ease-in-out infinite; }
@keyframes stirglow { 50% { box-shadow: 0 3px 0 #b07020, 0 0 30px #ffd060; } }
.fc-flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 55%, #fff, #ffe8a0 30%, rgba(255,190,80,.6) 60%, transparent 80%); opacity: 0; pointer-events: none; z-index: 7; }
.finalcraft.burst .fc-flash { animation: fcflash 2.2s ease-out forwards; }
@keyframes fcflash { 0% { opacity: 0; } 15% { opacity: 1; } 60% { opacity: .85; } 100% { opacity: .25; } }
.finalcraft.burst .fc-pot::after { content: ''; position: absolute; left: 50%; bottom: 40%; width: 120px; margin-left: -60px; height: 100vh; background: linear-gradient(0deg, rgba(255,240,180,.95), rgba(255,210,120,.4) 60%, transparent); filter: blur(6px); animation: pillar 2s ease-out forwards; transform-origin: bottom; }
@keyframes pillar { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.finalcraft.done .fc-slots, .finalcraft.done .fc-center, .finalcraft.done .fc-say { opacity: 0; transition: opacity .6s; }
.fc-result { position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .8s; color: #4a2a10; }
.fc-result.show { opacity: 1; pointer-events: auto; }
.fr-rays { position: absolute; left: 50%; top: 45%; width: 900px; height: 900px; margin: -450px; background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.5) 0 6deg, transparent 6deg 20deg); border-radius: 50%; mask: radial-gradient(circle, #000 20%, transparent 65%); -webkit-mask: radial-gradient(circle, #000 20%, transparent 65%); animation: spin 14s linear infinite; }
.fr-icon { position: relative; width: 128px; height: 128px; display: flex; align-items: center; justify-content: center; animation: popin .8s cubic-bezier(.2,1.6,.4,1); }
.fr-icon .ic-missing { display: none; }
.fr-icon img + .fr-gem { display: none; }
.fr-gem { width: 70px; height: 92px; clip-path: polygon(50% 0, 100% 35%, 80% 100%, 20% 100%, 0 35%); background: conic-gradient(from 30deg, #ffd0e0, #ffe8a0, #b0f0d0, #a8d8ff, #e0c0ff, #ffd0e0); filter: drop-shadow(0 0 16px #fff) drop-shadow(0 0 30px #ffd060); animation: gemspin 3s ease-in-out infinite; }
@keyframes gemspin { 50% { transform: scale(1.06) rotate(4deg); filter: drop-shadow(0 0 24px #fff) drop-shadow(0 0 40px #ffb040); } }
.fr-name { position: relative; font-family: 'Kaisei Decol', serif; font-size: clamp(26px, 5vw, 40px); margin-top: 10px; text-shadow: 0 0 12px #fff, 0 0 24px #fff; letter-spacing: .12em; }
.fr-sub { position: relative; font-weight: 700; text-shadow: 0 0 8px #fff; margin-bottom: 14px; }
.fr-ok { position: relative; }

/* ---------- スマホ縦（追加） ---------- */
@media (max-width: 760px), (orientation: portrait) {
  .at-top { left: 10px; right: 10px; top: 10px; gap: 6px; }
  .at-day, .at-money, .at-warm { padding: 4px 10px; font-size: 12px; gap: 6px; }
  .at-sys { margin-left: 0; }
  .at-mini { padding: 4px 9px; font-size: 11px; }
  .at-title { top: 92px; left: 14px; font-size: 22px; }
  .at-title small { font-size: 11px; }
  .at-shelf { left: auto; right: 10px; top: 92px; width: 46vw; padding: 6px 8px 4px; }
  .as-vials i { width: 8px; height: 14px; }
  .at-talk { top: auto; bottom: calc(12px + 4 * 52px + 20px); left: 4vw; width: 92vw; padding: 8px 12px; }
  .att-face { width: 42px; height: 42px; }
  .at-chara { height: 56%; bottom: 30%; }
  .at-menu .at-btn { min-height: 48px; }
  .ab-s { font-size: 10px; }
  .menu-status { gap: 10px; }
  .ms-face { width: 60px; height: 60px; }
  .mr-sales li { flex-wrap: wrap; }
  .fc { min-width: 50px; padding: 3px 6px; }
  .fc-say { top: 70px; max-width: 92vw; left: 4vw !important; right: auto !important; }
  .fc-say-k { top: 150px; }
  .fc-say p { font-size: 12px; }
  .fc-say img { width: 40px; height: 40px; }
  .fc-center { top: 47%; height: 34vh; width: 92vw; }
  .fc-tube { width: 30px; }
  .fc-pot { width: 150px; height: 130px; }
  .fc-slots { grid-template-columns: 1fr 1fr; gap: 6px; bottom: 8px; }
  .fc-slot { padding: 8px 6px 6px; }
  .fs-t { font-size: 13px; } .fs-i { font-size: 10px; min-height: 0; }
  .fs-vial { width: 20px; height: 26px; }
  .fc-stir { bottom: 33%; }
  .fc-calc { font-size: 9px; padding: 3px 4px; gap: 2px; } .fc-calc div { min-width: 40px; }
  .ed-card { bottom: 6%; }
  .dlg-ctrl { right: 12px; }
}
.mt-r { font-size: 12px; color: var(--ink2); margin-top: 2px; } .mt-f { font-size: 12px; color: #6a4a8a; margin-top: 2px; }
.mr-order { margin-top: 6px; background: #eef4ff; border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.mr-rank { background: linear-gradient(90deg, #fff0c8, #fff8e8); font-weight: 700; } .mr-rank b { color: #c0602a; }
.mr-del div { display: flex; align-items: center; gap: 6px; font-size: 13px; } .mr-del img { width: 24px; height: 24px; } .mr-del small { color: var(--ink2); }
.at-title { z-index: 2; text-shadow: 0 2px 4px rgba(60,20,40,.8), 0 0 18px rgba(0,0,0,.6); }
.at-top, .at-shelf, .at-talk, .at-menu { z-index: 3; }
.atelier { z-index: 0; }
/* 最終調合: ゲージは釜の上、計算表示はゲージの上 */
.fc-center { top: 150px; bottom: 190px; height: auto; transform: translateX(-50%); width: min(560px, 94vw); }
.finalcraft.calcing .fc-center { animation: none; }
.fc-gauges { inset: 44px 0 128px 0; padding: 0 22px; }
.fc-pot { width: 150px; height: 140px; }
.fc-calc { top: 0; transform: translateX(-50%); padding: 3px 8px; }
.fc-calc div { flex-direction: row; gap: 3px; min-width: 0; align-items: baseline; }
.fc-calc i { display: none; }
.fc-val { top: -18px; }
.fc-say { top: 82px; }
.fc-say-k { left: 50%; transform: translate(-50%, -8px); } .fc-say-k.show { transform: translate(-50%, 0); }
.fc-say-c { right: auto; left: 50%; transform: translate(-50%, -8px); } .fc-say-c.show { transform: translate(-50%, 0); }
.fc-say { max-width: min(640px, 92vw); width: max-content; }
.finalcraft.calcing .fc-gauges { animation: hum2 .2s linear infinite; }
@keyframes hum2 { 50% { transform: translateX(1px); } }
body:has(#dialog.show) .at-hero { opacity: 0; transition: opacity .3s; }
body:has(#dialog.show) .atelier .at-menu, body:has(#dialog.show) .atelier .at-talk, body:has(#dialog.show) .atelier .at-shelf { opacity: .25; }
@media (max-width: 760px), (orientation: portrait) {
  .fc-head { top: 10px; }
  .fc-say { top: 70px; left: 50% !important; right: auto !important; }
  .fc-center { top: 150px; bottom: 260px; width: 94vw; }
  .fc-gauges { inset: 40px 0 112px 0; padding: 0 10px; }
  .fc-pot { width: 120px; height: 115px; }
  .fc-calc { font-size: 9px; }
}
.ed-card { background: rgba(14,8,24,.5); border-radius: 18px; padding: 14px 22px 16px; backdrop-filter: blur(3px); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.finalcraft.burst .fc-flash { animation: fcflash2 2.2s ease-out forwards; }
@keyframes fcflash2 { 0% { opacity: 0; } 15% { opacity: 1; } 60% { opacity: .85; } 100% { opacity: .5; } }
.finalcraft.done .fc-head { opacity: 0; transition: opacity .6s; }
/* スマホ（タッチ）での HUD の重なり回避 */
body:has(#touch:not(.hidden)):has(.hud-cold.on) .hud-quick { top: 92px; }
body:has(#touch:not(.hidden)) .hud-boss { bottom: auto; top: 140px; width: min(520px, 70vw); left: 14px; transform: none; }
body:has(#touch:not(.hidden)) .hud-toasts { top: 202px; }
@media (max-width: 760px), (orientation: portrait) {
  .bn-name { white-space: nowrap; font-size: 20px; letter-spacing: .08em; }
  .bn-name::before, .bn-name::after { width: 18px; margin: 0 8px; }
  .bn-sub { font-size: 11px; letter-spacing: .2em; }
  .hud-banner { top: 22%; width: 100vw; }
  .fc-center { bottom: 312px; }
  .fs-vial { display: none; }
  .fc-slot { gap: 1px; }
}
@media (max-width: 760px), (orientation: portrait) {
  .at-shelf { top: 132px; width: 44vw; }
  .at-title { max-width: 52vw; }
}
@media (min-width: 761px) and (orientation: landscape) { .fc-center { top: 168px; } .fc-say { top: 78px; } }

/* 統合: パネル表示中はトーストを見出し（✕ボタン）より下に出す */
body:has(#ui .panel) .ui-toasts { top: 112px; right: 28px; }
@media (max-width: 600px) { body:has(#ui .panel) .ui-toasts { top: 96px; right: 16px; } }
.at-talk { cursor: pointer; }
.at-talk:hover { filter: brightness(1.03); }
