:root {
  --ink: #4a2a0e;
  --ink2: #7a5730;
  --paper: #f3e2bd;
  --paper2: #e8d3a4;
  --wood: #7d4a22;
  --wood2: #5a3216;
  --cream: #fff6dc;
  --ok: #3f8a3a;
  --ng: #c23a27;
  --font: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "Yu Gothic UI", "YuGothic", "Meiryo", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a6f88; font-family: var(--font); color: var(--ink); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#scene { touch-action: none; }
button { font-family: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

#loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; background: #1a6f88; z-index: 60; transition: opacity .5s; }
#fade { position: fixed; inset: 0; background: #06121f; opacity: 0; pointer-events: none; transition: opacity .55s; z-index: 40; }
#fade.on { opacity: 1; pointer-events: auto; }

/* ---- 上の帯 ---- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud button, #hud .tap { pointer-events: auto; }
#topL { position: absolute; left: max(8px, env(safe-area-inset-left)); top: max(8px, env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 6px; }
#gauges { display: grid; grid-template-columns: repeat(2, 148px); gap: 5px 8px; }
.gauge { position: relative; display: flex; align-items: center; height: 30px; }
.gauge img { position: relative; z-index: 2; width: 32px; height: 32px; flex: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.gauge .track { position: relative; flex: 1; height: 17px; margin-left: -10px; padding-left: 10px; background: #3d2614; border: 2.5px solid #a2682f; border-radius: 0 10px 10px 0; box-shadow: 0 1px 3px rgba(0,0,0,.45), inset 0 1px 3px rgba(0,0,0,.6); overflow: hidden; }
.gauge .fill { height: 100%; border-radius: 0 6px 6px 0; transition: width .25s; box-shadow: inset 0 2px 0 rgba(255,255,255,.28); }
.gauge .num { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); font-size: 10.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000; }
.gauge.low .track { animation: lowblink 1s infinite; }
@keyframes lowblink { 50% { border-color: #ff6d4d; } }
#res { display: flex; flex-wrap: wrap; gap: 4px; max-width: 306px; }
.chip { display: inline-flex; align-items: center; gap: 3px; height: 25px; padding: 0 8px 0 2px; border-radius: 13px; background: rgba(58,32,12,.8); color: var(--cream); font-size: 13px; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.chip img { width: 22px; height: 22px; }

#goal { position: absolute; left: 50%; top: max(8px, env(safe-area-inset-top)); transform: translateX(-50%); max-width: min(430px, calc(100vw - 660px)); min-width: 200px; padding: 6px 14px 7px; background: rgba(245,228,190,.96); border: 2.5px solid #9a6228; border-radius: 12px; font-size: 13.5px; line-height: 1.35; font-weight: 700; text-align: left; color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.35); }
#goal small { display: block; font-size: 10.5px; color: var(--ink2); letter-spacing: .05em; }
#goal.pop { animation: goalpop .7s; }
@keyframes goalpop { 30% { transform: translateX(-50%) scale(1.07); background: #fff3c2; } }

#topR { position: absolute; right: max(8px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); display: flex; align-items: flex-start; gap: 6px; }
#clock { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.clockTop { display: flex; align-items: center; gap: 5px; padding: 3px 10px 3px 4px; border-radius: 18px; background: rgba(58,32,12,.82); color: var(--cream); font-weight: 700; font-size: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.clockTop img { width: 28px; height: 28px; }
.clockSub { display: flex; align-items: center; gap: 4px; padding: 2px 9px 2px 3px; border-radius: 14px; background: rgba(58,32,12,.7); color: var(--cream); font-size: 11.5px; }
.clockSub img { width: 20px; height: 20px; }
.raftBar { display: flex; align-items: center; gap: 4px; padding: 2px 8px 2px 3px; border-radius: 14px; background: rgba(58,32,12,.7); color: var(--cream); font-size: 11.5px; pointer-events: auto; cursor: pointer; }
.raftBar img { width: 20px; height: 20px; }
.raftBar .mini { width: 58px; height: 8px; border-radius: 4px; background: #2d1a0b; overflow: hidden; }
.raftBar .mini i { display: block; height: 100%; background: #e0a24a; }
.raftBar.low .mini i { background: #ef5a3a; }
.ico { width: 40px; height: 40px; background-size: contain; background-repeat: no-repeat; background-position: center; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }

#toast { position: absolute; left: 50%; top: 82px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; width: min(92vw, 520px); }
.tst { display: flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 16px; background: rgba(40,22,8,.87); color: #fff6dc; font-size: 14.5px; font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,.4); animation: tstin .25s; }
.tst img { width: 26px; height: 26px; }
.tst.warn { background: rgba(150,36,18,.93); }
.tst.good { background: rgba(38,104,44,.93); }
@keyframes tstin { from { transform: translateY(-8px); opacity: 0; } }

/* ---- 下の帯 ---- */
#bar { position: absolute; left: 50%; bottom: max(6px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: flex-end; gap: 6px; }
.rbtn { position: relative; width: 70px; display: flex; flex-direction: column; align-items: center; pointer-events: auto; }
.rbtn .disc { position: relative; width: 58px; height: 58px; background-size: contain; background-repeat: no-repeat; display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); transition: transform .08s; }
.rbtn:active .disc { transform: scale(.92); }
.rbtn .disc img { width: 38px; height: 38px; }
.rbtn .lab { margin-top: -3px; padding: 1px 8px; border-radius: 9px; background: rgba(58,32,12,.86); color: var(--cream); font-size: 12px; font-weight: 700; white-space: nowrap; }
.rbtn.dim { opacity: .55; }
.rbtn .badge { position: absolute; right: 8px; top: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #e8452a; color: #fff; font-size: 11px; line-height: 18px; font-weight: 700; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,.45); animation: bump 1.2s infinite; }
@keyframes bump { 50% { transform: scale(1.18); } }
.rbtn.on .disc { filter: drop-shadow(0 0 7px #ffe27a); }

#fishUI { position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%); width: min(92vw, 420px); padding: 8px 14px 10px; border-radius: 14px; background: rgba(40,22,8,.82); color: var(--cream); font-size: 15px; font-weight: 700; text-align: center; }
#fishUI.bite { background: rgba(206,54,24,.95); font-size: 22px; animation: bump .3s infinite; }
.reelTrack { position: relative; height: 20px; margin-top: 7px; border-radius: 10px; background: #2d1a0b; overflow: hidden; }
.reelZone { position: absolute; top: 0; bottom: 0; background: #e0b542; }
.reelZone.best { background: #65d15a; }
.reelNeedle { position: absolute; top: -2px; bottom: -2px; width: 6px; margin-left: -3px; background: #fff; border-radius: 3px; box-shadow: 0 0 5px #000; }

#anchorBtn { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: 100px; display: flex; align-items: center; gap: 8px; padding: 6px 16px 6px 6px; border-radius: 34px; background: #b8391c; color: #fff; font-size: 16px; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.5); animation: bump 1s infinite; }
#anchorBtn img { width: 48px; height: 48px; }
/* 碇のボタンと同じ場所（碇が出ているときは隠す） */
#doorBtn { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: 100px; display: flex; align-items: center; gap: 8px; padding: 6px 16px 6px 8px; border-radius: 30px; background: linear-gradient(#a8692f, #7d4a1f); color: #fff6dc; font-size: 15px; font-weight: 700; box-shadow: 0 2px 0 #4f2c10, 0 3px 7px rgba(0,0,0,.45); text-shadow: 0 1px 1px rgba(0,0,0,.5); }
#doorBtn:active { transform: translateY(1px); }
#doorBtn canvas { position: static; width: 24px; height: 40px; }
#doorBtn.first { animation: bump 1.1s infinite; }

/* ---- パネル ---- */
#modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 10px; background: rgba(10,22,32,.45); }
.panel { position: relative; display: flex; flex-direction: column; width: min(720px, 100%); max-height: min(92vh, 100%); background: var(--paper); border: 4px solid #8a5524; border-radius: 18px; box-shadow: 0 6px 24px rgba(0,0,0,.5), inset 0 0 0 2px #d9bd84, inset 0 0 40px rgba(170,120,60,.22); animation: panelin .18s; }
.panel.narrow { width: min(500px, 100%); }
@keyframes panelin { from { transform: scale(.96); opacity: 0; } }
.phead { position: relative; flex: none; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 54px 6px 16px; background: linear-gradient(#8f5828, #6a3e1a); color: var(--cream); font-size: 19px; font-weight: 700; border-radius: 13px 13px 0 0; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.phead img { width: 32px; height: 32px; }
.pclose { position: absolute; right: 8px; top: 7px; width: 36px; height: 36px; border-radius: 18px; background: rgba(255,240,205,.92); color: var(--ink); font-size: 20px; line-height: 36px; font-weight: 700; }
.pbody { flex: 1; overflow-y: auto; padding: 12px 14px 14px; -webkit-overflow-scrolling: touch; }
.sect { margin: 10px 0 6px; font-size: 14px; font-weight: 700; color: var(--ink2); border-bottom: 2px dotted #bb9256; padding-bottom: 3px; }
.sect:first-child { margin-top: 0; }
.note { font-size: 13px; line-height: 1.6; color: var(--ink2); margin: 4px 0 8px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 7px; }
.slot { position: relative; display: flex; flex-direction: column; align-items: center; padding: 5px 2px 4px; background: #fbf0d3; border: 2px solid #b08a53; border-radius: 10px; font-size: 11.5px; line-height: 1.2; text-align: center; min-height: 80px; }
.slot:active { background: #fff; }
.slot img { width: 44px; height: 44px; object-fit: contain; }
.slot .n { position: absolute; right: 5px; top: 3px; font-size: 13px; font-weight: 700; color: #fff; background: rgba(74,42,14,.9); border-radius: 8px; padding: 0 5px; }
.slot .eff { color: var(--ok); font-size: 10.5px; font-weight: 700; }

.row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 7px; background: #fbf0d3; border: 2px solid #c6a26b; border-radius: 12px; }
.row > img { width: 56px; height: 56px; object-fit: contain; flex: none; }
.row .mid { flex: 1; min-width: 0; }
.row .ttl { font-size: 15.5px; font-weight: 700; }
.row .dsc { font-size: 12.5px; line-height: 1.45; color: var(--ink2); margin-top: 1px; }
.costs { display: flex; flex-wrap: wrap; gap: 4px 7px; margin-top: 4px; }
.cost { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 700; color: var(--ok); }
.cost img { width: 22px; height: 22px; object-fit: contain; }
.cost.no { color: var(--ng); }
.pbtn { flex: none; min-width: 84px; min-height: 42px; padding: 7px 14px; border-radius: 10px; background: linear-gradient(#a8692f, #7d4a1f); color: #fff6dc; font-size: 15px; font-weight: 700; box-shadow: 0 2px 0 #4f2c10, 0 2px 4px rgba(0,0,0,.3); text-shadow: 0 1px 1px rgba(0,0,0,.5); }
.pbtn:active { transform: translateY(1px); }
.pbtn[disabled] { background: #b3a58b; box-shadow: none; color: #eee3cc; cursor: default; text-shadow: none; }
.pbtn.go { background: linear-gradient(#5aa24a, #3a7b30); box-shadow: 0 2px 0 #235018, 0 2px 4px rgba(0,0,0,.3); }
.pbtn.red { background: linear-gradient(#c75132, #96341b); box-shadow: 0 2px 0 #5e1e0d; }
.pbtn.wide { display: block; width: 100%; margin-top: 8px; min-height: 48px; }
.tabs { display: flex; gap: 5px; margin-bottom: 9px; }
.tabs button { flex: 1; min-height: 38px; border-radius: 10px; background: #e0c99a; font-size: 14px; font-weight: 700; color: var(--ink2); }
.tabs button.on { background: #7d4a1f; color: #fff6dc; }

.talk { display: flex; gap: 12px; align-items: flex-start; }
.talk .por { flex: none; width: 118px; height: 170px; object-fit: contain; object-position: bottom; }
.talk .say { flex: 1; font-size: 15px; line-height: 1.7; background: #fff8e4; border: 2px solid #c6a26b; border-radius: 12px; padding: 10px 12px; }
.talk .who { font-weight: 700; font-size: 14px; color: var(--ink2); margin-bottom: 2px; }

.stagePrev { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 2px 0 6px; }
.stagePrev img { max-width: 44%; max-height: 150px; object-fit: contain; }
.stagePrev .arw { font-size: 26px; color: var(--ink2); }

.hd { display: flex; align-items: center; gap: 10px; padding: 9px 11px; margin-bottom: 7px; background: #fbf0d3; border: 2.5px solid #c6a26b; border-radius: 12px; width: 100%; text-align: left; }
.hd.sel { border-color: #3f8a3a; background: #eef6d9; box-shadow: 0 0 0 2px #7eb85f inset; }
.hd.lock { opacity: .5; }
.hd img { width: 40px; height: 40px; flex: none; }
.hd b { font-size: 15.5px; }
.hd span { display: block; font-size: 12.5px; color: var(--ink2); line-height: 1.4; }

.line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 14px; margin-bottom: 5px; }
.line img.fc { width: 28px; height: 28px; object-fit: cover; object-position: top; border-radius: 14px; background: #fff3cc; border: 1.5px solid #b08a53; }

.letter { white-space: pre-wrap; font-size: 15.5px; line-height: 1.9; padding: 14px 16px; background: #fffaf0; border: 1px solid #d5b98a; border-radius: 6px; box-shadow: 1px 2px 5px rgba(0,0,0,.2); }
.stat { display: flex; justify-content: space-between; padding: 4px 2px; border-bottom: 1px dotted #c6a26b; font-size: 14px; }

/* ---- 語り ---- */
#story { position: fixed; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(4,14,26,.72); color: #fdf6e2; text-align: center; font-size: clamp(18px, 3.2vw, 26px); line-height: 1.9; white-space: pre-wrap; cursor: pointer; }
#story .t { max-width: 760px; animation: fadein .7s; text-shadow: 0 2px 8px #000; }
#story .hint { position: absolute; bottom: 7%; left: 0; right: 0; font-size: 13px; opacity: .7; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

/* ---- 題名 ---- */
#title { position: fixed; inset: 0; z-index: 25; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; padding: max(5vh, 14px) 0 0 5vw; pointer-events: none; }
@media (max-width: 720px) { #title { align-items: center; padding-left: 0; } }
#title h1 { margin: 0; font-size: clamp(44px, 9vh, 84px); letter-spacing: .1em; color: #fffdf2; font-weight: 800; text-shadow: 0 3px 0 #1d6e86, 0 5px 18px rgba(0,50,70,.75); }
#title .yomi { margin-top: 2px; font-size: clamp(12px, 2vh, 16px); letter-spacing: .4em; color: #fff; text-shadow: 0 1px 4px rgba(0,50,70,.9); }
#title .menu { position: absolute; left: 50%; bottom: max(4vh, 12px); transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: min(92vw, 640px); pointer-events: auto; }
#title .menu .pbtn { min-width: 150px; min-height: 52px; font-size: 17px; }

/* ---- 工事中の帯・加工の知らせ ---- */
#workUI { position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; width: min(92vw, 460px); padding: 7px 8px 7px 14px; border-radius: 14px; background: rgba(40,22,8,.86); color: var(--cream); font-size: 14px; font-weight: 700; pointer-events: auto; }
#workUI .wt { flex: 1; min-width: 0; }
#workUI .wbar { height: 9px; margin-top: 4px; border-radius: 5px; background: #2d1a0b; overflow: hidden; }
#workUI .wbar i { display: block; height: 100%; background: #e0b542; }
#workUI .pbtn { min-width: 70px; min-height: 36px; padding: 4px 10px; font-size: 13px; }
#jobs { position: absolute; right: max(8px, env(safe-area-inset-right)); top: 112px; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.job { display: flex; align-items: center; gap: 4px; padding: 2px 7px 2px 2px; border-radius: 12px; background: rgba(58,32,12,.78); color: var(--cream); font-size: 11px; }
.job img { width: 20px; height: 20px; object-fit: contain; }
.job .mini { width: 44px; height: 7px; border-radius: 4px; background: #2d1a0b; overflow: hidden; }
.job .mini i { display: block; height: 100%; background: #7fd16a; }

/* ---- つくるの中身 ---- */
.jobrow { display: flex; align-items: center; gap: 8px; padding: 5px 8px; margin-bottom: 5px; background: #f8ecd0; border: 1.5px solid #c6a26b; border-radius: 10px; font-size: 13px; font-weight: 700; }
.jobrow.wait { opacity: .62; }
.jobrow img { width: 30px; height: 30px; object-fit: contain; }
.jobrow .jb { flex: 1; height: 9px; border-radius: 5px; background: #d9c49a; overflow: hidden; }
.jobrow .jb i { display: block; height: 100%; background: #5aa24a; }
.jobrow button { width: 30px; height: 30px; border-radius: 15px; background: #d8c196; font-weight: 700; }
.pbtn.sm { min-width: 54px; min-height: 42px; padding: 6px 8px; font-size: 14px; margin-left: 4px; }
.row .pbtns { display: flex; flex: none; align-items: center; }
.row.unk > img { filter: grayscale(.85) brightness(.75); }
.asm { padding: 9px 10px 10px; margin-bottom: 8px; background: #fbf0d3; border: 2px solid #b08a53; border-radius: 12px; }
.asmslots { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.asmslot { width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; border: 2px dashed #b08a53; border-radius: 10px; background: #fff8e4; font-size: 20px; color: #b08a53; }
.asmslot.full { border-style: solid; }
.asmslot img { width: 42px; height: 42px; object-fit: contain; }
.asmplus { font-size: 18px; font-weight: 700; color: var(--ink2); }
.asmres { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; line-height: 1.35; color: var(--ink2); }
.asmres.good { color: var(--ok); }
.asmres.ng { color: var(--ng); }
.asmchips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.asmchip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px 2px 2px; border-radius: 14px; background: #eddcb5; font-size: 12px; font-weight: 700; }
.asmchip img { width: 26px; height: 26px; object-fit: contain; }
.asmchip.on { background: #7d4a1f; color: #fff6dc; }
.upnext { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; }
.upnext img { max-width: 44%; max-height: 130px; object-fit: contain; }
.upnext .arw { font-size: 24px; color: var(--ink2); }
.upprog { height: 12px; border-radius: 6px; background: #d9c49a; overflow: hidden; margin: 6px 0; }
.upprog i { display: block; height: 100%; background: #5aa24a; }
.bomrow { display: flex; align-items: center; gap: 8px; padding: 3px 4px; font-size: 14px; font-weight: 700; }
.bomrow img { width: 32px; height: 32px; object-fit: contain; }
.bomrow .q { margin-left: auto; color: var(--ok); }
.bomrow .q.no { color: var(--ng); }

/* ---- 設計図 ---- */
#design { position: fixed; inset: 0; z-index: 28; display: flex; flex-direction: column; background: linear-gradient(#123f68, #0e3355); color: #eaf4ff; }
.dhead { position: relative; flex: none; display: flex; align-items: center; min-height: 46px; padding: 4px 54px 4px 14px; font-size: 18px; font-weight: 700; background: rgba(4,20,38,.5); }
.dhead .pclose { top: 5px; }
.dbody { flex: 1; min-height: 0; display: flex; gap: 10px; padding: 8px 10px; }
.dleft { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.dgoal { flex: none; font-size: 13px; line-height: 1.45; padding: 5px 10px; border-radius: 8px; background: rgba(255,255,255,.1); }
#dcanvasBox { position: relative; flex: 1; min-height: 120px; border: 1.5px solid rgba(255,255,255,.3); border-radius: 8px; background: rgba(255,255,255,.04); overflow: hidden; }
#dcanvas { position: absolute; left: 0; top: 0; touch-action: none; cursor: crosshair; }
.dstatus { flex: none; min-height: 34px; font-size: 13px; line-height: 1.35; padding: 3px 8px; color: #ffe9a8; }
.dside { flex: none; width: 322px; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-right: 3px; }
#dpal { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 4px; margin-bottom: 7px; }
.dtool { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 56px; padding: 2px; border-radius: 8px; background: rgba(255,255,255,.12); color: #eaf4ff; font-size: 11.5px; font-weight: 700; border: 2px solid transparent; }
.dtool img { width: 34px; height: 34px; object-fit: contain; }
.dtool.on { background: rgba(255,226,122,.28); border-color: #ffe27a; }
.dtool .er { display: block; height: 34px; font-size: 26px; line-height: 34px; color: #ffb9a8; }
.dm { display: flex; align-items: center; gap: 7px; font-size: 12px; margin-bottom: 4px; }
.dm > span { flex: none; width: 66px; }
.dm > b { flex: none; min-width: 48px; text-align: right; }
.dbar { flex: 1; height: 11px; border-radius: 6px; background: rgba(255,255,255,.15); overflow: hidden; }
.dbar i { display: block; height: 100%; background: #6fd0ff; }
.dbar i.over, .dtilt i.over { background: #ff7a5c; }
.dtilt { position: relative; flex: 1; height: 11px; border-radius: 6px; background: rgba(255,255,255,.15); }
.dtilt::before { content: ''; position: absolute; left: 31.2%; right: 31.2%; top: 0; bottom: 0; background: rgba(120,230,140,.3); }
.dtilt i { position: absolute; top: -2px; bottom: -2px; width: 5px; margin-left: -2.5px; border-radius: 2px; background: #fff; }
.dstars { flex: 1; color: #ffe27a; font-size: 14px; letter-spacing: 1px; }
.dperf { font-size: 11px; color: #bfd9ee; margin: 2px 0 7px; line-height: 1.4; }
.dc { font-size: 12.5px; line-height: 1.35; padding: 1px 0; }
.dc.ok { color: #a9f0b0; }
.dc.ng { color: #ffb9a8; font-weight: 700; }
#dchecks { margin-bottom: 7px; }
.dsect { font-size: 12.5px; font-weight: 700; margin-bottom: 3px; }
#dbom .cost { color: #a9f0b0; }
#dbom .cost.no { color: #ffb9a8; }
.dbtns { display: flex; gap: 6px; margin-top: 8px; }
.dbtns .pbtn { flex: 1; min-width: 0; font-size: 13px; padding: 6px 4px; }
@media (max-width: 760px) {
  .dbody { flex-direction: column; overflow-y: auto; padding: 6px 8px; }
  .dleft { flex: none; }
  #dcanvasBox { flex: none; height: min(48vh, calc(100vw * .72)); }
  .dside { width: auto; overflow: visible; }
  .dgoal { font-size: 12px; }
}
@media (max-height: 460px) and (min-width: 761px) {
  .dgoal { display: none; }
  .dhead { min-height: 36px; font-size: 15px; }
  .dhead .pclose { top: 0; }
  .dside { width: 290px; }
  .dstatus { min-height: 18px; font-size: 11.5px; }
}

/* ---- 幅が足りないとき、目標は下へ ---- */
@media (max-width: 980px) {
  #goal { top: auto; left: 8px; right: auto; bottom: 86px; transform: none; max-width: min(460px, calc(100vw - 16px)); min-width: 0; }
  #goal.pop { animation: none; }
}

/* ---- スマホ縦持ち ---- */
@media (max-width: 720px) {
  #gauges { grid-template-columns: repeat(2, 104px); gap: 3px 5px; }
  .gauge { height: 25px; }
  .gauge img { width: 25px; height: 25px; }
  .gauge .track { height: 13px; margin-left: -8px; padding-left: 8px; border-width: 2px; }
  .gauge .num { display: none; }
  #res { max-width: 216px; gap: 3px; }
  .chip { height: 21px; font-size: 11.5px; padding: 0 6px 0 1px; }
  .chip img { width: 18px; height: 18px; }
  #goal { top: auto; left: 8px; right: 8px; bottom: 80px; transform: none; max-width: none; font-size: 12.5px; padding: 4px 10px 5px; min-width: 0; }
  #goal.pop { animation: none; }
  #goal small { display: inline; margin-right: 6px; }
  #toast { top: 118px; }
  .rbtn { width: min(60px, 16vw); }
  .rbtn .disc { width: min(50px, 13.5vw); height: min(50px, 13.5vw); }
  .rbtn .disc img { width: 64%; height: 64%; }
  .rbtn .lab { font-size: 11px; padding: 0 5px; }
  #bar { gap: 1px; }
  #fishUI, #workUI { bottom: 118px; }
  #anchorBtn, #doorBtn { bottom: 118px; font-size: 14px; }
  #workUI { bottom: 170px; }
  #jobs { top: 92px; }
  .talk .por { width: 84px; height: 124px; }
  .clockTop { font-size: 12.5px; }
  .clockTop img { width: 22px; height: 22px; }
  .ico { width: 32px; height: 32px; }
}
@media (max-width: 360px) {
  #gauges { grid-template-columns: repeat(2, 82px); }
  #res { max-width: 172px; }
  .clockTop { font-size: 11.5px; padding-right: 7px; }
  .clockSub { font-size: 10px; }
  .hdname { display: none; }
  .ico { width: 28px; height: 28px; }
  #topR { gap: 3px; }
}
@media (max-height: 460px) {
  #gauges { grid-template-columns: repeat(4, 86px); }
  .gauge .num { display: none; }
  #res { max-width: none; }
  #goal { top: auto; bottom: 66px; left: 8px; transform: none; max-width: 44vw; font-size: 11.5px; min-width: 0; padding: 3px 8px; }
  #goal.pop { animation: none; }
  .rbtn { width: 56px; }
  .rbtn .disc { width: 42px; height: 42px; }
  .rbtn .disc img { width: 28px; height: 28px; }
  #toast { top: 58px; }
  #fishUI, #anchorBtn, #doorBtn, #workUI { bottom: 72px; }
  #workUI { width: 44vw; font-size: 12px; left: auto; right: 150px; transform: none; }
  #jobs { top: 44px; right: 54px; flex-direction: row; }
}
