/* 食卓シミュレーション  TATSUYA STYLE */
.simbody { background: var(--bg2); }
.wrap.wide { max-width: none; padding: 0 20px; }
.topbar .back { font-size: 14px; color: var(--mute); text-decoration: none; white-space: nowrap; }
.topbar .back:hover { color: var(--gosu); }

.simapp { display: grid; grid-template-columns: minmax(0, 1fr) 392px; height: calc(100vh - 57px); height: calc(100dvh - 57px); min-height: 520px; }

/* 3D の舞台 */
.simstage { position: relative; min-width: 0; overflow: hidden; background: #E9E6E0; user-select: none; -webkit-user-select: none; transition: background .4s; }
#simcanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.simstage.dragging #simcanvas { cursor: grabbing !important; }
.s-top { position: absolute; left: 14px; right: 14px; top: 14px; display: flex; justify-content: space-between; gap: 10px; pointer-events: none; z-index: 3; }
.s-top > * { pointer-events: auto; }
.seg { display: inline-flex; background: rgba(255,255,255,.9); border-radius: 12px; padding: 3px; box-shadow: 0 4px 14px rgba(23,32,58,.12); backdrop-filter: blur(6px); }
.sbtn {
  font: inherit; font-size: 14px; line-height: 1.3; border: 0; background: transparent; color: var(--sumi);
  padding: 8px 14px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s; white-space: nowrap;
}
.sbtn:hover { color: var(--gosu); background: rgba(31,60,140,.07); }
.sbtn.on { background: var(--gosu); color: #fff; }
.sbtn svg { width: 17px; height: 17px; flex: none; }
.sbtn.save { background: rgba(255,255,255,.92); box-shadow: 0 4px 14px rgba(23,32,58,.12); border-radius: 12px; }
.sbtn.save:hover { background: #fff; }

.s-hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 2; pointer-events: none;
  background: rgba(23,32,58,.72); color: #fff; font-size: 12px; padding: 5px 14px; border-radius: 999px; white-space: nowrap;
  transition: opacity .6s; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
}
.s-hint.off { opacity: 0; }
.s-hint .h-touch { display: none; }
@media (max-width: 760px), (hover: none) { .s-hint .h-pc { display: none; } .s-hint .h-touch { display: inline; } }

.s-empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; display: none; flex-direction: column; align-items: center; gap: 6px;
  background: rgba(255,255,255,.88); border-radius: 16px; padding: 18px 24px; text-align: center; color: var(--mute); font-size: 14px; pointer-events: none; max-width: calc(100% - 40px); box-shadow: 0 10px 30px rgba(23,32,58,.12); }
.s-empty b { color: var(--sumi); font-size: 17px; }
.s-empty.show { display: flex; }

.s-busy { position: absolute; left: 50%; top: 70px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.95); border-radius: 999px; padding: 7px 16px 7px 10px; font-size: 13px; color: var(--mute);
  box-shadow: 0 6px 18px rgba(23,32,58,.14); opacity: 0; pointer-events: none; transition: opacity .25s; }
.s-busy.show { opacity: 1; }
.s-busy .spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--sen); border-top-color: var(--gosu); animation: spin 1s linear infinite; }

.s-sel { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.96); border-radius: 16px; padding: 8px 8px 8px 16px; box-shadow: 0 10px 30px rgba(23,32,58,.18);
  max-width: calc(100% - 24px); animation: rise .22s ease-out; }
