/* Crew of Me — 画面（ux）。スマホ縦 390×844 を基準に、PC（≥900px）は左に自分の厨房、右に隣の3軒 */
:root {
  --bg: #16130f; --panel: #221d17; --panel2: #2c261e; --line: #3d352a;
  --fg: #f6eedf; --dim: #b9ad98; --accent: #e5484d; --orange: #ff8a3d; --gold: #f2b830; --green: #35b36b;
  --c1: #e5484d; --c2: #3b82f6; --c3: #2fa56a; --c4: #8b5cf6; --c5: #f0b429;
  --sx: 0px; --sy: 0px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overscroll-behavior: none;
  font: 15px/1.4 "Hiragino Maru Gothic ProN", "Zen Maru Gothic", "Hiragino Sans", system-ui, -apple-system, "Noto Sans JP", sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
b { font-variant-numeric: tabular-nums; }

.app { width: 100%; max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }

/* A 上の帯 */
.top { height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; }
.shopname { position: absolute; left: 10px; top: 2px; max-width: 150px; padding: 0; border: 0; background: none; color: var(--dim); font-size: 11px; line-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.rpm { display: flex; align-items: baseline; gap: 3px; margin-top: 13px; min-width: 92px; }
.rpm b { font-size: 28px; line-height: 30px; font-weight: 800; letter-spacing: -.5px; }
.rpm small { font-size: 11px; color: var(--dim); }
.rpm.pulse b { animation: pop .5s ease-out; color: var(--gold); }
.best { display: flex; flex-direction: column; font-size: 11px; line-height: 14px; color: var(--dim); min-width: 62px; }
.best b { color: var(--fg); font-size: 13px; }
.best.glow b { animation: pop .6s ease-out; color: var(--gold); }
.stars { display: flex; gap: 1px; }
.stars i { width: 11px; height: 11px; background: #4a4033; clip-path: polygon(50% 0,62% 36%,100% 38%,70% 60%,80% 100%,50% 76%,20% 100%,30% 60%,0 38%,38% 36%); }
.stars i.on { background: var(--gold); }
.rank { margin-left: auto; min-width: 46px; height: 28px; padding: 0 8px; display: grid; place-items: center; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line); font-size: 13px; }
.rank b { font-size: 14px; }
.rank.first { background: linear-gradient(#f8d56a, #d19a1c); color: #2a1d05; border-color: #f8d56a; }
.rank.flip { animation: flip .4s ease; }
.tools { display: flex; gap: 4px; }
.tool { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); font-weight: 800; font-size: 12px; }
.tool svg { width: 20px; height: 20px; }
.tool:active, .side-btn:active { transform: scale(.94); }

/* 帯 */
.band { height: 28px; flex: none; position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--dim); background: #1b1712; overflow: hidden; }
.band-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: transparent; }
.band span, .band b { position: relative; }
.band b { font-size: 18px; color: var(--fg); }
.band.rec { color: #fff; background: #3a1214; }
.band.rec .band-fill { background: linear-gradient(90deg, #c4252b, #ef4b52); transition: width .1s linear; }
.band.rec.last .band-fill { animation: blink .35s infinite alternate; }
.band.auto { background: linear-gradient(90deg, #d19a1c, #f8d56a); color: #2a1d05; font-weight: 800; }
.band.offline { color: #f1c27a; }

/* B 厨房 */
.play { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.stage { position: relative; flex: none; width: 100%; aspect-ratio: 16 / 14; background: #0e0c09; touch-action: none; user-select: none; overflow: hidden; }
#kitchen { display: block; width: 100%; height: 100%; transform: translate(var(--sx), var(--sy)); touch-action: none; }
.stage.recording::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 4px rgba(229,72,77,.9), inset 0 0 40px rgba(229,72,77,.55); animation: pulse 1s ease-in-out infinite; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.on { animation: flash .22s ease-out; }
.stick { position: absolute; width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%; border: 2px solid rgba(255,255,255,.55); background: rgba(255,255,255,.1); pointer-events: none; opacity: 0; transform: translate(var(--jx, 0px), var(--jy, 0px)); }
.stick.on { opacity: 1; }
.stick i { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; background: rgba(255,255,255,.7); transform: translate(var(--dx, 0px), var(--dy, 0px)); }
.toast { position: absolute; left: 50%; top: 10px; transform: translate(-50%, -20px); opacity: 0; padding: 7px 16px; border-radius: 18px; background: rgba(20,16,12,.88); border: 1px solid rgba(255,255,255,.25); font-weight: 700; font-size: 15px; white-space: nowrap; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 94%; overflow: hidden; text-overflow: ellipsis; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.gold { background: linear-gradient(#f8d56a, #d19a1c); color: #2a1d05; border-color: #fff3c0; }

/* C 隣の店 */
.court { flex: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 4px 3px 0; background: #0e0c09; }
.nb { position: relative; border-radius: 8px; overflow: hidden; background: #000; border: 2px solid #3d352a; }
.nb.first { border-color: var(--gold); box-shadow: 0 0 10px rgba(242,184,48,.5); }
.nb canvas { display: block; width: 100%; aspect-ratio: 16 / 14; }
.nb-name { position: absolute; left: 0; top: 0; max-width: 100%; padding: 1px 6px; background: rgba(15,12,9,.78); font-size: 11px; line-height: 16px; border-bottom-right-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-rank { position: absolute; right: 3px; top: 3px; min-width: 24px; padding: 0 5px; border-radius: 9px; background: var(--panel2); font-size: 11px; line-height: 17px; font-weight: 800; text-align: center; }
.nb.first .nb-rank { background: linear-gradient(#f8d56a, #d19a1c); color: #2a1d05; }
.nb-rpm { position: absolute; left: 3px; bottom: 3px; padding: 0 6px; border-radius: 9px; background: rgba(15,12,9,.8); font-size: 11px; line-height: 17px; font-variant-numeric: tabular-nums; }

.under { flex: 1; display: flex; flex-direction: column; min-height: 0; }
/* D 店員の枠 */
.chips { flex: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; padding: 6px 3px 4px; }
.chip { position: relative; min-width: 0; height: 66px; padding: 4px 2px 3px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; border-radius: 10px; border: 2px solid var(--line); background: var(--panel); color: var(--fg); text-align: center; overflow: hidden; }
.chip .num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; background: var(--cc, #777); box-shadow: 0 1px 0 rgba(255,255,255,.35) inset; }
.chip .job { font-size: 11px; line-height: 13px; font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .cnt { font-size: 9.5px; line-height: 11px; color: var(--dim); max-width: 100%; white-space: nowrap; }
.chip .cnt { display: flex; flex-direction: column; align-items: center; }
.chip .cnt em { font-style: normal; display: block; }
.chip .cnt .hot { color: #ff8b8b; }
.chip.sel { border-color: var(--cc, var(--fg)); background: var(--panel2); box-shadow: 0 0 0 1px var(--cc, var(--fg)); }
.chip.empty { border-style: dashed; color: var(--dim); }
.chip.locked { opacity: .55; }
.chip.you { --cc: #f4ecdc; }
.chip.you .num { color: #2a1d05; background: #fff; box-shadow: 0 0 0 2px var(--orange); }
.chip.hit { animation: hit .5s ease; }
.chip.glow { animation: glow 1s ease 2; }
.chip .lock { width: 18px; height: 18px; }
.chip.dim { opacity: .9; }

/* E 操作の帯 */
.ctl { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 6px 12px calc(10px + env(safe-area-inset-bottom)); gap: 6px; min-height: 0; }
.coach { margin: 0; min-height: 24px; font-size: 16px; font-weight: 700; text-align: center; color: var(--fg); }
.coach:empty { visibility: hidden; }
.ctl-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; width: 100%; max-width: 420px; }
.rec-btn { width: 84px; height: 84px; border-radius: 50%; border: 4px solid #fff; background: radial-gradient(circle at 35% 30%, #ff6b70, #c4252b 70%); display: grid; place-items: center; align-content: center; gap: 2px; font-weight: 800; font-size: 14px; color: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.5), 0 0 0 0 rgba(229,72,77,.6); }
.rec-btn:active { transform: scale(.95); }
.rec-btn .rec-icon { width: 18px; height: 18px; border-radius: 50%; background: #fff; }
.rec-btn.recording { background: radial-gradient(circle at 35% 30%, #5a5348, #2c261e 70%); border-color: #cfc5b0; }
.rec-btn.recording .rec-icon { border-radius: 3px; background: #ff6b70; }
.rec-btn.pulse { animation: recpulse 1.1s infinite; }
.rec-btn:disabled { opacity: .4; }
.side-btn { min-height: 48px; padding: 6px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); font-size: 13px; font-weight: 700; line-height: 1.2; }
.side-btn[hidden] { display: block; visibility: hidden; }
.rec-target { margin: 0; font-size: 12px; color: var(--dim); min-height: 16px; }

/* ダイアログ */
.dlg { width: min(92vw, 420px); max-height: 92dvh; overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--fg); }
.dlg::backdrop { background: rgba(0,0,0,.65); }
.dlg h2 { margin: 0 0 12px; font-size: 18px; }
.dlg h3 { margin: 12px 0 6px; font-size: 13px; color: var(--dim); font-weight: 600; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { min-height: 40px; padding: 0 14px; border: 0; background: var(--panel2); }
.seg button[aria-pressed="true"] { background: var(--orange); color: #2a1305; font-weight: 800; }
.plain, .primary, .danger { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); }
.primary { background: var(--orange); border-color: var(--orange); color: #2a1305; font-weight: 800; margin-top: 14px; width: 100%; }
.danger { background: #4a1618; border-color: #8a2a2e; color: #ffd6d6; }
.close { margin-top: 10px; width: 100%; }
.reset { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.reset p { margin: 0 0 8px; font-size: 13px; }
.warn { margin: 6px 0; padding: 8px; border-radius: 8px; background: #4a3612; color: #ffd78a; font-size: 13px; }
.preview { margin: 0 0 4px; font-size: 22px; font-weight: 800; text-align: center; }
.pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pick button { min-height: 40px; padding: 2px 4px; border-radius: 10px; border: 2px solid var(--line); background: var(--panel2); font-size: 13px; }
.pick button[aria-pressed="true"] { border-color: var(--orange); background: #3a2414; font-weight: 800; }
#card-canvas { display: block; width: 100%; height: auto; border-radius: 12px; background: #000; }
.row-btns { display: flex; gap: 8px; margin-top: 10px; }
.row-btns .primary { margin-top: 0; flex: 1; }

@keyframes pop { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes flip { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes blink { from { opacity: .55; } to { opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes flash { 0% { opacity: .7; } 100% { opacity: 0; } }
@keyframes hit { 0%, 100% { background: var(--panel); } 30% { background: #7a1f24; } }
@keyframes glow { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 14px 2px var(--gold); } }
@keyframes recpulse { 0% { box-shadow: 0 6px 16px rgba(0,0,0,.5), 0 0 0 0 rgba(229,72,77,.7); } 70%, 100% { box-shadow: 0 6px 16px rgba(0,0,0,.5), 0 0 0 18px rgba(229,72,77,0); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01s !important; animation-iteration-count: 1 !important; transition-duration: .01s !important; } }

/* 高さが足りない端末 */
@media (max-height: 700px) and (max-width: 899px) {
  .court { padding-top: 3px; } .chip { height: 58px; } .rec-btn { width: 68px; height: 68px; } .coach { min-height: 20px; font-size: 14px; }
}

/* 391〜899px は最大 480px まで拡大して中央 */
@media (min-width: 481px) and (max-width: 899px) { .app { box-shadow: 0 0 0 1px var(--line); } }

/* PC: 左に自分の厨房（大きく）、右に隣の3軒を縦に */
@media (min-width: 900px) {
  .app { max-width: none; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) var(--side); grid-template-rows: 56px 30px minmax(0, 1fr); grid-template-areas: "top top" "band band" "play play"; --side: calc((100dvh - 150px) / 3 * 1.142857); --under: 182px; }
  .top { grid-area: top; height: 56px; padding: 0 24px; gap: 18px; justify-content: flex-start; }
  .rpm { margin-top: 15px; } .rpm b { font-size: 32px; } .shopname { left: 24px; top: 4px; font-size: 12px; }
  .band { grid-area: band; height: 30px; }
  .play { grid-area: play; display: grid; grid-template-columns: minmax(0, 1fr) var(--side); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "stage court" "under court"; column-gap: 12px; padding: 8px 12px 8px; min-height: 0; }
  .stage { grid-area: stage; justify-self: center; width: min(100%, calc((100dvh - 56px - 30px - 8px - 8px - var(--under)) * 16 / 14)); border-radius: 12px; }
  .court { grid-area: court; grid-template-columns: 1fr; grid-auto-rows: min-content; align-content: start; gap: 8px; padding: 0; background: transparent; }
  .under { grid-area: under; width: min(100%, calc((100dvh - 56px - 30px - 8px - 8px - var(--under)) * 16 / 14)); justify-self: center; }
  .chips { padding: 8px 0 4px; gap: 6px; }
  .ctl { padding: 4px 0 0; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 20px; }
  .coach { order: 2; flex: 1 1 100%; } .ctl-row { order: 1; width: auto; } .rec-target { order: 3; flex: 1 1 100%; text-align: center; }
  .rec-btn { width: 72px; height: 72px; }
}

/* 5-4: 知らせの帯、隣の店の印、S6 大きく見る */
.band.alert { background: #4a3612; color: #ffe29a; font-weight: 700; }
.band.alert.on { background: #5a1a1d; color: #ffd6d6; }
.band.peak { background: linear-gradient(90deg, #7a3d0a, #c2670f); color: #fff; font-weight: 700; }
.band.alert span, .band.peak span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 96%; font-size: 12.5px; }
.nb { cursor: pointer; }
.nb-tag { position: absolute; left: 3px; bottom: 22px; padding: 0 6px; border-radius: 9px; background: rgba(15,12,9,.8); font-size: 10px; line-height: 15px; }
.nb-tag.online { background: #1f7a45; } .nb-tag.past { background: #4a4f7a; }
.nb.joined { animation: glow 1s ease 2; }
.zoom { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.zoom[hidden] { display: none; }
.zoom canvas#zoom-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.zoom canvas#zoom-me { position: absolute; left: 6px; bottom: 6px; width: 34%; aspect-ratio: 16 / 14; border: 2px solid #ff9b4d; border-radius: 8px; background: #000; }
.zoom-name { position: absolute; left: 8px; top: 8px; padding: 2px 10px; border-radius: 12px; background: rgba(15,12,9,.85); font-weight: 800; font-size: 14px; }
.zoom-close { position: absolute; right: 6px; top: 6px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid #fff5; background: rgba(15,12,9,.85); font-size: 22px; line-height: 1; pointer-events: auto; }
.zoom-hint { position: absolute; right: 8px; bottom: 8px; padding: 1px 8px; border-radius: 10px; background: rgba(15,12,9,.75); font-size: 11px; }

/* 工程7: 知らせの2段（上=ご褒美、下=理由と対処）、小さい画面 */
.toast { pointer-events: auto; white-space: normal; text-align: center; width: max-content; max-width: 94%; line-height: 1.3; }
.toast2 { top: auto; bottom: 10px; transform: translate(-50%, 20px); background: rgba(40,28,10,.92); border-color: rgba(255,200,100,.5); }
.toast2.on { transform: translate(-50%, 0); }
.rank { white-space: nowrap; }
@media (max-height: 700px) and (max-width: 899px) {
  .top { height: 44px; } .band { height: 24px; }
  .court { grid-template-columns: repeat(3, 84px); justify-content: center; padding: 3px 3px 0; }
  .nb { border-width: 1px; border-radius: 6px; } .nb-tag, .nb-rpm { display: none; } .nb-name { font-size: 9px; line-height: 12px; padding: 0 4px; } .nb-rank { font-size: 9px; line-height: 13px; min-width: 18px; }
  .chips { padding: 3px 3px 2px; } .chip { height: 58px; padding: 2px 1px; } .chip .num { width: 18px; height: 18px; font-size: 11px; }
  .ctl { padding: 2px 10px 6px; gap: 3px; } .coach { min-height: 0; font-size: 13px; line-height: 1.25; } .rec-btn { width: 62px; height: 62px; font-size: 12px; border-width: 3px; } .rec-btn .rec-icon { width: 14px; height: 14px; }
  .rec-target { font-size: 11px; min-height: 0; } .side-btn { min-height: 40px; font-size: 12px; }
}
@media (max-width: 380px) {
  .top { gap: 4px; padding: 0 4px; } .tool { width: 32px; height: 32px; } .rpm { min-width: 76px; } .rpm b { font-size: 24px; } .best { min-width: 52px; } .shopname { max-width: 110px; }
}
@media (max-width: 340px) { .best { display: none; } .rank { min-width: 40px; padding: 0 5px; } }
@media (max-width: 380px) { .shopname { max-width: 78px; } }

/* 工程7（PO差し戻し）: 知らせは厨房の操作を止めない、名前が札に隠れない、待つだけの空振りは弱く */
.toast { pointer-events: none; }
.nb-name { max-width: calc(100% - 34px); }
.chip .cnt .soft { color: #d8b27a; }
.nb-tag.sample { background: #7a5a1f; }
@media (max-height: 700px) and (max-width: 899px) { .rec-target:not(.warn) { display: none; } .coach { font-size: 12.5px; line-height: 1.2; } .ctl { gap: 2px; } }

/* 周回1 ux: 撮り直す枠の指名、枠の面、順位の札の動き */
.chip .cnt { font-size: 9px; line-height: 11px; }
.chip .cnt em { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.fix { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 12px 2px rgba(242,184,48,.55); animation: fixpulse 1.2s ease-in-out infinite; }
.chip.fix::after { content: "!"; position: absolute; right: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--gold); color: #2a1d05; font-size: 10px; line-height: 14px; font-weight: 900; }
@keyframes fixpulse { 0%, 100% { box-shadow: 0 0 0 2px var(--gold), 0 0 4px 0 rgba(242,184,48,.2); } 50% { box-shadow: 0 0 0 2px var(--gold), 0 0 14px 3px rgba(242,184,48,.8); } }
.sheet { font-size: 14px; }
.sheet p { margin: 0; }
.sheet-h { margin-top: 12px !important; font-size: 12px; font-weight: 700; color: var(--dim); }
.sheet-fix { margin: 4px 0 0; padding: 8px 10px; border-radius: 10px; background: #4a3612; color: #ffe29a; font-weight: 700; }
.sheet-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.sheet-row b { white-space: nowrap; }
.sheet-row-t { padding: 4px 0; border-top: 1px solid var(--line); }
.sheet-dim { color: var(--dim); padding: 4px 0; }
.rank.rise { animation: rankup .4s ease; }
.rank.drop { animation: rankdown .4s ease; }
.nb-rank.rise { animation: nbup .4s ease; }
.nb-rank.drop { animation: nbdown .4s ease; }
@keyframes rankup { 0% { transform: translateY(10px); opacity: .3; } 60% { transform: translateY(-4px); } 100% { transform: none; opacity: 1; } }
@keyframes rankdown { 0% { transform: translateY(-6px); opacity: .5; } 100% { transform: none; opacity: 1; } }
@keyframes nbup { 0% { transform: translateY(8px); opacity: .3; } 100% { transform: none; opacity: 1; } }
@keyframes nbdown { 0% { transform: translateY(-6px); opacity: .3; } 100% { transform: none; opacity: 1; } }
html.calm .rank.rise, html.calm .rank.drop, html.calm .nb-rank.rise, html.calm .nb-rank.drop, html.calm .chip.fix { animation: none; }
@media (prefers-reduced-motion: reduce) { .rank.rise, .rank.drop, .nb-rank.rise, .nb-rank.drop, .chip.fix { animation: none; } }
@media (max-width: 380px) { .chip .job { font-size: 10px; } }
.sheet-short { margin-top: 4px !important; color: #ff8b8b; font-weight: 700; }
.sheet-note { margin: 6px 0 0; font-size: 12px; text-align: center; }
/* 周回2 ux: 空き枠がないとき、ボタンの下に何を撮り直すかを出す */
.rec-target.warn { color: #ffd78a; font-weight: 700; line-height: 1.25; text-align: center; min-height: 0; }
/* 周回2 ux: PC は下の枠と操作をつめて、厨房を縦いっぱいに近づける */
@media (min-width: 900px) {
  .chips { padding: 6px 0 2px; } .chip { height: 66px; }
  .ctl { flex-direction: row; flex-wrap: wrap; padding: 2px 0 0; gap: 2px 16px; }
  .coach { order: 2; flex: 1 1 100%; min-height: 0; font-size: 14px; } .rec-btn { width: 64px; height: 64px; font-size: 12px; } .rec-target { min-height: 0; }
}
@media (min-width: 900px) { .ctl { flex-wrap: wrap; align-items: center; } .coach { order: 2; flex: 1 1 0; min-width: 0; text-align: left; font-size: 14px; } .rec-target { order: 3; flex: 1 1 100%; } .ctl-row { order: 1; flex: none; } }
@media (max-height: 700px) and (max-width: 899px) { .chip { height: 52px; } .rec-btn { width: 56px; height: 56px; font-size: 11px; } .coach { font-size: 12px; } .ctl { padding-bottom: 4px; gap: 1px; } .rec-target.warn { font-size: 10.5px; } .chips { padding: 3px 3px 1px; } }

/* 周回3 ux: 次の★、前回の最高、全自動の目盛り、撮り直しの前後の差 */
.goalbar { height: 19px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; background: #14110d; font-size: 12px; color: var(--dim); border-bottom: 1px solid var(--line); }
.goalbar #goal-star { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--gold); font-weight: 700; }
.autog { display: flex; align-items: center; gap: 6px; flex: none; }
.autog small { font-size: 11px; white-space: nowrap; }
.cells { display: flex; gap: 2px; align-items: flex-end; height: 12px; }
.cells i { width: 7px; height: 7px; border-radius: 2px; background: #3a3228; transition: background .6s ease, height .6s ease; }
.cells i.m1 { height: 10px; box-shadow: 0 -2px 0 #8a7a5a; } .cells i.m2 { height: 12px; width: 9px; box-shadow: 0 -2px 0 var(--gold); }
.cells i.on { background: var(--green); } .cells i.m2.on { background: var(--gold); }
.prev { color: var(--dim); font-size: 10px; }
.chip .cnt .up { color: #7be39b; }
.band.retake { background: #123b25; color: #b8f0cf; font-weight: 700; }
.sheet-state { font-weight: 800; padding: 4px 8px; border-radius: 8px; display: inline-block; margin-bottom: 6px !important; }
.sheet-state.ok { background: #123b25; color: #b8f0cf; } .sheet-state.bad { background: #4a3612; color: #ffe29a; }
@media (max-height: 700px) and (max-width: 899px) { .goalbar { height: 17px; font-size: 11px; } .cells i { height: 6px; } }
@media (min-width: 900px) { .app { grid-template-rows: 56px 30px 20px minmax(0, 1fr); grid-template-areas: "top top" "band band" "goal goal" "play play"; } .goalbar { grid-area: goal; padding: 0 24px; } }
@media (min-width: 900px) { .app { --under: 206px; } }
@media (max-height: 700px) and (max-width: 899px) { .court { grid-template-columns: repeat(3, 76px); } .band { height: 22px; } .top { height: 40px; } .rpm { margin-top: 9px; } }
@media (min-height: 701px) { .coach.long { font-size: 13px; line-height: 1.25; } }
@media (max-height: 700px) and (max-width: 899px) { .ctl { padding-bottom: 0 !important; gap: 0 !important; } .court { grid-template-columns: repeat(3, 72px); } .coach { line-height: 1.15; } }
@media (max-height: 700px) and (max-width: 899px) { .court { grid-template-columns: repeat(3, 68px); } .chip { height: 50px; } }
.best-line { white-space: nowrap; }
@media (min-height: 701px) { .coach.xlong { font-size: 12px; } }

/* 周回6 ux: 構成。★の行と全自動の目盛りは厨房の上の壁に重ねる（段を増やさない）。スマホは厨房を縦に伸ばし、隣の店は1行の札に */
.goalbar { position: absolute; left: 0; right: 0; top: 0; z-index: 2; pointer-events: none; background: rgba(14,12,9,.74); border-bottom: 0; }
.rec-target { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (max-width: 899px) {
  .stage { width: 100%; aspect-ratio: auto; height: clamp(calc(100vw * 14 / 16), calc(100dvh - 385px), calc(100vw * 40 / 39)); }
  .court { grid-template-columns: repeat(3, 1fr) !important; gap: 3px; padding: 4px 3px 0; }
  .nb { height: 58px; border: 0; border-top: 6px solid var(--aw, #666); border-radius: 8px; background: var(--panel); display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 1fr 1fr; align-items: center; padding: 1px 6px 3px; }
  .nb.first { border-top-color: var(--gold); box-shadow: 0 0 8px rgba(242,184,48,.5); }
  .nb canvas { display: none; }
  .nb-name, .nb-rank, .nb-rpm, .nb-tag { position: static; display: block; background: none; border-radius: 0; padding: 0; min-width: 0; max-width: 100%; }
  .nb-name { grid-area: 1 / 1; font-size: 12px; line-height: 16px; font-weight: 700; } .nb-rank { grid-area: 1 / 2; font-size: 13px; font-weight: 800; padding: 0 6px; border-radius: 9px; background: var(--panel2); }
  .nb.first .nb-rank { background: linear-gradient(#f8d56a, #d19a1c); color: #2a1d05; }
  .nb-rpm { grid-area: 2 / 1; font-size: 12px; color: var(--dim); } .nb-tag { grid-area: 2 / 2; font-size: 10px; color: var(--dim); background: none !important; }
}
@media (max-height: 700px) and (max-width: 899px) { .stage { height: auto; aspect-ratio: 16 / 14; } .nb { height: 50px; } .court { grid-template-columns: repeat(3, 1fr) !important; } .nb-rpm, .nb-tag { display: block !important; } .nb-name { font-size: 11px; } }
@media (min-width: 900px) {
  .app { grid-template-rows: 56px 30px minmax(0, 1fr); grid-template-areas: "top top" "band band" "play play"; }
  .play { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "stage court" "stage under" "stage ."; column-gap: 16px; padding: 8px 16px; align-content: start; }
  .stage { grid-area: stage; justify-self: start; height: calc(100dvh - 56px - 30px - 16px); width: min(calc((100dvh - 56px - 30px - 16px) * 16 / 14), 62vw); }
  .court { grid-area: court; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .under { grid-area: under; width: 100%; justify-self: stretch; }
  .ctl { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; padding: 8px 0 0; }
  .coach { order: 1; flex: none; text-align: left; font-size: 15px; min-height: 0; } .ctl-row { order: 2; width: 100%; max-width: none; } .rec-target { order: 3; flex: none; text-align: center; } .rec-btn { width: 84px; height: 84px; }
  .chip { height: 66px; }
}

/* 周回6 ux B: 撮り直しのご褒美 */
.chip.bounce { animation: chipbounce .55s ease; }
@keyframes chipbounce { 0% { transform: scale(1); } 30% { transform: scale(1.14) translateY(-6px); } 60% { transform: scale(.97); } 100% { transform: scale(1); } }
.floatup { position: absolute; left: 50%; top: 2px; transform: translateX(-50%); padding: 1px 6px; border-radius: 9px; background: #1f7a45; color: #eafff1; font-size: 11px; font-weight: 800; white-space: nowrap; pointer-events: none; animation: floatup 1.5s ease-out forwards; z-index: 3; }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, 8px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -26px); } }
html.calm .chip.bounce, html.calm .floatup { animation: none; }
@media (prefers-reduced-motion: reduce) { .chip.bounce, .floatup { animation: none; } }
.chip { overflow: visible; }

/* 周回7 ux A: 押せる範囲を44px以上に（見た目の大きさは変えない） */
.tool, .shopname { position: relative; }
.tool::after { content: ""; position: absolute; inset: -4px; }
@media (max-width: 380px) { .tool::after { inset: -6px; } }
.shopname { position: absolute; }
.shopname::after { content: ""; position: absolute; left: -10px; right: -10px; top: -14px; bottom: -16px; }
@media (max-height: 700px) and (max-width: 899px) { .side-btn { min-height: 44px; } }
#slot-undo.glow { box-shadow: 0 0 0 3px var(--gold), 0 0 14px rgba(242,184,48,.7); }
#dlg-slot .row-btns { gap: 8px; } #dlg-slot .row-btns .primary { margin-top: 14px; min-height: 48px; }
.shopname::after { display: none; }
.shopname { left: 0; top: -13px; padding: 15px 10px; }
@media (min-width: 900px) { .shopname { left: 14px; top: -11px; padding: 15px 10px; } }
.tool::after { inset: -6px; } @media (max-width: 380px) { .tool::after { inset: -9px; } }
.shopname { top: -16px; padding: 18px 10px; } @media (min-width: 900px) { .shopname { top: -14px; padding: 18px 10px; } }
.shopname { top: 0; padding: 2px 10px 28px; z-index: 2; } @media (min-width: 900px) { .shopname { top: 0; padding: 4px 14px 26px; left: 10px; } }
@media (max-height: 700px) and (max-width: 899px) { .tool { width: 40px; height: 40px; } }
@media (max-height: 700px) and (max-width: 899px) { .top { height: 44px; } .tool { width: 44px; height: 44px; } .band { height: 20px; } .rpm { margin-top: 11px; } .tool { border-radius: 12px; } .tools { gap: 0; } }
.floatup.big { font-size: 16px; padding: 2px 9px; background: #178a4a; box-shadow: 0 0 10px rgba(90,230,150,.7); }

/* 周回7 修正 ux: 上の帯の幅と押せる幅 */
.srow { display: flex; align-items: center; gap: 4px; min-width: 0; }
.best-line { white-space: nowrap; }
.tool { width: 44px; height: 44px; } .tools { gap: 0; }
.rpm { min-width: 76px; }
@media (max-width: 380px) { .tool { width: 40px; height: 40px; } .tool::after { inset: -2px; } .rpm { min-width: 64px; } .rank { min-width: 36px; padding: 0 4px; } .top { gap: 2px; padding: 0 4px; } .best { min-width: 0; } }
