:root{--bg:#091321;--panel:rgba(20, 34, 54, 0.25);--panel2:rgba(27, 43, 64, 0.25);--line:#2b4058;--muted:#aab8ca;--gold:#f2bd59;--gold2:#ffda8a;--green:#48c78e;--red:#f07178;--blue:#67b9f3;--text:#edf3fa;--main-red:#bd0000;}
  *{box-sizing:border-box}

  .logo {
      width: 42px;
      height: 42px;
      border-radius: 12px;
      background: transparent !important;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
      overflow: hidden;
      padding: 0;
  }
  .logo img {
      width: 100%;
      height: 100%;
      object-fit: cover;
  }

  body{
      margin:0;
      padding:0;
      padding-top: env(safe-area-inset-top);
      padding-bottom: env(safe-area-inset-bottom);
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
      background-image: url("../bg_portrait.webp");
      background-size: cover;
      background-position: center center;
      background-repeat: no-repeat;
      background-attachment: fixed;
      min-height: 100vh;
      background-color: #101720;
      color:var(--text);
      font:14px/1.5 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  }

  @media screen and (orientation: landscape) {
      body {
          background-image: url("../bg_landscape.webp");
      }
  }

  button,input,select,textarea{font:inherit}
  button{
      cursor:pointer;
      border:1px solid var(--line);
      border-radius:11px;
      background:rgba(32, 50, 74, 0.25);
      color:var(--text);
      padding:9px 13px;
      transition:.15s;
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  }
  button:hover{filter:brightness(1.13);transform:translateY(-1px);box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);}
  button.primary{background:linear-gradient(135deg,var(--gold),#e8a93d);color:#241b0d;border:0;font-weight:800;box-shadow: 0 4px 16px rgba(242, 189, 89, 0.4);}
  button.danger{background:rgba(73, 38, 49, 0.25);border-color:#75404d;color:#ffb4bb}
  button.good{background:rgba(21, 62, 57, 0.25);border-color:#28675a;color:#a7f0d0}
  button.small{padding:5px 8px;font-size:12px;border-radius:8px}
  button:disabled{opacity:.45;cursor:not-allowed;transform:none;box-shadow:none}

  input,select,textarea{
      width:100%;
      background:rgba(13, 25, 41, 0.3);
      border:1px solid #30445c;
      color:var(--text);
      border-radius:10px;
      padding:10px;
      outline:none;
      box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.5);
  }
  input:focus,select:focus,textarea:focus{border-color:var(--gold)}
  textarea{min-height:82px;resize:vertical}

  .app{
      max-width:1500px;
      margin:auto;
      padding:18px;
      padding-bottom: calc(95px + env(safe-area-inset-bottom));
  }
  .top{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
  .brand{display:flex;align-items:center;gap:12px}
  .brand h1{font-size:20px;margin:0}
  .brand p{margin:2px 0 0;color:var(--muted);font-size:12px}

  .top-actions{display:none !important;}
  .steps{display:none !important;}

  .step{
      padding:11px 8px;
      border:1px solid var(--line);
      border-radius:12px;
      background:rgba(16, 29, 45, 0.25);
      color:var(--muted);
      text-align:center;
      font-size:12px;
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  }
  .step b{display:block;color:var(--main-red);font-size:13px}
  .step.active{border-color:var(--gold);background:rgba(48, 42, 32, 0.35);color:var(--gold2);box-shadow: 0 6px 20px rgba(242, 189, 89, 0.35);}
  .step.active b {color: var(--main-red);}
  .step.done{border-color:#28675a;color:#9ee3c5}

  .layout{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(290px,.8fr);gap:15px;align-items:start}
  .panel{
      background:rgba(20, 34, 54, 0.25);
      border:1px solid rgba(43, 64, 88, 0.7);
      border-radius:17px;
      padding:17px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  }
  .panel h2{margin:0 0 5px;font-size:18px;}
  .sub{color:var(--muted);margin:0 0 15px;font-size:13px}
  .section-title{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:16px 0 9px}
  .section-title h3{margin:0;font-size:14px;}
  .muted{color:var(--muted)}
  .hint{background:rgba(23, 48, 68, 0.25);border:1px solid #31536a;padding:11px;border-radius:11px;color:#c5d8e6;font-size:12px;margin:12px 0;box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);}
  .toolbar{display:flex;gap:8px;flex-wrap:wrap}

  .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(145px,1fr));gap:9px}
  .role{
      background:rgba(26, 42, 63, 0.25);
      border:1px solid #31465d;
      border-radius:12px;
      padding:10px;
      position:relative;
      min-height:94px;
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
      cursor: pointer;
      transition: all 0.2s ease;
  }
  .role .role-actions {
      position: absolute;
      right: 8px;
      top: 8px;
      display: flex;
      flex-direction: row-reverse;
      gap: 5px;
      align-items: center;
  }
  .role .btn-delete {
      background: rgba(73, 38, 49, 0.4);
      border: 1px solid #75404d;
      color: #ffb4bb;
      padding: 5px 8px;
      font-size: 12px;
      border-radius: 8px;
  }
  .role .btn-delete:hover {
      background: rgba(117, 38, 55, 0.6);
  }
  .role .pick {
      position: static !important;
  }
  .role.selected{border-color:var(--gold);box-shadow: 0 6px 20px rgba(233, 181, 77, 0.4), inset 0 0 0 1px #e9b54d}
  .role .emoji{font-size:20px}
  .role strong{display:block;margin:3px 0;}
  .role small{color:var(--muted)}
  .role .count{font-size:11px;color:var(--gold2)}

  /* Thống kê sử dụng thẻ */
  .role-history-panel{margin-top:20px;padding:13px;border:1px solid rgba(76,103,132,.55);border-radius:13px;background:rgba(12,24,40,.45)}
  .role-history-panel .section-title{margin-top:0}
  .role-history-stats{display:grid;gap:4px}
  .role-history-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:10px;align-items:center;padding:7px 8px;border-bottom:1px solid rgba(120,145,170,.15);font-size:12px}
  .role-history-row:last-child{border-bottom:none}
  .role-history-row small{color:var(--muted)}
  .role-history-toggle-wrap{margin-top:8px;display:flex;justify-content:center}
  .role-history-toggle-btn{width:100%;background:rgba(32, 50, 74, 0.45);border-color:rgba(95, 125, 160, 0.45);color:var(--gold2);font-weight:600}
  .role-history-details{margin-top:12px;padding-top:10px;border-top:1px dashed rgba(120,145,170,.25);font-size:12px;color:var(--muted)}
  .role-history-details summary{cursor:pointer;color:var(--text);font-weight:600;padding:4px 0}
  .role-history-game{padding:7px 0;border-bottom:1px solid rgba(120,145,170,.15)}

  .row{display:flex;align-items:center;gap:8px}.row>*{min-width:0}.between{justify-content:space-between}.wrap{flex-wrap:wrap}
  .order-list{display:flex;flex-direction:column;gap:8px}
  .order-item{
      display:grid;
      grid-template-columns:36px 1fr auto;
      gap:9px;
      align-items:center;
      background:rgba(26, 42, 63, 0.25);
      border:1px solid #31465d;
      padding:9px;
      border-radius:12px;
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  }
  .num{width:32px;height:32px;border-radius:9px;background:#344760;display:grid;place-items:center;font-weight:800;color:var(--gold2)}
  .order-item .meta{color:var(--muted);font-size:12px}
  .order-item .controls{display:flex;gap:4px;flex-wrap:wrap;justify-content:flex-end}

  .player-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(205px,1fr));gap:9px}
  .player{
      background:rgba(26, 42, 63, 0.25);
      border:1px solid #31465d;
      border-radius:13px;
      padding:11px;
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  }
  .player.dead{opacity:1;border-color:#a33e4b;box-shadow:0 0 0 1px rgba(190,55,70,.45),0 0 17px rgba(190,55,70,.22)}
  .player.alive{border-color:#29966b;box-shadow:0 0 0 1px rgba(41,150,107,.45),0 0 17px rgba(41,150,107,.20)}
  .player.critical{border-color:#ffffff!important;background:rgba(255,255,255,0.16)!important;box-shadow:0 0 0 2px rgba(255,255,255,0.85),0 0 22px rgba(255,255,255,0.45)!important}
  .player-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
  .seat{font-size:11px;color:var(--muted);font-weight:800;letter-spacing:.04em;white-space:nowrap}
  .player h3{font-size:14px;margin:5px 0;}
  .player .roleline{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:850;color:#ffe0a0;background:linear-gradient(120deg,rgba(112,76,25,.55),rgba(69,49,28,.55));border:1px solid rgba(242,189,89,.72);border-radius:9px;padding:5px 9px;margin:5px 0 8px;box-shadow:0 0 12px rgba(242,189,89,.18)}
  .statusline{display:flex;gap:5px;flex-wrap:wrap;margin-top:9px}
  .chip{display:inline-flex;align-items:center;gap:5px;padding:4px 8px;border-radius:99px;background:rgba(36, 57, 80, 0.3);border:1px solid #3a5068;font-size:11px}
  .chip.live{background:rgba(21, 90, 62, 0.35);color:#a7f0d0;border-color:#35c58a;box-shadow:0 0 10px rgba(53,197,138,.28)}
  .chip.deadchip{background:rgba(110, 28, 42, 0.38);color:#ffc0c5;border-color:#e05b6b;box-shadow:0 0 10px rgba(224,91,107,.25)}
  .status-buttons{display:flex;gap:5px;flex-wrap:wrap;margin-top:8px}
  .status-btn{padding:5px 7px;font-size:12px}
  .status-btn.on{border-color:var(--gold);background:#45371e}
  .status-btn.status-disabled{opacity:.28;filter:grayscale(1);pointer-events:none;cursor:not-allowed}
  .player{cursor:pointer}.player-head .seat{cursor:pointer;user-select:none}
  .artifact-search{margin:8px 0 12px}
  .quick-control-panel{margin:0 0 14px}
  #deathSummaryModal{position:fixed;inset:0;z-index:20001;display:none;place-items:center;padding:16px;background:rgba(2,8,19,.78);backdrop-filter:blur(7px)}
  #deathSummaryModal.active{display:grid} #deathSummaryBox{width:min(460px,100%);max-height:85vh;overflow:auto;background:rgba(20,34,54,.97);border:1px solid #49617d;border-radius:16px;padding:18px;box-shadow:0 25px 80px rgba(0,0,0,.85)}
  .death-row{padding:9px 0;border-bottom:1px solid rgba(130,160,190,.2)}

  .timerbox{
      text-align:center;
      background:linear-gradient(150deg,rgba(23, 39, 59, 0.25),rgba(16, 27, 44, 0.25));
      border:1px solid #344960;
      border-radius:15px;
      padding:18px;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  }
  .phase{color:var(--gold2);font-size:12px;letter-spacing:.13em;font-weight:800}
  .clock{font-size:52px;font-weight:850;letter-spacing:.04em;margin:2px 0 8px;font-variant-numeric:tabular-nums}
  .timer-actions{display:flex;gap:7px;justify-content:center;flex-wrap:wrap}
  .fields{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:12px}
  .field label{display:block;font-size:12px;color:var(--muted);margin-bottom:5px}

  .log{display:flex;flex-direction:column;gap:8px;max-height:420px;overflow:auto}
  .logitem{border-left:3px solid #4a6b88;background:rgba(24, 40, 60, 0.25);padding:9px 11px;border-radius:0 9px 9px 0;box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);}
  .logitem time{font-size:11px;color:var(--gold2)}
  .logitem p{margin:3px 0 0}
  .story{background:rgba(27, 43, 63, 0.25);border:1px solid #5c4928;border-radius:13px;padding:13px;font-size:14px;white-space:pre-wrap;min-height:112px;box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);}
  .artifact{background:rgba(26, 42, 63, 0.25);border:1px solid #31465d;padding:10px;border-radius:11px;margin:8px 0;box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);}
  .artifact p{margin:3px 0;color:var(--muted);font-size:12px}

  /* Tab Kho báu vật: Một lần & Vĩnh viễn */
  .artifact-tabs {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin: 10px 0 12px;
  }
  .artifact-tab-btn {
      padding: 8px 12px;
      border-radius: 10px;
      font-weight: 700;
      font-size: 13px;
      background: rgba(26, 42, 63, 0.35);
      border: 1px solid #31465d;
      color: var(--muted);
      transition: .15s;
  }
  .artifact-tab-btn.active[data-artifact-tab="Một lần"] {
      background: rgba(245, 158, 11, 0.22);
      border-color: #f59e0b;
      color: #ffca62;
      box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
  }
  .artifact-tab-btn.active[data-artifact-tab="Vĩnh viễn"] {
      background: rgba(101, 200, 121, 0.22);
      border-color: #65c879;
      color: #9ff0b0;
      box-shadow: 0 4px 14px rgba(101, 200, 121, 0.25);
  }

  .player-artifacts{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
  .artifact-hitbox{display:inline-flex;align-items:center;gap:6px;padding:7px 9px;border-radius:9px;border:1px solid #49617d;background:rgba(31,52,75,.72);color:#dce9f7;font-size:11px;text-align:left;cursor:pointer;max-width:100%}
  .artifact-hitbox:active{transform:scale(.98)}
  .artifact-empty-hitbox{border-style:dashed;color:var(--gold2);background:rgba(31,52,75,.35)}
  .artifact-hitbox span{overflow-wrap:anywhere}
  .artifact-hitbox .artifact-inline-status{font-size:10px;font-weight:800;padding:3px 6px;border-radius:99px;white-space:nowrap;border:1px solid transparent}
  .artifact-inline-status.unused{background:#424b57;color:#f1f3f5;border-color:#697583}
  .artifact-inline-status.used{background:#7f2933;color:#fff;border-color:#bd4654}
  .artifact-inline-status.active{background:#17633e;color:#e5fff0;border-color:#2c9b61}
  .artifact-state{display:inline-flex;padding:5px 10px;border-radius:99px;font-size:12px;font-weight:750;border:1px solid transparent}
  .artifact-state.unused{background:#424b57;color:#f1f3f5;border-color:#697583}
  .artifact-state.used{background:#7f2933;color:#fff;border-color:#bd4654}
  .artifact-state.active{background:#17633e;color:#e5fff0;border-color:#2c9b61}
  .artifact-assignment{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;background:rgba(26,42,63,.35);border:1px solid #31465d;padding:9px 11px;border-radius:10px;margin:7px 0}
  .artifact-detail-title{font-size:23px;font-weight:850;margin:0 0 12px}
  .artifact-detail-effect{font-size:14px;line-height:1.55;color:#d7e2ef;white-space:pre-wrap;margin:0 0 14px}
  .artifact-detail-meta{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:14px}
  .artifact-state-options{display:flex;gap:7px;flex-wrap:wrap}
  .artifact-state-choice{cursor:pointer;transition:transform .12s,filter .12s}
  .artifact-state-choice:active{transform:scale(.96)}
  .artifact-state-choice[aria-pressed="true"]{outline:2px solid #fff;outline-offset:2px;box-shadow:0 0 0 4px rgba(255,255,255,.13)}
  #artifactDetailOverlay{background:rgba(0,5,14,.88);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}
  #artifactDetailOverlay .editor-box{background:rgba(13,25,42,.97);box-shadow:0 18px 60px rgba(0,0,0,.8)}
  .artifact-detail-manage{margin-top:16px;padding-top:12px;border-top:1px solid rgba(130,160,190,.22)}
  #artifactDetailRemove{border-color:rgba(239,68,68,.55);color:#fecaca;background:rgba(127,29,29,.22)}
  .artifact-readonly-note{font-size:11px;color:var(--muted);margin-top:13px}
  #roleAssignOverlay{position:fixed;inset:0;z-index:10020;display:none;place-items:center;padding:16px;background:rgba(2,8,19,.72);backdrop-filter:blur(40px);-webkit-backdrop-filter:blur(40px)}
  #roleAssignOverlay.active{display:grid}
  #roleAssignOverlay .role-assign-box{width:min(390px,100%);background:rgba(15,29,47,.97);border:1px solid #536b86;border-radius:18px;padding:20px;box-shadow:0 24px 80px rgba(0,0,0,.85)}
  #roleAssignOverlay .role-assign-box h2{margin:8px 0 5px}
  #roleAssignOverlay .role-assign-box label{display:block;color:var(--muted);font-size:12px;margin:12px 0 5px}
  #roleAssignOverlay .role-assign-box input{width:100%}
  #roleAssignOverlay .role-assign-entry{display:grid;grid-template-columns:105px minmax(0,1fr) 34px;gap:8px;align-items:end;margin-top:10px}
  #roleAssignOverlay .role-assign-entry label{margin-top:0}
  #roleAssignOverlay .role-assign-entry button{height:38px;padding:0}
  .order-item.role-clickable{cursor:pointer;transition:border-color .15s,background .15s}
  .order-item.role-clickable:active{background:rgba(70,105,140,.25)}
  .order-assigned{font-size:11px;color:#9fe3b5;margin-top:4px}

  .chip.artifact-use-once{background:#f59e0b;border-color:#d97706;color:#111;font-weight:700}
  .chip.artifact-use-permanent{background:#65c879;border-color:#369b4d;color:#111;font-weight:700}

  .two{display:grid;grid-template-columns:1fr 1fr;gap:8px}.hidden{display:none!important}
  .footer-nav{display:flex;justify-content:space-between;gap:8px;margin-top:17px}
  .stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
  .stat{background:rgba(27, 43, 64, 0.25);border-radius:11px;padding:10px;text-align:center;box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);}
  .stat b{display:block;font-size:21px;}
  .stat span{font-size:11px;color:var(--muted)}

  @media(max-width:850px){.layout{grid-template-columns:1fr}.app{padding:10px;padding-bottom:calc(95px + env(safe-area-inset-bottom))}.fields{grid-template-columns:1fr 1fr}}
  @media(max-width:480px){.top{align-items:flex-start;flex-direction:column}.panel{padding:13px}.clock{font-size:42px}.fields{grid-template-columns:1fr}.order-item{grid-template-columns:32px 1fr}.order-item .controls{grid-column:2;justify-content:flex-start}}

  .editor-overlay{position:fixed;inset:0;z-index:1000;background:rgba(2, 8, 19, 0.6);display:grid;place-items:center;padding:16px}
  /* Riêng bảng thông tin trạng thái: nền phía sau tối 40% và làm mờ */
  .editor-overlay.status-editor-overlay{background:rgba(0,0,0,.4);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}
  /* Bảng chỉnh sửa ghế/người chơi ở phần 3: làm tối nền và blur 40% nền phía sau */
  .editor-overlay.player-editor-overlay{background:rgba(0,0,0,0.72);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px)}
  .editor-overlay.player-editor-overlay .editor-box{background:rgba(15,29,47,0.94)}
  .status-role-checklist{display:grid;grid-template-columns:repeat(auto-fill,minmax(145px,1fr));gap:6px;max-height:175px;overflow:auto;padding:8px;border:1px solid #30445c;border-radius:10px;background:rgba(13,25,41,0.45);margin-top:6px}
  .status-role-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--text);cursor:pointer;padding:4px 6px;border-radius:7px;background:rgba(255,255,255,0.04)}
  .status-role-item input{width:auto;margin:0;box-shadow:none}
  .status-private-row{display:flex;align-items:center;gap:8px;margin-top:10px;padding:8px 10px;border-radius:10px;background:rgba(242,189,89,0.1);border:1px solid rgba(242,189,89,0.35);cursor:pointer;font-size:13px;font-weight:600;color:var(--gold2)}
  .status-private-row input{width:auto;margin:0;box-shadow:none}
  /* Bảng chỉnh sửa Artifacts: nền phía sau tối 40% và làm mờ */
  .editor-overlay.artifact-editor-overlay{background:rgba(0,0,0,.4);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}
  .editor-overlay.artifact-editor-overlay .editor-box{background:rgba(13,25,42,.94)}
  .editor-box{
      width:min(460px,100%);
      max-height:90vh;
      overflow:auto;
      background:rgba(20, 34, 54, 0.4);
      border:1px solid #49617d;
      border-radius:16px;
      padding:17px;
      box-shadow:0 25px 80px rgba(0, 0, 0, 0.85);
  }
  .editor-box h2{font-size:18px;margin:0;}
  .editor-field{margin-top:12px}
  .editor-field label{display:block;color:var(--muted);font-size:12px;margin-bottom:5px}
  .editor-field textarea{min-height:75px}

  #bottom-toolbar {
      position: fixed;
      bottom: calc(20px + env(safe-area-inset-bottom));
      left: 50%;
      transform: translateX(-50%);
      width: 92%;
      max-width: 450px;
      height: 65px;
      background: rgba(20, 34, 54, 0.75);
      backdrop-filter: blur(10px);
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 18px;
      display: flex;
      align-items: center;
      justify-content: space-around;
      padding: 0 10px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
      z-index: 9999;
  }
  #bottom-toolbar { overflow:hidden; gap:4px; transition:width .7s cubic-bezier(.22,1,.36,1),height .7s cubic-bezier(.22,1,.36,1),padding .7s cubic-bezier(.22,1,.36,1),gap .7s cubic-bezier(.22,1,.36,1),border-radius .7s cubic-bezier(.22,1,.36,1),left .7s ease,bottom .7s ease,transform .7s ease; }
  #bottom-toolbar .toolbar-num-btn,#bottom-toolbar .wolf-menu-btn { flex:0 0 auto; transition:opacity .55s cubic-bezier(.22,1,.36,1),transform .65s cubic-bezier(.22,1,.36,1),width .65s cubic-bezier(.22,1,.36,1),height .65s cubic-bezier(.22,1,.36,1),margin .65s ease,padding .65s ease,border-width .55s ease; }
  #bottom-toolbar .wolf-menu-btn { order:4; }
  #bottom-toolbar .toolbar-num-btn:nth-child(1){order:1} #bottom-toolbar .toolbar-num-btn:nth-child(2){order:2} #bottom-toolbar .toolbar-num-btn:nth-child(3){order:3}
  #bottom-toolbar .toolbar-num-btn:nth-child(5){order:5} #bottom-toolbar .toolbar-num-btn:nth-child(6){order:6} #bottom-toolbar .toolbar-num-btn:nth-child(7){order:7}
  #bottom-toolbar.collapsed {width:65px;height:65px;min-height:65px;padding:0;justify-content:center;border-radius:50%}
  #bottom-toolbar.collapsed .toolbar-num-btn {opacity:0;pointer-events:none;width:0;min-width:0;padding:0;margin:0;border-width:0;transform:scale(.2)}
  #bottom-toolbar.collapsed .wolf-menu-btn {margin:0;transform:scale(1)}
  @media (orientation:landscape) {
    #bottom-toolbar {
      left:calc(18px + env(safe-area-inset-left));
      top:50%;
      bottom:auto;
      transform:translateY(-50%);
      width:65px;
      max-width:none;
      height:352px;
      min-height:0;
      padding:10px 0;
      flex-direction:column;
      justify-content:flex-start;
      align-items:center;
      gap:9px;
      border-radius:18px;
      z-index:9999;
      transition:height .75s cubic-bezier(.22,1,.36,1),border-radius .75s cubic-bezier(.22,1,.36,1),gap .7s cubic-bezier(.22,1,.36,1),padding .7s cubic-bezier(.22,1,.36,1),width .7s ease;
    }
    #bottom-toolbar .wolf-menu-btn {order:0;margin:0;z-index:2;flex:0 0 45px}
    #bottom-toolbar .toolbar-num-btn {
      width:38px;
      height:38px;
      opacity:1;
      transform:translateY(0) scale(1);
      transition:opacity .55s cubic-bezier(.22,1,.36,1),transform .68s cubic-bezier(.22,1,.36,1),height .68s cubic-bezier(.22,1,.36,1),margin .65s ease,padding .65s ease,border-width .5s ease;
    }
    /* Mở rộng: 1 -> 2 -> 3 -> 4 -> 5 -> 6 bung mượt từ menu sói xuống */
    #bottom-toolbar .toolbar-num-btn:nth-child(1){order:1;transition-delay:.03s}
    #bottom-toolbar .toolbar-num-btn:nth-child(2){order:2;transition-delay:.06s}
    #bottom-toolbar .toolbar-num-btn:nth-child(3){order:3;transition-delay:.09s}
    #bottom-toolbar .toolbar-num-btn:nth-child(5){order:4;transition-delay:.12s}
    #bottom-toolbar .toolbar-num-btn:nth-child(6){order:5;transition-delay:.15s}
    #bottom-toolbar .toolbar-num-btn:nth-child(7){order:6;transition-delay:.18s}

    /* Đóng: menu sói < 1 < 2 < 3 < 4 < 5 < 6 cuốn lên vào menu sói rồi biến mất */
    #bottom-toolbar.collapsed {
      width:65px;
      height:65px;
      min-height:0;
      padding:10px 0;
      gap:0;
      justify-content:flex-start;
      border-radius:50%;
    }
    #bottom-toolbar.collapsed .toolbar-num-btn {
      width:38px;
      height:0;
      min-height:0;
      opacity:0;
      pointer-events:none;
      margin:0;
      padding:0;
      border-width:0;
      transform:translateY(-36px) scale(.3);
    }
    #bottom-toolbar.collapsed .toolbar-num-btn:nth-child(7){transition-delay:.00s}
    #bottom-toolbar.collapsed .toolbar-num-btn:nth-child(6){transition-delay:.03s}
    #bottom-toolbar.collapsed .toolbar-num-btn:nth-child(5){transition-delay:.06s}
    #bottom-toolbar.collapsed .toolbar-num-btn:nth-child(3){transition-delay:.09s}
    #bottom-toolbar.collapsed .toolbar-num-btn:nth-child(2){transition-delay:.12s}
    #bottom-toolbar.collapsed .toolbar-num-btn:nth-child(1){transition-delay:.15s}

    #wolf-popup-menu {left:calc(95px + env(safe-area-inset-left))!important;top:50%!important;bottom:auto!important;transform:translateY(-50%) scale(.9)!important;flex-direction:column!important;max-height:calc(100vh - 28px);overflow-y:auto;z-index:10000}
    #wolf-popup-menu.active {display:flex!important;transform:translateY(-50%) scale(1)!important}
    .app {padding-left:18px;padding-bottom:18px}
  }
  @media (orientation:portrait) {#bottom-toolbar{flex-direction:row} #wolf-popup-menu{left:50%;top:auto;bottom:calc(95px + env(safe-area-inset-bottom));transform:translateX(-50%) scale(.9)} #wolf-popup-menu.active{transform:translateX(-50%) scale(1)}}
  .toolbar-num-btn {
      width: 38px; height: 38px; background: rgba(40, 40, 40, 0.6);
      border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 10px;
      color: #ffaa00; font-size: 16px; font-weight: bold;
      display: flex; align-items: center; justify-content: center; cursor: pointer;
  }
  .wolf-menu-btn {
      width: 45px;
      height: 45px;
      background: transparent !important;
      border: none !important;
      box-shadow: none !important;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      margin: 0 8px;
      padding: 0;
  }
  .wolf-menu-btn img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      border-radius: 0;
  }
  #wolf-popup-menu {
      position: fixed; bottom: calc(95px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) scale(0.9);
      width: 220px; background: rgba(25, 25, 25, 0.95);
      border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 16px;
      padding: 10px; display: none; flex-direction: column; gap: 8px; z-index: 10000;
  }
  #wolf-popup-menu.active { display: flex; transform: translateX(-50%) scale(1); }
  .menu-item { padding: 10px 14px; color: #fff; font-size: 14px; background: rgba(255, 255, 255, 0.05); border-radius: 8px; text-align: center; cursor: pointer; }
  #swipe-trigger-zone { position: fixed; top: 0; left: 0; width: 100%; height: calc(40px + env(safe-area-inset-top)); z-index: 998; }

  #settingsModal {
      position: fixed; inset: 0; z-index: 10001; background: rgba(2, 8, 19, 0.7);
      display: none; place-items: center; padding: 16px; backdrop-filter: blur(5px);
  }
  #settingsModal.active { display: grid; }
  #infoModal {
      position: fixed; inset: 0; z-index: 10002; background: rgba(2, 8, 19, 0.75);
      display: none; place-items: center; padding: 16px; backdrop-filter: blur(5px);
  }
  #infoModal.active { display: grid; }
  .info-box {
      width: min(380px, 100%); max-height: 80vh; overflow-y: auto;
      background: rgba(20, 34, 54, 0.95); border: 1px solid #49617d;
      border-radius: 16px; padding: 18px; box-shadow: 0 25px 80px rgba(0, 0, 0, 0.85);
  }
  .info-content { font-size: 11px; line-height: 1.55; color: var(--muted); margin-top: 12px; }
  .info-content p { margin: 5px 0 10px; }
  .info-content ul { margin: 4px 0 0; padding-left: 18px; }
  .info-content li { margin: 2px 0; }
  .info-content .info-group-title { margin: 8px 0 3px; color: var(--gold2); font-weight: 700; }
  .info-old-version { margin: 12px 0; padding: 8px 10px; border: 1px solid rgba(130,160,190,.25); border-radius: 10px; background: rgba(13, 25, 41, 0.45); font-size: 10px; line-height: 1.5; color: var(--muted); }
  .info-old-version summary { cursor: pointer; font-weight: 700; color: var(--text); font-size: 10px; user-select: none; }
  .info-old-version .info-old-body { margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(130,160,190,.22); font-size: 10px; }
  .info-old-version ul { margin: 3px 0 0; padding-left: 16px; }
  .info-old-version li { font-size: 10px; margin: 2px 0; }
  .settings-box {
      width: min(380px, 100%); background: rgba(20, 34, 54, 0.9);
      border: 1px solid #49617d; border-radius: 16px; padding: 20px;
      box-shadow: 0 25px 80px rgba(0, 0, 0, 0.85);
  }
  .settings-option { display: flex; justify-content: space-between; align-items: center; margin: 15px 0; }
  .settings-option span { font-size: 15px; font-weight: 500; }
  .toggle-group { display: flex; gap: 5px; background: rgba(13, 25, 41, 0.5); padding: 4px; border-radius: 10px; border: 1px solid #30445c; }
  .toggle-btn { padding: 6px 14px; border-radius: 8px; border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: bold; }
  .toggle-btn.active { background: var(--gold); color: #241b0d; box-shadow: 0 2px 8px rgba(242,189,89,0.4); }

  #customAlertModal {
      position: fixed; inset: 0; z-index: 20000; background: rgba(2, 8, 19, 0.75);
      display: none; place-items: center; padding: 16px; backdrop-filter: blur(6px);
  }
  #customAlertModal.active { display: grid; }
  .custom-alert-box {
      width: min(380px, 100%); background: rgba(20, 34, 54, 0.95);
      border: 1px solid #49617d; border-radius: 16px; padding: 20px;
      box-shadow: 0 25px 80px rgba(0, 0, 0, 0.85);
      animation: alertScaleIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }
  @keyframes alertScaleIn {
      from { transform: scale(0.9); opacity: 0; }
      to { transform: scale(1); opacity: 1; }
  }
/* Online Room Modal & Connection Badge */
  #onlineModal {
      position: fixed; inset: 0; z-index: 10003; background: rgba(2, 8, 19, 0.78);
      display: none; place-items: center; padding: 16px; backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
  }
  #onlineModal.active { display: grid; }
  .online-box {
      width: min(440px, 100%); max-height: 88vh; overflow-y: auto;
      background: rgba(16, 30, 48, 0.96); border: 1px solid #49617d;
      border-radius: 16px; padding: 20px; box-shadow: 0 25px 80px rgba(0, 0, 0, 0.85);
  }
  .online-status-bar {
      display: flex; align-items: center; justify-content: space-between; gap: 8px;
      padding: 8px 11px; border-radius: 10px; margin: 10px 0 12px;
      background: rgba(13, 25, 41, 0.65); border: 1px solid #30445c; font-size: 12px;
  }
  .online-dot {
      display: inline-block; width: 8px; height: 8px; border-radius: 50%;
      background: #8a9bb0; margin-right: 6px;
  }
  .online-dot.connected { background: var(--green); box-shadow: 0 0 8px var(--green); }
  .online-dot.connecting { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
  .online-dot.error { background: var(--red); box-shadow: 0 0 8px var(--red); }
  .online-pill {
      display: inline-flex; align-items: center; gap: 5px;
      padding: 4px 9px; border-radius: 99px; font-size: 11px; font-weight: 700;
      border: 1px solid #3a5068; background: rgba(20, 34, 54, 0.65); color: var(--muted);
      cursor: pointer; vertical-align: middle; margin-left: 6px;
  }
  .online-pill.live { border-color: #35c58a; color: #a7f0d0; background: rgba(21, 90, 62, 0.35); }
/* Player Mode View (Online Client) */
  #playerModeView { max-width: 720px; margin: 0 auto; }
  .player-secret-hidden {
      text-align: center; padding: 22px 14px; border-radius: 13px;
      background: rgba(13, 25, 41, 0.55); border: 1px dashed rgba(242, 189, 89, 0.45);
  }
  .player-secret-open {
      padding: 14px; border-radius: 13px;
      background: linear-gradient(150deg, rgba(46, 36, 20, 0.45), rgba(16, 29, 45, 0.65));
      border: 1px solid rgba(242, 189, 89, 0.6);
  }
  .player-role-big {
      font-size: 26px; font-weight: 850; color: var(--gold2); margin: 10px 0 8px;
  }
  .player-roster-grid {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px;
  }
  .roster-card {
      padding: 10px; border-radius: 11px; background: rgba(26, 42, 63, 0.35);
      border: 1px solid #31465d;
  }
  .roster-card.alive { border-color: #29966b; }
  .roster-card.dead { border-color: #a33e4b; opacity: 0.72; }
  .roster-card.self { border-color: var(--gold); box-shadow: 0 0 12px rgba(242, 189, 89, 0.28); }
  .online-badge-dot {
      display: inline-block; width: 7px; height: 7px; border-radius: 50%;
      background: var(--green); box-shadow: 0 0 6px var(--green); margin-left: 5px;
      vertical-align: middle;
  }
/* Voice Controls on Moderator Player Cards & Player View */
  .player-voice-row {
      display: flex; align-items: center; justify-content: space-between; gap: 6px;
      flex-wrap: wrap; margin-top: 8px; padding-top: 8px;
      border-top: 1px dashed rgba(130, 160, 190, 0.22);
  }
  .voice-state-pills { display: flex; gap: 4px; flex-wrap: wrap; }
  .voice-pill {
      display: inline-flex; align-items: center; gap: 3px;
      padding: 2px 7px; border-radius: 99px; font-size: 10px; font-weight: 700;
      border: 1px solid #3a5068; background: rgba(20, 34, 54, 0.5); color: var(--muted);
  }
  .voice-pill.on { background: rgba(21, 90, 62, 0.35); border-color: #35c58a; color: #a7f0d0; }
  .voice-pill.off { background: rgba(110, 28, 42, 0.38); border-color: #e05b6b; color: #ffc0c5; }
  .voice-override-btns { display: flex; gap: 4px; }
  .voice-ov-btn {
      padding: 4px 6px; font-size: 11px; border-radius: 7px;
      background: rgba(32, 50, 74, 0.45); border: 1px solid #3b536e; color: var(--text);
  }
  .voice-ov-btn.muted-manual {
      background: rgba(140, 30, 48, 0.65); border-color: #f07178; color: #ffd0d5;
      box-shadow: 0 0 8px rgba(240, 113, 120, 0.35);
  }
  .player-voice-grid {
      display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0;
  }
  .voice-status-card {
      padding: 10px; border-radius: 11px; border: 1px solid #31465d;
      background: rgba(13, 25, 41, 0.55); text-align: center;
  }
  .voice-status-card.on { border-color: #35c58a; background: rgba(21, 90, 62, 0.25); }
  .voice-status-card.off { border-color: #e05b6b; background: rgba(110, 28, 42, 0.28); }
  .voice-status-card b { display: block; font-size: 14px; margin-top: 3px; }
  .voice-turn-banner {
      padding: 10px 12px; border-radius: 11px; margin-bottom: 10px;
      background: linear-gradient(120deg, rgba(242, 189, 89, 0.25), rgba(72, 199, 142, 0.2));
      border: 1px solid var(--gold); color: var(--gold2); font-weight: 800; text-align: center;
  }
/* Live Mic Level Meter & Voice Diagnostics */
  .mic-meter-wrap {
      display: flex; align-items: center; gap: 8px; margin-top: 8px;
  }
  .mic-meter-track {
      flex: 1; height: 8px; border-radius: 99px; overflow: hidden;
      background: rgba(13, 25, 41, 0.75); border: 1px solid #30445c;
  }
  .mic-meter-bar {
      height: 100%; width: 0%; border-radius: 99px;
      background: linear-gradient(90deg, #48c78e, #f2bd59);
      transition: width 0.08s linear;
  }
  .voice-error-box {
      margin: 8px 0; padding: 8px 10px; border-radius: 9px;
      background: rgba(120, 28, 42, 0.45); border: 1px solid #e05b6b;
      color: #ffd0d5; font-size: 12px;
  }
/* Settings Modal Audio-Only Mode (dành cho Người chơi Online) */
  #settingsModal.audio-only #settingsRulesSection { display: none !important; }

  /* Realtime Database Room Manager Panel (Bước 3 - Quản trò) */
  .rtdb-panel {
      margin: 12px 0 14px; padding: 13px; border-radius: 13px;
      background: linear-gradient(150deg, rgba(16, 36, 58, 0.72), rgba(12, 24, 40, 0.78));
      border: 1px solid rgba(103, 185, 243, 0.42);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  }
  .rtdb-meta-grid {
      display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px;
  }
  .rtdb-stat {
      padding: 8px 10px; border-radius: 10px; background: rgba(13, 25, 41, 0.6);
      border: 1px solid #30445c;
  }
  .rtdb-stat b { display: block; font-size: 14px; color: var(--gold2); margin-top: 2px; word-break: break-word; }
  .rtdb-stat small { font-size: 10px; }
  .rtdb-edit-row {
      display: grid; grid-template-columns: minmax(0, 1.5fr) 115px auto; gap: 8px;
      align-items: end; margin-top: 10px;
  }
  .rtdb-rooms-details {
      margin-top: 11px; padding-top: 9px; border-top: 1px dashed rgba(130, 160, 190, 0.28);
      font-size: 12px;
  }
  .rtdb-rooms-details summary { cursor: pointer; font-weight: 700; color: var(--gold2); user-select: none; }
  .rtdb-room-list { display: flex; flex-direction: column; gap: 7px; margin-top: 9px; }
  .rtdb-room-row {
      display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
      padding: 8px 10px; border-radius: 10px; background: rgba(20, 34, 54, 0.65);
      border: 1px solid #31465d;
  }
  .rtdb-room-row.current { border-color: var(--gold); background: rgba(54, 44, 24, 0.35); }
  @media (max-width: 640px) {
      .rtdb-meta-grid { grid-template-columns: 1fr; }
      .rtdb-edit-row { grid-template-columns: 1fr; }
  }

  /* Speaking Visual Effect on Player Hitbox (chỉ buổi sáng & đầu game trước Đêm 1) */
  .speaking-badge {
      display: none; align-items: center; gap: 5px;
      padding: 2px 8px; border-radius: 99px; font-size: 10px; font-weight: 800;
      background: rgba(72, 199, 142, 0.25); border: 1px solid #48c78e; color: #b9ffe0;
      letter-spacing: 0.02em; white-space: nowrap;
  }
  .speaking-wave {
      display: inline-flex; align-items: flex-end; gap: 2px; height: 11px;
  }
  .speaking-wave i {
      display: block; width: 2.5px; height: 4px; border-radius: 2px;
      background: #6ff7be; animation: speakingWaveBar 0.7s ease-in-out infinite;
  }
  .speaking-wave i:nth-child(2) { animation-delay: 0.15s; height: 9px; }
  .speaking-wave i:nth-child(3) { animation-delay: 0.3s; height: 6px; }

  .player.is-speaking,
  .roster-card.is-speaking {
      border-color: #48c78e !important;
      background: linear-gradient(155deg, rgba(25, 86, 65, 0.42), rgba(26, 42, 63, 0.38)) !important;
      box-shadow: 0 0 0 2px rgba(72, 199, 142, 0.92), 0 0 24px rgba(72, 199, 142, 0.55) !important;
      animation: speakingHitboxPulse 1.15s ease-in-out infinite;
  }
  .player.is-speaking .speaking-badge,
  .roster-card.is-speaking .speaking-badge {
      display: inline-flex;
  }

  @keyframes speakingHitboxPulse {
      0%, 100% {
          box-shadow: 0 0 0 2px rgba(72, 199, 142, 0.95), 0 0 18px rgba(72, 199, 142, 0.45);
      }
      50% {
          box-shadow: 0 0 0 3px rgba(126, 249, 196, 1), 0 0 32px rgba(72, 199, 142, 0.85);
      }
  }
  @keyframes speakingWaveBar {
      0%, 100% { transform: scaleY(0.45); }
      50% { transform: scaleY(1.25); }
  }
/* ==================== CHATBOX ONLINE (v2.5) ==================== */
  #playerChatMount { max-width: 720px; margin: 0 auto 14px; }

  .host-chat-fab {
      position: fixed;
      right: calc(16px + env(safe-area-inset-right));
      bottom: calc(96px + env(safe-area-inset-bottom));
      z-index: 9998;
      display: inline-flex; align-items: center; gap: 6px;
      padding: 11px 16px; border-radius: 999px;
      background: linear-gradient(135deg, rgba(242, 189, 89, 0.96), rgba(226, 159, 50, 0.96));
      color: #201609; border: 1px solid rgba(255, 232, 175, 0.85);
      font-weight: 800; font-size: 13px;
      box-shadow: 0 8px 26px rgba(0, 0, 0, 0.72), 0 0 18px rgba(242, 189, 89, 0.35);
  }
  @media (orientation: landscape) {
      .host-chat-fab {
          bottom: calc(18px + env(safe-area-inset-bottom));
      }
  }
  .chat-unread-badge {
      display: inline-flex; align-items: center; justify-content: center;
      min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
      background: #c81d25; color: #fff; font-size: 11px; font-weight: 800;
      box-shadow: 0 2px 8px rgba(200, 29, 37, 0.7);
  }
  .chat-unread-badge.has-secret {
      background: #9b2c9b;
      box-shadow: 0 0 12px rgba(186, 85, 211, 0.85);
  }

  .chat-drawer-overlay {
      position: fixed; inset: 0; z-index: 10015;
      background: rgba(2, 8, 19, 0.68);
      backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
      display: none; justify-content: flex-end; align-items: stretch;
  }
  .chat-drawer-overlay.active { display: flex; }
  .chat-drawer-box {
      width: min(440px, 100%); height: 100%;
      background: rgba(13, 24, 38, 0.97);
      border-left: 1px solid #3f5875;
      display: flex; flex-direction: column;
      padding: 14px;
      padding-top: calc(14px + env(safe-area-inset-top));
      padding-bottom: calc(14px + env(safe-area-inset-bottom));
      box-shadow: -12px 0 40px rgba(0, 0, 0, 0.8);
  }
  .chat-drawer-head {
      display: flex; align-items: center; justify-content: space-between; gap: 8px;
      margin-bottom: 10px;
  }

  .chat-tabs {
      display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px;
  }
  .chat-tab-btn {
      padding: 5px 10px; font-size: 12px; font-weight: 700; border-radius: 9px;
      background: rgba(26, 42, 63, 0.55); border: 1px solid #31465d; color: var(--muted);
      box-shadow: none;
  }
  .chat-tab-btn.active {
      background: rgba(242, 189, 89, 0.22); border-color: var(--gold); color: var(--gold2);
  }

  .chat-messages {
      display: flex; flex-direction: column; gap: 8px;
      max-height: 290px; min-height: 150px; overflow-y: auto;
      padding: 10px; border-radius: 12px;
      background: rgba(9, 17, 29, 0.65); border: 1px solid rgba(49, 70, 93, 0.7);
      margin-bottom: 10px;
  }
  .host-chat-messages {
      flex: 1; max-height: none; min-height: 0;
  }
  .chat-empty {
      text-align: center; padding: 24px 10px; font-size: 12px;
  }

  .chat-msg {
      padding: 8px 10px; border-radius: 11px;
      background: rgba(26, 42, 63, 0.55); border: 1px solid rgba(58, 80, 104, 0.75);
      font-size: 13px; line-height: 1.45; word-break: break-word;
  }
  .chat-msg.is-self {
      background: rgba(23, 66, 94, 0.52); border-color: rgba(103, 185, 243, 0.55);
  }
  .chat-msg.is-host {
      background: rgba(66, 52, 24, 0.42); border-color: rgba(242, 189, 89, 0.55);
  }
  .chat-msg-head {
      display: flex; align-items: center; justify-content: space-between; gap: 8px;
      font-size: 11px; margin-bottom: 3px;
  }
  .chat-time { color: var(--muted); font-size: 10px; white-space: nowrap; }
  .chat-host-tag {
      color: var(--gold2); font-weight: 800;
  }
  .chat-msg-text { white-space: pre-wrap; color: var(--text); }

  /* Thẻ thông báo lựa chọn bí mật — CHỈ QUẢN TRÒ THẤY */
  .chat-secret-card {
      background: linear-gradient(150deg, rgba(64, 42, 18, 0.68), rgba(45, 22, 58, 0.68));
      border: 1.5px dashed var(--gold);
      box-shadow: 0 4px 18px rgba(242, 189, 89, 0.16);
  }
  .chat-secret-head {
      display: flex; align-items: center; justify-content: space-between; gap: 6px;
      margin-bottom: 5px;
  }
  .chat-secret-tag {
      display: inline-flex; align-items: center; gap: 4px;
      padding: 2px 7px; border-radius: 99px; font-size: 10px; font-weight: 850;
      background: rgba(242, 189, 89, 0.25); border: 1px solid var(--gold); color: var(--gold2);
      letter-spacing: 0.03em;
  }
  .chat-secret-actor {
      display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
      font-size: 12px; margin-bottom: 4px;
  }
  .chat-secret-body { font-size: 13px; color: #fff5df; }
  .chat-secret-note {
      margin-top: 4px; padding: 5px 8px; border-radius: 7px;
      background: rgba(0, 0, 0, 0.28); font-size: 12px; color: #dbe7f5;
  }
  .chat-secret-actions {
      display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px;
  }

  /* Tin nhắn hộp thư riêng 1-1 */
  .chat-private-msg {
      background: linear-gradient(145deg, rgba(44, 28, 72, 0.68), rgba(24, 34, 62, 0.68));
      border: 1px dashed rgba(178, 134, 255, 0.72);
  }
  .chat-private-label { color: #d8beff; font-size: 11px; }

  /* Kênh Sói & Kênh Người Chết */
  .chat-wolf-msg {
      background: rgba(84, 22, 34, 0.52); border-color: rgba(240, 113, 120, 0.62);
  }
  .chat-dead-msg {
      background: rgba(34, 42, 54, 0.6); border-color: rgba(130, 148, 170, 0.45);
      opacity: 0.92;
  }

  .chat-lock-note {
      padding: 7px 10px; border-radius: 9px; margin-bottom: 8px;
      background: rgba(110, 28, 42, 0.35); border: 1px solid rgba(224, 91, 107, 0.6);
      color: #ffd0d5; font-size: 12px;
  }
  .chat-drawer-footer {
      display: flex; flex-direction: column; gap: 7px;
  }
  .chat-target-banner {
      display: flex; align-items: center; justify-content: space-between; gap: 8px;
      padding: 7px 10px; border-radius: 9px; font-size: 11px; font-weight: 700;
      background: rgba(58, 34, 94, 0.65); border: 1px solid rgba(178, 134, 255, 0.75); color: #e9dbff;
  }
  .chat-target-banner.mode-wolves {
      background: rgba(94, 24, 38, 0.65); border-color: #f07178; color: #ffd4d8;
  }
  .chat-target-banner.mode-dead {
      background: rgba(36, 48, 62, 0.75); border-color: #7c93ad; color: #dbe6f2;
  }
  .quick-reply-row {
      display: flex; gap: 6px; flex-wrap: wrap;
  }
  .quick-reply-chip {
      background: rgba(66, 44, 108, 0.55); border-color: rgba(178, 134, 255, 0.6); color: #efe5ff;
  }
  .chat-target-select {
      padding: 7px 9px; font-size: 12px;
  }
  .chat-composer {
      display: flex; gap: 7px; align-items: center;
  }
  .chat-composer input { flex: 1; padding: 9px 11px; }
/* ==================== HOST INLINE CHATBOX & SHARED GROUPS (v2.6) ==================== */
  #hostChatPanel {
      display: flex; flex-direction: column;
      border-color: rgba(242, 189, 89, 0.45);
  }
  #hostChatPanel .host-inline-messages {
      max-height: 290px; min-height: 150px;
  }
  #hostChatPanel.is-fullscreen {
      position: fixed !important;
      inset: 0 !important;
      z-index: 10015 !important;
      margin: 0 !important;
      border-radius: 0 !important;
      border: 0 !important;
      background: rgba(11, 21, 34, 0.98) !important;
      padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom)) 14px !important;
      display: flex !important;
      flex-direction: column !important;
      height: 100vh !important;
      height: 100dvh !important;
  }
  #hostChatPanel.is-fullscreen .host-inline-messages {
      flex: 1 !important;
      max-height: none !important;
      min-height: 0 !important;
  }

  /* Shared Visibility Groups Box inside Host Chatbox */
  .chat-groups-box {
      margin: 0 0 10px;
      padding: 8px 10px;
      border-radius: 11px;
      background: rgba(12, 26, 44, 0.72);
      border: 1px solid rgba(103, 185, 243, 0.38);
      font-size: 12px;
  }
  .chat-groups-box summary {
      cursor: pointer; font-weight: 750; color: var(--blue); user-select: none;
  }
  .chat-groups-body {
      margin-top: 9px; padding-top: 9px;
      border-top: 1px dashed rgba(130, 160, 190, 0.25);
  }
  .chat-groups-list {
      display: flex; flex-direction: column; gap: 6px; margin-bottom: 9px;
  }
  .chat-group-item {
      display: flex; align-items: center; justify-content: space-between; gap: 8px;
      padding: 7px 9px; border-radius: 9px;
      background: rgba(24, 42, 66, 0.65); border: 1px solid #35506d;
  }
  .chat-group-editor {
      padding: 8px; border-radius: 9px;
      background: rgba(8, 17, 30, 0.55); border: 1px solid rgba(49, 70, 93, 0.75);
  }
  .chat-seat-checklist {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
      gap: 5px; max-height: 135px; overflow-y: auto;
      margin-top: 7px; padding: 6px; border-radius: 8px;
      background: rgba(13, 25, 41, 0.5); border: 1px solid #2b4058;
  }
  .chat-seat-check {
      display: flex; align-items: center; gap: 5px; font-size: 11px;
      padding: 4px 6px; border-radius: 7px; cursor: pointer;
      background: rgba(255, 255, 255, 0.04); border: 1px solid transparent;
  }
  .chat-seat-check.checked {
      background: rgba(242, 189, 89, 0.16); border-color: rgba(242, 189, 89, 0.6); color: var(--gold2);
  }
  .chat-seat-check input { width: auto; margin: 0; box-shadow: none; }
  .chat-group-flags {
      display: flex; gap: 12px; flex-wrap: wrap; margin-top: 7px; font-size: 11px; color: var(--muted);
  }
  .chat-group-flags label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
  .chat-group-flags input { width: auto; margin: 0; box-shadow: none; }

  .chat-target-banner.mode-group {
      background: rgba(20, 66, 94, 0.72); border-color: #67b9f3; color: #d8f0ff;
  }
  .chat-group-banner {
      padding: 7px 10px; border-radius: 9px; margin: 6px 0 8px;
      background: rgba(20, 66, 94, 0.45); border: 1px solid rgba(103, 185, 243, 0.55);
      color: #d6eeff; font-size: 12px;
  }
  .chat-group-msg {
      background: rgba(22, 56, 84, 0.55); border-color: rgba(103, 185, 243, 0.58);
  }
  .chat-group-action-card {
      background: linear-gradient(145deg, rgba(22, 62, 88, 0.72), rgba(44, 52, 24, 0.68));
      border: 1px dashed #67b9f3;
  }
  .chat-group-label { color: #9cd6ff; font-size: 11px; }
/* Small Red "+N" Unread Badge on Chat Tabs (Host & Player) */
  .chat-tab-btn {
      position: relative;
      display: inline-flex; align-items: center; gap: 5px;
      overflow: visible;
  }
  .chat-tab-badge {
      display: inline-flex; align-items: center; justify-content: center;
      flex-shrink: 0;
      min-width: 20px; height: 17px; padding: 0 5px;
      border-radius: 999px;
      background: #ef233c; color: #ffffff;
      font-size: 10px; font-weight: 800; line-height: 1;
      letter-spacing: 0.01em;
      border: 1px solid rgba(255, 255, 255, 0.35);
      box-shadow: 0 0 10px rgba(239, 35, 60, 0.85);
      animation: chatBadgePop 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  }
  @keyframes chatBadgePop {
      0% { transform: scale(0.5); opacity: 0; }
      100% { transform: scale(1); opacity: 1; }
  }
.chat-tab-btn.has-unread {
      border-color: #ef233c !important;
      background: rgba(140, 24, 42, 0.42) !important;
      color: #ffdce0 !important;
      box-shadow: 0 0 12px rgba(239, 35, 60, 0.38);
  }
/* ==================== AUDIO VOLUME SLIDER (v2.8) ==================== */
  .settings-slider-row {
      flex-direction: column;
      align-items: stretch;
      margin-top: -4px;
      padding-top: 2px;
  }
  .volume-slider {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 7px;
      padding: 0;
      border-radius: 999px;
      background: linear-gradient(90deg, rgba(242, 189, 89, 0.45), rgba(49, 70, 93, 0.85));
      border: 1px solid #354c66;
      outline: none;
      cursor: pointer;
      box-shadow: none;
  }
  .volume-slider::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--gold2), var(--gold));
      border: 2px solid #1b2838;
      box-shadow: 0 0 10px rgba(242, 189, 89, 0.75);
      cursor: pointer;
      transition: transform 0.12s ease;
  }
  .volume-slider::-webkit-slider-thumb:hover { transform: scale(1.14); }
  .volume-slider::-moz-range-thumb {
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--gold2), var(--gold));
      border: 2px solid #1b2838;
      box-shadow: 0 0 10px rgba(242, 189, 89, 0.75);
      cursor: pointer;
  }

  /* ==================== FLOATING BOTTOM-LEFT CHAT BUBBLE & POPUP (v2.8) ==================== */
  #playerChatMount {
      position: fixed;
      left: 0;
      bottom: 0;
      width: 0;
      height: 0;
      margin: 0;
      max-width: none;
      z-index: 9998;
      pointer-events: none;
  }
  #playerChatMount > * { pointer-events: auto; }

  .chat-bubble-btn {
      position: fixed;
      left: calc(16px + env(safe-area-inset-left));
      bottom: calc(16px + env(safe-area-inset-bottom));
      z-index: 10005;
      width: 56px;
      height: 56px;
      padding: 0;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: linear-gradient(145deg, rgba(242, 189, 89, 0.96), rgba(214, 146, 42, 0.96));
      color: #1f1608;
      border: 2px solid rgba(255, 236, 184, 0.85);
      box-shadow: 0 8px 26px rgba(0, 0, 0, 0.75), 0 0 20px rgba(242, 189, 89, 0.35);
      transition: transform 0.18s ease, box-shadow 0.18s ease;
  }
  .chat-bubble-btn:hover {
      transform: scale(1.06);
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 26px rgba(242, 189, 89, 0.55);
  }
  .chat-bubble-btn.is-open {
      background: linear-gradient(145deg, rgba(30, 50, 74, 0.96), rgba(16, 29, 46, 0.96));
      color: var(--gold2);
      border-color: var(--gold);
  }
  .chat-bubble-btn.has-unread {
      animation: chatBubblePulse 1.6s ease-in-out infinite;
  }
  .chat-bubble-icon { font-size: 24px; line-height: 1; }
  .chat-bubble-badge {
      position: absolute;
      top: -5px;
      right: -5px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 22px;
      height: 22px;
      padding: 0 6px;
      border-radius: 999px;
      background: #ef233c;
      color: #ffffff;
      font-size: 11px;
      font-weight: 850;
      line-height: 1;
      border: 2px solid #101720;
      box-shadow: 0 2px 10px rgba(239, 35, 60, 0.85);
  }
  .chat-bubble-badge.has-secret {
      background: #a832a8;
      box-shadow: 0 2px 12px rgba(186, 85, 211, 0.9);
  }
  @keyframes chatBubblePulse {
      0%, 100% { box-shadow: 0 8px 26px rgba(0, 0, 0, 0.75), 0 0 14px rgba(239, 35, 60, 0.45); }
      50% { box-shadow: 0 8px 28px rgba(0, 0, 0, 0.8), 0 0 28px rgba(239, 35, 60, 0.85); }
  }

  /* Tránh đè lên #bottom-toolbar của Host trên màn hình dọc hoặc ngang thấp */
  @media (orientation: portrait) {
      .host-chat-bubble {
          bottom: calc(92px + env(safe-area-inset-bottom));
      }
  }
  @media (orientation: landscape) and (max-height: 520px) {
      .host-chat-bubble {
          left: calc(82px + env(safe-area-inset-left));
      }
  }

  .chat-float-popup {
      position: fixed;
      left: calc(16px + env(safe-area-inset-left));
      bottom: calc(82px + env(safe-area-inset-bottom));
      z-index: 10010;
      width: min(400px, calc(100vw - 24px));
      max-height: min(540px, calc(100dvh - 110px));
      display: flex;
      flex-direction: column;
      padding: 13px;
      border-radius: 16px;
      background: rgba(13, 23, 37, 0.94);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid rgba(242, 189, 89, 0.48);
      box-shadow: 0 16px 46px rgba(0, 0, 0, 0.85);
      animation: chatPopupIn 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  }
  @media (orientation: portrait) {
      .host-chat-popup {
          bottom: calc(156px + env(safe-area-inset-bottom));
          max-height: calc(100dvh - 180px);
      }
  }
  @keyframes chatPopupIn {
      0% { opacity: 0; transform: translateY(14px) scale(0.96); }
      100% { opacity: 1; transform: translateY(0) scale(1); }
  }

  .chat-float-popup .player-float-messages,
  .chat-float-popup .host-inline-messages {
      flex: 1 1 auto;
      min-height: 140px;
      max-height: 310px;
      overflow-y: auto;
  }

  .chat-float-popup.is-fullscreen {
      position: fixed !important;
      inset: 0 !important;
      left: 0 !important;
      bottom: 0 !important;
      width: 100vw !important;
      max-width: none !important;
      height: 100vh !important;
      height: 100dvh !important;
      max-height: none !important;
      z-index: 10020 !important;
      margin: 0 !important;
      border-radius: 0 !important;
      border: 0 !important;
      background: rgba(11, 21, 34, 0.98) !important;
      padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom)) 14px !important;
  }
  .chat-float-popup.is-fullscreen .player-float-messages,
  .chat-float-popup.is-fullscreen .host-inline-messages {
      flex: 1 !important;
      max-height: none !important;
      min-height: 0 !important;
  }

  /* ==================== PHÂN BIỆT RÕ TIN NHẮN BẢN THÂN vs NGƯỜI KHÁC (v2.8) ==================== */
  .chat-sender-wrap {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      flex-wrap: wrap;
  }
  .chat-self-tag {
      display: inline-flex;
      align-items: center;
      padding: 1px 6px;
      border-radius: 999px;
      font-size: 9.5px;
      font-weight: 800;
      background: rgba(242, 189, 89, 0.28);
      color: var(--gold2);
      border: 1px solid rgba(242, 189, 89, 0.65);
      letter-spacing: 0.02em;
  }

  /* Tin nhắn của NGƯỜI CHƠI KHÁC: tối hơn, phẳng, KHÔNG có viền nổi */
  .chat-msg.is-other,
  .chat-msg.is-other.chat-group-msg,
  .chat-msg.is-other.chat-dead-msg {
      align-self: flex-start;
      width: fit-content;
      min-width: 58%;
      max-width: 88%;
      background: rgba(11, 18, 29, 0.82) !important;
      border: 1px solid rgba(255, 255, 255, 0.04) !important;
      box-shadow: none !important;
  }
  .chat-msg.is-other.chat-wolf-msg {
      align-self: flex-start;
      width: fit-content;
      min-width: 58%;
      max-width: 88%;
      background: rgba(42, 14, 21, 0.76) !important;
      border: 1px solid rgba(255, 255, 255, 0.05) !important;
      box-shadow: none !important;
  }
  .chat-msg.is-other.is-host {
      background: rgba(34, 28, 16, 0.78) !important;
      border: 1px solid rgba(242, 189, 89, 0.16) !important;
  }
  .chat-msg.is-other .chat-msg-head strong {
      color: #8fa6bf;
      font-weight: 600;
  }
  .chat-msg.is-other .chat-msg-text {
      color: #b7c8da;
  }

  /* Tin nhắn của CHÍNH BẢN THÂN: sáng nổi bật, viền sáng rõ nét, căn phải — ưu tiên cao hơn mọi class kênh */
  .chat-msg.is-self,
  .chat-msg.is-self.chat-group-msg,
  .chat-msg.is-self.chat-wolf-msg,
  .chat-msg.is-self.chat-dead-msg,
  .chat-msg.is-self.is-host {
      align-self: flex-end;
      width: fit-content;
      min-width: 58%;
      max-width: 88%;
      background: linear-gradient(135deg, rgba(242, 189, 89, 0.28), rgba(52, 134, 206, 0.28)) !important;
      border: 1.5px solid rgba(242, 189, 89, 0.92) !important;
      box-shadow: 0 4px 16px rgba(242, 189, 89, 0.22), inset 0 1px 0 rgba(255, 245, 210, 0.22) !important;
  }
  .chat-msg.is-self .chat-msg-head strong {
      color: var(--gold2);
      font-weight: 800;
  }
  .chat-msg.is-self .chat-msg-text {
      color: #ffffff;
      font-weight: 500;
  }
  .chat-msg.is-self .chat-time {
      color: #e6d3a3;
  }
/* Spotlight Speaker button for 15-25 player voice rooms (v3.0) */
  .voice-ov-btn.spotlight-active {
      background: linear-gradient(135deg, rgba(242, 189, 89, 0.35), rgba(226, 159, 50, 0.35)) !important;
      border-color: var(--gold) !important;
      color: var(--gold2) !important;
      box-shadow: 0 0 12px rgba(242, 189, 89, 0.65);
  }
/* Ghim website chính thức ở đầu hộp Thông tin (v3.0) */
  .info-pinned-web {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 6px;
      margin: 0 0 10px;
      padding: 8px 10px;
      border-radius: 10px;
      background: linear-gradient(135deg, rgba(242, 189, 89, 0.18), rgba(45, 92, 138, 0.28));
      border: 1px solid rgba(242, 189, 89, 0.65);
      color: var(--gold2);
      font-size: 11px;
      font-weight: 700;
  }
  .info-pinned-web a {
      color: #ffffff;
      text-decoration: underline;
      text-underline-offset: 2px;
      word-break: break-all;
  }
  .info-pinned-web a:hover {
      color: var(--gold2);
  }
  .info-content a {
      color: #8cc8ff;
      text-decoration: underline;
      text-underline-offset: 2px;
  }
  .info-old-version .info-group-title {
      font-size: 10px;
      margin: 6px 0 2px;
  }
