:root{font-family:Tahoma,system-ui,sans-serif;color:#293c32;background:#f5f1e6;font-synthesis:none;--ink:#293c32;--muted:#677268;--green:#315c48;--line:#dddccf;--paper:#fffdf6;--accent:#e8ab63}
*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button{cursor:pointer;min-height:44px;border:0;border-radius:12px;padding:10px 16px;background:#e9ede4;color:var(--ink);font-weight:600}button:hover{filter:brightness(.97)}button:disabled{opacity:.45;cursor:not-allowed}button.primary{background:var(--green);color:#fff}button.secondary{background:#f2e4cc}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:3px solid #b87831;outline-offset:3px}input,select,textarea{width:100%;min-height:44px;padding:11px 12px;border:1px solid #c9cec0;border-radius:12px;background:#fff;color:var(--ink)}textarea{resize:vertical}label{display:block;font-size:14px;font-weight:600}label input,label select,label textarea{margin-top:7px}small,.muted{color:var(--muted)}h1,h2,h3,p{margin-top:0}h1{font-size:clamp(27px,6vw,42px);line-height:1.35;letter-spacing:-.6px}h2{font-size:21px}h3{font-size:17px}p{line-height:1.7}a{color:var(--green)}.topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 24px;border-bottom:1px solid var(--line);max-width:1400px;margin:auto}.wordmark{text-decoration:none;font-weight:700;font-size:18px}.wordmark small{display:block;font-size:11px;font-weight:400;margin-top:4px}.connection{font-size:12px;padding:7px 10px;border-radius:30px;background:#e5e9df;white-space:nowrap}.connection.offline{background:#f7dfbb;color:#794414}main{max-width:1200px;margin:auto;padding:24px}.loading{padding:48px;text-align:center}.eyebrow{letter-spacing:1px;font-size:11px;color:#8b653a;text-transform:uppercase;font-weight:700}.intro{display:grid;grid-template-columns:1.4fr 1fr;gap:24px;margin:12px 0 30px;align-items:center}.intro p{max-width:520px}.intro-art{background:#dde7cf;border:1px solid #d3ddc5;border-radius:24px;min-height:170px;position:relative;overflow:hidden}.intro-art svg{width:100%;height:190px;display:block}.select-toolbar{display:flex;justify-content:space-between;gap:20px;align-items:center;margin-bottom:18px}.select-toolbar h2{margin:0}.select-toolbar input{max-width:250px}.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(145px,1fr));gap:14px}.profile-card{display:flex;flex-direction:column;align-items:flex-start;text-align:left;background:var(--paper);border:2px solid transparent;box-shadow:0 2px 8px #26352708;padding:14px;border-radius:18px;min-width:0;font-weight:400}.profile-card img{width:100%;aspect-ratio:1;object-fit:cover;border-radius:13px;background:#eee9da}.profile-card strong{font-size:17px;margin:12px 0 6px}.profile-card .status{font-size:12px;line-height:1.5;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;min-height:36px;color:#5b695b}.mood{font-size:11px;padding:5px 8px;border-radius:7px;background:#eaf0e2;display:inline-block;margin-top:10px;font-weight:400}.profile-card.picked{border-color:var(--green);background:#f0f5e9}.profile-card.taken{opacity:.45}.join-bar{position:sticky;bottom:12px;display:flex;align-items:center;justify-content:space-between;gap:15px;border-radius:18px;padding:15px 18px;margin:24px 0 0;background:var(--paper);box-shadow:0 4px 30px #283b3220;border:1px solid var(--line);z-index:5}.join-bar span{font-size:13px}.notice{font-size:12px;background:#eeeadc;border-radius:12px;padding:12px;line-height:1.7;margin:16px 0}.room-top{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:18px}.room-top h1{font-size:27px;margin:0 0 5px}.room-top small{font-size:12px}.room-actions{display:flex;gap:8px;flex-wrap:wrap}.phase-bar{padding:15px 18px;background:var(--green);color:#fff;display:flex;align-items:center;justify-content:space-between;border-radius:18px;margin-bottom:16px;gap:15px}.phase-bar strong{display:block;font-size:18px}.phase-bar small{color:#d5e1d2;display:block;font-size:12px;margin-top:4px}.clock{font-size:25px;font-variant-numeric:tabular-nums;font-weight:700;white-space:nowrap}.play-layout{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(280px,1fr);gap:20px;align-items:start}.village-panel,.chat-panel,.panel{background:var(--paper);border-radius:22px;border:1px solid var(--line);overflow:hidden}.map-label{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;gap:10px}.map-label small{font-size:11px}.map{position:relative;width:100%;aspect-ratio:1/1.12;overflow:hidden;background:#bfd095;transition:background 1s}.map.night{background:#839b80}.map-background{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.map.night .map-background{filter:brightness(.7) saturate(.7)}.map .house{position:absolute;width:25%;height:23%;transform:translate(-50%,-50%);padding:0;min-height:0;border-radius:0;background:transparent;display:flex;flex-direction:column;align-items:center;filter:drop-shadow(0 4px 2px #33442122)}.house .roof{width:82%;height:58%;display:block;overflow:visible}.house .roof .door{transform-origin:50% 90%;transition:transform .4s;transform-box:fill-box}.house.speaking .roof .door{transform:scaleX(.18)}.house .resident{position:absolute;top:35%;height:31%;aspect-ratio:1;border-radius:50%;object-fit:cover;border:3px solid #fff7e8;box-shadow:0 2px 5px #34433444;transition:transform .4s}.house.speaking .resident{transform:translateY(15px) rotate(-7deg)}.house .house-name{max-width:100%;font-size:clamp(11px,2.8vw,14px);padding:5px 9px;background:#fff4d7;border:1px solid #d9b984;border-radius:7px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;box-shadow:0 2px 2px #43543a18;position:absolute;top:68%}.house .house-state{position:absolute;top:91%;font-size:10px;border-radius:5px;padding:2px 6px;background:#e4eadc;white-space:nowrap}.house.out .roof{filter:grayscale(.8);opacity:.65}.house.out .house-state{background:#655b50;color:#fff}.house.eligible .house-name{outline:2px solid #315c48;outline-offset:3px}.house.offline .resident{border-style:dashed}.scene{position:absolute;left:10%;right:10%;top:39%;z-index:4;background:#fff8ebee;box-shadow:0 4px 30px #24382024;border:2px solid #e0c596;border-radius:17px;text-align:center;padding:20px;pointer-events:none;animation:scene-in .5s ease}.scene strong{display:block;font-size:18px;margin-bottom:7px}.scene p{font-size:13px;margin:0}.map-foot{padding:14px 18px;font-size:13px;line-height:1.6}.map-foot p{margin:0}.command-strip{display:flex;gap:8px;margin-top:12px;flex-wrap:wrap}.panel{padding:18px;margin-top:16px}.panel h3{margin-bottom:12px}.role-counts{display:grid;grid-template-columns:repeat(5,1fr);gap:8px}.role-counts label{font-size:11px;text-align:center}.role-counts input{text-align:center;padding:8px}.host-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.check-label{display:flex;gap:8px;align-items:center;margin:16px 0;font-size:12px}.check-label input{width:20px;min-height:20px;margin:0}.chat-panel{position:sticky;top:12px}.chat-title{padding:17px 18px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between}.chat-title h2{font-size:16px;margin:0}.chat-title small{font-size:11px}.chat-messages{height:430px;overflow:auto;padding:14px;overscroll-behavior:contain}.message{display:flex;gap:8px;margin:0 0 16px;align-items:flex-start}.message img{height:30px;width:30px;border-radius:50%;object-fit:cover}.message-body{min-width:0;flex:1}.message strong{font-size:12px}.message time{font-size:10px;color:#7c837b;margin-left:5px}.message .dead-label{font-size:10px;background:#ece5df;border-radius:4px;padding:2px 4px;margin-left:5px}.message p{font-size:13px;margin:5px 0 0;overflow-wrap:anywhere;white-space:pre-wrap}.system-message{background:#f0eee3;border-radius:10px;padding:10px;margin-bottom:12px;font-size:11px;color:#667260;line-height:1.7}.chat-form{padding:12px;border-top:1px solid var(--line);display:flex;gap:8px}.chat-form input{min-width:0;font-size:13px}.chat-form button{padding:8px 14px}.chat-help{padding:0 14px 12px;display:block;font-size:10px}.naming-form{display:flex;gap:8px;margin-top:12px}.naming-form input{min-width:0}.result-list{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}.result-list>div{background:#f0f2e9;padding:10px;border-radius:10px;font-size:13px}.result-list strong{display:block}.mobile-shortcuts{display:none}.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);padding:12px 18px;border-radius:12px;background:#273e32;color:#fff;z-index:30;max-width:min(90vw,500px);font-size:13px;box-shadow:0 3px 12px #0002;pointer-events:none;opacity:0;transition:opacity .2s}.toast.visible{opacity:1}dialog{width:min(92vw,450px);border:1px solid #d7d9c9;border-radius:22px;background:var(--paper);padding:28px;color:var(--ink);max-height:85dvh;overflow:auto}dialog::backdrop{background:#213c3266;backdrop-filter:blur(3px)}dialog .close{position:absolute;top:10px;right:10px;font-size:23px;padding:0;width:40px;min-height:40px;background:transparent}dialog h2{padding-right:20px;margin-bottom:18px}dialog p{font-size:14px}dialog form{display:grid;gap:16px}.card-portrait{height:140px;width:140px;object-fit:cover;border-radius:20px;display:block;margin:0 auto 20px}.card-status{font-size:15px!important;white-space:pre-wrap;overflow-wrap:anywhere;background:#f0efdf;border-radius:12px;padding:14px}.card-meta{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}.dialog-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:18px}.private-role{border-radius:18px;background:#e8ecde;padding:24px;text-align:center;margin-bottom:18px}.private-role strong{font-size:28px;display:block;margin-bottom:10px}.private-role p{margin:0;font-size:13px}.checks{font-size:13px;line-height:1.8}.offline-banner{background:#f6e2c1;border-radius:10px;padding:12px;margin-bottom:16px;font-size:12px;line-height:1.6}details summary{cursor:pointer;font-size:13px;min-height:44px;display:flex;align-items:center}.empty-chat{font-size:12px;color:#778275;text-align:center;margin:30px 0}.section-note{font-size:12px;color:#667564;margin:12px 0 0}.inline-form{display:flex;gap:8px}.inline-form input{min-width:0}.hidden{display:none!important}@keyframes scene-in{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
@media(min-width:1000px){.house .house-name{font-size:14px}}
@media(max-width:700px){.topbar{padding:14px 16px}.wordmark{font-size:16px}.connection{font-size:10px}main{padding:18px 14px 90px}.intro{grid-template-columns:1fr;gap:0;margin-top:6px}.intro-art{display:none}.intro h1{margin-bottom:14px}.intro p{font-size:14px}.select-toolbar{align-items:flex-start;flex-direction:column;gap:12px}.select-toolbar input{max-width:none}.cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.profile-card{padding:12px}.join-bar{bottom:76px;padding:12px;gap:8px}.join-bar button{font-size:13px;padding:10px 14px}.room-top{align-items:flex-start}.room-top h1{font-size:23px}.room-actions button{font-size:12px;padding:8px 10px}.room-actions{max-width:155px;justify-content:flex-end}.play-layout{grid-template-columns:1fr;gap:16px}.phase-bar{padding:14px;margin-bottom:14px}.phase-bar strong{font-size:17px}.phase-bar small{font-size:11px}.clock{font-size:22px}.chat-panel{position:static}.chat-messages{height:260px}.map-label{padding:12px}.map-label strong{font-size:14px}.map-foot{padding:12px;font-size:12px}.map .house{height:23%}.house .house-name{padding:4px 6px}.house .house-state{top:92%;font-size:9px}.scene{padding:14px;left:6%;right:6%}.scene strong{font-size:16px}.scene p{font-size:12px}.panel{padding:14px}.role-counts{gap:5px}.role-counts label{font-size:10px}.role-counts input{padding:8px 2px}.mobile-shortcuts{display:flex;position:fixed;bottom:0;left:0;right:0;padding:8px 14px max(8px,env(safe-area-inset-bottom));gap:8px;background:#fffdf6f5;border-top:1px solid var(--line);z-index:10;backdrop-filter:blur(10px)}.mobile-shortcuts button{flex:1;font-size:12px}.toast{bottom:85px}.result-list{grid-template-columns:1fr 1fr}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
.topbar{flex-wrap:wrap}.wordmark{flex:1;min-width:130px}.topbar-actions{display:flex;align-items:center;gap:10px}.role-guide-trigger{font-size:12px;padding:8px 12px;background:#e5eadb;border:1px solid #cbd5bc}.role-guide-link{display:block;margin-top:16px;width:100%}.guide-intro{font-size:13px!important;color:var(--muted)}.role-guide-list{display:grid;gap:14px}.guide-role{border:1px solid var(--line);background:#f7f7ed;border-radius:15px;padding:16px}.guide-role header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}.guide-role h3{font-size:20px;margin:0 0 3px}.guide-role header small{font-size:11px}.guide-count{font-size:12px;white-space:nowrap;background:#e3ead9;padding:6px 9px;border-radius:7px}.guide-faction{font-size:11px;font-weight:600;color:#3d6248}.guide-summary{font-size:13px!important;margin:10px 0 14px}.guide-role dl{margin:0}.guide-role dt{font-size:12px;font-weight:700;margin-top:12px}.guide-role dd{margin:4px 0 0;font-size:12px;line-height:1.8;color:#566352}.guide-footnote{font-size:11px!important;color:var(--muted);margin:18px 0 0}
@media(max-width:700px){.topbar-actions{gap:6px}.role-guide-trigger{padding:8px 10px;font-size:11px}.wordmark{font-size:15px}}

/* The room is a single viewport. Only chat history and opened dialogs scroll. */
body.in-room{height:100vh;height:var(--app-height,100dvh);display:flex;flex-direction:column;overflow:hidden}
.in-room .topbar{flex:0 0 auto;width:100%;padding:7px 16px;flex-wrap:nowrap;gap:10px}
.in-room .wordmark{font-size:14px;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.in-room .wordmark small{display:none}
.in-room .topbar-actions{flex-shrink:0;gap:6px}
.in-room .connection{font-size:10px;padding:6px 8px}
.in-room #app{flex:1;min-height:0;width:100%;display:flex;flex-direction:column;padding:10px 14px max(8px,env(safe-area-inset-bottom));position:relative}
.in-room .room-top{flex-shrink:0;gap:10px;margin-bottom:8px;align-items:center}
.in-room .room-heading{min-width:0;flex:1}
.in-room .room-top h1{font-size:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:2px}
.in-room .room-top small{font-size:11px;white-space:nowrap;display:block;overflow:hidden;text-overflow:ellipsis}
.in-room .room-actions{flex-shrink:0;max-width:none;flex-wrap:nowrap;gap:6px}
.in-room .room-actions button{font-size:11px;padding:8px 10px}
.in-room .phase-bar{flex-shrink:0;margin-bottom:10px;border-radius:13px;padding:10px 14px;gap:8px}
.in-room .phase-bar strong{font-size:16px}
.in-room .phase-bar small{font-size:11px;margin-top:3px}
.in-room .clock{font-size:22px}
.in-room .play-layout{flex:1;min-height:0;align-items:stretch;gap:16px}
.in-room .village-stack{min-height:0;display:flex;flex-direction:column}
.in-room .village-panel{flex:1;min-height:0;display:flex;flex-direction:column;border-radius:18px}
.in-room .map-label{flex-shrink:0;padding:9px 12px;min-height:32px}
.in-room .map-label strong{font-size:13px}
.in-room .map-label small{font-size:10px}
.in-room .map{flex:1;min-height:0;height:0;aspect-ratio:auto!important}
.in-room .house{min-height:44px}
.in-room .house .house-name{font-size:12px;padding:3px 6px;top:67%}
.in-room .house .house-state{font-size:9px;top:90%;padding:1px 5px}
.in-room .house .resident{min-height:20px;border-width:2px}
.in-room .map-foot{flex-shrink:0;padding:7px 12px;font-size:11px;line-height:1.5;border-top:1px solid #a9bb8766}
.in-room #action-hint{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.in-room .naming-form{margin-top:7px}
.in-room .naming-form input{font-size:16px}
.in-room .chat-panel{min-height:0;display:flex;flex-direction:column;position:static;border-radius:18px}
.in-room .chat-title{flex-shrink:0;padding:10px 12px;gap:8px}
.in-room .chat-title h2{font-size:14px}
.in-room .chat-title small{font-size:10px}
.in-room .chat-messages{flex:1;min-height:0;height:auto;padding:10px 12px;overflow:auto;scrollbar-gutter:stable}
.in-room .message{margin-bottom:12px}
.in-room .message p{font-size:13px;margin-top:3px;line-height:1.6}
.in-room .system-message{padding:8px;font-size:11px;margin-bottom:9px}
.in-room .chat-form{flex-shrink:0;padding:8px;gap:6px;background:var(--paper)}
.in-room .chat-form input{font-size:16px;min-height:44px;padding:9px 10px}
.in-room .chat-form button{min-height:44px;padding:8px 12px}
.room-bottom{flex-shrink:0;display:flex;gap:8px;padding-top:8px}
.room-bottom button{flex:1;min-width:0;font-size:12px;padding:9px 10px;min-height:44px}
.in-room .offline-banner{position:absolute;top:122px;left:14px;right:14px;z-index:6;box-shadow:0 3px 10px #273e3220}
.in-room .toast{bottom:66px}
#controls-dock .panel{margin:0 0 12px;padding:14px;border-radius:14px}
#controls-dock .role-counts{gap:5px}
#controls-dock .role-counts label{font-size:10px}
@media(max-width:700px){
  .in-room .play-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) clamp(180px,30dvh,250px);gap:0}
  .in-room .village-panel{border-radius:18px 18px 0 0;border-bottom:0}
  .in-room .chat-panel{border-radius:0 0 18px 18px}
  .in-room .chat-title{padding:7px 12px;min-height:30px}
  .in-room .map .house-name{font-size:11px}
  .room-bottom button{font-size:11px;padding:8px 5px}
}
@media(max-width:700px) and (max-height:720px){
  .in-room .phase-bar small{display:none}
  .in-room .phase-bar{padding:8px 12px;margin-bottom:7px}
  .in-room .map-label{padding:5px 10px;min-height:26px}
  .in-room .map-foot{padding:5px 10px}
  .in-room .play-layout{grid-template-rows:minmax(0,1fr) 180px}
}
@media(max-width:700px) and (max-height:500px){
  .in-room .topbar{display:none}
  .in-room .room-top{display:none}
  .in-room .map-label,.in-room .map-foot{display:none}
  .in-room .phase-bar{padding:7px 12px;margin-bottom:5px}
  .in-room .play-layout{grid-template-rows:minmax(70px,1fr) minmax(130px,1.7fr)}
  .in-room .room-bottom{padding-top:5px}
}
.in-room.keyboard-open .room-top{display:none}
.in-room.keyboard-open .map-label,.in-room.keyboard-open .phase-bar small{display:none}
.in-room.keyboard-open .map .house{min-height:0;height:20px!important;pointer-events:none;filter:none}
.in-room.keyboard-open .map .roof,.in-room.keyboard-open .map .house-name,.in-room.keyboard-open .map .house-state{display:none}
.in-room.keyboard-open .map .resident{height:20px;min-height:20px;top:0;border-width:1px}
.in-room.keyboard-open .map::after{content:'แผนที่ย่อ · ปิดคีย์บอร์ดเพื่อเลือกบ้าน';position:absolute;bottom:3px;right:5px;font-size:10px;background:#fff9e8e8;border-radius:5px;padding:3px 6px;color:var(--ink);pointer-events:none}
@media(max-width:700px) and (max-height:640px){
  .in-room:not(.keyboard-open) .topbar{display:none}
  .in-room:not(.keyboard-open) .map-label{display:none}
  .in-room:not(.keyboard-open) .map-foot{padding:0;border-top:0}
  .in-room:not(.keyboard-open) #action-hint{display:none}
  .in-room:not(.keyboard-open) .naming-form{padding:6px;margin:0}
  .in-room:not(.keyboard-open) .play-layout{grid-template-rows:minmax(0,1fr) 150px}
}
.guide-nav{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:16px}.guide-nav button{font-size:12px}.role-art{display:block;width:100%;aspect-ratio:1;object-fit:cover;border-radius:12px;margin-bottom:16px;background:#dce4d0}.private-art{max-width:280px;margin:0 auto 16px}.reference-role{border:1px solid var(--line);border-radius:12px;padding:14px;margin-top:12px}.reference-role h3{margin:0 0 6px}.reference-role h3 small{display:inline-block;font-size:10px;border-radius:6px;background:#e8ecde;padding:4px 7px}.reference-role p{font-size:13px;margin:8px 0}.reference-role>small{display:block;font-size:11px;line-height:1.6}.ranking-list{display:grid;gap:9px}.ranking-row{display:flex;width:100%;align-items:center;gap:12px;text-align:left;padding:12px}.ranking-row img{width:48px;height:48px;border-radius:12px;object-fit:cover}.ranking-row small{display:block;font-size:11px;margin-top:5px;font-weight:400}.rank-number{font-size:21px;min-width:23px}.stats-summary{border-radius:14px;background:#e8ecde;padding:18px;margin:14px 0}.stats-summary p{font-size:13px;margin:8px 0 0}.match-history{padding:14px 0;border-bottom:1px solid var(--line)}.match-history p{font-size:12px;margin:5px 0}.match-history small{font-size:11px}.stats-empty{padding:25px 12px;background:#eef0e4;border-radius:12px;font-size:14px}.dice-stage{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:min(85%,280px);background:#fff9eaf2;border:1px solid #d9bc83;box-shadow:0 8px 24px #37493230;border-radius:18px;padding:14px;text-align:center;z-index:3}.dice-stage strong{font-size:15px;display:block}.dice-stage small{font-size:11px;display:block;line-height:1.5}.dice-pair{font-size:45px;color:#996a36;line-height:1.3;margin:8px 0}.dice-stage button{font-size:12px}.dice-result{position:absolute;bottom:3px;left:50%;transform:translateX(-50%);z-index:2;min-height:44px;max-width:95%;white-space:nowrap;font-size:11px;padding:6px 9px;background:#fff5d9e8;box-shadow:0 2px 9px #283e2520}.keyboard-open .dice-stage,.keyboard-open .dice-result{display:none}@media(prefers-reduced-motion:no-preference){.dice-stage .dice-pair{animation:dice-wiggle .7s ease-in-out infinite alternate}}@keyframes dice-wiggle{from{transform:rotate(-6deg)}to{transform:rotate(6deg)}}
.card-portrait.role-portrait{width:140px;height:210px;object-fit:contain;border-radius:8px}
.pdf-card{width:min(100%,180px);height:auto;aspect-ratio:auto;object-fit:contain;margin:0 auto 16px;background:#151715;border-radius:8px}.game-setup{border:0;padding:0}.setup-count{background:#eaf0e3;border-radius:12px;padding:12px;font-size:13px;font-weight:600}.deck-preview{display:grid;grid-template-columns:repeat(auto-fit,minmax(72px,1fr));gap:8px;margin:16px 0}.deck-card{background:#f2f0e3;border:1px solid var(--line);border-radius:12px;text-align:center;padding:9px 6px;min-width:0}.deck-card img{display:block;width:62px;height:93px;max-width:100%;object-fit:contain;margin:0 auto 7px;border-radius:5px;background:#182019}.deck-card span{display:block;font-size:11px;line-height:1.5;overflow-wrap:anywhere}.deck-card strong{display:block;font-size:14px;margin-top:4px}.setup-role-counts{display:grid;grid-template-columns:1fr;gap:8px;margin:0 0 12px}.setup-role-counts label,.setup-role-counts .role-step{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:13px}
.role-step-name{font-size:14px;font-weight:600;min-width:0;overflow-wrap:anywhere}
.stepper{display:flex;align-items:center;gap:6px;flex:none}
.stepper .step{width:44px;min-width:44px;height:44px;min-height:44px;padding:0;border-radius:12px;font-size:22px;line-height:1}
.stepper input{width:64px;max-width:64px}.setup-role-counts input{max-width:90px;margin:0;text-align:center;font-size:16px;padding:10px}.setup-option-note{display:block;margin:0 0 10px 26px;font-size:11px;line-height:1.6}.setup-advanced{border-block:1px solid var(--line);margin:14px 0}.setup-advanced small{display:block;padding-bottom:14px;line-height:1.7}.setup-readiness{font-size:12px;padding:12px;background:#f4e8d0;border-radius:10px;line-height:1.7;margin:14px 0 0}.setup-readiness.ready{background:#e4eddc;color:#315c48}.setup-actions{display:grid;grid-template-columns:1fr 1fr}.setup-actions #start-game{grid-column:1/-1;grid-row:1;font-size:16px}.setup-actions button{font-size:12px}.game-setup #mode-description{line-height:1.6}.game-setup select{font-size:16px}@media(max-width:360px){.deck-preview{grid-template-columns:repeat(3,minmax(0,1fr))}}
.game-setup{overflow:visible}.game-setup form#role-form{gap:8px}.game-setup #mode-description{margin:0}.game-setup .deck-preview{margin:8px 0}.game-setup .check-label{margin:8px 0 0}.game-setup .setup-option-note{margin:0 0 6px 26px}.game-setup .setup-advanced{margin:6px 0}.game-setup #deck-warning{margin-top:0}.game-setup .setup-actions{position:sticky;bottom:-20px;z-index:2;background:var(--paper);padding:10px 0;box-shadow:0 -8px 12px var(--paper)}
.host-setting-links{display:grid;grid-template-columns:1fr 1fr;gap:8px}.host-setting-links button{font-size:12px;min-height:44px;padding:10px 6px}.host-menu{display:grid;gap:10px}.host-menu button{text-align:left;min-height:62px;font-size:14px}.host-menu small{display:block;font-size:11px;font-weight:400;margin-top:5px}.host-settings-form{gap:12px}.host-settings-form label{font-size:13px}.host-settings-form input:not([type=checkbox]),.host-settings-form select,.host-settings-form textarea{font-size:16px;min-width:0;width:100%;max-width:100%}.host-settings-form small{display:block;line-height:1.7;font-size:11px}.rule-section{padding:12px;background:#edf0e2;border-radius:12px}.rule-section .check-label{margin:0 0 8px}.timer-settings{display:grid;grid-template-columns:1fr 1fr;gap:10px}.dice-setting-row{border:1px solid var(--line);border-radius:12px;padding:12px;margin:10px 0}.dice-setting-row input{margin:8px 0}.dice-setting-row details{margin-top:8px}.dice-setting-row summary{font-size:12px}.settings-save{position:sticky;bottom:-20px;display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:12px 0;background:var(--paper);box-shadow:0 -8px 12px var(--paper);z-index:3}.settings-save button{min-height:44px;font-size:13px;padding:10px 8px}.event-effect{padding:12px;background:#eef0e3;border-radius:10px;font-size:13px;line-height:1.7}.roster-row{display:flex;align-items:center;gap:10px;border:1px solid var(--line);padding:10px;margin:6px 0;border-radius:12px;min-height:64px}.roster-row input[type=checkbox]{width:22px;height:22px;flex-shrink:0;margin:0}.roster-row img{width:40px;height:40px;object-fit:cover;border-radius:10px}.roster-row span{min-width:0}.roster-row small{font-weight:400;font-size:11px}.house.waiting .house-state{background:#f1ebd4;color:#645337}.public-role{background:#e7eddc;border-radius:10px;padding:12px}
.host-settings-form details>summary{display:flex;align-items:center;justify-content:space-between;gap:10px;border:1px solid var(--line);border-radius:10px;padding:12px;font-size:13px;min-height:44px;list-style:none}.host-settings-form details>summary::after{content:'⌄';font-size:20px;line-height:1}.host-settings-form details[open]>summary::after{content:'⌃'}.host-settings-form details>summary::-webkit-details-marker{display:none}.host-settings-form details[open]>.timer-settings{margin-top:12px}
.hunter-stage{position:absolute;left:50%;bottom:4%;transform:translateX(-50%);z-index:4;max-width:90%;width:250px;background:#fff9eaf2;border:1px solid #d9bc83;border-radius:16px;padding:12px;text-align:center;box-shadow:0 3px 12px #37493220}.hunter-stage strong,.hunter-stage small{display:block}.hunter-stage p{margin:5px 0;font-size:11px}.hunter-stage small{font-size:12px}.hunter-stage button{min-height:44px;font-size:12px;padding:8px 16px}.cursed-state{padding:12px;border-radius:10px;background:#e8ddd1;font-size:13px;line-height:1.7}.keyboard-open .hunter-stage{display:none}
.shot-actions{display:flex;gap:6px;justify-content:center}.hunter-stage .shot-actions button{padding:8px 10px}.shot-targets{display:grid;gap:8px}.shot-targets button{display:flex;align-items:center;gap:10px;text-align:left;min-height:56px}.shot-targets img{width:36px;height:36px;border-radius:10px;object-fit:cover}

.open-rooms{background:var(--paper);border:2px solid var(--line);border-radius:18px;padding:16px;margin:0 0 20px;box-shadow:0 2px 8px #26352708}
.open-rooms[hidden]{display:none}
.open-rooms h2{margin:0 0 12px;font-size:18px}
.room-list{display:grid;gap:10px}
.room-item{display:grid;grid-template-columns:1fr auto;align-items:center;gap:8px 12px;text-decoration:none;color:var(--ink);background:#fff;border:2px solid transparent;border-radius:14px;padding:12px 14px;box-shadow:0 1px 4px #2635270d}
.room-item:hover,.room-item:focus-visible{border-color:var(--green)}
.room-main{display:flex;flex-direction:column;gap:2px;min-width:0;grid-column:1/-1}
.room-main strong{overflow-wrap:anywhere}
.room-meta{font-size:12px;color:var(--muted)}
.room-state{justify-self:start;font-size:12px;border-radius:999px;padding:4px 10px;background:#eeeadc;white-space:nowrap}
.room-state.open{background:#dcebd6;color:var(--green)}
.room-go{justify-self:end;font-weight:700;color:var(--green);white-space:nowrap}

.host-quick{flex-shrink:0;display:flex;gap:8px;margin:-6px 0 14px}
.host-quick button{flex:1;min-width:0;min-height:40px;padding:6px 10px;font-size:13px}
.pending-names{font-weight:700;background:#fbeed6;border-radius:12px;padding:10px 12px;line-height:1.6;overflow-wrap:anywhere}
body.keyboard-open .host-quick{display:none}
.event-cards{display:grid;gap:8px;margin:12px 0}
.event-card{display:flex;flex-direction:column;align-items:flex-start;gap:2px;text-align:left;padding:12px 14px;border-radius:14px;background:#fff;border:2px solid var(--line)}
.event-card:hover:not(:disabled),.event-card:focus-visible{border-color:var(--green)}
.event-card small{font-weight:400;color:var(--muted);line-height:1.5}
.event-card:disabled{opacity:.55;cursor:not-allowed}
.event-custom{margin:6px 0 10px}
.event-custom summary{cursor:pointer;font-size:13px;color:var(--muted);padding:6px 0}

.announce{position:fixed;top:16%;left:50%;right:auto;bottom:auto;margin:0;transform:translateX(-50%);z-index:40;display:flex;align-items:center;gap:14px;width:max-content;max-width:min(92vw,440px);padding:16px 22px;border:0;border-radius:20px;color:#fff;background:#315c48;box-shadow:0 10px 40px #0005;pointer-events:none;overflow:visible}
.announce:not(.show){display:none}
.announce.show{animation:announce-in var(--ms,2800ms) ease both}
.announce-icon{font-size:36px;line-height:1}
.announce strong{display:block;font-size:20px;line-height:1.3}
.announce small{display:block;margin-top:2px;font-size:13px;line-height:1.5;color:#fff;opacity:.95}
.announce.night{background:linear-gradient(135deg,#1b2850,#3b2f66)}
.announce.morning{background:linear-gradient(135deg,#a85d0c,#a63e27)}
.announce.start{background:linear-gradient(135deg,#2b5a44,#3d7a56)}
.announce.vote{background:linear-gradient(135deg,#8a4a38,#b0583c)}
.announce.paused{background:#585f66}
.announce.lobby{background:#6b6a55}
.announce.prompt-wolf{background:linear-gradient(135deg,#45191f,#992d2d)}
.announce.prompt-seer{background:linear-gradient(135deg,#372864,#6c50b8)}
.announce.prompt-guard{background:linear-gradient(135deg,#1c4a78,#2d6dad)}
.announce.prompt-vote{background:linear-gradient(135deg,#7d4630,#a6502d)}
.announce.prompt-hunt{background:linear-gradient(135deg,#4c3b1e,#95641d)}
@keyframes announce-in{0%{opacity:0;transform:translate(-50%,-16px) scale(.92)}10%{opacity:1;transform:translate(-50%,0) scale(1)}88%{opacity:1;transform:translate(-50%,0) scale(1)}100%{opacity:0;transform:translate(-50%,-6px) scale(.98)}}
.fx-layer{position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:5}
.fx{position:absolute;transform:translate(-50%,-50%);pointer-events:none}
.fx-claw svg,.fx-shot svg{width:100%;height:100%;overflow:visible}
.fx-claw path{fill:none;stroke:#c1212f;stroke-width:7;stroke-linecap:round;stroke-dasharray:100;stroke-dashoffset:100;filter:drop-shadow(0 0 4px #ff3b3b);animation:claw-slash .35s ease-out forwards}
.fx-claw path:nth-child(2){animation-delay:.12s}.fx-claw path:nth-child(3){animation-delay:.24s}
.fx-claw{animation:fx-fade 2.6s ease-out forwards}
.fx-claw::before{content:"";position:absolute;inset:0;border-radius:50%;background:radial-gradient(circle,#ff2a2a55,#ff2a2a00 70%);animation:claw-flash .5s ease-out}
.fx-shot svg{fill:none;stroke:#b3261e;stroke-width:5;stroke-linecap:round;animation:shot-in .45s ease-out both}
.fx-shot svg circle:last-of-type{fill:#b3261e}
.fx-shot{animation:fx-fade 2.4s ease-out forwards}
.fx-vote{display:flex;align-items:center;justify-content:center;animation:fx-fade 2.6s ease-out forwards}
.fx-vote b{border:4px solid #b3261e;color:#b3261e;background:#fff8f0cc;border-radius:10px;padding:2px 12px;font-size:clamp(16px,4.5vw,24px);white-space:nowrap;animation:stamp .45s cubic-bezier(.2,1.6,.4,1) both}
.fx-calm{inset:0;left:0;top:0;width:100%;height:100%;transform:none;background:radial-gradient(circle at 50% 45%,#fff3b8aa,#fff3b800 62%);display:flex;align-items:center;justify-content:space-around;font-size:clamp(22px,6vw,38px);animation:fx-fade 2.6s ease-out forwards}
.house.hit{animation:house-hit .7s}
.house .house-x{position:absolute;left:9%;top:0;width:82%;height:58%;overflow:visible;pointer-events:none;z-index:2}
.house .house-x path{fill:none;stroke:#b3261e;stroke-width:10;stroke-linecap:round;filter:drop-shadow(0 1px 1px #fff9)}
.house .house-x.fresh path{stroke-dasharray:100;stroke-dashoffset:100;animation:x-draw .26s ease-out forwards}
.house .house-x.fresh path:nth-child(2){animation-delay:.26s}
@keyframes x-draw{to{stroke-dashoffset:0}}
.fx-spare{display:flex;align-items:center;justify-content:center;animation:fx-fade 2.6s ease-out forwards}
.fx-spare b{border:4px solid #2c6a45;color:#2c6a45;background:#f2fff4cc;border-radius:10px;padding:2px 12px;font-size:clamp(15px,4.2vw,22px);white-space:nowrap;animation:stamp .45s cubic-bezier(.2,1.6,.4,1) both}
.house.condemned .house-name{outline:3px solid #b3261e;outline-offset:3px}
.house.condemned::after{content:"⚖️";position:absolute;top:-4px;right:2px;font-size:18px;filter:drop-shadow(0 1px 1px #0003)}
.verdict-bar{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;padding:10px 14px;background:#fff1e0;border-top:1px solid #e6c9a3}
.verdict-bar[hidden]{display:none}
.seer-bar{display:flex;flex-wrap:wrap;align-items:center;gap:5px 6px;flex-shrink:0;margin:0 0 8px;font-size:12.5px}
.seer-bar[hidden]{display:none}
.seer-bar strong{font-size:13px;margin-right:2px}
.seer-bar .check{padding:3px 10px;border-radius:999px;background:#e3efe2;color:#25573a;border:1px solid #bcd6bb}
.seer-bar .check.wolf{background:#f9dcd9;color:#8f1f17;border-color:#e3a7a2;font-weight:700}
.verdict-bar strong{font-size:15px;flex:1 1 100%}
.verdict-bar small{color:#6b5a45;flex:1 1 100%}
.verdict-buttons,.verdict-dialog .dialog-actions{display:flex;gap:10px;flex:1 1 100%}
.verdict-buttons button,.verdict-dialog .dialog-actions button{flex:1;min-height:46px;font-size:16px}
.verdict-dialog{text-align:center}
.abstain-link{margin-top:10px;background:none;border:0;color:#6b5a45;text-decoration:underline;font-size:14px;min-height:36px;cursor:pointer}
.verdict-buttons [data-verdict="abstain"]{flex:0 1 auto;min-width:96px;font-size:14px}
.verdict-bar [data-abstain]{min-height:44px;font-size:15px}
.chat-tabs{display:flex;gap:6px;padding:0 14px 8px;flex-shrink:0}
.chat-tabs[hidden]{display:none}
.chat-tab{position:relative;min-height:44px;padding:4px 12px;font-size:13px;border-radius:999px;border:1px solid #d6cdb4;background:#efe9d6;color:#4b4632;cursor:pointer}
.chat-tab.active{background:var(--green);border-color:var(--green);color:#fff}
.tab-dot{position:absolute;top:2px;right:2px;width:10px;height:10px;border-radius:50%;background:#d6342a;border:2px solid #fff}
.tab-dot[hidden]{display:none}
.chat-panel.wolf-chat{background:#2a2226}
.chat-panel.wolf-chat .chat-title h2,.chat-panel.wolf-chat .empty-chat{color:#f2dcd6}
.chat-panel.wolf-chat .chat-messages{background:#352a2f}
.chat-panel.wolf-chat .message-body p{color:#f4eae6}
.chat-panel.wolf-chat .message-body strong{color:#ffc9bf}
.chat-panel.wolf-chat .message-body time{color:#c9b3ad}
.announce{padding:12px 56px 12px 16px;gap:12px}
.announce-icon{font-size:30px}
.announce strong{font-size:18px}
.announce small{font-size:12.5px}
.announce-close{pointer-events:auto;position:absolute;top:8px;right:8px;width:38px;height:38px;min-height:0;padding:0;border-radius:50%;background:#fff;color:#2a2a2a;font-size:17px;line-height:1;box-shadow:0 2px 8px #0003;display:flex;align-items:center;justify-content:center}
.scene{padding-top:18px}
.scene-close{pointer-events:auto;position:absolute;top:6px;right:6px;width:36px;height:36px;min-height:0;padding:0;border-radius:50%;background:#efe2c5;color:#4b3b1b;font-size:15px;line-height:1}
.hunter-stage .stage-close{position:absolute;top:0;right:0;width:44px;height:44px;min-height:0;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;font-size:16px;line-height:1;box-shadow:none}
.hunter-stage-tab{position:absolute;right:8px;bottom:8px;z-index:4;white-space:nowrap;min-height:44px;padding:8px 16px;border:1px solid #d9bc83;border-radius:999px;background:#fff9eaf2;color:#293c32;font-size:13px;font-weight:600;box-shadow:0 3px 12px #37493220}
.dice-stage{top:auto;bottom:6px;transform:translateX(-50%);width:max-content;max-width:92%;padding:4px 10px;border-radius:999px;pointer-events:none;display:flex;flex-wrap:nowrap;align-items:center;justify-content:center;column-gap:8px}
.dice-stage strong{display:none}
.dice-pair{font-size:22px;margin:0;line-height:1.1}
.dice-stage button{pointer-events:auto;min-height:34px;padding:5px 12px;font-size:12px}
.dice-stage small{font-size:11px;line-height:1.3}
.verdict-person{display:flex;flex-direction:column;align-items:center;gap:6px;margin:6px 0 10px}
.verdict-person img{width:72px;height:72px;border-radius:50%;object-fit:cover;border:3px solid #b3261e}
.verdict-clock{margin:10px 0 0;color:#6b5a45}
.name-dialog{text-align:center}
.name-dialog input{width:100%;box-sizing:border-box;font-size:18px;padding:14px;margin:8px 0 12px;border-radius:12px;border:2px solid #cdb98f;background:#fffdf6}
.name-dialog .dialog-actions button{width:100%;min-height:48px;font-size:17px}
.phase-right{display:flex;align-items:center;gap:8px;flex-shrink:0}
.phase-bar .sound-toggle{min-width:34px;min-height:34px;width:34px;height:34px;padding:0;border:0;border-radius:50%;background:#ffffff26;color:#fff;font-size:16px;line-height:1;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
@keyframes claw-slash{to{stroke-dashoffset:0}}
@keyframes claw-flash{from{opacity:1;transform:scale(.6)}to{opacity:0;transform:scale(1.3)}}
@keyframes shot-in{from{opacity:0;transform:scale(2.2)}to{opacity:1;transform:scale(1)}}
@keyframes stamp{from{opacity:0;transform:rotate(-14deg) scale(2.4)}to{opacity:1;transform:rotate(-14deg) scale(1)}}
@keyframes fx-fade{0%,70%{opacity:1}100%{opacity:0}}
@keyframes house-hit{0%,100%{transform:translate(-50%,-50%)}15%{transform:translate(calc(-50% - 5px),-50%)}35%{transform:translate(calc(-50% + 5px),-50%)}55%{transform:translate(calc(-50% - 3px),-50%)}75%{transform:translate(calc(-50% + 3px),-50%)}}
.mark{position:absolute;inset:-4% -8%;z-index:3;display:flex;align-items:center;justify-content:center;border-radius:50%;pointer-events:none;font-size:clamp(20px,5vw,30px)}
.mark::after{filter:drop-shadow(0 1px 2px #0006)}
.mark-guard{background:radial-gradient(circle,#8ccaff22,#4aa8ff66 62%,#4aa8ff00 72%);border:3px solid #6ab6ff;box-shadow:0 0 18px #4aa8ff;animation:mark-pulse 1.6s ease-in-out infinite}
.mark-guard::after{content:"🛡️"}
.mark-bite{background:radial-gradient(circle,#ff2a2a22,#ff2a2a55 62%,#ff2a2a00 72%);border:3px dashed #c1212f;animation:mark-pulse 1.6s ease-in-out infinite}
.mark-bite::after{content:"🐾"}
.mark-seer{background:radial-gradient(circle,#b79bff22,#8c6ae255 62%,#8c6ae200 72%);border:3px solid #8c6ae2;animation:mark-pulse 1.6s ease-in-out infinite}
.mark-seer::after{content:"🔍"}
.mark-shush{background:radial-gradient(circle,#ffd86b22,#e0a82e55 62%,#e0a82e00 72%);border:3px solid #e0a82e;animation:mark-pulse 1.6s ease-in-out infinite}
.mark-shush::after{content:"🤫"}
.mark-vote::after{content:"🗳️";position:absolute;top:-4%;right:-2%}
@keyframes mark-pulse{0%,100%{transform:scale(1);opacity:.9}50%{transform:scale(1.08);opacity:1}}
.result-panel h2{margin:0 0 4px}
.result-note{margin:0 0 14px;font-size:13px;color:var(--muted);line-height:1.6}
.result-rows{display:grid;gap:8px}
.result-row{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:14px;background:#f0efe6;border:2px solid transparent}
.result-row.won{background:#fbf0d3;border-color:#e6b955}
.result-row img{width:40px;height:40px;border-radius:50%;object-fit:cover;flex:none}
.result-who{display:flex;flex-direction:column;min-width:0;flex:1}
.result-who small{color:var(--muted)}
.result-tags{display:flex;flex-wrap:wrap;gap:4px;justify-content:flex-end}
.tag{font-style:normal;font-size:11px;font-weight:700;border-radius:999px;padding:3px 8px;background:#e3e6dc;white-space:nowrap}
.tag.win{background:#f4c95d;color:#4b3500}.tag.alive{background:#d6ebd0;color:#2c5a3a}.tag.dead{background:#e4dad6;color:#6b4a40}
@media (prefers-reduced-motion:reduce){.announce.show,.fx-claw,.fx-shot,.fx-vote,.fx-spare,.fx-calm,.house-x.fresh path{animation-duration:.01ms!important;animation-delay:0s!important}.mark{animation:none!important}}

button.danger{background:#b3261e;color:#fff}
.profile-card.open-seat{border-color:#e6b955;background:#fffaf0}
.profile-card.open-seat .status{color:#8a5a00;font-weight:700}

.add-profile{margin-top:14px;font-size:13px}
.add-profile summary{cursor:pointer;color:var(--muted);padding:6px 0}
.add-profile .inline-form{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0}
.add-profile .inline-form input{flex:1 1 9em;min-width:0}

.plan-box{margin:12px 0;padding:12px;border-radius:14px;background:#f3f1e6}
.plan-box h4{margin:0 0 8px;font-size:14px}
.plan-list{display:grid;gap:8px;margin-bottom:10px}
.plan-item{display:flex;gap:8px;align-items:stretch}
.plan-use{flex:1;min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:2px;text-align:left;background:#fff;border:2px solid var(--line);border-radius:12px;padding:10px 12px}
.plan-use:hover{border-color:var(--green)}
.plan-use small{font-weight:400;color:var(--muted);line-height:1.5;overflow-wrap:anywhere}
.plan-del{flex:none;padding:8px 12px}
.plan-save{display:flex;flex-wrap:wrap;gap:8px}
.plan-save input{flex:1 1 11em;min-width:0}

body.in-room .topbar{display:none}
.deck-strip{flex-shrink:0;display:flex;flex-wrap:wrap;align-items:center;gap:5px 6px;max-height:88px;overflow-y:auto;margin:0 0 8px;padding:2px 0;scrollbar-width:none}
.deck-strip::-webkit-scrollbar{display:none}
.deck-strip[hidden]{display:none}
.deck-label{flex:none;font-size:12px;font-weight:700;color:var(--muted);margin-right:2px;white-space:nowrap}
.deck-chip{flex:none;display:flex;align-items:center;gap:5px;min-height:30px;padding:2px 10px 2px 3px;border-radius:999px;background:#fff;border:1.5px solid var(--line);font-size:12px;font-weight:700;white-space:nowrap}
.deck-chip:hover{border-color:var(--green)}
.deck-chip img{width:22px;height:22px;border-radius:50%;object-fit:cover;background:#ece8d8}
@media (max-height:520px){.deck-strip{display:none}}
/* ---- Phones: easy to tap ----
   The map keeps its natural shape so houses never crowd each other; the chat takes whatever height is left and the page
   scrolls only if even that does not fit. Buttons are at least 44px with room between them. */
.verdict-bar.compact{flex-wrap:nowrap;padding:6px 10px;gap:8px}
.verdict-bar.compact strong{flex:1 1 auto;font-size:13px}
.verdict-bar.compact .verdict-buttons{flex:none}
.verdict-bar.compact [data-abstain]{min-width:104px}
@media(max-width:700px){
  .in-room #app{overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
  .in-room .play-layout{display:flex;flex-direction:column;flex:1 0 auto;min-height:0;gap:0}
  .in-room .village-stack{flex:none;min-height:0}
  .in-room .village-panel{flex:none}
  .in-room .map{flex:none;height:auto;min-height:0;aspect-ratio:var(--ratio,750 / 520)!important}
  .in-room .map-label{display:none}
  .in-room .chat-panel{flex:1 0 150px;min-height:150px}
  .room-bottom{position:sticky;bottom:0;z-index:5;background:var(--paper,#f5f1e6);padding:8px 0 max(2px,env(safe-area-inset-bottom));gap:10px}
  .room-bottom button{min-height:48px}
  .in-room .room-actions{gap:8px}
  .in-room .room-actions button{font-size:12px;padding:10px 12px;min-height:44px}
  .phase-bar .sound-toggle{width:42px;height:42px;min-width:42px;min-height:42px;font-size:18px}
  .deck-strip{gap:8px;max-height:120px}
  .deck-chip{min-height:38px;padding:3px 12px 3px 4px}
  .host-quick{gap:10px}
  .host-quick button{min-height:44px;font-size:14px}
  .seer-bar{gap:8px}
  .seer-bar .check{padding:6px 12px}
  .chat-tabs{gap:8px}
  .chat-tab{min-height:44px;padding:6px 14px}
  .in-room .chat-form{gap:8px}
  .in-room .chat-form button{min-width:64px}
  .verdict-buttons{gap:12px}
  .verdict-buttons button{min-height:48px}
  .abstain-link{min-height:44px;padding:8px 16px}
  /* With the keyboard open there is no room for a full map: back to the slim version, chat on top of the page. */
  .in-room.keyboard-open #app{overflow:hidden}
  .in-room.keyboard-open .map{aspect-ratio:auto!important;height:72px;flex:none}
  .in-room.keyboard-open .play-layout{flex:1 1 0;min-height:0}
  .in-room.keyboard-open .chat-panel{flex:1 1 0;min-height:0}
  .in-room.keyboard-open .room-bottom{display:none}
}
@media(max-width:700px){
  /* trim the chrome above the map so the map and the chat both fit without scrolling */
  .in-room .room-top{margin-bottom:6px}
  .in-room .room-top h1{font-size:18px}
  .in-room .phase-bar{padding:8px 12px;margin-bottom:8px}
  .in-room .phase-bar strong{font-size:14px;line-height:1.25}
  .in-room .clock{font-size:20px}
  .host-quick{margin:-2px 0 8px}
  .host-quick button{font-size:13px;padding:6px 8px;line-height:1.2}
  .deck-strip{gap:6px;margin-bottom:8px}
  .deck-chip{min-height:34px;padding:2px 10px 2px 3px}
  .deck-label{font-size:12px}
}
@media(max-width:700px){
  .deck-strip{gap:10px 8px}
  .deck-chip{min-height:38px}
  .in-room .map-foot{padding:8px 12px}
}
/* ---- Short phone screens (browser bars leave about 600px): the title row goes behind "⋯", the map is capped so the chat stays on screen ---- */
.room-menu-btn{display:none}
.menu-list{display:grid;gap:12px;margin-top:12px}
.menu-list button{min-height:52px;font-size:16px;text-align:left;padding:12px 16px}
@media(max-width:700px) and (max-height:720px){
  .in-room .room-top{display:none}
  .room-menu-btn{display:inline-flex;align-items:center;justify-content:center;width:42px;height:42px;min-width:42px;min-height:42px;padding:0;border:0;border-radius:50%;background:#ffffff26;color:#fff;font-size:22px;line-height:1}
  .in-room .phase-bar{padding:6px 10px 6px 14px;margin-bottom:6px}
  .in-room .phase-bar small{display:none}
  .in-room .phase-right{gap:6px}
  .in-room .map{width:min(100%,calc(var(--app-height,100dvh) * .4 * var(--rn,1.5)));max-height:calc(var(--app-height,100dvh) * .4);margin-inline:auto}
  .in-room .village-panel{align-items:stretch}
  .in-room .chat-panel{flex:1 0 140px;min-height:140px}
  .host-quick{margin:0 0 6px}
  .host-quick button{min-height:42px}
  .deck-label{display:none}
  .deck-strip{gap:6px;margin-bottom:6px}
  .deck-chip{min-height:30px;font-size:11.5px;padding:1px 9px 1px 2px}
  .deck-chip img{width:20px;height:20px}
  .seer-bar{margin-bottom:6px}
}
@media(max-width:700px) and (max-height:720px){
  .in-room .phase-bar{padding:4px 8px 4px 14px;margin-bottom:5px}
  .room-menu-btn,.phase-bar .sound-toggle{width:38px;height:38px;min-width:38px;min-height:38px}
  .deck-chip img{display:none}
  .deck-chip{min-height:30px;padding:2px 10px}
  .deck-strip{margin-bottom:5px}
  .verdict-bar.compact{padding:3px 10px}
  .verdict-bar.compact [data-abstain]{min-height:40px}
  .in-room .map{width:min(100%,calc(var(--app-height,100dvh) * .38 * var(--rn,1.5)));max-height:calc(var(--app-height,100dvh) * .38)}
  .in-room .chat-panel{flex:1 0 124px;min-height:124px}
  .room-bottom{padding-top:6px}
  .room-bottom button{min-height:46px}
}
@media(max-width:700px) and (max-height:720px){
  .deck-strip{gap:4px 5px}
  .deck-chip{padding:2px 7px;font-size:11px}
  .in-room .map{width:min(100%,calc(var(--app-height,100dvh) * .36 * var(--rn,1.5)));max-height:calc(var(--app-height,100dvh) * .36)}
  .in-room .chat-panel{flex:1 0 116px;min-height:116px}
}
/* "Reconnecting" is a slim strip in the flow under the phase bar instead of a card laid over the houses */
.in-room .offline-banner{position:static;margin:0 0 6px;padding:6px 12px;font-size:12px;line-height:1.4;border-radius:10px;box-shadow:none;flex-shrink:0}
.in-room .offline-banner.hidden{display:none}
.chat-panel.wolf-chat .chat-title{background:#5a1f26;border-bottom:1px solid #7a2c35}
.chat-panel.wolf-chat .chat-title h2{color:#fff}
.chat-panel.wolf-chat .message.wolf-line img{border:2px solid #b3262e}
/* ---- Joining a village: one page, one button, then a pick-your-name pop-up ---- */
.invite{max-width:520px;margin:8vh auto 0;padding:0 4px;text-align:center}
.invite h1{margin:6px 0 8px;font-size:clamp(26px,8vw,38px);line-height:1.2}
.invite-meta{margin:0 0 22px;color:#5d5a47}
.invite-button{width:100%;min-height:60px;font-size:20px;border-radius:16px}
.invite-back{margin-top:22px}
.picker-cards{max-height:46vh;overflow:auto;padding:4px}
.quick-join{display:flex;align-items:center;gap:14px;width:100%;min-height:64px;margin:6px 0 4px;padding:8px 16px;border-radius:16px;background:var(--green);color:#fff;text-align:left;font-size:17px}
.quick-join img{width:46px;height:46px;border-radius:50%;object-fit:cover;border:2px solid #fff8}
#dialog-content .section-note{margin:6px 0 8px;color:#6b6650;font-size:13px}
.picker-cards{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.picker-cards .profile-card{display:grid;grid-template-columns:44px minmax(0,1fr);column-gap:10px;align-items:center;text-align:left;min-height:64px;padding:8px 10px;border-radius:14px}
.picker-cards .profile-card img{grid-row:1 / span 2;width:44px;height:44px;aspect-ratio:1;border-radius:50%;object-fit:cover}
.picker-cards .profile-card strong{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.picker-cards .profile-card .status{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:none;padding:0}
.picker-cards .profile-card .mood{display:none}
/* ---- The house card: the action first, big; the rest in a tidy grid with room between the buttons ---- */
.house-head{display:flex;align-items:center;gap:14px;margin:4px 0 10px}
.house-head .card-portrait{width:84px;height:84px;margin:0;border-radius:20px;flex:none;object-fit:cover}
.house-head h2{margin:0 0 6px;font-size:22px}
.house-head .card-meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;margin:0}
.house-card .card-status{margin:8px 0 0}
.house-actions{display:grid;gap:12px;margin-top:16px}
.house-actions button{width:100%;min-height:52px;font-size:16px}
.house-actions #target-action{min-height:62px;font-size:18px;border-radius:16px}
.house-secondary{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.house-secondary:empty{display:none}
.house-secondary button{font-size:14px;padding:8px 10px}
.house-secondary #kick-player{order:3;grid-column:1/-1}
.host-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px 0 14px}
.host-actions button{min-height:52px;font-size:16px}
.host-menu{gap:12px}
.host-menu small{font-size:12px}
@media(max-height:720px){.private-art{max-width:190px}}
/* the round chat switch: only on short phone screens, where it replaces the title row and the tab buttons */
.chat-switch{display:none;position:relative;flex:none;width:44px;height:44px;min-height:44px;padding:0;border-radius:50%;background:#efe9d6;font-size:20px;line-height:1;align-items:center;justify-content:center}
.chat-switch.unread::after{content:"";position:absolute;top:3px;right:3px;width:11px;height:11px;border-radius:50%;background:#d6342a;border:2px solid #fff}
@media(max-width:700px) and (max-height:720px){
  .chat-switch.on{display:inline-flex}
  .in-room .chat-tabs{display:none}
  .in-room .chat-title{display:none}
  .in-room .chat-panel{flex:1 0 140px;min-height:140px}
  .chat-panel.wolf-chat .chat-form{background:#2a2226}
  .in-room .chat-messages{padding:8px 12px}
}
.in-room .chat-form .chat-switch{width:46px;min-width:46px;height:46px;min-height:46px;padding:0;border-radius:50%;flex:none}
/* ---- Host setup on phones: roomy checkboxes, and a slim one-row action dock so it does not cover the settings ---- */
.check-label{min-height:44px;gap:12px;font-size:14px;margin:6px 0}
.check-label input{width:24px;height:24px;min-height:24px;flex:none}
@media(max-height:720px){
  .game-setup .setup-actions{grid-template-columns:1fr 1.7fr 1fr;gap:8px;padding:8px 0;bottom:-20px}
  .setup-actions #start-game{grid-column:auto;grid-row:auto;order:2}
  .setup-actions #save-setup{order:1}
  .setup-actions #setup-invite{order:3}
  .setup-actions button{font-size:13px;padding:6px 4px;min-height:50px}
}
/* ---- The village art: each cottage fills its box; the resident stands at the door and the name sits on the front garden ---- */
.map .house{width:28%}
.house .roof{position:absolute;inset:0;width:100%;height:100%;display:block;overflow:visible}
.map .house .resident{top:48%;height:27%}
.in-room .map .house .house-name,.map .house .house-name{top:79%}
.in-room .map .house .house-state,.map .house .house-state{top:94%}
.map.night .map-background{filter:none}
/* painted houses (assets/village/house-N-day.png, cropped to the cottage): the picture rests on the bottom of the box.
   The painted door is about 63% across and 75% down, so the resident's face stands there; the name sits on the garden below */
.house .roof.art{object-fit:contain;object-position:50% 100%;transform-origin:50% 100%;pointer-events:none;-webkit-user-drag:none;user-select:none}
.map.night .roof.art.dim{filter:brightness(.62) saturate(.9) hue-rotate(-8deg)}
.house.speaking .roof.art{transform:translateY(-3px) scale(1.03);transition:transform .25s}
.map.painted .house .resident{top:50%;height:25%;left:63%;margin-left:-11.9%}
.in-room .map.painted .house .house-name,.map.painted .house .house-name{top:74%}
.in-room .map.painted .house .house-state,.map.painted .house .house-state{top:99%}
.map.painted .house .house-x{left:14%;top:6%;width:72%;height:78%}
.map.painted .house.speaking .resident{transform:translateY(-4px) scale(1.14) rotate(-6deg)}
/* a cottage used a second time is mirrored (see mirrored() in village-art.js): its door, and the face standing at it, move to the left */
.map.painted .house.flip .roof.art{transform:scaleX(-1)}
.map.painted .house.flip.speaking .roof.art{transform:scaleX(-1) translateY(-3px) scale(1.03)}
.map.painted .house.flip .resident{left:37%}
.map.painted .house.flip.speaking .resident{transform:translateY(-4px) scale(1.14) rotate(6deg)}
/* wide screens: the map fills the height it is given; its width follows the village's own shape so painted trees and the well are not stretched sideways */
@media(min-width:701px){ .in-room .map{width:min(100%,calc(var(--app-height,100dvh) * .58 * var(--rn,1)));margin-inline:auto;box-shadow:0 0 0 1px #a9bb8788,0 6px 18px #2b4a2430} }
@media(max-width:700px) and (max-height:720px){ /* short phones: the whole village is about 200px wide, so names and labels shrink with it */
  .in-room .map.painted .house .house-name{font-size:10px;padding:1px 4px;top:74%;border-radius:5px;line-height:1.5}
  .in-room .map.painted .house .house-state{font-size:8px;padding:0 4px;top:calc(74% + 16px);line-height:1.5}
  .in-room .map.painted .house .resident{border-width:1.5px}
}
/* leave button: calm, but clearly not the same as "my card" */
.room-actions #leave-room{color:#9a2a22;background:#f7e6e2}
/* Reserve the close button's full touch target when a confirmation title wraps. */
dialog:not(.room-sheet) #dialog-content>h2:first-child{padding-right:56px;overflow-wrap:anywhere}
