/* パズルモード：平面的（フラット）なデザイン。影やぼかしは使わず、色の面と太い線で見せる */
.puzzle-screen {
  --pz-bg: #f6f1e7; --pz-ink: #2b2a33; --pz-sub: #6b6875; --pz-line: #2b2a33;
  background: var(--pz-bg); color: var(--pz-ink); max-width: 560px; left: 50%; transform: translateX(-50%); width: 100%;
  font-family: "Zen Maru Gothic", var(--sk-font, sans-serif);
}
.puzzle-screen .bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.puzzle-screen .bar h2 { flex: 1; margin: 0; font-size: 19px; font-weight: 700; color: var(--pz-ink); font-family: inherit; letter-spacing: .02em; }
.puzzle-screen .bar h2 small { margin-left: 8px; font-size: 13px; padding: 2px 8px; border-radius: 6px; background: var(--pz-ink); color: var(--pz-bg); vertical-align: 2px; }
.puzzle-screen .icon.back { background: #fff; color: var(--pz-ink); border: 2px solid var(--pz-line); box-shadow: none; }
.pz-life { display: flex; gap: 5px; }
.pz-life i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--pz-line); background: transparent; }
.pz-life i.on { background: #e86f5a; }
.pz-rule { font-size: 13.5px; line-height: 1.65; color: var(--pz-sub); margin: 0 0 12px; background: #fff; border: 2px solid var(--pz-line); border-radius: 10px; padding: 10px 12px; }
.pz-moves { margin: 0 0 10px; font-size: 15px; text-align: center; color: var(--pz-ink); }
.pz-moves b { font-size: 22px; }
.pz-moves.warn b { color: #d0453a; }
.pz-host { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-bottom: 20px; }
.pz-host button { font-family: inherit; -webkit-tap-highlight-color: transparent; }

.pz-board { display: grid; width: min(100%, 420px); border: 3px solid var(--pz-line); border-radius: 8px; overflow: hidden; background: var(--pz-line); gap: 1px; }
.pz-cell { aspect-ratio: 1; border: 0; padding: 0; margin: 0; display: grid; place-items: center; font-size: 15px; font-weight: 700; color: var(--pz-ink); cursor: pointer; min-width: 0; }
.pz-x { color: rgba(43,42,51,.55); font-size: 18px; line-height: 1; }
.pz-lamp { width: 58%; height: 58%; border-radius: 50%; background: #fff7c2; border: 3px solid var(--pz-ink); box-shadow: 0 0 0 3px #fff7c2; }
@keyframes pzShake { 0%,100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.pz-shake { animation: pzShake .25s; }

/* 家具あぶりだし */
.pz-aburi { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.pz-nono { display: grid; gap: 1px; width: min(100%, 420px); }
.pz-nono .pz-cell { border: 1px solid #cfc8b8; border-radius: 2px; }
.pz-clue { display: flex; align-items: center; justify-content: flex-end; font-size: 11px; font-weight: 700; color: var(--pz-ink); padding-right: 4px; white-space: nowrap; }
.pz-clue.c { flex-direction: column; justify-content: flex-end; padding: 0 0 3px; line-height: 1.15; }
.pz-clue.done { color: #b5ae9f; }
.pz-tools { display: flex; gap: 8px; }
.pz-tool { min-width: 88px; padding: 10px 14px; border-radius: 10px; border: 2px solid var(--pz-line); background: #fff; color: var(--pz-ink); font-size: 15px; font-weight: 700; }
.pz-tool.on { background: var(--pz-ink); color: var(--pz-bg); }

/* 六畳ロジック */
.pz-rokujo { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.pz-sd { grid-template-columns: repeat(6, 1fr); gap: 2px; padding: 0; background: var(--pz-line); }
.pz-sd .pz-cell { font-size: 11px; color: #fff; background: #fff; }
.pz-sd .pz-cell.given { filter: saturate(.65) brightness(.88); }
.pz-sd .pz-cell.sel { outline: 4px solid #2b2a33; outline-offset: -4px; background: #fff7c2 !important; }
.pz-pal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(100%, 420px); }
.pz-pal button { padding: 12px 6px; border-radius: 10px; border: 2px solid var(--pz-line); color: #fff; font-size: 15px; font-weight: 700; text-shadow: 0 1px 0 rgba(0,0,0,.25); }

/* おひっこし */
.pz-slide-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pz-slide { position: relative; background: #e7dfcf; border: 3px solid var(--pz-line); border-radius: 8px; box-sizing: content-box; }
.pz-exit { position: absolute; bottom: -9px; height: 6px; background: #3fa66b; border-radius: 3px; }
.pz-empty { position: absolute; border-radius: 6px; border: 2px dashed rgba(43,42,51,.18); cursor: pointer; }
.pz-blk { position: absolute; border: 2px solid var(--pz-line); border-radius: 8px; color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; text-shadow: 0 1px 0 rgba(0,0,0,.25); transition: left .12s, top .12s; }
.pz-blk.sel { outline: 4px solid #fff7c2; outline-offset: -6px; }
.pz-arrows { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 48px); gap: 6px; }
.pz-arrows button { border-radius: 10px; border: 2px solid var(--pz-line); background: #fff; color: var(--pz-ink); font-size: 20px; font-weight: 700; }
.pz-arrows button:nth-child(1) { grid-column: 2; grid-row: 1; }
.pz-arrows button:nth-child(2) { grid-column: 1; grid-row: 2; }
.pz-arrows button:nth-child(3) { grid-column: 3; grid-row: 2; }
.pz-arrows button:nth-child(4) { grid-column: 2; grid-row: 2; }

/* パズルえらび（下から出る画面） */
.pz-hub { display: flex; flex-direction: column; gap: 8px; }
.pz-pick { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px; border-radius: var(--sk-radius, 14px); background: var(--sk-card); border: 1px solid var(--sk-card-line); color: var(--sk-text); font: inherit; }
.pz-pick .s-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--sk-icon-bg); color: var(--sk-icon-fg); flex: none; }
.pz-pick .s-ic svg { width: 22px; height: 22px; }
.pz-pick-t { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pz-pick-t b { font-size: 15px; }
.pz-pick-t small, .pz-lv small { color: var(--sk-muted); font-size: 11.5px; }
.pz-lv { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; color: var(--sk-muted); }
.pz-lv b { font-size: 20px; color: var(--sk-text); margin-left: 2px; }

/* 結果 */
.pz-res-sheet .pz-res { text-align: center; padding: 6px 0 4px; }
.pz-res .pz-sub { font-size: 13px; color: var(--sk-muted); margin: 6px 0; }
.pz-res .pz-up { font-size: 14px; margin: 10px 0 0; color: var(--sk-text); }
.pz-res-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

/* はじめのモードえらび */
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 10px; }
.mode-pick button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 10px; border-radius: var(--sk-radius, 14px); background: var(--sk-card); border: 1px solid var(--sk-card-line); color: var(--sk-text); font: inherit; }
.mode-pick button.on { border-color: var(--sk-accent); }
.mode-pick .mp-ic { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--sk-icon-bg); color: var(--sk-icon-fg); }
.mode-pick .mp-ic svg { width: 26px; height: 26px; }
.mode-pick b { font-size: 17px; }
.mode-pick small { font-size: 12px; color: var(--sk-muted); text-align: center; line-height: 1.5; }

/* 管理者画面のモード表示 */
.ac-mode { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 12.5px; }
.ac-mode small { color: var(--sk-muted); }
.ac-mode .ac-mode-btn { margin-left: auto; }
.mode-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; background: var(--sk-icon-bg); }
.mode-tag svg { width: 14px; height: 14px; }
.mode-tag.puzzle { color: #8fd3a8; } .mode-tag.study { color: #9cc3ff; } .mode-tag.none { color: var(--sk-muted); }

/* 家具のイラスト */
.pz-art { width: 74%; height: 74%; display: block; pointer-events: none; }
.pz-sd .pz-cell .pz-art { width: 78%; height: 78%; }
.pz-lampart { width: 84%; height: 84%; }
.pz-blk .pz-art { width: 82%; height: 82%; }
.pz-pal button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 8px; }
.pz-pal button .pz-art { width: 34px; height: 34px; }
.pz-pal button small { font-size: 12px; }

/* ★えらび（1.5.0） */
.pz-pick { flex-direction: column; align-items: stretch; gap: 10px; }
.pz-pick-top { display: flex; align-items: center; gap: 12px; }
.pz-stars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pz-star { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 46px; padding: 4px 0; border-radius: 10px; border: 1px solid var(--sk-card-line); background: var(--sk-icon-bg); color: var(--sk-text); font: inherit; }
.pz-star b { font-size: 13px; color: #f2c14e; }
.pz-star small { font-size: 11px; color: var(--sk-muted); }
.pz-star.clear { border-color: rgba(242, 193, 78, .45); }
.pz-star.last { background: #f2efe9; border-color: #f2efe9; }
.pz-star.last b { color: #b07a00; } .pz-star.last small { color: #4a4750; }
.pz-star.locked { opacity: .45; }
.pz-star.locked svg { width: 15px; height: 15px; }
.pz-hub-note { font-size: 12px; color: var(--sk-muted); text-align: center; margin: 10px 0 0; }
.pz-rule b { color: #d0453a; margin-left: 4px; }

/* ---------- 遊び方（右上の i）1.6.0 ---------- */
.pz-ibtn { position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #2b2a33; background: #fff; color: #2b2a33; font: 700 17px Georgia, "Times New Roman", serif; display: grid; place-items: center; padding: 0; cursor: pointer; }
.pz-ibtn.pulse::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid #f2884b; animation: phRing 1.4s infinite; }
@keyframes phRing { 0% { transform: scale(.8); opacity: 1 } 100% { transform: scale(1.35); opacity: 0 } }
.ph-sheet { position: fixed; inset: 0; z-index: 60; background: rgba(43,42,51,.45); display: flex; align-items: flex-end; justify-content: center; font-family: "Zen Maru Gothic", var(--sk-font, sans-serif); color: #2b2a33; }
.ph-card { width: min(100%, 560px); background: #f6f1e7; border-radius: 22px 22px 0 0; border-top: 3px solid #2b2a33; padding: 14px 18px calc(18px + env(safe-area-inset-bottom, 0px)); animation: phUp .25s ease-out; }
@keyframes phUp { from { transform: translateY(40px); opacity: 0 } to { transform: none; opacity: 1 } }
.ph-head { display: flex; align-items: center; justify-content: space-between; }
.ph-head b { font-size: 16px; }
.ph-close { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #2b2a33; background: #fff; color: #2b2a33; font-weight: 700; font-size: 16px; cursor: pointer; }
.ph-stage { position: relative; width: min(100%, 250px); margin: 10px auto 0; }
.ph-board { position: relative; }
.ph-finger { position: absolute; left: 0; top: 0; width: 34px; height: 44px; pointer-events: none; z-index: 5; opacity: 0; transition: transform .45s cubic-bezier(.4,.1,.2,1), opacity .3s; }
.ph-finger svg { transition: transform .12s; }
.ph-finger.press svg { transform: scale(.88); transform-origin: 12px 2px; }
.ph-ripple { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 3px solid #f2884b; pointer-events: none; z-index: 4; animation: phRip .5s forwards; }
@keyframes phRip { from { transform: scale(.3); opacity: 1 } to { transform: scale(1.2); opacity: 0 } }
.ph-cap { min-height: 46px; margin: 12px 0 8px; font-size: 14.5px; line-height: 1.55; font-weight: 700; text-align: center; }
.ph-n { display: inline-block; min-width: 22px; height: 22px; line-height: 22px; border-radius: 50%; background: #2b2a33; color: #fff; font-size: 12px; margin-right: 6px; text-align: center; }
.ph-dots { display: flex; justify-content: center; gap: 8px; align-items: center; }
.ph-dots button { width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 0; background: #cfc8b8; cursor: pointer; }
.ph-dots button.on { background: #2b2a33; width: 24px; border-radius: 5px; }
.ph-nav { display: flex; justify-content: space-between; margin-top: 10px; }
.ph-nav button { font: 700 13px "Zen Maru Gothic", sans-serif; padding: 8px 16px; border-radius: 10px; border: 2px solid #2b2a33; background: #fff; color: #2b2a33; cursor: pointer; }
.ph-bd { display: grid; gap: 1px; background: #2b2a33; border: 3px solid #2b2a33; border-radius: 7px; overflow: hidden; }
.ph-bd.done { box-shadow: 0 0 0 4px #f2c14e; }
.ph-cell { aspect-ratio: 1; display: grid; place-items: center; position: relative; min-width: 0; }
.ph-x { color: rgba(43,42,51,.6); font-size: 16px; line-height: 1; }
.ph-art { width: 78%; height: 78%; display: block; }
.ph-cell.hl::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(255,255,255,.55) 0 4px, transparent 4px 8px); }
.ph-cell.ng { outline: 3px solid #d0453a; outline-offset: -3px; animation: pzShake .3s; }
.ph-cell.ng::after { content: ""; position: absolute; inset: 0; background: rgba(208,69,58,.35); }
.ph-cell.sel { background: #fff7c2 !important; outline: 3px solid #2b2a33; outline-offset: -3px; }
.ph-hearts { display: flex; gap: 4px; justify-content: flex-end; margin-bottom: 5px; }
.ph-hearts i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #2b2a33; }
.ph-hearts i.on { background: #e86f5a; }
.ph-nono { display: grid; gap: 1px; }
.ph-nono .ph-cell { background: #fff; border: 1px solid #cfc8b8; border-radius: 2px; }
.ph-nono .ph-cell.f { background: #2b2a33; }
.ph-nono.done .ph-cell.f { background: #f2b84b; }
.ph-nono .ph-cell.hlrow { box-shadow: inset 0 0 0 2px #f2884b; }
.ph-clue { font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: flex-end; padding-right: 4px; white-space: nowrap; }
.ph-clue.c { flex-direction: column; justify-content: flex-end; line-height: 1.1; padding: 0 0 2px; }
.ph-clue.hl { color: #d0453a; }
.ph-tools, .ph-arrows { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.ph-tools span, .ph-arrows span { min-width: 46px; text-align: center; padding: 4px 8px; border-radius: 8px; border: 2px solid #2b2a33; background: #fff; font-weight: 700; font-size: 13px; }
.ph-tools span.on { background: #2b2a33; color: #f6f1e7; }
.ph-arrows span { min-width: 36px; }
.ph-pal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.ph-pal span { padding: 3px 0; border-radius: 8px; border: 2px solid #2b2a33; display: grid; place-items: center; }
.ph-pal .ph-art { width: 28px; height: 28px; }
.ph-mv { text-align: center; font-size: 12px; margin-bottom: 4px; }
.ph-mv b { font-size: 16px; }
.ph-sl { position: relative; background: #e7dfcf; border: 3px solid #2b2a33; border-radius: 7px; margin: 0 auto; }
.ph-e { position: absolute; border-radius: 5px; border: 2px dashed rgba(43,42,51,.2); }
.ph-b { position: absolute; border: 2px solid #2b2a33; border-radius: 7px; display: grid; place-items: center; transition: left .25s, top .25s, transform .7s, opacity .7s .3s; }
.ph-b.sel { outline: 3px solid #fff7c2; outline-offset: -5px; }
.ph-b.out { transform: translateY(var(--out)); opacity: 0; }
.ph-exit { position: absolute; bottom: -8px; height: 5px; background: #3fa66b; border-radius: 3px; }
@media (prefers-reduced-motion: reduce) { .ph-finger, .ph-b { transition: none } .pz-ibtn.pulse::after { animation: none } .ph-card { animation: none } }
