/* style.css */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg: #080810;
      --panel: #0e0e1c;
      --panel2: #13132a;
      --border: #252540;
      --evader: #8be9fd;
      --evader-glow: rgba(139,233,253,0.35);
      --hunter-a: #e84855;
      --hunter-a-glow: rgba(232,72,85,0.35);
      --hunter-b: #ffd166;
      --hunter-b-glow: rgba(255,209,102,0.35);
      --portal-up: #a78bfa;
      --portal-down: #fb923c;
      --portal-left: #60a5fa;
      --portal-right: #f472b6;
      --text: #c8d8f0;
      --text-dim: #55688a;
      --current: rgba(108,99,255,0.16);
      --evader-deep: rgba(30,58,138,0.5);      /* 深蓝色 */
      --evader-light: rgba(59,130,246,0.25);   /* 浅蓝色 */
      --hunter-deep: rgba(127,29,29,0.6);      /* 深红色 */
      --hunter-light: rgba(220,38,38,0.3);     /* 浅红色 */
      --both-reachable: rgba(255,193,7,0.3);   /* 黄色 - 双方阵营可达 */
    }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: 'Segoe UI', 'PingFang SC', sans-serif;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0;
    }

    header {
      width: 100%;
      text-align: center;
      padding: 16px 0 6px;
      border-bottom: 1px solid var(--border);
    }
    header h1 {
      font-size: 1.5rem;
      letter-spacing: 0.18em;
      background: linear-gradient(90deg, var(--evader), var(--hunter-a), var(--hunter-b));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    header p {
      color: var(--text-dim);
      font-size: 0.78rem;
      margin-top: 3px;
    }

    #status-bar {
      display: flex;
      gap: 24px;
      align-items: center;
      padding: 8px 28px;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 8px;
      margin: 12px 0 8px;
      font-size: 0.85rem;
      flex-wrap: wrap;
      justify-content: center;
    }
    .stat { display: flex; align-items: center; gap: 6px; }
    .stat-label { color: var(--text-dim); }
    .stat-val { font-weight: 700; font-size: 1rem; }
    #sv-turn { color: #d7e3ff; }
    #sv-evader { color: var(--evader); }
    #sv-hunter-a { color: var(--hunter-a); }
    #sv-hunter-b { color: var(--hunter-b); }
    #sv-round { color: #c9a8ff; }
    #sv-known { color: #a78bfa; }

    #main {
      display: flex;
      gap: 20px;
      padding: 0 16px 24px;
      align-items: flex-start;
      flex-wrap: wrap;
      justify-content: center;
    }

    #map-panel {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
    }
    .panel-title {
      font-size: 0.82rem;
      color: var(--text-dim);
      letter-spacing: 0.1em;
      text-transform: uppercase;
    }
    #overview-map {
      display: grid;
      grid-template-columns: repeat(4, 144px);
      grid-template-rows: repeat(4, 144px);
      gap: 12px;
    }
    .room-cell {
      width: 144px;
      height: 144px;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 14px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      position: relative;
      transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
      cursor: pointer;
      font-size: 0.98rem;
    }
    .room-cell .room-id {
      font-size: 1rem;
      color: var(--text-dim);
      position: absolute;
      top: 8px;
      left: 10px;
    }

    /* 逃避者阵营区域（含占据+可达） - 浅蓝 */
    .room-cell.evader-reachable {
      background: var(--evader-light);
      border-color: rgba(96,165,250,0.25);
    }

    /* 追捕者阵营区域（含占据+可达） - 浅红 */
    .room-cell.hunter-reachable {
      background: var(--hunter-light);
      border-color: rgba(248,113,113,0.25);
    }
    .room-cell.current {
      border: 2px solid #8b7fff;
      box-shadow: 0 0 12px rgba(108,99,255,0.24);
    }
    .room-cell.target {
      border: 2px solid #ffd166;
      box-shadow: 0 0 0 1px rgba(255,209,102,0.24), 0 0 14px rgba(255,209,102,0.16);
    }
    .room-cell.path-start {
      border: 2px solid #8b7fff;
      box-shadow: 0 0 0 1px rgba(108,99,255,0.4), 0 0 14px rgba(108,99,255,0.16);
    }
    .room-cell.on-path {
      background: rgba(108,99,255,0.1);
    }
    .room-cell.both-reachable {
      background: var(--both-reachable);
      border-color: rgba(255,193,7,0.3);
    }

    .actor-markers {
      position: absolute;
      left: 0; right: 0;
      top: 22px;
      bottom: 28px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
      pointer-events: none;
    }
    .actor-badge {
      min-width: 34px;
      padding: 3px 8px;
      border-radius: 999px;
      background: rgba(0,0,0,0.62);
      border: 1px solid rgba(255,255,255,0.15);
      color: #fff;
      font-size: 0.92rem;
      font-weight: 800;
      line-height: 1.1;
      text-align: center;
    }

    .actor-badge.evader {
      color: var(--evader);
      border-color: rgba(139,233,253,0.45);
    }
    .actor-badge.hunter-a {
      color: var(--hunter-a);
      border-color: rgba(232,72,85,0.4);
    }
    .actor-badge.hunter-b {
      color: var(--hunter-b);
      border-color: rgba(255,209,102,0.4);
    }
    .actor-badge.active {
      background: rgba(255,255,255,0.1);
      box-shadow: 0 0 8px rgba(255,255,255,0.18);
    }

    /* 通道指示器横排（格子底部） */
    .channel-row {
      position: absolute;
      bottom: 5px;
      left: 0; right: 0;
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: center;
      gap: 3px;
      pointer-events: none;
    }
    .ch-indicator {
      display: inline-flex;
      align-items: center;
      gap: 1px;
      font-size: 0.72rem;
      font-weight: 700;
      line-height: 1;
      transition: opacity 0.2s;
    }
    .ch-ind-num {
      font-size: 0.62rem;
      opacity: 0.7;
    }
    .ch-ind-dest {
      font-size: 0.78rem;
    }

    /* 保留 pinfo 兼容旧代码（不再用于通道指示） */
    .pinfo {
      position: absolute;
      display: flex;
      align-items: center;
      gap: 3px;
      font-size: 0.92rem;
      font-weight: 700;
      line-height: 1;
      white-space: nowrap;
    }
    .pinfo-up { top: 8px; left: 50%; transform: translateX(-50%); color: var(--portal-up); flex-direction: column; }
    .pinfo-down { bottom: 8px; left: 50%; transform: translateX(-50%); color: var(--portal-down); flex-direction: column-reverse; }
    .pinfo-left { left: 8px; top: 50%; transform: translateY(-50%); color: var(--portal-left); flex-direction: row; }
    .pinfo-right { right: 8px; top: 50%; transform: translateY(-50%); color: var(--portal-right); flex-direction: row-reverse; }
    .pinfo .parrow { font-size: 0.82rem; opacity: 0.8; }
    .pinfo .pnum { font-size: 0.96rem; }


    #room-panel {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      min-width: 280px;
    }
    #current-actor-note {
      font-size: 0.78rem;
      color: var(--text-dim);
      text-align: center;
      line-height: 1.7;
      max-width: 300px;
      min-height: 40px;
    }
    #room-view {
      width: 280px;
      height: 280px;
      background: var(--panel2);
      border: 1px solid var(--border);
      border-radius: 12px;
      position: relative;
      overflow: hidden;
    }
    #room-number {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 5rem;
      font-weight: 900;
      color: rgba(255,255,255,0.04);
      letter-spacing: -0.02em;
      pointer-events: none;
      user-select: none;
    }


    /* 桌面端通道按钮 */
    .channel-bar {
      display: flex;
      gap: 6px;
      justify-content: center;
      margin-top: 8px;
    }
    .ch-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 72px;
      padding: 6px 4px;
      border-radius: 8px;
      border: 1.5px solid var(--ch-color, rgba(255,255,255,0.15));
      background: rgba(0,0,0,0.45);
      color: var(--ch-color, var(--text));
      cursor: pointer;
      transition: transform 0.1s, opacity 0.15s, background 0.15s;
    }
    .ch-btn:hover:not(:disabled) {
      background: rgba(255,255,255,0.08);
      transform: scale(1.04);
    }
    .ch-btn:active:not(:disabled) {
      transform: scale(0.96);
    }
    .ch-btn:disabled {
      opacity: 0.35;
      cursor: not-allowed;
    }
    .ch-btn .ch-num {
      font-size: 0.95rem;
      font-weight: 800;
      line-height: 1.2;
    }
    .ch-btn .ch-dest {
      font-size: 0.68rem;
      font-weight: 600;
      color: var(--text-dim);
      margin-top: 2px;
    }

    .stay-btn {
      position: absolute;
      right: 12px;
      bottom: 12px;
      padding: 7px 10px;
      border-radius: 8px;
      border: 1px solid rgba(255,255,255,0.12);
      background: rgba(0,0,0,0.48);
      color: var(--text);
      font-size: 0.72rem;
      font-weight: 700;
      cursor: pointer;
      transition: transform 0.1s, opacity 0.15s, background 0.15s;
      z-index: 2;
    }
    .stay-btn:hover:not(:disabled) {
      background: rgba(255,255,255,0.08);
      transform: scale(1.04);
    }
    .stay-btn:disabled {
      opacity: 0.45;
      cursor: not-allowed;
      transform: none;
    }

    #actor-in-room {

      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 2.8rem;
      pointer-events: none;
      font-weight: 900;
      text-shadow: 0 0 12px rgba(255,255,255,0.25);
    }

    #teleport-flash {
      position: absolute;
      inset: 0;
      background: rgba(108,99,255,0.0);
      pointer-events: none;
      transition: background 0.15s;
      border-radius: 12px;
      z-index: 10;
    }
    #teleport-flash.flash {
      background: rgba(108,99,255,0.35);
    }

    #side-panel {
      display: flex;
      flex-direction: column;
      gap: 12px;
      min-width: 220px;
      max-width: 260px;
    }
    .info-box {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px 14px;
    }
    .info-box h3 {
      font-size: 0.75rem;
      color: var(--text-dim);
      letter-spacing: 0.1em;
      text-transform: uppercase;
      margin-bottom: 10px;
    }
    #path-panel {
      width: 100%;
      max-width: 612px;
      margin-top: 4px;
    }
    .legend-item {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
      font-size: 0.78rem;
    }
    .leg-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      flex-shrink: 0;
    }
    .info-note {
      margin-top: 8px;
      font-size: 0.72rem;
      color: var(--text-dim);
      line-height: 1.75;
    }
    #path-status {
      font-size: 0.82rem;
      color: var(--text);
      line-height: 1.85;
    }
    #path-route {
      margin-top: 10px;
      min-height: 28px;
      font-size: 0.78rem;
      color: var(--text-dim);
      line-height: 1.9;
      word-break: break-word;
    }
    .path-route-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .path-route-item {
      padding: 10px 12px;
      border-radius: 10px;
      background: rgba(255,255,255,0.03);
      border: 1px solid rgba(255,255,255,0.08);
    }
    .path-route-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 6px;
      flex-wrap: wrap;
    }
    .path-route-name {
      font-size: 0.8rem;
      font-weight: 800;
    }
    .path-route-meta {
      font-size: 0.72rem;
      color: var(--text-dim);
    }
    .path-route-line {
      font-size: 0.78rem;
      color: var(--text);
      line-height: 1.9;
    }
    .route-arrow {
      font-weight: 800;
      margin: 0 2px;
    }
    #history-list {
      max-height: 180px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 4px;
      scrollbar-width: thin;
      scrollbar-color: var(--border) transparent;
    }
    .hist-entry {
      font-size: 0.76rem;
      color: var(--text-dim);
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }
    .hist-entry .hist-step {
      color: #c9a8ff;
      min-width: 28px;
      font-weight: 700;
    }
    .hist-entry .hist-arrow { font-size: 0.8rem; }
    .hist-entry .hist-actor {
      min-width: 24px;
      font-weight: 800;
    }
    .hist-entry .hist-reason {
      width: 100%;
      margin-left: 34px;
      color: #93a5c6;
      font-size: 0.72rem;
      line-height: 1.6;
    }

    #key-hint {

      font-size: 0.72rem;
      color: var(--text-dim);
      text-align: center;
      line-height: 1.8;
      max-width: 520px;
    }
    #key-hint kbd {
      background: var(--panel2);
      border: 1px solid var(--border);
      border-radius: 4px;
      padding: 1px 5px;
      font-size: 0.7rem;
      color: var(--text);
    }

    .btn {
      padding: 7px 18px;
      border-radius: 6px;
      border: none;
      cursor: pointer;
      font-size: 0.85rem;
      font-weight: 600;
      letter-spacing: 0.05em;
      transition: opacity 0.15s, transform 0.1s;
    }
    .btn:hover { opacity: 0.82; }
    .btn:active { transform: scale(0.96); }
    .btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
      transform: none;
    }
    .btn-primary { background: linear-gradient(135deg, #6c63ff, #e84855); color: #fff; }
    .btn-secondary { background: var(--panel); color: var(--text); border: 1px solid var(--border); }
    .btn-evader { background: linear-gradient(135deg, #37d5ff, #2dd4bf); color: #041018; }
    .btn-hunters { background: linear-gradient(135deg, #ff6b6b, #ffd166); color: #18070a; }

    #overlay {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.85);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 200;
      backdrop-filter: blur(5px);
    }
    #overlay.hidden { display: none; }
    .overlay-box {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 36px 44px;
      text-align: center;
      max-width: 520px;
    }
    .overlay-box h2 {
      font-size: 1.6rem;
      margin-bottom: 12px;
    }
    .overlay-box h2.hunter-win { color: var(--hunter-a); }
    .overlay-box h2.evader-win { color: var(--evader); }
    .overlay-box h2.neutral { color: #a8dadc; }
    .overlay-box p {
      color: var(--text-dim);
      font-size: 0.88rem;
      line-height: 1.8;
      margin-bottom: 22px;
    }
    .portal-legend {
      display: flex;
      gap: 16px;
      justify-content: center;
      margin-bottom: 20px;
      flex-wrap: wrap;
    }
    .pl-item {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 0.78rem;
    }
    .pl-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
    }
    .rounds-setting {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      margin: 12px 0 8px;
      font-size: 0.9rem;
      color: #c9c9e8;
    }
    .rounds-setting label {
      white-space: nowrap;
    }
    .rounds-setting input[type="number"] {
      width: 72px;
      padding: 4px 8px;
      border-radius: 6px;
      border: 1px solid #555;
      background: #1e1e30;
      color: #eee;
      font-size: 1rem;
      text-align: center;
    }
    .overlay-actions {
      display: flex;
      gap: 12px;
      justify-content: center;
      flex-wrap: wrap;
    }

    #graph-modal,
    #rules-modal {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.88);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 300;
      backdrop-filter: blur(4px);
    }
    #graph-modal.hidden,
    #rules-modal.hidden { display: none; }
    #graph-wrap {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
    }
    #graph-canvas {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 12px;
      cursor: pointer;
    }
    #graph-hint {
      font-size: 0.76rem;
      color: var(--text-dim);
      text-align: center;
      line-height: 1.7;
      max-width: 420px;
    }
    #close-graph,
    #close-rules {
      position: absolute;
      top: 20px;
      right: 24px;
      background: var(--panel2);
      border: 1px solid var(--border);
      color: var(--text);
      border-radius: 6px;
      padding: 6px 14px;
      cursor: pointer;
      font-size: 0.85rem;
    }
    #rules-card {
      width: min(560px, calc(100vw - 32px));
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 24px 24px 20px;
      box-shadow: 0 18px 40px rgba(0,0,0,0.36);
    }
    #rules-card h3 {
      font-size: 1rem;
      letter-spacing: 0.08em;
      color: #d7e3ff;
      margin-bottom: 14px;
      text-transform: uppercase;
    }

    /* 职业选择卡片 */
    .class-grid {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin: 16px 0;
      max-height: 320px;
      overflow-y: auto;
      scrollbar-width: thin;
      scrollbar-color: var(--border) transparent;
    }
    .class-card {
      background: rgba(255,255,255,0.03);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px 16px;
      text-align: left;
      line-height: 1.7;
    }
    .class-type {
      font-size: 0.7rem;
      color: var(--text-dim);
      margin-bottom: 2px;
    }
    .class-desc {
      font-size: 0.76rem;
      color: #93a5c6;
      margin: 6px 0 10px;
    }
    .class-card .btn {
      font-size: 0.8rem;
      padding: 5px 14px;
    }

    /* ── 状态栏角色卡片 ── */
    .stat-actor-card {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
      cursor: pointer;
      padding: 4px 8px;
      border-radius: 8px;
      border: 1px solid transparent;
      transition: background 0.15s, border-color 0.15s;
      min-width: 72px;
    }
    .stat-actor-card:hover {
      background: rgba(255,255,255,0.06);
      border-color: rgba(255,255,255,0.12);
    }
    .stat-actor-card .card-icon { font-size: 1.3rem; line-height: 1; }
    .stat-actor-card .card-name { font-size: 0.7rem; color: var(--text-dim); }
    .stat-actor-card .card-room { font-weight: 700; font-size: 1rem; }
    .stat-actor-card .card-charge {
      font-size: 0.64rem;
      padding: 1px 5px;
      border-radius: 999px;
      background: rgba(108,99,255,0.18);
      border: 1px solid rgba(108,99,255,0.28);
      color: #c9a8ff;
      margin-top: 1px;
    }

    /* ── 角色详情弹窗 ── */
    #actor-detail-modal {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.55);
      z-index: 200;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    #actor-detail-modal.hidden { display: none; }
    #actor-detail-card {
      background: var(--panel2);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 24px 28px 20px;
      min-width: 280px;
      max-width: 360px;
    }
    #actor-detail-card h3 {
      font-size: 1.1rem;
      margin-bottom: 10px;
    }
    .detail-row {
      display: flex;
      justify-content: space-between;
      font-size: 0.82rem;
      padding: 5px 0;
      border-bottom: 1px solid var(--border);
      gap: 10px;
    }
    .detail-row:last-of-type { border-bottom: none; }
    .detail-key { color: var(--text-dim); flex-shrink: 0; }
    .detail-val { color: #d7e3ff; text-align: right; }

    /* ── 地图技能特效 ── */
    .skill-fx {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.7rem;
      font-weight: 800;
      border-radius: 14px;
      pointer-events: none;
      z-index: 10;
      animation: skillFxAnim 1.4s ease-out forwards;
    }
    @keyframes skillFxAnim {
      0%   { opacity: 1; transform: scale(1); }
      60%  { opacity: 0.9; transform: scale(1.12); }
      100% { opacity: 0; transform: scale(1.3); }
    }

    /* ── 技能面板 ── */
    #skill-panel {
      margin-top: 0;
    }
    .skill-tag {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 4px;
      background: rgba(108,99,255,0.15);
      border: 1px solid rgba(108,99,255,0.3);
      font-size: 0.72rem;
      color: #c9a8ff;
      margin-right: 6px;
      margin-bottom: 4px;
    }
    .skill-note {
      margin-top: 8px;
      font-size: 0.72rem;
      color: var(--text-dim);
      line-height: 1.7;
    }
    .skill-btn-active {
      background: rgba(108,99,255,0.25) !important;
      border-color: #6c63ff !important;
      color: #c9a8ff !important;
    }

    /* 地图格子上的危险度标记（右上角） */
    .cell-danger {
      position: absolute;
      top: 6px;
      right: 8px;
      font-size: 0.68rem;
      font-weight: 800;
      pointer-events: none;
      z-index: 3;
    }

    /* 地图格子上的陷阱标记 */
    .cell-trap {
      position: absolute;
      bottom: 6px;
      right: 8px;
      font-size: 0.76rem;
      color: #ff6b6b;
      pointer-events: none;
      z-index: 3;
      text-shadow: 0 0 6px rgba(255,107,107,0.5);
    }

    /* 追捕者职业选择：两栏布局 */
    .hunter-class-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin: 14px 0;
    }
    .hunter-class-col {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .hunter-class-col h4 {
      font-size: 0.82rem;
      color: var(--text-dim);
      text-align: center;
      margin-bottom: 4px;
    }
    .hunter-class-col .class-card {
      padding: 10px 12px;
    }

    /* 祈福者累计缩短量 */
    .blessing-total {
      color: #7ee787;
      font-weight: 700;
    }

    @media (max-width: 700px) {
      #main { gap: 14px; }
      #room-view { width: 240px; height: 240px; }
      #overview-map { grid-template-columns: repeat(4, 92px); grid-template-rows: repeat(4, 92px); gap: 8px; }
      .room-cell { width: 92px; height: 92px; font-size: 0.74rem; border-radius: 10px; }
      .room-cell .room-id { font-size: 0.76rem; top: 6px; left: 7px; }
      .actor-markers { gap: 4px; top: 18px; bottom: 22px; }
      .actor-badge { min-width: 24px; padding: 2px 6px; font-size: 0.72rem; }
      .channel-row { gap: 2px; bottom: 3px; }
      .ch-indicator { gap: 1px; font-size: 0.6rem; }
      .ch-ind-num { font-size: 0.52rem; }
      .ch-ind-dest { font-size: 0.65rem; }
      .pinfo { gap: 2px; font-size: 0.7rem; }
      .pinfo-up { top: 5px; }
      .pinfo-down { bottom: 5px; }
      .pinfo-left { left: 5px; }
      .pinfo-right { right: 5px; }
      .pinfo .parrow { font-size: 0.62rem; }
      .pinfo .pnum { font-size: 0.74rem; }
      #path-panel { max-width: 100%; }
      #rules-card { padding: 20px 16px 16px; }
      .overlay-box { padding: 28px 20px; }
    }

    /* ══════════════════════════════════════════
       手机竖屏专用布局（≤480px / 9:16）
       ══════════════════════════════════════════ */
    @media (max-width: 480px) {

      /* ── 全局基础 ── */
      html, body {
        height: 100%;
        overflow: hidden;
      }
      body {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        height: 100dvh;
        overflow: hidden;
      }

      /* ── 隐藏桌面版头部和状态栏 ── */
      header { display: none; }
      #status-bar { display: none; }

      /* ── 主内容区全屏重布局 ── */
      #main {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        gap: 0;
        flex: 1;
        overflow: hidden;
        min-height: 0;
      }

      /* ── 手机顶部信息栏 ── */
      #mobile-topbar {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 6px 10px;
        background: var(--panel);
        border-bottom: 1px solid var(--border);
        gap: 6px;
        flex-shrink: 0;
        min-height: 52px;
      }
      .mob-turn-info {
        display: flex;
        flex-direction: column;
        gap: 1px;
        flex: 1;
        min-width: 0;
      }
      .mob-turn-label {
        font-size: 0.75rem;
        color: var(--text-dim);
        text-transform: uppercase;
        letter-spacing: 0.08em;
      }
      .mob-turn-val {
        font-size: 1.025rem;
        font-weight: 800;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .mob-actor-group {
        display: flex;
        gap: 4px;
        align-items: center;
      }
      .mob-actor-pill {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
        padding: 3px 6px;
        border-radius: 8px;
        border: 1px solid rgba(255,255,255,0.1);
        background: rgba(0,0,0,0.3);
        min-width: 42px;
        cursor: pointer;
      }
      .mob-actor-pill .pill-icon { font-size: 1.125rem; line-height: 1; }
      .mob-actor-pill .pill-room { font-size: 0.845rem; font-weight: 800; }
      .mob-round {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
        padding: 0 4px;
      }
      .mob-round-label { font-size: 0.705rem; color: var(--text-dim); }
      .mob-round-val { font-size: 1.005rem; font-weight: 800; color: #c9a8ff; }
      .mob-topbar-btns {
        display: flex;
        gap: 4px;
        align-items: center;
      }
      .mob-icon-btn {
        background: var(--panel2);
        border: 1px solid var(--border);
        border-radius: 8px;
        color: var(--text);
        font-size: 1.225rem;
        width: 38px;
        height: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.15s;
        padding: 0;
      }
      .mob-icon-btn:hover { background: rgba(255,255,255,0.08); }
      .mob-icon-btn.hidden { display: none; }

      /* ── 中部地图区（占屏幕一半以上） ── */
      #map-panel {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 6px 6px 0;
        overflow: hidden;
        min-height: 0;
      }
      #map-panel .panel-title { display: none; }
      #key-hint { display: none; }
      #path-panel { display: none; }

      #overview-map {
        flex: 1 1 auto;
        display: grid;
        width: 100%;
        max-width: 100vw;
        gap: 3px;
        min-height: 0;
        align-content: start;
      }
      /* 计算格子尺寸：屏幕宽度 / 4 - gap */
      .room-cell {
        width: auto;
        height: auto;
        aspect-ratio: 1;
        font-size: 0.725rem;
        border-radius: 8px;
      }
      .room-cell .room-id { font-size: 0.725rem; top: 3px; left: 4px; }
      .actor-markers { gap: 2px; top: 16px; bottom: 18px; }
      .actor-badge { min-width: 18px; padding: 1px 4px; font-size: 0.725rem; }
      .channel-row { gap: 1px; bottom: 2px; }
      .ch-indicator { gap: 0px; font-size: 0.5rem; }
      .ch-ind-num { font-size: 0.44rem; }
      .ch-ind-dest { font-size: 0.55rem; }
      .pinfo { gap: 1px; font-size: 0.705rem; }
      .pinfo-up { top: 2px; }
      .pinfo-down { bottom: 2px; }
      .pinfo-left { left: 2px; }
      .pinfo-right { right: 2px; }
      .pinfo .parrow { font-size: 0.625rem; }
      .pinfo .pnum { font-size: 0.725rem; }

      /* ── 底部操作区 ── */
      #mobile-bottom {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        flex-shrink: 0;
        background: var(--panel);
        border-top: 1px solid var(--border);
      }
      #mobile-bottom-inner {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        min-height: 160px;
        max-height: 200px;
      }
      /* 底部安全区占位：解决系统导航栏遮挡【下】方向按钮 */
      #mobile-bottom-safe {
        height: max(10dvh, env(safe-area-inset-bottom, 32px));
        background: var(--panel);
        flex-shrink: 0;
      }

      /* 左侧：技能面板 */
      #mobile-skill-pane {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        padding: 8px 10px;
        overflow-y: auto;
        border-right: 1px solid var(--border);
        scrollbar-width: none;
        min-width: 0;
      }
      #mobile-skill-pane::-webkit-scrollbar { display: none; }

      /* 右侧：方向控制 */
      #mobile-controls {
        flex: 0 0 160px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px;
        gap: 4px;
      }
      .mob-controls-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
        width: 100%;
        max-width: 200px;
      }
      .mob-ch-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 6px 2px;
        border-radius: 10px;
        border: 1.5px solid var(--ch-color, rgba(255,255,255,0.15));
        background: var(--panel2);
        color: var(--ch-color, var(--text));
        font-size: 0.82rem;
        cursor: pointer;
        transition: background 0.12s, transform 0.08s;
        min-height: 44px;
      }
      .mob-ch-btn:active:not(:disabled) { transform: scale(0.92); }
      .mob-ch-btn:disabled { opacity: 0.3; cursor: not-allowed; }
      .mob-ch-btn .ch-num {
        font-size: 1rem;
        font-weight: 800;
        line-height: 1.1;
      }
      .mob-ch-btn .ch-dest {
        font-size: 0.62rem;
        font-weight: 600;
        color: var(--text-dim);
        margin-top: 1px;
      }
      .mob-ch-btn.mob-stay-btn {
        border-color: rgba(168,218,220,0.4);
        color: #a8dadc;
      }
      .mob-ctrl-row {
        display: flex;
        gap: 4px;
        align-items: center;
        justify-content: center;
      }
      .mob-dir-btn {
        width: 44px;
        height: 44px;
        border-radius: 10px;
        border: 1px solid var(--border);
        background: var(--panel2);
        color: var(--text);
        font-size: 1.2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.12s, transform 0.08s;
        position: relative;
        flex-direction: column;
        gap: 1px;
      }
      .mob-dir-btn:active:not(:disabled) { transform: scale(0.9); }
      .mob-dir-btn:disabled { opacity: 0.35; cursor: not-allowed; }
      .mob-dir-btn .dir-dest {
        font-size: 0.675rem;
        font-weight: 700;
        opacity: 0.85;
      }
      .mob-dir-btn.dir-up { border-color: var(--portal-up); }
      .mob-dir-btn.dir-up:not(:disabled):hover { background: rgba(167,139,250,0.15); }
      .mob-dir-btn.dir-down { border-color: var(--portal-down); }
      .mob-dir-btn.dir-down:not(:disabled):hover { background: rgba(251,146,60,0.15); }
      .mob-dir-btn.dir-left { border-color: var(--portal-left); }
      .mob-dir-btn.dir-left:not(:disabled):hover { background: rgba(96,165,250,0.15); }
      .mob-dir-btn.dir-right { border-color: var(--portal-right); }
      .mob-dir-btn.dir-right:not(:disabled):hover { background: rgba(244,114,182,0.15); }
      .mob-dir-btn.dir-stay {
        width: 44px; height: 32px;
        border-color: rgba(255,255,255,0.15);
        font-size: 0.845rem;
      }
      .mob-skill-btn {
        width: 44px; height: 32px;
        border-radius: 8px;
        border: 1px solid rgba(108,99,255,0.4);
        background: rgba(108,99,255,0.12);
        color: #c9a8ff;
        font-size: 0.805rem;
        font-weight: 700;
        cursor: pointer;
        transition: background 0.12s;
      }
      .mob-skill-btn:disabled { opacity: 0.35; cursor: not-allowed; }
      .mob-skill-btn.active-skill { background: rgba(108,99,255,0.35); border-color: #6c63ff; }

      /* 技能面板手机内容 */
      .mob-skill-name {
        font-size: 0.845rem;
        font-weight: 800;
        margin-bottom: 4px;
        color: #d7e3ff;
      }
      .mob-skill-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 5px; }
      .mob-skill-tag {
        font-size: 0.725rem;
        padding: 1px 6px;
        border-radius: 4px;
        background: rgba(108,99,255,0.15);
        border: 1px solid rgba(108,99,255,0.3);
        color: #c9a8ff;
      }
      .mob-skill-note {
        font-size: 0.775rem;
        color: var(--text-dim);
        line-height: 1.6;
      }

      /* ── 隐藏桌面版面板 ── */
      #room-panel { display: none !important; }
      #side-panel { display: none !important; }

      /* ── 二级浮层（行动记录/路径/全知图） ── */
      #mob-sheet {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: var(--panel2);
        border-top: 1px solid var(--border);
        border-radius: 16px 16px 0 0;
        z-index: 400;
        display: flex;
        flex-direction: column;
        max-height: 70vh;
        transform: translateY(100%);
        transition: transform 0.28s cubic-bezier(0.32,0.72,0,1);
      }
      #mob-sheet.open { transform: translateY(0); }
      #mob-sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px 8px;
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
      }
      #mob-sheet-tabs {
        display: flex;
        gap: 6px;
      }
      .mob-sheet-tab {
        padding: 4px 12px;
        border-radius: 6px;
        border: 1px solid var(--border);
        background: transparent;
        color: var(--text-dim);
        font-size: 0.875rem;
        cursor: pointer;
        transition: background 0.12s, color 0.12s;
      }
      .mob-sheet-tab.active {
        background: rgba(108,99,255,0.2);
        border-color: rgba(108,99,255,0.4);
        color: #c9a8ff;
      }
      #mob-sheet-close {
        background: none;
        border: none;
        color: var(--text-dim);
        font-size: 1.2rem;
        cursor: pointer;
        padding: 0 4px;
      }
      #mob-sheet-body {
        flex: 1;
        overflow-y: auto;
        padding: 12px 16px;
        scrollbar-width: thin;
        scrollbar-color: var(--border) transparent;
      }

      /* ── overlay / 职业选择满屏 ── */
      .overlay-box {
        width: 100%;
        max-width: 100%;
        height: 100dvh;
        border-radius: 0;
        padding: 20px 16px;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
      }
      .overlay-box h2 { font-size: 1.425rem; margin-bottom: 8px; }
      .overlay-box p { font-size: 0.925rem; margin-bottom: 14px; }

      /* 职业选择网格：满屏单列 */
      .class-grid {
        max-height: none;
        flex: 1;
        overflow-y: auto;
      }
      .hunter-class-grid {
        grid-template-columns: 1fr;
      }
      .class-card { padding: 12px 14px; }
      .class-desc { font-size: 0.905rem; }

      /* 职业选择按钮行 */
      .overlay-actions {
        flex-direction: column;
        gap: 10px;
        margin-top: auto;
        padding-top: 12px;
      }
      .overlay-actions .btn { width: 100%; padding: 12px; font-size: 1.075rem; }

      /* rounds setting */
      .rounds-setting {
        font-size: 0.945rem;
        flex-wrap: wrap;
        justify-content: center;
      }

      /* 弹窗全屏 */
      #graph-modal, #rules-modal {
        align-items: flex-end;
      }
      #rules-card {
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 80vh;
        overflow-y: auto;
      }
      #graph-wrap {
        width: 100%;
        padding: 16px;
        background: var(--panel);
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        overflow-y: auto;
      }
      #graph-canvas {
        width: calc(100vw - 32px) !important;
        height: calc(100vw - 32px) !important;
      }
      #close-graph, #close-rules {
        position: static;
        margin-top: 12px;
        width: 100%;
        text-align: center;
        padding: 10px;
      }
      #actor-detail-card {
        width: calc(100vw - 32px);
        max-width: none;
      }

      /* 胜负overlay */
      #overlay { align-items: flex-end; }
    }

