:root {
      --bg: #050506;
      --surface: #111113;
      --surface2: #18181c;
      --border: rgba(255, 255, 255, 0.08);
      --text: #f4f4f5;
      --muted: #a1a1aa;
      --accent: #a855f7;
      --accent2: #ec4899;
      --gold: #eab308;
      --radius: 16px;
      --sidebar-w: 240px;
      --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    }
    * { box-sizing: border-box; }
    html, body { height: 100%; margin: 0; }
    body {
      font-family: var(--font);
      background-color: var(--bg);
      background-image: linear-gradient(180deg, rgba(5, 5, 6, 0.88) 0%, rgba(5, 5, 6, 0.96) 100%),
        url("/static/images/luxury-bedroom.jpg");
      background-size: auto, cover;
      background-position: center top;
      background-attachment: fixed;
      color: var(--text);
      font-size: 14px;
      display: flex;
      min-height: 100vh;
      overflow-x: hidden;
    }

    /* ----- Sidebar ----- */
    .sidebar {
      width: var(--sidebar-w);
      flex-shrink: 0;
      background: var(--surface);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      padding: 20px 14px;
      min-height: 100vh;
    }
    .sb-logo {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 0 8px 20px;
      border-bottom: 1px solid var(--border);
      margin-bottom: 16px;
    }
    .sb-logo-mark {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
      box-shadow: 0 0 24px rgba(168, 85, 247, 0.35);
    }
    .sb-logo span { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }

    .sb-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
    .sb-nav a {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 11px 12px;
      border-radius: 10px;
      color: var(--muted);
      text-decoration: none;
      font-size: 14px;
      transition: background 0.15s, color 0.15s;
    }
    .sb-nav a:hover { background: var(--surface2); color: var(--text); }
    .sb-nav a.active { background: rgba(168, 85, 247, 0.15); color: #fff; font-weight: 600; }
    .sb-nav .ico { width: 22px; text-align: center; opacity: 0.9; }

    .sb-section-label {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--muted);
      padding: 16px 12px 8px;
    }
    .sb-footer {
      border-top: 1px solid var(--border);
      padding-top: 12px;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .sb-footer a {
      padding: 8px 12px;
      border-radius: 8px;
      color: var(--muted);
      text-decoration: none;
      font-size: 13px;
    }
    .sb-footer a:hover { color: var(--text); background: var(--surface2); }

    /* ----- Main ----- */
    .main {
      flex: 1;
      min-width: 0;
      overflow-y: auto;
      padding: 24px 28px 48px;
    }
    .main-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 16px;
      margin-bottom: 28px;
    }
    .main-header h1 {
      margin: 0;
      font-size: 22px;
      font-weight: 700;
      letter-spacing: -0.03em;
    }
    .main-header .sub { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
    .user-bar {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .user-chip {
      font-size: 12px;
      padding: 6px 12px;
      border-radius: 999px;
      background: rgba(45, 212, 191, 0.1);
      border: 1px solid rgba(45, 212, 191, 0.4);
      color: #5eead4;
      max-width: 200px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      cursor: pointer;
    }
    .user-chip:hover { border-color: rgba(45, 212, 191, 0.7); }
    .btn {
      font: inherit;
      cursor: pointer;
      border-radius: 10px;
      padding: 8px 16px;
      border: 1px solid var(--border);
      background: var(--surface2);
      color: var(--text);
      font-size: 13px;
    }
    .btn:hover { background: #27272a; }
    .btn-primary {
      border: none;
      background: linear-gradient(135deg, #7c3aed, #a855f7);
      color: #fff;
    }
    .btn-primary:hover { filter: brightness(1.06); }
    .btn-secondary {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 10px 16px;
      border-radius: 10px;
      border: 1px solid rgba(255, 255, 255, 0.14);
      background: rgba(255, 255, 255, 0.04);
      color: var(--text);
      cursor: pointer;
      font: inherit;
      font-size: 13px;
      font-weight: 600;
    }
    .btn-secondary:hover:not(:disabled) {
      background: rgba(255, 255, 255, 0.08);
      border-color: rgba(255, 255, 255, 0.2);
    }
    .btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

    /* 图二：并排两个大框（会话区 / 资料区 入口） */
    .dual-boxes {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 20px;
      margin-bottom: 36px;
    }
    @media (max-width: 900px) {
      .dual-boxes { grid-template-columns: 1fr; }
    }
    .big-box {
      border-radius: 20px;
      padding: 26px 28px;
      min-height: 168px;
      position: relative;
      overflow: hidden;
      border: 1px solid var(--border);
    }
    .big-box h2 {
      margin: 0 0 10px;
      font-size: 18px;
      font-weight: 700;
      letter-spacing: -0.02em;
    }
    .big-box p {
      margin: 0 0 18px;
      font-size: 13px;
      color: var(--muted);
      line-height: 1.55;
      max-width: 420px;
    }
    .big-box .cta-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
    .big-box-chat {
      background:
        radial-gradient(ellipse 80% 60% at 80% 20%, rgba(139, 92, 246, 0.35), transparent),
        linear-gradient(165deg, #15151a 0%, #0c0c0e 100%);
      border-color: rgba(139, 92, 246, 0.35);
    }
    .big-box-profile {
      background:
        radial-gradient(ellipse 70% 50% at 20% 80%, rgba(236, 72, 153, 0.22), transparent),
        linear-gradient(165deg, #15151a 0%, #0c0c0e 100%);
      border-color: rgba(236, 72, 153, 0.35);
    }
    .pill-mini {
      display: inline-block;
      font-size: 10px;
      font-weight: 700;
      padding: 3px 8px;
      border-radius: 6px;
      margin-bottom: 10px;
      letter-spacing: 0.04em;
    }
    .pill-mini.chat { background: rgba(139, 92, 246, 0.35); color: #e9d5ff; }
    .pill-mini.profile { background: rgba(236, 72, 153, 0.28); color: #fbcfe8; }

    /* ----- Character grid ----- */
    .section-title {
      font-size: 13px;
      font-weight: 600;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.06em;
      margin-bottom: 16px;
    }
    .card-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 18px;
    }
    .char-card {
      position: relative;
      border-radius: 18px;
      overflow: hidden;
      aspect-ratio: 3 / 4;
      cursor: pointer;
      border: 1px solid var(--border);
      background: var(--surface2);
      transition: transform 0.2s, box-shadow 0.2s;
    }
    .char-card:hover {
      transform: translateY(-3px);
      box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    }
    .char-card img.cover {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .char-card .badge {
      position: absolute;
      top: 12px;
      right: 12px;
      font-size: 11px;
      font-weight: 700;
      padding: 4px 10px;
      border-radius: 999px;
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .char-card .badge.new {
      background: linear-gradient(135deg, #ec4899, #f472b6);
      color: #fff;
      box-shadow: 0 4px 14px rgba(236, 72, 153, 0.45);
    }
    .char-card .badge.series {
      background: rgba(30, 30, 35, 0.85);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: #e4e4e7;
    }
    .char-card .overlay {
      position: absolute;
      inset: 0;
      background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, transparent 55%);
      pointer-events: none;
    }
    .char-card .meta {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      padding: 16px 14px 14px;
      pointer-events: none;
    }
    .char-card .meta .name {
      font-weight: 700;
      font-size: 15px;
      margin-bottom: 6px;
      text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
    }
    .char-card .meta .hook {
      font-size: 12px;
      color: #d4d4d8;
      line-height: 1.45;
      display: -webkit-box;
      line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .group-teaser {
      grid-column: 1 / -1;
      max-width: none;
      aspect-ratio: auto;
      min-height: 140px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      background:
        linear-gradient(135deg, rgba(236, 72, 153, 0.15), rgba(59, 130, 246, 0.12)),
        #121215;
      border: 1px dashed rgba(236, 72, 153, 0.4);
    }
    .group-teaser .neon {
      font-size: clamp(22px, 4vw, 34px);
      font-weight: 800;
      letter-spacing: 0.06em;
      background: linear-gradient(90deg, #f472b6, #60a5fa, #c084fc);
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
      margin-bottom: 8px;
    }
    .group-teaser p { margin: 0; font-size: 13px; color: var(--muted); }

    .sb-nav a.sb-nav-coins { margin-top: 8px; }
    .sb-nav a.sb-nav-coins .ico--gold { color: var(--gold); }
    .btn.btn-cta-inline {
      text-decoration: none;
      display: inline-flex;
      align-items: center;
    }
    .group-teaser.char-card--static {
      cursor: default;
    }
    .char-card .cover.cover--gradient-ph {
      min-height: 100%;
      background: linear-gradient(160deg, #3f3f46, #18181b);
    }

    .user-profile-dialog {
      border: none;
      border-radius: 18px;
      padding: 0;
      background: #141418;
      color: var(--text);
      max-width: 400px;
      width: 92vw;
      box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    }
    .user-profile-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
    .user-profile-dialog .gift-dialog-inner { padding: 18px; }
    .user-profile-dialog .gift-dialog-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12px;
    }
    .user-profile-dialog .gift-dialog-head h2 { margin: 0; font-size: 17px; }
    .user-profile-dialog .gift-dialog-x {
      border: none;
      background: transparent;
      color: var(--muted);
      font-size: 22px;
      cursor: pointer;
    }
    .user-profile-body { display: flex; flex-direction: column; gap: 12px; }
    .user-profile-row { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
    .user-profile-row .v2-muted { color: var(--muted); font-size: 11px; }
    .user-profile-id {
      padding: 10px 12px;
      border-radius: 10px;
      background: rgba(0, 0, 0, 0.25);
      border: 1px solid var(--border);
      font-family: ui-monospace, Consolas, monospace;
      font-size: 13px;
      color: #a7f3d0;
      word-break: break-all;
    }
    .user-profile-copy-hint { margin: 0; font-size: 12px; color: var(--muted); }
    .user-profile-copy-hint.is-ok { color: #86efac; }

    .char-card--random-encounter {
      cursor: pointer;
      outline: 1px solid rgba(236, 72, 153, 0.35);
    }
    .char-card--random-encounter:hover {
      outline-color: rgba(236, 72, 153, 0.65);
      box-shadow: 0 8px 32px rgba(236, 72, 153, 0.2);
    }

    .char-card--companion-npc {
      cursor: pointer;
      outline: 1px solid rgba(168, 85, 247, 0.35);
    }
    .char-card--companion-npc:hover {
      outline-color: rgba(168, 85, 247, 0.65);
      box-shadow: 0 8px 32px rgba(168, 85, 247, 0.18);
    }
    .char-card-delete {
      position: absolute;
      top: 10px;
      left: 10px;
      z-index: 3;
      width: 28px;
      height: 28px;
      border: none;
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.55);
      color: #fecaca;
      font-size: 16px;
      line-height: 1;
      cursor: pointer;
      opacity: 0;
      transition: opacity 0.15s ease, background 0.15s ease;
    }
    .char-card--companion-npc:hover .char-card-delete,
    .char-card-delete:focus-visible {
      opacity: 1;
    }
    .char-card-delete:hover {
      background: rgba(127, 29, 29, 0.85);
      color: #fff;
    }

    .re-companion-delete {
      margin-right: auto;
      color: #fecaca;
      border-color: rgba(248, 113, 113, 0.35);
    }
    .re-companion-delete:hover {
      background: rgba(127, 29, 29, 0.35);
      border-color: rgba(248, 113, 113, 0.55);
    }
    .re-actions--companion {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .random-encounter-dialog {
      border: none;
      border-radius: 18px;
      padding: 0;
      background: #141418;
      color: var(--text);
      width: min(92vw, 320px);
      max-width: 320px;
      height: fit-content;
      max-height: min(92vh, 640px);
      box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
      overflow: hidden;
    }
    .random-encounter-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
    .random-encounter-dialog .gift-dialog-inner {
      display: flex;
      flex-direction: column;
      height: fit-content;
      max-height: min(92vh, 640px);
      padding: 12px 12px 8px;
      box-sizing: border-box;
      overflow: hidden;
    }
    .random-encounter-dialog .gift-dialog-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 8px;
      flex-shrink: 0;
    }
    .random-encounter-dialog .re-companion-stage {
      flex: 0 0 auto;
      overflow: hidden;
    }
    .random-encounter-dialog .gift-dialog-inner.re-phase-ready .re-companion-stage,
    .random-encounter-dialog .gift-dialog-inner.re-phase-confirmed .re-companion-stage {
      flex: 1 1 auto;
      min-height: 0;
      overflow: hidden;
    }
    .random-encounter-dialog .re-npc-scroll {
      flex: 0 0 auto;
      overflow: hidden;
      margin: 0;
      padding: 0;
    }
    .random-encounter-dialog .re-npc-scroll--blank {
      flex: 0 0 auto;
      overflow: hidden;
    }
    .random-encounter-dialog .gift-dialog-head h2 { margin: 0 0 2px; font-size: 15px; }
    .random-encounter-dialog .re-sub { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.35; }
    .random-encounter-dialog .gift-dialog-x {
      border: none;
      background: transparent;
      color: var(--muted);
      font-size: 22px;
      cursor: pointer;
      flex-shrink: 0;
    }
    .re-mood {
      margin-bottom: 8px;
      padding: 8px 10px;
      border-radius: 10px;
      background: rgba(168, 85, 247, 0.1);
      border: 1px solid rgba(168, 85, 247, 0.22);
      font-size: 11px;
      color: #ddd6fe;
      line-height: 1.4;
      flex-shrink: 0;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .re-npc-scroll {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      margin: 0 -2px;
      padding: 2px 2px 4px;
    }
    .re-npc-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
      align-items: stretch;
    }
    @media (min-width: 720px) {
      .random-encounter-dialog .gift-dialog-inner { padding: 12px 12px 8px; }
      .re-npc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    }
    @media (min-width: 1024px) {
      .re-npc-grid.re-npc-grid--many { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    }
    .re-npc-grid.re-npc-grid--dense { gap: 6px; }
    .re-gacha-card {
      display: flex;
      flex-direction: column;
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      padding: 0;
      background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0.18) 100%);
      cursor: pointer;
      text-align: left;
      transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
      color: inherit;
      font: inherit;
      overflow: hidden;
      min-height: 0;
    }
    .re-gacha-card:hover:not(:disabled) {
      border-color: rgba(236, 72, 153, 0.55);
      transform: translateY(-1px);
      box-shadow: 0 8px 20px rgba(236, 72, 153, 0.1);
    }
    .re-gacha-card:disabled { opacity: 0.55; cursor: wait; }
    .re-gacha-avatar {
      width: 100%;
      aspect-ratio: 1 / 1;
      max-height: 88px;
      background: #0f0f12;
      overflow: hidden;
      position: relative;
      flex-shrink: 0;
    }
    @media (min-width: 720px) {
      .re-gacha-avatar {
        aspect-ratio: 4 / 5;
        max-height: 120px;
      }
    }
    .re-gacha-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .re-gacha-avatar--fallback {
      display: flex;
      align-items: center;
      justify-content: center;
      background: linear-gradient(145deg, #312e81, #701a75);
    }
    .re-gacha-avatar--fallback span {
      font-size: 22px;
      font-weight: 800;
      color: rgba(255, 255, 255, 0.92);
      letter-spacing: 0.04em;
    }
    .re-gacha-info {
      display: flex;
      flex-direction: column;
      gap: 6px;
      padding: 8px 8px 10px;
      flex: 1;
      min-height: 0;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(0, 0, 0, 0.22);
    }
    @media (min-width: 720px) {
      .re-gacha-info { padding: 10px 10px 12px; gap: 8px; }
    }
    .re-gacha-title {
      display: flex;
      flex-direction: column;
      gap: 2px;
      min-width: 0;
    }
    .re-gacha-name {
      font-size: 13px;
      font-weight: 700;
      line-height: 1.25;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .re-gacha-meta {
      font-size: 10px;
      color: #a1a1aa;
      line-height: 1.2;
    }
    .re-gacha-fields {
      display: flex;
      flex-direction: column;
      gap: 8px;
      min-height: 0;
    }
    .re-section {
      display: flex;
      flex-direction: column;
      gap: 3px;
      min-width: 0;
    }
    .re-section-k {
      font-size: 10px;
      font-weight: 700;
      color: #c4b5fd;
      line-height: 1.3;
      letter-spacing: 0.02em;
    }
    .re-section-v {
      margin: 0;
      font-size: 10px;
      color: #e4e4e7;
      line-height: 1.38;
      word-break: break-word;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .re-section-v--basic { -webkit-line-clamp: 2; }
    @media (min-width: 720px) {
      .re-section-k { font-size: 11px; }
      .re-section-v { font-size: 11px; line-height: 1.42; }
    }
    .re-tag-list {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .re-tag-row {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 2px 6px;
      align-items: start;
      min-width: 0;
    }
    .re-tag-k {
      font-size: 9px;
      font-weight: 700;
      color: #a78bfa;
      white-space: nowrap;
      line-height: 1.35;
      flex-shrink: 0;
    }
    .re-tag-v {
      font-size: 9px;
      color: #e4e4e7;
      line-height: 1.35;
      word-break: break-word;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      overflow: hidden;
      -webkit-line-clamp: 2;
    }
    .re-tag-row:nth-child(4) .re-tag-v {
      -webkit-line-clamp: 3;
    }
    @media (min-width: 720px) {
      .re-tag-k { font-size: 10px; }
      .re-tag-v { font-size: 10px; line-height: 1.4; }
    }
    .re-npc-grid.re-npc-grid--dense .re-tag-v { -webkit-line-clamp: 1; }
    .re-npc-grid.re-npc-grid--dense .re-tag-row:nth-child(4) .re-tag-v {
      -webkit-line-clamp: 2;
    }
    .re-gacha-card--reveal {
      animation: re-card-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
    }
    @keyframes re-card-in {
      from {
        opacity: 0;
        transform: translateY(14px) scale(0.96);
      }
      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }
    .re-gacha-card:hover:not(:disabled).re-gacha-card--reveal {
      transform: translateY(-1px);
    }
    .re-field {
      display: grid;
      grid-template-columns: 2.2em 1fr;
      gap: 4px;
      align-items: start;
      min-width: 0;
    }
    .re-field-k {
      font-size: 10px;
      color: #71717a;
      line-height: 1.35;
      padding-top: 1px;
    }
    .re-field-v {
      margin: 0;
      font-size: 10px;
      color: #e4e4e7;
      line-height: 1.35;
      word-break: break-word;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .re-field-v--look { -webkit-line-clamp: 2; }
    .re-field-v--bg { -webkit-line-clamp: 3; }
    .re-field-v--ori { -webkit-line-clamp: 1; }
    @media (min-width: 720px) {
      .re-gacha-name { font-size: 14px; }
      .re-gacha-meta { font-size: 11px; }
      .re-field-k { font-size: 11px; }
      .re-field-v { font-size: 11px; line-height: 1.4; }
      .re-field-v--look { -webkit-line-clamp: 3; }
      .re-field-v--bg { -webkit-line-clamp: 4; }
      .re-field-v--ori { -webkit-line-clamp: 2; }
    }
    .re-npc-grid.re-npc-grid--dense .re-gacha-avatar { max-height: 72px; }
    .re-npc-grid.re-npc-grid--dense .re-field-v--bg { -webkit-line-clamp: 2; }
    .re-gacha-card .re-pick {
      margin-top: auto;
      padding-top: 4px;
      font-size: 10px;
      color: var(--accent2);
      font-weight: 700;
      text-align: center;
      flex-shrink: 0;
    }
    .re-actions {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-top: 10px;
      flex-wrap: wrap;
      flex-shrink: 0;
    }
    .re-actions .btn-secondary {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 10px 14px;
      border-radius: 10px;
      border: 1px solid rgba(168, 85, 247, 0.35);
      background: rgba(168, 85, 247, 0.12);
      color: #e9d5ff;
      cursor: pointer;
      font-size: 13px;
      font-weight: 600;
    }
    .re-actions .btn-secondary:hover:not(:disabled) {
      background: rgba(168, 85, 247, 0.22);
    }
    .re-actions .btn-secondary:disabled { opacity: 0.5; cursor: wait; }
    .re-cost-note { font-size: 11px; color: var(--muted); }
    .re-status { margin: 10px 0 0; font-size: 12px; }
    .re-status.is-error { color: #fca5a5; }
    .re-loading {
      grid-column: 1 / -1;
      text-align: center;
      padding: 28px 12px;
      color: var(--muted);
      font-size: 13px;
    }
    .re-loading-fx {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 16px;
      min-height: 160px;
      padding: 36px 12px;
    }
    .re-loading-cards {
      display: flex;
      gap: 10px;
      perspective: 480px;
    }
    .re-loading-card {
      width: 38px;
      height: 52px;
      border-radius: 7px;
      background: linear-gradient(145deg, rgba(168, 85, 247, 0.45), rgba(236, 72, 153, 0.28));
      border: 1px solid rgba(168, 85, 247, 0.4);
      box-shadow: 0 6px 18px rgba(168, 85, 247, 0.18);
      animation: re-card-flip 1.15s ease-in-out infinite;
    }
    .re-loading-card:nth-child(2) { animation-delay: 0.14s; }
    .re-loading-card:nth-child(3) { animation-delay: 0.28s; }
    @keyframes re-card-flip {
      0%, 100% {
        transform: rotateY(0deg) translateY(0);
        opacity: 0.65;
      }
      50% {
        transform: rotateY(180deg) translateY(-8px);
        opacity: 1;
      }
    }
    .re-loading-text {
      margin: 0;
      font-size: 13px;
      color: #c4b5fd;
      letter-spacing: 0.06em;
      animation: re-loading-pulse 1.4s ease-in-out infinite;
    }
    .re-loading-text.is-error {
      color: #fca5a5;
      animation: none;
    }
    @keyframes re-loading-pulse {
      0%, 100% { opacity: 0.55; }
      50% { opacity: 1; }
    }
    .re-controls {
      display: flex;
      flex-wrap: wrap;
      gap: 8px 12px;
      margin-bottom: 8px;
    }
    .re-control {
      display: flex;
      flex-direction: column;
      gap: 4px;
      font-size: 11px;
      color: var(--muted);
    }
    .re-control select {
      min-width: 120px;
      padding: 6px 8px;
      border-radius: 8px;
      border: 1px solid rgba(255, 255, 255, 0.12);
      background: rgba(0, 0, 0, 0.25);
      color: inherit;
      font-size: 12px;
    }
    .re-onboard {
      margin-bottom: 8px;
      padding: 8px 10px;
      border-radius: 10px;
      background: rgba(59, 130, 246, 0.12);
      border: 1px solid rgba(59, 130, 246, 0.25);
      font-size: 11px;
      color: #bfdbfe;
      line-height: 1.45;
    }
    .re-onboard-dismiss { margin-top: 6px; }
    .re-lock-notice {
      margin-bottom: 8px;
      padding: 8px 10px;
      border-radius: 10px;
      background: rgba(245, 158, 11, 0.12);
      border: 1px solid rgba(245, 158, 11, 0.28);
      font-size: 11px;
      color: #fde68a;
      line-height: 1.45;
    }
    .re-gacha-card--avatar-only {
      padding: 0;
      align-items: stretch;
    }
    .re-gacha-card--avatar-only .re-gacha-avatar {
      aspect-ratio: 1 / 1;
      max-height: none;
    }
    .re-gacha-card--avatar-only .re-gacha-avatar-name {
      display: block;
      padding: 6px 8px 8px;
      font-size: 11px;
      font-weight: 700;
      text-align: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      background: rgba(0, 0, 0, 0.28);
      border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .re-gacha-card--active {
      border-color: rgba(34, 197, 94, 0.55);
      box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
    }
    .re-npc-grid:not(.re-npc-grid--many):not(.re-npc-grid--dense) .re-gacha-card-wrap {
      min-width: 0;
    }
    .re-npc-grid.re-npc-grid--many .re-gacha-card--avatar-only .re-gacha-avatar {
      aspect-ratio: 4 / 5;
    }
    .re-history-chip.is-blocked {
      opacity: 0.45;
      cursor: not-allowed;
    }
    .re-gacha-card-wrap {
      display: flex;
      flex-direction: column;
      gap: 4px;
      min-width: 0;
    }
    .re-card-detail-btn {
      border: none;
      background: transparent;
      color: #a78bfa;
      font-size: 10px;
      font-weight: 600;
      cursor: pointer;
      padding: 0 4px 2px;
      text-align: center;
    }
    .re-history {
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .re-history-board {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
      align-items: start;
    }
    .re-history-col {
      min-width: 0;
      padding: 10px 12px;
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid rgba(255, 255, 255, 0.08);
    }
    .re-history-col--active {
      border-color: rgba(34, 197, 94, 0.22);
      background: rgba(34, 197, 94, 0.04);
    }
    .re-history-empty {
      display: block;
      font-size: 11px;
      color: var(--muted);
      padding: 4px 0;
    }
    .re-grid-placeholder {
      grid-column: 1 / -1;
      text-align: center;
      padding: 28px 16px;
      font-size: 12px;
      line-height: 1.5;
      color: #c4b5fd;
      border: 1px dashed rgba(168, 85, 247, 0.35);
      border-radius: 12px;
      background: rgba(168, 85, 247, 0.06);
    }
    .re-active-card {
      display: flex;
      gap: 10px;
      align-items: flex-start;
    }
    .re-active-avatar {
      width: 56px;
      height: 56px;
      flex-shrink: 0;
      max-height: none;
      aspect-ratio: 1 / 1;
      border-radius: 10px;
      overflow: hidden;
    }
    .re-active-meta {
      flex: 1;
      min-width: 0;
    }
    .re-active-name {
      font-size: 13px;
      font-weight: 700;
      margin-bottom: 6px;
      color: #ecfdf5;
    }
    .re-active-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-bottom: 4px;
    }
    .re-history-k {
      font-size: 11px;
      color: #c4b5fd;
      margin-bottom: 6px;
      font-weight: 700;
    }
    .re-history-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }
    .re-history-chip {
      border: 1px solid rgba(236, 72, 153, 0.35);
      background: rgba(236, 72, 153, 0.1);
      color: #fbcfe8;
      border-radius: 999px;
      padding: 4px 10px;
      font-size: 11px;
      cursor: pointer;
    }
    .re-history-chip--active {
      border-color: rgba(34, 197, 94, 0.45);
      background: rgba(34, 197, 94, 0.12);
      color: #bbf7d0;
    }
    .re-history-chip--danger {
      border-color: rgba(248, 113, 113, 0.45);
      background: rgba(239, 68, 68, 0.12);
      color: #fecaca;
    }
    .re-history-chip--danger:hover {
      background: rgba(239, 68, 68, 0.2);
    }
    .re-history-active-hint {
      margin: 0;
      font-size: 10px;
      color: #fde68a;
      line-height: 1.4;
    }
    .re-reroll-dialog,
    .re-detail-dialog {
      border: none;
      border-radius: 18px;
      padding: 0;
      background: #141418;
      color: var(--text);
      width: min(92vw, 440px);
      max-width: 440px;
      box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    }
    .re-detail-dialog {
      width: min(92vw, 480px);
      max-width: 480px;
    }
    .re-reroll-dialog::backdrop,
    .re-detail-dialog::backdrop {
      background: rgba(0, 0, 0, 0.6);
    }
    .re-reroll-dialog .gift-dialog-inner,
    .re-detail-dialog .gift-dialog-inner {
      padding: 18px 20px 20px;
      box-sizing: border-box;
    }
    .re-reroll-dialog .gift-dialog-head,
    .re-detail-dialog .gift-dialog-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 16px;
      padding-bottom: 12px;
      border-bottom: 1px solid var(--border);
    }
    .re-reroll-dialog .gift-dialog-head h2,
    .re-detail-dialog .gift-dialog-head h2 {
      margin: 0;
      font-size: 18px;
      font-weight: 700;
      line-height: 1.3;
      letter-spacing: -0.02em;
    }
    .re-detail-head-text {
      display: flex;
      flex-direction: column;
      gap: 4px;
      min-width: 0;
    }
    .re-detail-sub {
      margin: 0;
      font-size: 12px;
      color: var(--muted);
      line-height: 1.4;
    }
    .re-reroll-dialog .gift-dialog-x,
    .re-detail-dialog .gift-dialog-x {
      border: none;
      background: rgba(255, 255, 255, 0.06);
      color: var(--muted);
      font-size: 20px;
      line-height: 1;
      cursor: pointer;
      padding: 6px 10px;
      border-radius: 8px;
      flex-shrink: 0;
      margin: -2px -4px 0 0;
    }
    .re-reroll-dialog .gift-dialog-x:hover,
    .re-detail-dialog .gift-dialog-x:hover {
      background: rgba(255, 255, 255, 0.1);
      color: var(--text);
    }
    .re-reroll-body {
      margin-bottom: 18px;
    }
    .re-reroll-lead {
      margin: 0 0 10px;
      font-size: 15px;
      font-weight: 600;
      line-height: 1.5;
      color: var(--text);
    }
    .re-reroll-note {
      margin: 0;
      font-size: 13px;
      line-height: 1.55;
      color: var(--muted);
    }
    .re-reroll-actions {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
      padding-top: 4px;
      border-top: 1px solid var(--border);
    }
    .re-reroll-actions .btn {
      min-width: 96px;
      padding: 10px 16px;
      font-size: 13px;
      font-weight: 600;
      border-radius: 10px;
    }
    .re-detail-body {
      display: flex;
      flex-direction: column;
      gap: 12px;
      max-height: min(58vh, 520px);
      overflow-y: auto;
      margin-bottom: 16px;
      padding-right: 2px;
    }
    .re-detail-body .re-section {
      padding: 12px 14px;
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--border);
      gap: 8px;
    }
    .re-detail-body .re-section-k {
      font-size: 12px;
      font-weight: 700;
      color: #c4b5fd;
      line-height: 1.35;
      padding-bottom: 6px;
      margin-bottom: 2px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    .re-detail-body .re-section-v {
      margin: 0;
      font-size: 13px;
      line-height: 1.55;
      color: #f4f4f5;
      display: block;
      overflow: visible;
      -webkit-line-clamp: unset;
    }
    .re-detail-body .re-tag-list {
      gap: 10px;
    }
    .re-detail-body .re-tag-row {
      display: flex;
      flex-direction: column;
      gap: 4px;
      grid-template-columns: unset;
      align-items: stretch;
    }
    .re-detail-body .re-tag-k {
      font-size: 11px;
      font-weight: 700;
      color: #a78bfa;
      white-space: normal;
      line-height: 1.35;
    }
    .re-detail-body .re-tag-v {
      font-size: 13px;
      line-height: 1.55;
      color: #e4e4e7;
      display: block;
      overflow: visible;
      -webkit-line-clamp: unset;
    }
    .re-detail-footer {
      padding-top: 14px;
      border-top: 1px solid var(--border);
    }
    .re-detail-chat {
      width: 100%;
      padding: 12px 16px;
      font-size: 14px;
      font-weight: 600;
      border-radius: 12px;
    }
    .re-detail-chat:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }
    .re-npc-grid.re-npc-grid--carousel {
      display: flex;
      overflow-x: auto;
      scroll-snap-type: x mandatory;
      gap: 10px;
      padding-bottom: 4px;
      -webkit-overflow-scrolling: touch;
    }
    .re-npc-grid.re-npc-grid--carousel .re-gacha-card-wrap {
      flex: 0 0 88%;
      max-width: 88%;
      scroll-snap-align: center;
    }

/* 让用户自定义模块占据原来词条框的大空间 */
.re-entries-area { margin-top: 8px; flex: 1; display: flex; flex-direction: column; }
.re-custom-entries-box {
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 12px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.re-custom-textarea-large {
  flex: 1;
  width: 100%;
  min-height: 200px;
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
  background: rgba(255,255,255,0.015);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 10px;
  color: #eee;
}
.re-custom-textarea-large:focus { border-color: #ec4899; outline: none; }
.re-entries-core-header { display:flex; align-items:center; gap:6px; margin-bottom:6px; flex-wrap:wrap; }
.re-core-label { font-size:12px; color:#888; }
.re-core-chip { background:rgba(236,72,153,0.12); color:#f9a8d4; font-size:12px; padding:2px 7px; border-radius:999px; margin:1px 3px 1px 0; }

/* 核心标签 inline 添加区（直接放在 chips 下面，便于修改/添加） */
.re-core-inline-add {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 2px 0 8px;
}
#companionCoreInlineInput {
  background: #111;
  color: #eee;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
  width: 120px;
}
#companionCoreInlineInput:focus {
  border-color: #ec4899;
  outline: none;
}
.custom-erotic-header { font-size:13px; color:#ccc; margin-bottom:4px; display:flex; gap:6px; align-items:center; }
.tip { font-size:11px; color:#666; margin-top:4px; }

/* 让用户自定义模块在原来词条框位置变大、好看 */
#companionEntriesArea,
.re-entries-area {
  margin-top: 4px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.re-custom-entries-box {
  background: #16161a;
  border: 1px solid #2a2a2f;
  border-radius: 12px;
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.re-kink-pref-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  min-height: 28px;
}
.re-kink-pref-chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #3a3a44;
  background: #1a1a20;
  color: #d4d4dc;
  cursor: pointer;
}
.re-kink-pref-chip.active {
  border-color: #e879a9;
  background: rgba(232, 121, 169, 0.15);
  color: #fce7f3;
}
.re-kink-core-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.re-kink-core-title {
  font-size: 13px;
  font-weight: 600;
  color: #f4f4f5;
  margin-bottom: 6px;
}
.re-kink-intensity-group {
  margin-bottom: 8px;
}
.re-kink-intensity-label-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.re-kink-intensity-label {
  font-size: 12px;
  font-weight: 500;
  color: #e4e4e7;
}
.re-kink-intensity-hint {
  font-size: 11px;
  color: #71717a;
}
.re-kink-intensity-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.re-kink-segmented {
  display: inline-flex;
  align-items: center;
  background: #252525;
  border-radius: 9999px;
  padding: 4px;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}
.re-kink-segment {
  flex: 1 1 0;
  min-width: 4.5em;
  padding: 9px 14px;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: #a1a1aa;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
  white-space: nowrap;
}
.re-kink-segment:hover:not(:disabled):not(.active) {
  color: #d4d4d8;
  background: rgba(255, 255, 255, 0.04);
}
.re-kink-segment.active {
  background: linear-gradient(90deg, #c026d3, #db2777);
  color: #fff;
  box-shadow: 0 4px 14px rgba(192, 38, 211, 0.32);
}
.re-kink-segment:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.re-kink-random-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  border: none;
  border-radius: 9999px;
  padding: 10px 18px;
  background: linear-gradient(90deg, #f59e0b, #eab308);
  color: #1c1917;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 5px 18px rgba(245, 158, 11, 0.38);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.re-kink-random-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 7px 22px rgba(245, 158, 11, 0.48);
  filter: brightness(1.04);
}
.re-kink-random-btn:active:not(:disabled) {
  transform: translateY(0);
}
.re-kink-random-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.re-kink-random-coin {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.92;
}
.re-kink-coin-icon {
  font-size: 9px;
  color: #78350f;
}
.re-kink-sub-hint {
  margin: 0 0 10px;
  font-size: 11px;
  line-height: 1.45;
  color: #71717a;
}
.re-kink-match-inline {
  margin-top: 4px;
  margin-bottom: 8px;
  padding: 10px 12px;
  background: #16161a;
  border: 1px solid #2a2a2f;
  border-radius: 10px;
}
.re-kink-match-inline .re-kink-match-lead {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.5;
  color: #a1a1aa;
}
.re-kink-match-inline-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.re-kink-match-inline-foot .re-kink-match-pick-hint {
  margin: 0;
  font-size: 11px;
  color: #a78bfa;
}
.re-kink-match-inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.re-kink-tag-chip.is-locked {
  opacity: 0.92;
}
.re-kink-tags-box {
  margin-top: 4px;
}
.re-kink-tags-box:empty,
.re-kink-tags-box.is-empty {
  display: none;
}
.re-kink-tags-empty {
  display: none;
}
.re-kink-tags-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}
.re-kink-tag-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(232, 121, 169, 0.45);
  background: rgba(232, 121, 169, 0.14);
  color: #fce7f3;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
}
.re-kink-core-result {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.re-kink-reroll-btn {
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.08);
}
.re-kink-match-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.re-kink-match-chip {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #e4e4e7;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.re-kink-match-chip.is-selected {
  border-color: #e879a9;
  background: rgba(232, 121, 169, 0.18);
  color: #fce7f3;
}
.re-kink-match-pick-hint {
  margin: 0;
  font-size: 11px;
  color: #a78bfa;
}
.re-kink-pref-panel {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #2a2a32;
  border-radius: 10px;
  background: #121218;
  max-height: 220px;
  overflow: auto;
}
.re-kink-pref-cat {
  margin-bottom: 10px;
}
.re-kink-pref-cat-k {
  font-size: 11px;
  color: #a78bfa;
  margin-bottom: 6px;
}
.re-kink-pref-actions {
  display: flex;
  gap: 6px;
}

/* 邂逅确认页 · 词条摘要（主界面） */
.re-entries-summary {
  background: #16161a;
  border: 1px solid #2a2a32;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 4px;
}
.re-entries-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.re-entries-summary-k {
  font-size: 13px;
  font-weight: 600;
  color: #e8e8ee;
}
.re-entries-summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.re-entries-summary-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 12px;
  line-height: 1.45;
}
.re-entries-summary-label {
  color: #9ca3af;
  flex-shrink: 0;
}
.re-entries-summary-value {
  color: #e5e7eb;
  word-break: break-word;
}
.re-entries-summary-value.is-empty {
  color: #6b7280;
  font-style: italic;
}
.re-entries-summary-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: #6b7280;
}

/* 词条编辑弹窗 */
dialog.companion-entries-editor-dialog {
  width: min(96vw, 520px);
  max-width: 96vw;
  padding: 0;
  border: none;
  border-radius: 18px;
  background: transparent;
  overflow: hidden;
  box-sizing: border-box;
}
.companion-entries-editor-dialog .gift-dialog-inner {
  width: 100%;
  max-width: 100%;
  max-height: min(92vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}
.companion-entries-editor-dialog .gift-dialog-head {
  flex-shrink: 0;
  min-width: 0;
}
.companion-entries-editor-dialog .re-detail-head-text {
  min-width: 0;
}
.companion-entries-editor-dialog .re-entries-editor-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
.companion-entries-editor-dialog .re-entries-area--editor {
  padding-bottom: 8px;
  min-width: 0;
}
.companion-entries-editor-dialog .re-kink-pref-panel {
  max-height: min(42vh, 320px);
  overflow-y: auto;
}
.companion-entries-editor-dialog .re-v2-entry-head {
  flex-wrap: wrap;
  align-items: flex-start;
}
.companion-entries-editor-dialog .re-v2-entry-head > span {
  flex: 1 1 140px;
  min-width: 0;
  line-height: 1.4;
}
.companion-entries-editor-dialog .re-kink-pref-actions {
  flex-shrink: 0;
}
.re-entries-editor-foot {
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #2a2a32;
  flex-shrink: 0;
}
.re-entries-editor-foot .btn-block {
  width: 100%;
}

@media (max-width: 640px) {
  dialog.companion-entries-editor-dialog {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
  .companion-entries-editor-dialog .gift-dialog-inner {
    height: 100%;
    max-height: 100dvh;
    border-radius: 0;
  }
  .companion-entries-editor-dialog .re-detail-sub {
    font-size: 11px;
  }
  .companion-entries-editor-dialog .re-v2-entry-head {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .companion-entries-editor-dialog .re-v2-entry-head .btn,
  .companion-entries-editor-dialog .re-kink-pref-actions {
    width: 100%;
    justify-content: center;
  }
  .companion-entries-editor-dialog .re-kink-pref-actions {
    display: flex;
    gap: 6px;
  }
  .companion-entries-editor-dialog .re-kink-pref-actions .btn {
    flex: 1 1 0;
  }
  .companion-entries-editor-dialog .re-kink-intensity-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .companion-entries-editor-dialog .re-kink-segmented {
    width: 100%;
  }
  .companion-entries-editor-dialog .re-kink-random-btn {
    width: 100%;
    justify-content: center;
  }
  .companion-entries-editor-dialog .re-v2-entry-box {
    padding: 8px 10px;
    margin-bottom: 8px;
  }
  .companion-entries-editor-dialog .re-v2-random-paid {
    min-width: 0;
  }
}

/* 头像首屏小弹窗 */
.companion-avatar-first-dialog {
  overflow: hidden;
  box-sizing: border-box;
}
.companion-avatar-first-inner {
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}
.companion-avatar-first-inner .gift-dialog-head {
  min-width: 0;
}
.re-avatar-first-mount {
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
.re-avatar-first-mount .re-companion-portrait--choices {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 0;
  padding: 14px 12px;
  box-shadow:
    0 0 0 1px rgba(167, 139, 250, 0.28) inset,
    0 8px 24px rgba(0, 0, 0, 0.35);
}
.re-avatar-first-mount .re-event-btn {
  white-space: normal;
  text-align: center;
  line-height: 1.35;
  padding-left: 10px;
  padding-right: 10px;
  max-width: 100%;
  box-sizing: border-box;
}

#companionCustomEroticTextarea {
  flex: 1;
  min-height: 220px !important;
  font-size: 14px;
  line-height: 1.6;
  background: #0f0f12;
  color: #e5e5e5;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 12px;
  resize: vertical;
}

.custom-erotic-header {
  font-size: 13px;
  color: #c9c9c9;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.re-core-chip {
  background: #25252a;
  color: #ddd;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  margin-right: 4px;
  border: 1px solid #3a3a3f;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.re-core-remove {
  background: transparent;
  border: none;
  color: #888;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.re-core-remove:hover { color: #f66; }

.re-suggest-tag {
  display: inline-block;
  font-size: 11px;
  background: #222;
  color: #aaa;
  padding: 1px 6px;
  border-radius: 4px;
  margin: 1px 3px 1px 0;
  cursor: pointer;
  border: 1px solid #333;
}
.re-suggest-tag:hover {
  background: #ec4899;
  color: #fff;
  border-color: #ec4899;
}

/* 让词条区域整体更高，把大自定义框撑开 */
.re-companion-tags-col {
  min-height: 0;
}
.re-entries-area {
  min-height: 0;
}

.re-v2-personality-row {
  margin-bottom: 12px;
  flex-shrink: 0;
}
.re-v2-personality-row .re-core-label {
  display: block;
  font-size: 12px;
  color: #aaa;
  margin-bottom: 6px;
}
.re-v2-personality-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.re-v2-relationship-row {
  margin-bottom: 10px;
}
.re-v2-relationship-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.re-v2-relationship-inline .re-core-label {
  flex: 0 0 auto;
  font-size: 12px;
  color: #aaa;
  margin-bottom: 0;
}
.re-relationship-seed-input {
  flex: 1 1 160px;
  min-width: 120px;
  box-sizing: border-box;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.28);
  color: #f4f4f5;
  font: inherit;
  padding: 6px 10px;
  line-height: 1.4;
}
.re-v2-single-chip .re-core-chip {
  margin-right: 0;
}
.re-v2-core-chip {
  background: rgba(236, 72, 153, 0.12);
  border: 1px solid rgba(236, 72, 153, 0.25);
}
.re-v2-entry-box {
  background: #16161a;
  border: 1px solid #2a2a2f;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.re-v2-entry-box:not(.re-v2-entry-box--custom) .re-v2-entry-body {
  max-height: 4.8em;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(167, 139, 250, 0.45) transparent;
}
.re-v2-entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #c9c9c9;
  margin-bottom: 6px;
}
.re-v2-entry-head-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.45;
}
.re-v2-inline-badge {
  display: inline-block;
  font-size: 10px;
  line-height: 1.3;
  padding: 2px 6px;
  border-radius: 999px;
  vertical-align: middle;
  white-space: nowrap;
}
.re-v2-entry-body--story {
  max-height: 7.2em;
}
.re-v2-entry-box--kink-pref {
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: none;
}
.re-v2-entry-box--kink-pref .re-v2-entry-body {
  max-height: 6.4em;
}
.re-v2-entry-body,
.re-v2-entry-preview {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #d4d4d8;
  white-space: pre-wrap;
}
.re-v2-entry-preview {
  color: #a1a1aa;
  font-size: 12px;
}
.re-v2-random-paid {
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fbbf24;
  min-width: 4.5em;
}
.re-v2-random-paid:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.re-v2-entry-box--rolling,
.re-v2-personality-row.re-v2-entry-box--rolling {
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.12);
}
.re-v2-random-progress {
  display: none;
  height: 3px;
  margin: 0 0 8px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.15);
  overflow: hidden;
}
.re-v2-entry-box--rolling .re-v2-random-progress,
.re-v2-personality-row.re-v2-entry-box--rolling .re-v2-random-progress {
  display: block;
}
.re-v2-random-progress-bar {
  display: block;
  width: 35%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.2), rgba(236, 72, 153, 0.95), rgba(167, 139, 250, 0.2));
  animation: re-v2-random-progress 1.1s ease-in-out infinite;
}
@keyframes re-v2-random-progress {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.re-v2-entry-body--empty {
  color: rgba(161, 161, 170, 0.82) !important;
  font-style: italic;
}
.re-v2-entry-body--rolling,
.re-v2-single-chip.re-v2-entry-body--rolling {
  color: #a78bfa !important;
  font-style: italic;
  opacity: 0.9;
}
.re-v2-entry-box--custom {
  margin-bottom: 0;
  flex-shrink: 0;
  min-height: 72px;
}
.re-v2-entry-box--custom .re-v2-entry-preview {
  max-height: 3.6em;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(236, 72, 153, 0.45) transparent;
}

/* v2：隐藏旧版侧写/词条区 */
.re-persona-blurb-actions,
.re-persona-blurb-card,
.re-persona-blurb-empty,
.re-companion-tags-head {
  display: none !important;
}
.re-avatar-confirm-dialog .gift-dialog-inner {
  max-width: 420px;
  background: linear-gradient(165deg, rgba(18, 18, 24, 0.98) 0%, rgba(8, 8, 12, 0.98) 100%);
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 20px;
}
.re-avatar-confirm-dialog .re-reroll-lead {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #e4e4e7;
  text-align: center;
}
.re-avatar-confirm-dialog .re-reroll-actions {
  justify-content: center;
  gap: 12px;
}
.re-avatar-confirm-dialog .re-reroll-actions .btn-primary {
  min-width: 120px;
}
