/* ロビー（待機）画面: 左に映像の席（3×2）、右に招待・ゲーム・ルール・スタート。 */
.screen.room:not(.playing){padding:0;gap:0;max-width:none;min-height:100dvh;display:grid;grid-template-columns:minmax(0,1fr) 440px;grid-template-rows:auto auto minmax(0,1fr) auto;column-gap:28px}
.screen.room:not(.playing)>.bar,.screen.room:not(.playing)>.status,.screen.room:not(.playing)>.dock{grid-column:1/-1}
.screen.room:not(.playing)>.bar{justify-content:flex-start;gap:24px;height:76px;padding:0 32px;border-bottom:3px solid #000;background:var(--ink)}
.screen.room:not(.playing) .bar .bar-room{font-weight:700;font-size:15px;color:var(--mute)}
.screen.room:not(.playing) .bar .leave-top{margin-left:auto}
.screen.room:not(.playing) .bar .bug-link{margin-left:0}
.screen.room.playing .leave-top{display:none}
.screen.room:not(.playing)>.dock{grid-row:4;padding:14px 32px 18px;border-top:3px solid #000;background:#1F1B33}
.screen.room:not(.playing)>.dock .leave-btn,.screen.room:not(.playing)>.dock .end-btn{display:none}

.lobby-head{grid-column:1;grid-row:2;display:flex;align-items:flex-end;justify-content:space-between;gap:16px;padding:28px 0 0 32px}
.lobby-head[hidden]{display:none}
.lobby-head h1{margin:0 0 6px;font-weight:900;font-size:34px;line-height:1.2}
.lobby-head .sub{margin:0}
.lobby-ctl{display:flex;gap:12px}
.lobby-ctl .chip{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 18px;border:3px solid #000;border-radius:14px;background:#2A2640;color:#fff;font-weight:900;font-size:14px;box-shadow:0 4px 0 #000}
.lobby-ctl .chip[aria-pressed="false"]{background:var(--coral);color:var(--ink)}

.screen.room:not(.playing)>.table{grid-column:1;grid-row:3;min-height:0;display:flex;flex-direction:column;padding:20px 0 32px 32px}
.screen.room:not(.playing) .table>.grid{flex:1 1 0;min-height:0;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:18px;grid-auto-rows:minmax(0,1fr)}
.screen.room:not(.playing) .table>.grid[data-seats="1"],.screen.room:not(.playing) .table>.grid[data-seats="2"]{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(0,1fr)}
.screen.room:not(.playing) .table>.grid[data-seats="3"],.screen.room:not(.playing) .table>.grid[data-seats="4"]{grid-template-columns:repeat(2,minmax(0,1fr))}
.screen.room:not(.playing) .grid .tile{aspect-ratio:auto;height:100%;min-height:140px;border:3px solid #000;border-radius:22px;background:#1F1B33}
.screen.room:not(.playing) .grid .tile.empty{border:3px dashed #3A3558;background:transparent;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;color:var(--mute);font-weight:700;font-size:15px}
.screen.room:not(.playing) .grid .tile.empty b{font-weight:900;font-size:18px}
.screen.room:not(.playing) .grid .avatar{top:46%;width:96px;min-width:96px;max-width:40%;font-size:40px}
.screen.room:not(.playing) .grid .nm{top:auto;bottom:12px;left:12px;padding:6px 12px;background:#17151Fe6;border:2px solid #000;font-size:14px;max-width:calc(100% - 24px)}
.tile-x{position:absolute;top:10px;right:10px;z-index:3}

.screen.room:not(.playing)>.panel{grid-column:2;grid-row:2/4;display:flex;flex-direction:column;gap:18px;padding:28px 32px 32px 0;overflow:auto;min-height:0}
.screen.room:not(.playing)>.panel[hidden]{display:none}
.lbp,.screen.room:not(.playing)>.panel>.opts{background:#2A2640;border:3px solid #000;border-radius:22px;box-shadow:0 6px 0 #000;padding:22px;display:flex;flex-direction:column;gap:14px}
.lbp h2,.opts .seats-head{margin:0;font-weight:900;font-size:18px}
.lbp .invite input{flex:1 1 0;height:52px;border:3px solid #3A3558;border-radius:14px;background:#1F1B33;color:#fff;font-weight:700;font-size:16px}
.lbp .invite{flex-wrap:nowrap;align-items:center}
.lbp .row2{display:flex;gap:10px}.lbp .row2>*{flex:1}
.lbp .btn.small{background:var(--yel)}
.lbp .btn.small.ghost{background:#2A2640;color:#fff}
.gs-row{display:flex;align-items:center;gap:16px}
.gs-art{position:relative;flex:none;width:84px;height:84px;border:3px solid #000;border-radius:16px;overflow:hidden;display:flex;align-items:center;justify-content:center;background-image:radial-gradient(rgba(0,0,0,.14) 2px,transparent 2px);background-size:14px 14px}
.gs-art>*{transform:scale(.42);flex:none}
.gs-txt{flex:1;display:flex;flex-direction:column;gap:4px}.gs-txt h2{font-size:24px}
.gamesel .games{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}
.hostx{background:#2A2640;border:3px solid #000;border-radius:22px;box-shadow:0 6px 0 #000;padding:14px 22px;display:grid;gap:12px}
.hostx>summary{cursor:pointer;font-weight:900}
.startbox{display:grid;gap:10px;margin-top:auto}
.startbox .btn{min-height:68px;font-size:21px;border-radius:18px;width:100%}
/* ルールのスイッチ（チェックボックスを、デザインのスイッチにする） */
.opts .opt{justify-content:space-between;flex-direction:row-reverse;padding:6px 0;font-size:15px}
.opts .opt input{appearance:none;-webkit-appearance:none;flex:none;position:relative;width:52px;height:30px;margin:0;border:3px solid #000;border-radius:999px;background:#3A3558;cursor:pointer}
.opts .opt input::after{content:'';position:absolute;top:2px;left:2px;width:20px;height:20px;border-radius:50%;background:#fff;border:2px solid #000}
.opts .opt input:checked{background:var(--mint)}
.opts .opt input:checked::after{left:24px}
.opts .opt input:disabled{cursor:default;opacity:.85}

@media (max-width:1000px){
  .screen.room:not(.playing){display:flex;flex-direction:column}
  .screen.room:not(.playing)>.bar{padding:0 14px;gap:10px;height:64px}
  .lobby-head{padding:18px 14px 0;flex-wrap:wrap}
  .lobby-head h1{font-size:26px}
  .screen.room:not(.playing)>.table{padding:14px 14px 0}
  .screen.room:not(.playing) .table>.grid{flex:none;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:none;grid-auto-rows:minmax(130px,auto)}
  .screen.room:not(.playing)>.panel{padding:18px 14px 24px;overflow:visible}
  .screen.room:not(.playing)>.dock{padding:12px 14px}
}
.gs-art>*{transform:scale(.7)}
.gs-txt .sub{white-space:nowrap;font-size:12.5px}
.gs-row{gap:14px}
.screen.room:not(.playing) .bar .leave-top{white-space:nowrap}
@media (max-width:520px){
  .screen.room:not(.playing) .bar .bug-link{display:none}
  .screen.room:not(.playing) .bar .leave-top{font-size:13px;padding:0 12px;min-height:38px}
  .screen.room:not(.playing) .bar .bar-room{font-size:13px}
}

/* PCでは、画面1枚に収める（スクロールさせない） */
@media (min-width:1001px){
  .screen.room:not(.playing){height:100dvh;min-height:0;overflow:hidden}
  .screen.room:not(.playing)>.bar{height:64px}
  .lobby-head{padding-top:16px}
  .lobby-head h1{font-size:28px;margin-bottom:2px}
  .screen.room:not(.playing)>.table{padding:14px 0 16px 32px}
  .screen.room:not(.playing)>.panel{gap:12px;padding:16px 32px 16px 0}
  .lbp,.screen.room:not(.playing)>.panel>.opts{padding:14px 18px;gap:10px;border-radius:18px}
  .lbp h2,.opts .seats-head{font-size:16px}
  .lbp .invite input{height:44px}
  .gs-art{width:64px;height:64px}
  .gs-txt h2{font-size:20px}
  .startbox .btn{min-height:56px;font-size:19px}
  .screen.room:not(.playing)>.dock{padding:8px 32px 10px}
  .opts .opt{padding:3px 0}
  .lbp .aipanel{padding:10px 12px;gap:8px}
}
/* ゲームえらびのポップアップ */
.pick-back{position:fixed;inset:0;z-index:60;display:grid;place-items:center;padding:20px;background:rgba(10,8,18,.72)}
.pick-box{width:min(920px,100%);max-height:calc(100dvh - 40px);overflow:auto;background:#2A2640;border:3px solid #000;border-radius:22px;box-shadow:0 8px 0 #000;padding:20px 22px;display:grid;gap:14px}
.pick-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.pick-head h2{margin:0;font-weight:900;font-size:22px}
.pick-box .games{grid-template-columns:repeat(auto-fill,minmax(200px,1fr))}
@media (min-width:1001px){
  .startbox{position:sticky;bottom:0;padding-top:6px;background:linear-gradient(180deg,transparent,var(--ink) 18%)}
  .lbp .aipanel>.sub:not(.warn){display:none}
  .lbp .aipanel .seats-head .sub{display:inline}
}
@media (min-width:1001px) and (max-height:820px){
  .lbp .row2{display:none}
  .lobby-head .sub{display:none}
}
@media (min-width:1001px){
  .startbox{background:var(--ink);padding-top:8px;margin-top:0}
  .lbp>.aipanel{border:0;background:none;padding:0}
  .aipanel .chip.lvl{min-height:34px;padding:0 10px;font-size:13px}
  .aipanel .grp{gap:6px}
  .aipanel .row .btn.small{min-height:38px;font-size:14px}
}
@media (min-width:1001px) and (max-height:820px){
  .aibar{display:none}
}
.hx-box{width:min(560px,100%)}
.hostx-btn{width:100%;min-height:44px}
