/* === module: _impression_matrix === */
      /* ===== Impression Matrix Panel ===== */
      .impression-panel {
        flex: 1;
        min-height: 0;
        padding: 10px 16px;
        overflow-y: auto;
        border-bottom: 1px solid #222;
        background: #0d0d14;
      }
      .impression-panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        user-select: none;
        margin-bottom: 6px;
      }
      .impression-panel-header h4 {
        margin: 0;
        font-size: 12px;
        color: #aaa;
        font-weight: 500;
      }
      .impression-panel-header .toggle-arrow {
        font-size: 10px;
        color: #666;
        transition: transform 0.2s;
      }
      .impression-panel.collapsed .imp-matrix-wrap,
      .impression-panel.collapsed .rel-insights {
        max-height: 0;
        overflow: hidden;
        padding-top: 0;
        padding-bottom: 0;
        margin-top: 0;
        border-top-width: 0;
      }
      .impression-panel.collapsed .toggle-arrow {
        transform: rotate(-90deg);
      }

      /* ===== 关系洞察（presentation layer, derived from impression matrix）===== */
      .rel-insights {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px dashed rgba(255, 255, 255, 0.08);
        max-height: 400px;
        overflow: auto;
        transition: max-height 0.3s, padding 0.3s, margin 0.3s;
      }
      .rel-insights-header {
        font-size: 11px;
        color: #aaa;
        letter-spacing: 1px;
        margin-bottom: 8px;
        font-weight: 500;
      }
      .rel-insights-groups {
        display: flex;
        flex-direction: column;
        gap: 6px;
      }
      .rel-group {
        display: flex;
        align-items: flex-start;
        gap: 6px;
        font-size: 11px;
        line-height: 1.5;
      }
      .rel-group-label {
        flex-shrink: 0;
        min-width: 58px;
        color: #888;
        font-size: 10px;
        padding-top: 1px;
      }
      .rel-group-items {
        flex: 1;
        display: flex;
        flex-wrap: wrap;
        gap: 4px 8px;
      }
      .rel-item {
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 10px;
        padding: 1px 8px;
        font-size: 10px;
        color: #ddd;
        white-space: nowrap;
      }
      .rel-item.cp {
        background: rgba(232, 90, 140, 0.12);
        border-color: rgba(232, 90, 140, 0.35);
        color: #f4b8d0;
      }
      .rel-item.crush {
        background: rgba(232, 160, 200, 0.08);
        border-color: rgba(232, 160, 200, 0.25);
        color: #f1cfe0;
      }
      .rel-item.friend {
        background: rgba(120, 180, 140, 0.10);
        border-color: rgba(120, 180, 140, 0.30);
        color: #c5e0cc;
      }
      .rel-item.admire {
        background: rgba(220, 180, 80, 0.10);
        border-color: rgba(220, 180, 80, 0.30);
        color: #e8d59a;
      }
      .rel-item.tension {
        background: rgba(210, 90, 90, 0.10);
        border-color: rgba(210, 90, 90, 0.30);
        color: #e8b0b0;
      }
      .rel-insights-summary {
        margin-top: 10px;
        padding: 8px 10px;
        background: rgba(255, 255, 255, 0.025);
        border-left: 2px solid rgba(255, 255, 255, 0.15);
        border-radius: 2px;
        font-size: 10.5px;
        line-height: 1.6;
        color: #bbb;
      }
      .rel-insights-summary.empty {
        color: #666;
        font-style: italic;
      }

      /* Emoji legend — collapsible cheatsheet so players can decode mood icons. */
      .vibe-legend {
        margin-top: 10px;
        padding-top: 8px;
        border-top: 1px dashed rgba(255, 255, 255, 0.08);
        font-size: 10px;
      }
      .vibe-legend > summary {
        color: #888;
        cursor: pointer;
        user-select: none;
        list-style: none;
        padding: 2px 0;
      }
      .vibe-legend > summary::-webkit-details-marker { display: none; }
      .vibe-legend > summary:hover { color: #ccc; }
      .vibe-legend[open] > summary { color: #ccc; }
      .vibe-legend-grid {
        margin-top: 6px;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 4px 6px;
      }
      .vibe-legend-chip {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 2px 5px;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.06);
        color: #bbb;
        white-space: nowrap;
      }
      .vibe-legend-chip .vlc-emoji {
        font-size: 12px;
        line-height: 1;
      }
      .vibe-legend-chip .vlc-label {
        font-size: 10px;
      }
      .imp-matrix-wrap {
        max-height: 800px;
        overflow: auto;
        transition: max-height 0.3s;
      }
      .imp-matrix {
        border-collapse: collapse;
        width: 100%;
        font-size: 10px;
      }
      .imp-matrix th {
        font-weight: 500;
        color: #888;
        padding: 3px 2px;
        text-align: center;
        font-size: 9px;
        position: sticky;
        top: 0;
        background: #151520;
        z-index: 1;
      }
      .imp-matrix th.row-header {
        text-align: right;
        padding-right: 6px;
        position: sticky;
        left: 0;
        background: #151520;
        z-index: 2;
      }
      .imp-matrix td {
        padding: 3px 2px;
        text-align: center;
        vertical-align: top;
        border: 1px solid #1a1a25;
        position: relative;
        min-width: 40px;
      }
      .imp-matrix td.self-cell {
        background: #0d0d14;
      }
      .imp-matrix td.has-tags {
        cursor: pointer;
      }
      .imp-matrix td.has-tags:hover {
        background: #1e1e2e;
      }
      .imp-cell-flash {
        animation: impFlash 1.2s ease-out;
      }
      @keyframes impFlash {
        0% {
          background: #4dabf730;
        }
        100% {
          background: transparent;
        }
      }
      @keyframes impCellPulse {
        0% {
          transform: scale(1);
          background: #4dabf750;
          box-shadow: 0 0 0 0 #4dabf750;
        }
        50% {
          transform: scale(1.05);
          background: #4dabf730;
          box-shadow: 0 0 8px 2px #4dabf740;
        }
        100% {
          transform: scale(1);
          background: transparent;
          box-shadow: 0 0 0 0 transparent;
        }
      }
      .imp-tag {
        display: inline-block;
        font-size: 9px;
        padding: 1px 5px;
        margin: 1px;
        border-radius: 8px;
        white-space: nowrap;
        position: relative;
        cursor: default;
      }
      .imp-tag[data-feeling="喜欢"] {
        background: #e8415730;
        color: #ffa8a8;
      }
      .imp-tag[data-feeling="厌恶"] {
        background: #86888530;
        color: #adb5bd;
      }
      .imp-tag[data-feeling="崇拜"] {
        background: #f0c04030;
        color: #ffe066;
      }
      .imp-tag[data-feeling="轻蔑"] {
        background: #74541830;
        color: #c09878;
      }
      .imp-tag[data-feeling="依赖"] {
        background: #74c0fc30;
        color: #74c0fc;
      }
      .imp-tag[data-feeling="嫉妒"] {
        background: #a855f730;
        color: #d8b4fe;
      }
      .imp-tag[data-feeling="警惕"] {
        background: #f5900030;
        color: #ffa94d;
      }
      .imp-tag[data-feeling="好奇"] {
        background: #20c99730;
        color: #63e6be;
      }
      .imp-tag[data-feeling="心疼"] {
        background: #e8a0bf30;
        color: #e8a0bf;
      }
      .imp-tag[data-feeling="愧疚"] {
        background: #868e9630;
        color: #adb5bd;
      }
      /* Special style for unknown emotion (partial scan) */
      .imp-tag[data-feeling="???"] {
        background: #e8a04015;
        color: #e8a040;
        border: 1px dashed #e8a04050;
        font-style: italic;
        opacity: 0.8;
      }
      .imp-tag-count {
        font-size: 8px;
        vertical-align: super;
        margin-left: 1px;
        opacity: 0.7;
      }
      .imp-no-tag {
        color: #333;
        font-size: 9px;
      }

      /* Impression tooltip */
      .imp-tooltip {
        display: none;
        position: fixed;
        z-index: 9999;
        background: #1e1e2eee;
        border: 1px solid #3a3a4a;
        border-radius: 6px;
        padding: 8px 10px;
        max-width: 280px;
        font-size: 11px;
        color: #ccc;
        pointer-events: none;
        box-shadow: 0 4px 16px #0008;
      }
      .imp-tooltip.on {
        display: block;
      }
      .imp-tooltip .itp-feeling {
        font-weight: 600;
        margin-bottom: 4px;
      }
      .imp-tooltip .itp-reason {
        color: #aaa;
        line-height: 1.4;
      }
      .imp-tooltip .itp-meta {
        color: #666;
        font-size: 9px;
        margin-top: 4px;
      }

      /* Impression history modal */
      .imp-history-overlay {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 10000;
        background: #000a;
        justify-content: center;
        align-items: center;
      }
      .imp-history-overlay.on {
        display: flex;
      }
      .imp-history-box {
        background: #181825;
        border: 1px solid #333;
        border-radius: 10px;
        padding: 16px 20px;
        max-width: 400px;
        width: 90%;
        max-height: 70vh;
        overflow-y: auto;
        color: #ddd;
      }
      .imp-history-box h4 {
        margin: 0 0 12px;
        font-size: 14px;
        color: #f1f3f5;
      }
      .imp-history-box .close-btn {
        float: right;
        cursor: pointer;
        color: #888;
        font-size: 16px;
      }
      .imp-history-box .close-btn:hover {
        color: #fff;
      }
      .imp-hist-item {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        padding: 6px 0;
        border-bottom: 1px solid #222;
      }
      .imp-hist-item:last-child {
        border-bottom: none;
      }
      .imp-hist-badge {
        font-size: 9px;
        padding: 2px 6px;
        border-radius: 6px;
        white-space: nowrap;
        flex-shrink: 0;
      }
      .imp-hist-badge.new {
        background: #2f9e4430;
        color: #8ce99a;
      }
      .imp-hist-badge.removed {
        background: #c92a2a30;
        color: #ffa8a8;
      }
      .imp-hist-reason {
        flex: 1;
        font-size: 11px;
        color: #aaa;
        line-height: 1.4;
      }
      .imp-hist-meta {
        font-size: 9px;
        color: #555;
        white-space: nowrap;
        flex-shrink: 0;
      }

/* === end module: _impression_matrix === */
