
      :root {
        --ink: #272039;
        --ink-soft: #756d83;
        --night: #17142d;
        --night-2: #292044;
        --paper: #fffaf0;
        --paper-2: #f7ead8;
        --amber: #f2b968;
        --rose: #e96f8e;
        --mint: #88c8a7;
        --danger: #d95770;
        --line: rgba(64, 43, 79, 0.14);
        --shadow: 0 18px 48px rgba(24, 15, 39, 0.24);
        --safe-bottom: max(14px, env(safe-area-inset-bottom));
      }

      * {
        box-sizing: border-box;
      }

      html,
      body {
        margin: 0;
        min-height: 100%;
        background: #100d20;
        color: var(--ink);
        font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
      }

      body {
        min-height: 100dvh;
        display: grid;
        place-items: center;
        overflow-x: hidden;
        overflow-y: auto;
      }

      ::selection {
        color: #4d2638;
        background: #ffd2de;
      }

      .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
      }

      button,
      input,
      select,
      textarea {
        font: inherit;
      }

      button {
        -webkit-tap-highlight-color: transparent;
      }

      button:focus-visible,
      summary:focus-visible {
        outline: 3px solid rgba(173, 89, 117, 0.46);
        outline-offset: 3px;
      }

      .game-shell {
        width: min(100vw, 430px);
        height: 100dvh;
        min-height: 620px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        position: relative;
        background: #fffaf4;
        box-shadow: 0 0 70px rgba(0, 0, 0, 0.44);
      }

      @media (max-height: 619px) {
        body { place-items: start center; }
      }

      .secret-chip {
        position: absolute;
        left: 50%;
        bottom: 78px;
        z-index: 9;
        transform: translateX(-50%);
        min-height: 34px;
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 999px;
        padding: 0 12px;
        color: #fff8ea;
        background: rgba(24, 17, 41, 0.76);
        box-shadow: 0 6px 16px rgba(24, 15, 39, 0.26);
        backdrop-filter: blur(8px);
        font-size: 12px;
        cursor: pointer;
      }

      .secret-chip[hidden] {
        display: none;
      }

      .room-stage {
        position: relative;
        min-height: 0;
        flex: 1 1 auto;
        overflow: hidden;
        isolation: isolate;
        background-image:
          linear-gradient(180deg, rgba(255, 255, 255, 0.02) 30%, rgba(62, 43, 51, 0.03) 60%, rgba(55, 38, 46, 0.18) 100%),
          url("assets/heroine-home-background.png");
        background-size: cover;
        background-position: center 35%;
      }

      .room-stage::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        background:
          radial-gradient(circle at 50% 54%, rgba(255, 231, 210, 0.05), transparent 42%),
          linear-gradient(180deg, rgba(255, 255, 255, 0) 36%, rgba(68, 43, 51, 0.16) 100%);
      }

      .table {
        display: none;
      }

      .seat {
        position: absolute;
        width: 88px;
        margin: 0;
        text-align: center;
        transition: transform 180ms ease, filter 180ms ease, opacity 180ms ease;
        z-index: 2;
      }

      .seat[data-id="qiyu"] {
        left: calc(50% - 39px);
        top: 25%;
        width: 78px;
        z-index: 3;
      }

      .seat[data-id="qinche"] {
        left: 13%;
        top: 40%;
        width: 86px;
        z-index: 4;
      }

      .seat[data-id="shenxinghui"] {
        right: 13%;
        top: 40%;
        width: 86px;
        z-index: 4;
      }

      .seat[data-id="lishen"] {
        left: 3%;
        top: 64%;
        width: 94px;
        z-index: 6;
      }

      .seat[data-id="xiayizhou"] {
        right: 3%;
        top: 64%;
        width: 94px;
        z-index: 6;
      }

      .avatar-window {
        position: relative;
        width: 100%;
        height: auto;
        aspect-ratio: 192 / 208;
        margin: 0 auto;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
      }

      .avatar-window::after {
        content: "";
        position: absolute;
        left: 16%;
        right: 16%;
        bottom: 2px;
        z-index: 0;
        height: 10px;
        border-radius: 50%;
        background: rgba(66, 45, 51, 0.24);
        filter: blur(4px);
      }

      .avatar-window img {
        position: relative;
        z-index: 1;
        display: block;
        width: 100%;
        height: auto;
        left: auto;
        top: auto;
        transform: none;
        filter: drop-shadow(0 7px 5px rgba(62, 41, 49, 0.2));
        user-select: none;
        pointer-events: none;
      }

      .avatar-sprite-viewport {
        position: relative;
        z-index: 1;
        width: 100%;
        height: 100%;
        overflow: hidden;
        filter: drop-shadow(0 7px 5px rgba(62, 41, 49, 0.2));
      }

      .avatar-sprite-track.speaking {
        position: absolute;
        left: 0;
        top: 0;
        width: 800%;
        max-width: none;
        height: 100%;
        animation: character-speaking 1.333s steps(8, end) infinite;
        will-change: transform;
      }

      @keyframes character-speaking {
        to { transform: translateX(-100%); }
      }

      .seat figcaption {
        display: inline-flex;
        align-items: center;
        min-height: 23px;
        position: relative;
        z-index: 3;
        margin-top: -8px;
        padding: 2px 9px;
        color: #fff;
        border-radius: 999px;
        background: rgba(31, 22, 46, 0.78);
        backdrop-filter: blur(8px);
        font-size: 11px;
        font-weight: 700;
        box-shadow: 0 4px 10px rgba(24, 14, 34, 0.18);
      }

      .seat.active {
        transform: translateY(-7px) scale(1.05);
        z-index: 5;
      }

      .seat.active .avatar-window {
        border-color: transparent;
        box-shadow: none;
      }

      .seat.active .avatar-window img {
        filter:
          drop-shadow(0 0 9px rgba(255, 154, 187, 0.96))
          drop-shadow(0 8px 6px rgba(62, 41, 49, 0.24));
      }

      .seat.accused {
        animation: nudge 360ms ease;
      }

      .seat.eliminated {
        filter: grayscale(0.85);
        opacity: 0.52;
        transform: scale(0.9);
      }

      .seat.eliminated figcaption::after {
        content: " · 场边";
        color: rgba(255, 255, 255, 0.7);
        font-weight: 500;
      }

      .reaction-badge {
        position: absolute;
        right: -2px;
        top: -6px;
        min-width: 27px;
        height: 27px;
        display: grid;
        place-items: center;
        border-radius: 50%;
        color: #493046;
        background: #fff2bc;
        border: 2px solid #fff;
        font-size: 14px;
        font-weight: 900;
        transform: scale(0);
        transition: transform 160ms ease;
      }

      .seat.suspicious .reaction-badge,
      .seat.accused .reaction-badge {
        transform: scale(1);
      }

      .player-seat {
        position: absolute;
        left: 50%;
        bottom: 24px;
        z-index: 6;
        width: 58px;
        height: 58px;
        transform: translateX(-50%);
        border: 3px solid rgba(255, 255, 255, 0.9);
        border-radius: 50%;
        background: linear-gradient(145deg, #e76b8b, #7961b8);
        box-shadow: 0 9px 22px rgba(43, 27, 61, 0.38);
        transition: transform 180ms ease, opacity 180ms ease, filter 180ms ease;
      }

      .player-seat img {
        display: block;
        width: 100%;
        height: 100%;
        border-radius: 50%;
        object-fit: cover;
        object-position: 50% 42%;
      }

      .player-seat::after {
        content: "你的座位";
        position: absolute;
        white-space: nowrap;
        bottom: -17px;
        font-size: 9px;
        font-weight: 600;
        color: rgba(255, 255, 255, 0.85);
      }

      .player-seat.active {
        transform: translateX(-50%) translateY(-6px) scale(1.08);
        box-shadow: 0 0 0 5px rgba(255, 205, 117, 0.25), 0 10px 24px rgba(43, 27, 61, 0.5);
      }

      .player-seat.eliminated {
        filter: grayscale(1);
        opacity: 0.52;
      }

      .player-seat.accused {
        animation: player-nudge 360ms ease;
      }

      .interaction-panel {
        position: relative;
        z-index: 20;
        flex: 0 0 clamp(280px, 42dvh, 360px);
        display: flex;
        flex-direction: column;
        min-height: 0;
        margin-top: -14px;
        overflow: hidden;
        border-radius: 22px 22px 0 0;
        background: rgba(255, 250, 244, 0.97);
        border-top: 1px solid rgba(78, 53, 83, 0.12);
        box-shadow: 0 -8px 22px rgba(46, 31, 59, 0.1);
        backdrop-filter: blur(12px);
      }

      .dialogue-panel {
        position: relative;
        z-index: 1;
        min-height: 0;
        flex: 0 0 auto;
        padding: 14px 16px 8px;
        background: transparent;
        border: 0;
        overflow: visible;
        pointer-events: none;
      }

      .bubble {
        min-height: 60px;
        position: relative;
        padding: 10px 12px;
        border: 1px solid var(--line);
        border-radius: 18px 18px 18px 7px;
        background: rgba(255, 252, 248, 0.92);
        box-shadow: 0 6px 18px rgba(59, 39, 48, 0.12);
        backdrop-filter: blur(10px);
      }

      .speaker-name {
        display: flex;
        align-items: center;
        gap: 7px;
        margin: 0 0 5px;
        color: #9b536d;
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0.04em;
      }

      .speaker-name::before {
        content: "";
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--rose);
        box-shadow: 0 0 0 4px rgba(233, 111, 142, 0.12);
      }

      .speech-text {
        margin: 0;
        color: var(--ink);
        font-size: 15px;
        line-height: 1.5;
        font-weight: 600;
      }

      .speech-text.thinking::after {
        content: "···";
        display: inline-block;
        width: 1.5em;
        overflow: hidden;
        vertical-align: bottom;
        animation: thinking-dots 900ms steps(4, end) infinite;
      }

      .mini-log {
        display: flex;
        align-items: center;
        gap: 6px;
        height: 29px;
        margin-top: 7px;
        overflow: hidden;
        pointer-events: auto;
      }

      .mini-log:empty {
        display: none;
      }

      .log-item {
        min-width: 0;
        max-width: 48%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding: 4px 8px;
        border-radius: 999px;
        background: rgba(87, 68, 104, 0.08);
        color: var(--ink-soft);
        font-size: 10px;
      }

      .control-dock {
        min-height: 0;
        position: relative;
        z-index: 1;
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        max-height: none;
        overflow: hidden;
        margin-top: 0;
        padding: 0;
        border-radius: 0;
        background: transparent;
        border-top: 1px solid rgba(78, 53, 83, 0.12);
        box-shadow: none;
        backdrop-filter: none;
      }

      .control-content {
        min-height: 0;
        flex: 1 1 auto;
        overflow-y: auto;
        padding: 12px 16px 8px;
        scrollbar-width: none;
      }

      .control-content::-webkit-scrollbar {
        display: none;
      }

      .control-action {
        flex: 0 0 auto;
        padding: 10px 16px var(--safe-bottom);
        background: rgba(255, 250, 244, 0.98);
        border-top: 1px solid rgba(78, 53, 83, 0.08);
      }

      .control-action .primary-button {
        display: block;
      }

      .control-title {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        align-items: baseline;
        margin-bottom: 10px;
      }

      .control-title strong {
        font-size: 14px;
      }

      .control-title span {
        color: var(--ink-soft);
        font-size: 11px;
      }

      .primary-button,
      .secondary-button {
        width: 100%;
        min-height: 48px;
        border-radius: 15px;
        border: 0;
        cursor: pointer;
        font-weight: 800;
        transition: transform 120ms ease, filter 120ms ease;
      }

      .primary-button {
        color: #fff;
        background: linear-gradient(135deg, #e96888, #8566bd);
        box-shadow: 0 9px 20px rgba(156, 79, 126, 0.25);
      }

      .secondary-button {
        color: #664a6d;
        background: #f2e7de;
        border: 1px solid rgba(82, 57, 87, 0.12);
      }

      .primary-button:active,
      .secondary-button:active,
      .vote-choice:active {
        transform: translateY(1px) scale(0.995);
      }

      .primary-button:disabled,
      .secondary-button:disabled {
        cursor: default;
        filter: grayscale(0.5);
        opacity: 0.5;
      }

      .word-card {
        display: grid;
        place-items: center;
        min-height: 88px;
        margin-bottom: 10px;
        padding: 13px;
        border-radius: 18px;
        color: #4d3654;
        background:
          linear-gradient(135deg, rgba(255, 255, 255, 0.76), rgba(255, 242, 212, 0.9)),
          repeating-linear-gradient(90deg, transparent 0 17px, rgba(197, 146, 90, 0.08) 17px 18px);
        border: 1px solid rgba(143, 95, 79, 0.18);
      }

      .word-card small {
        color: #9c7780;
        font-size: 10px;
        letter-spacing: 0.1em;
      }

      .word-card b {
        margin-top: 2px;
        font-size: 26px;
        letter-spacing: 0.12em;
      }

      .rule-hint {
        margin: 0 0 10px;
        color: var(--ink-soft);
        font-size: 12px;
        line-height: 1.45;
      }

      .input-wrap {
        display: grid;
        gap: 7px;
      }

      .input-wrap label {
        color: #55455f;
        font-size: 12px;
        font-weight: 800;
      }

      textarea,
      input[type="password"],
      select {
        width: 100%;
        padding: 11px 12px;
        border-radius: 14px;
        border: 1px solid rgba(84, 58, 90, 0.18);
        color: var(--ink);
        background: #fffdf8;
        outline: none;
        font-size: 15px;
        line-height: 1.45;
      }

      textarea {
        min-height: 72px;
        resize: none;
      }

      input[type="password"] {
        min-height: 48px;
      }

      select {
        min-height: 44px;
      }

      .word-pack-picker {
        margin-bottom: 10px;
      }

      textarea:focus,
      input[type="password"]:focus,
      select:focus {
        border-color: #b27196;
        box-shadow: 0 0 0 3px rgba(178, 113, 150, 0.13);
      }

      .error-text {
        min-height: 18px;
        margin: 0;
        color: var(--danger);
        font-size: 11px;
        font-weight: 700;
      }

      .vote-grid {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 6px;
      }

      .vote-choice {
        min-width: 0;
        min-height: 78px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 5px 2px;
        border: 1px solid rgba(81, 56, 89, 0.12);
        border-radius: 13px;
        color: #58405f;
        background: #fffdf8;
        cursor: pointer;
        font-size: 10px;
        font-weight: 800;
      }

      .vote-choice img {
        width: 38px;
        height: 42px;
        object-fit: cover;
        object-position: 50% 6%;
        border-radius: 12px;
        background: #f1e2d7;
      }

      .vote-choice.player-target .mini-player {
        width: 38px;
        height: 38px;
        display: grid;
        place-items: center;
        border-radius: 12px;
        color: #fff;
        background: linear-gradient(145deg, #e76b8b, #7961b8);
      }

      .vote-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        margin: 0 0 10px;
      }

      .vote-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        min-height: 30px;
        padding: 5px 9px;
        border-radius: 10px;
        color: #5e4a63;
        background: #f3e9df;
        font-size: 11px;
      }

      .vote-row b {
        color: #9c506b;
      }

      .pk-strip {
        margin: 0 0 10px;
        padding: 9px 11px;
        border-radius: 12px;
        color: #724655;
        background: #fff0d0;
        border: 1px solid rgba(210, 142, 70, 0.22);
        font-size: 12px;
        font-weight: 700;
      }

      .result-card {
        text-align: center;
      }

      .result-details {
        margin-bottom: 10px;
        overflow: hidden;
        border: 1px solid rgba(116, 85, 111, 0.12);
        border-radius: 14px;
        background: #f3e8dd;
      }

      .result-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-height: 48px;
        padding: 9px 12px;
        list-style: none;
        text-align: left;
        cursor: pointer;
      }

      .result-summary::-webkit-details-marker {
        display: none;
      }

      .result-summary-copy {
        display: grid;
        min-width: 0;
        gap: 1px;
      }

      .result-summary-copy strong {
        color: #4d3657;
        font-size: 15px;
      }

      .result-summary-copy small {
        color: var(--ink-soft);
        font-size: 10px;
      }

      .result-summary-action {
        flex: none;
        color: #9b536d;
        font-size: 11px;
        font-weight: 800;
      }

      .result-details[open] .result-summary {
        border-bottom: 1px solid rgba(116, 85, 111, 0.1);
      }

      .result-body {
        padding: 10px 10px 1px;
      }

      .result-body > p {
        margin: 0 0 10px;
        color: var(--ink-soft);
        font-size: 12px;
      }

      .answer-pair {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 7px;
        margin-bottom: 10px;
      }

      .answer-box {
        padding: 9px 6px;
        border-radius: 12px;
        background: #f3e8dd;
        font-size: 11px;
        color: #7b657c;
      }

      .answer-box b {
        display: block;
        margin-top: 2px;
        color: #4c3753;
        font-size: 16px;
      }

      .roles-line {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
        margin-bottom: 11px;
      }

      .role-chip {
        padding: 4px 7px;
        border-radius: 999px;
        color: #66556c;
        background: #eee4dc;
        font-size: 10px;
      }

      .role-chip.undercover {
        color: #fff;
        background: #9b5873;
      }

      .toast {
        position: absolute;
        left: 50%;
        top: 70px;
        z-index: 30;
        max-width: calc(100% - 44px);
        transform: translate(-50%, -12px);
        padding: 9px 13px;
        border-radius: 999px;
        color: #fff;
        background: rgba(38, 29, 55, 0.9);
        box-shadow: var(--shadow);
        font-size: 11px;
        opacity: 0;
        pointer-events: none;
        transition: opacity 160ms ease, transform 160ms ease;
      }

      .toast.show {
        opacity: 1;
        transform: translate(-50%, 0);
      }

      @keyframes nudge {
        0%, 100% { transform: translateX(0); }
        30% { transform: translateX(-4px); }
        65% { transform: translateX(4px); }
      }

      @keyframes player-nudge {
        0%, 100% { transform: translateX(-50%); }
        30% { transform: translateX(calc(-50% - 4px)); }
        65% { transform: translateX(calc(-50% + 4px)); }
      }

      @keyframes thinking-dots {
        from { width: 0; }
        to { width: 1.5em; }
      }

      @media (max-height: 700px) {
        .room-stage { min-height: 0; }
        .interaction-panel { flex-basis: clamp(270px, 42dvh, 300px); }
        .dialogue-panel { padding: 10px 11px 6px; }
        .bubble { min-height: 58px; padding: 9px 11px; }
        .speech-text { font-size: 14px; }
        .mini-log { display: none; }
        .seat[data-id="qiyu"] { left: calc(50% - 35px); top: 25%; width: 70px; }
        .seat[data-id="qinche"],
        .seat[data-id="shenxinghui"] { top: 40%; width: 78px; }
        .seat[data-id="lishen"],
        .seat[data-id="xiayizhou"] { top: 65%; width: 86px; }
        .control-dock { max-height: none; }
        .control-content { padding-top: 10px; }
      }

      .disconnect-ai, .sound-toggle {
        position: absolute;
        top: max(8px, env(safe-area-inset-top));
        right: 10px;
        z-index: 10;
        border: 1px solid #ffffff80;
        border-radius: 16px;
        padding: 6px 10px;
        color: #40304b;
        background: #fff9efeb;
        font: inherit;
        font-size: 12px;
        cursor: pointer;
      }

      .sound-toggle { left: 10px; right: auto; min-height: 44px; }
      .sound-toggle:focus-visible { outline: 3px solid #b75d91; outline-offset: 2px; }
      .music-credit {
        position: absolute;
        top: max(13px, env(safe-area-inset-top));
        left: 50%;
        transform: translateX(-50%);
        z-index: 11;
        color: #40304b;
        font-size: 11px;
        background: #fff9efeb;
        border-radius: 12px;
        padding: 4px 7px;
      }
      .music-credit summary { cursor: pointer; white-space: nowrap; }
      .music-credit p { width: min(260px, 75vw); margin: 6px 0 2px; line-height: 1.45; }
      .music-credit a { color: #864d81; }

      @media (min-width: 431px) {
        .game-shell {
          height: min(900px, 100dvh);
          border-radius: 28px;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        *, *::before, *::after {
          animation-duration: 0.01ms !important;
          transition-duration: 0.01ms !important;
        }

        .speech-text.thinking::after {
          width: 1.5em;
          animation: none !important;
        }

        .avatar-sprite-track {
          animation: none !important;
          transform: translateX(0);
        }
      }
    