.s-sel[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.s-sel .nm { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.s-sel .nm b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-sel .nm small { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-sel .acts { display: flex; gap: 4px; flex: none; }
.s-sel .sbtn { border: 1px solid var(--sen); padding: 7px 11px; font-size: 13px; }
.s-sel .sbtn.icon { padding: 7px 8px; }
.s-sel .sbtn[hidden] { display: none; }
.s-sel .sbtn.danger { color: var(--aka); border-color: #E5C2BC; }
.s-sel .sbtn.danger:hover { background: var(--aka); color: #fff; border-color: var(--aka); }

.s-toast { position: absolute; left: 50%; top: 66px; transform: translate(-50%, -8px); z-index: 5; background: var(--sumi); color: #fff; font-size: 13px;
  padding: 8px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: calc(100% - 32px); text-align: center; }
.s-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 右の操作パネル */
.simpanel { background: #fff; border-left: 1px solid var(--sen); overflow-y: auto; min-width: 0; display: flex; flex-direction: column; }
.onboard { padding: 14px 16px 10px; border-bottom: 1px solid var(--bg3); }
.obhead { display: flex; align-items: baseline; gap: 8px; }
.obhead b { font-size: 15px; }
.obhead small { color: var(--sub); font-size: 12px; }
.lnk { margin-left: auto; font: inherit; font-size: 12px; color: var(--mute); background: none; border: 0; cursor: pointer; text-decoration: underline; padding: 0; }
.lnk:hover { color: var(--aka); }
.lnk[hidden] { display: none; }
.oblist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 196px; overflow-y: auto; }
.oblist:empty::before { content: 'まだ何も置いていません'; font-size: 13px; color: var(--sub); }
.oblist li { display: flex; align-items: center; gap: 4px; border: 1px solid var(--bg3); border-radius: 10px; }
.oblist li.on { border-color: var(--gosu); background: #F3F6FD; }
.oblist .obsel { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font: inherit; text-align: left; background: none; border: 0; padding: 4px 6px; cursor: pointer; color: var(--sumi); }
.oblist .obsel img, .oblist .obsel .noimg { width: 40px; height: 30px; object-fit: cover; border-radius: 6px; flex: none; background: var(--bg3); }
.oblist .obsel span { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.oblist .obsel b { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oblist .obsel small { font-size: 12px; color: var(--kin); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oblist .obsel small.dim { color: var(--sub); }
.oblist .obdel { font: inherit; font-size: 18px; line-height: 1; width: 30px; height: 30px; border: 0; background: none; color: var(--sub); cursor: pointer; border-radius: 8px; flex: none; }
.oblist .obdel:hover { color: var(--aka); background: #FBEFED; }

.stabs { display: flex; position: sticky; top: 0; background: #fff; z-index: 2; border-bottom: 1px solid var(--sen); padding: 0 6px; }
.stab { flex: 1; font: inherit; font-size: 13px; font-weight: 700; color: var(--mute); background: none; border: 0; border-bottom: 3px solid transparent; padding: 12px 4px 9px; cursor: pointer; white-space: nowrap; }
.stab small { font-weight: 400; color: var(--sub); margin-left: 3px; font-size: 11px; }
.stab:hover { color: var(--gosu); }
.stab.on { color: var(--gosu); border-bottom-color: var(--gosu); }
.spane { display: none; padding: 14px 16px 22px; }
.spane.on { display: block; }
.pnote { font-size: 13px; color: var(--mute); margin: 0 0 12px; line-height: 1.6; }
.pnote:empty { display: none; }

.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preset { font: inherit; text-align: left; border: 1px solid var(--bg3); background: #fff; border-radius: 12px; padding: 0; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; transition: .18s; color: var(--sumi); }
.preset:hover { border-color: var(--gosu); box-shadow: 0 8px 20px rgba(23,32,58,.10); transform: translateY(-1px); }
.preset .pv { height: 62px; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 6px; }
.preset .pv img { width: 44px; height: 33px; object-fit: cover; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.preset .pt { padding: 8px 10px 10px; display: flex; flex-direction: column; line-height: 1.4; }
.preset b { font-size: 14px; }
.preset small { font-size: 11px; color: var(--mute); }

.tables { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ttile { font: inherit; display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--bg3); background: #fff; border-radius: 12px; padding: 6px; cursor: pointer; color: var(--sumi); transition: .15s; }
.ttile:hover { border-color: var(--gosu); }
.ttile.on { border-color: var(--gosu); box-shadow: inset 0 0 0 1px var(--gosu); background: #F3F6FD; }
.ttile img { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.ttile span { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.ttile b { font-size: 13px; }
.ttile small { font-size: 11px; color: var(--sub); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chips .chip { font-size: 13px; padding: 4px 11px; }
.chips .chip small { margin-left: 3px; }
.chips .chip.brk { margin-left: 0; }
.target { font-size: 13px; margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: #F3F6FD; color: var(--gosu); }
.target.warn { background: #FBF4E7; color: #7A5A17; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { font: inherit; display: flex; flex-direction: column; align-items: stretch; gap: 4px; text-align: left; border: 1px solid var(--bg3); background: #fff; border-radius: 10px; padding: 4px 4px 6px; cursor: pointer; color: var(--sumi); transition: .15s; min-width: 0; }
.tile:hover { border-color: var(--gosu); transform: translateY(-1px); }
.tile.on { border-color: var(--kin); box-shadow: inset 0 0 0 1px var(--kin); }
.tile.off { opacity: .38; filter: grayscale(.6); }
.tile.off:hover { transform: none; border-color: var(--bg3); }
.tile .ti { position: relative; aspect-ratio: 4 / 3; border-radius: 7px; overflow: hidden; background: linear-gradient(180deg, #F4F5F7, #E4E6EA); display: grid; place-items: center; }
.tile .ti img { width: 100%; height: 100%; object-fit: cover; }
.tile .tn { font-size: 12px; line-height: 1.35; padding: 0 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile .k { position: absolute; left: 4px; bottom: 4px; font-style: normal; font-size: 10px; background: rgba(255,255,255,.92); color: var(--gosu); padding: 0 6px; border-radius: 6px; font-weight: 700; }
.tile .k.k-none { color: var(--sub); }
.fchip { width: 64%; aspect-ratio: 1; border-radius: 50%; box-shadow: 0 3px 8px rgba(0,0,0,.18); }
.dchip { width: 46%; aspect-ratio: 1; border-radius: 50% 50% 46% 46%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.18), inset 0 0 0 1px #E3E0D8; display: grid; place-items: center; }
.dchip i { width: 76%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 50%, var(--f) 0 45%, var(--c) 62%); opacity: var(--a); box-shadow: inset 0 0 0 2px rgba(0,0,0,.06); }

.simfoot { border-top: 1px solid var(--sen); background: var(--bg2); }
.simfoot .wrap { padding-top: 14px; padding-bottom: 18px; font-size: 12px; color: var(--mute); }
.simfoot p { margin: 0 0 4px; }
.simfoot .pubname { font-weight: 700; color: var(--sumi); letter-spacing: .12em; }

/* 料理の画像を撮るとき */
body.shotmode .topbar, body.shotmode .simpanel, body.shotmode .simfoot, body.shotmode .s-top, body.shotmode .s-hint,
body.shotmode .s-sel, body.shotmode .s-busy, body.shotmode .s-toast, body.shotmode .s-empty { display: none !important; }
body.shotmode .simapp { display: block; height: 100vh; min-height: 0; }
body.shotmode .simstage { height: 100vh; }

/* 狭い画面：パネルは下へ */
@media (max-width: 860px) {
  .simapp { display: block; height: auto; min-height: 0; }
  .simstage { height: 58vh; height: 58dvh; min-height: 320px; }
  .simpanel { border-left: 0; border-top: 1px solid var(--sen); overflow: visible; }
  .stabs { top: 57px; }
  .s-sel { bottom: 12px; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 10px; width: calc(100% - 20px); }
  .s-sel .nm { flex-direction: row; align-items: baseline; gap: 8px; }
  .s-sel .acts { flex-wrap: wrap; justify-content: center; }
  .s-hint { bottom: 10px; }
  .s-sel:not([hidden]) ~ .s-hint { display: none; }
  .oblist { max-height: 142px; }
}
@media (max-width: 520px) {
  .wrap.wide { padding: 0 16px; }
  .s-top { left: 8px; right: 8px; top: 8px; }
  .sbtn { padding: 7px 10px; font-size: 13px; }
  .s-top .seg .sbtn { padding-inline: 8px; }
  .sbtn.save { padding: 7px 10px; font-size: 0; gap: 0; }
  .sbtn.save .lab { display: none; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .presets { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tables { grid-template-columns: 1fr 1fr; }
  .ttile small { display: none; }
  .stab { font-size: 12px; padding: 11px 2px 8px; }
  .stab small { display: none; }
  .simfoot .wrap { padding-left: 16px; padding-right: 16px; }
}

.dchip i { position: relative; overflow: hidden; }
.dchip i::after { content: ""; position: absolute; inset: 0; background: url("drink-materials.jpg") var(--photo-pos) / 800% 800%; opacity: .92; }
