    :root {
      --sky: #79c8e9;
      --sky-2: #c8eff8;
      --water: #238eb8;
      --ink: #213243;
      --muted: #667888;
      --line: rgba(87, 134, 153, 0.18);
      --glass: rgba(255, 255, 255, 0.48);
      --glass-soft: rgba(255, 255, 255, 0.32);
      --panel: rgba(255, 255, 255, 0.58);
      --panel-strong: rgba(255, 255, 255, 0.74);
      --pearl: #fff8ef;
      --rose: #eaa6a6;
      --lemon: #f0ca68;
      --coral: #dc796e;
      --mint: #78c9b0;
      --shadow: 0 24px 70px rgba(57, 104, 123, 0.16);
      --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      --font-romance: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
      --radius: 20px;
      --radius-sm: 14px;
      --chat-font: 14px;
      --chat-pad-y: 10px;
      --chat-pad-x: 14px;
      --chat-max: 65%;
      --chat-avatar: 30px;
      --chat-radius: 18px;
      --app-height: 100dvh;
    }

    * { box-sizing: border-box; }

    html,
    body {
      height: 100%;
      height: var(--app-height);
      overflow: hidden;
      margin: 0;
      padding: 0;
    }

    body {
      font-family: var(--font-ui);
      color: var(--ink);
      background:
        linear-gradient(145deg, rgba(255,248,239,.92), rgba(219,242,241,.82) 42%, rgba(191,229,241,.78) 100%),
        linear-gradient(90deg, rgba(234,166,166,.28), transparent 34%, rgba(240,202,104,.22)),
        linear-gradient(180deg, rgba(255,255,255,.68), rgba(255,255,255,0));
      background-color: #dceff0;
      letter-spacing: 0;
    }

    .app-container {
      height: var(--app-height);
      overflow: hidden;
    }

    body:has(#view-chat.active) {
      overflow: hidden;
    }

    button, input {
      font: inherit;
    }

    .login {
      position: fixed;
      inset: 0;
      display: grid;
      place-items: center;
      z-index: 20;
      padding: 24px;
      background:
        linear-gradient(145deg, rgba(255,250,244,.92), rgba(218,241,239,.88) 48%, rgba(190,225,237,.86)),
        linear-gradient(90deg, rgba(234,166,166,.24), transparent 46%, rgba(240,202,104,.20));
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
    }

    .login.hidden { display: none; }

    .login-box {
      width: min(420px, 100%);
      padding: 30px;
      border: 1px solid rgba(255,255,255,.74);
      border-radius: var(--radius);
      background: rgba(255,255,255,.62);
      box-shadow: var(--shadow);
      backdrop-filter: blur(26px) saturate(1.18);
      -webkit-backdrop-filter: blur(26px) saturate(1.18);
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 12px;
      font-family: var(--font-romance);
      font-weight: 700;
      font-size: 20px;
      margin-bottom: 8px;
    }

    .brand-mark {
      width: 38px;
      height: 38px;
      border-radius: 50%;
      background:
        radial-gradient(circle at 35% 32%, rgba(255,255,255,.95), transparent 24%),
        linear-gradient(160deg, #f8d2c8, #7bcfc1 46%, #238eb8);
      box-shadow: inset 0 0 18px rgba(255,255,255,.68), 0 10px 24px rgba(57,104,123,.20);
      flex: 0 0 auto;
    }

    .login p {
      margin: 0 0 18px;
      color: var(--muted);
      line-height: 1.6;
    }

    .login input {
      width: 100%;
      height: 44px;
      border: 1px solid rgba(58,135,180,.24);
      border-radius: var(--radius-sm);
      padding: 0 12px;
      outline: none;
      background: rgba(255,255,255,.92);
      color: var(--ink);
    }

    .login input:focus {
      border-color: rgba(31,157,221,.72);
      box-shadow: 0 0 0 3px rgba(31,157,221,.14);
    }

    .btn {
      border: 0;
      border-radius: var(--radius-sm);
      height: 38px;
      padding: 0 14px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      color: var(--ink);
      background: rgba(255,255,255,.62);
      border: 1px solid rgba(87,134,153,.18);
      transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
      white-space: nowrap;
      font-weight: 600;
    }

    .btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 10px 24px rgba(51,140,190,.16);
      background: rgba(255,255,255,.96);
    }

    .btn.primary {
      background: linear-gradient(135deg, #78c9b0, #238eb8);
      color: #fff;
      border-color: transparent;
    }

    .login .btn { width: 100%; margin-top: 14px; }

    .app {
      height: var(--app-height);
      overflow: hidden;
      display: grid;
      grid-template-columns: minmax(0, 1fr);
    }

    body:has(#view-chat.active) .app {
      height: var(--app-height);
      overflow: hidden;
    }

    .sidebar {
      padding: 26px 10px;
      border-right: 1px solid rgba(255,255,255,.6);
      background: rgba(255,255,255,.38);
      backdrop-filter: blur(28px) saturate(1.18);
      -webkit-backdrop-filter: blur(28px) saturate(1.18);
      position: sticky;
      top: 0;
      height: 100vh;
    }
    .sidebar .brand span { display: none; }
    .sidebar .brand { justify-content: center; }

    .nav {
      margin-top: 28px;
      display: grid;
      gap: 14px;
      justify-items: center;
    }

    .nav a {
      width: 42px;
      height: 38px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      border-radius: 0;
      text-decoration: none;
      color: rgba(102,120,136,.62);
      border: 0;
      background: transparent;
      position: relative;
      transition: color .16s ease, transform .16s ease;
    }

    .nav a.active,
    .nav a:hover {
      color: var(--water);
      background: transparent;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    .nav a:hover {
      transform: translateY(-1px);
      color: rgba(35,142,184,.82);
    }

    .nav a.active::before {
      content: "";
      position: absolute;
      left: 50%;
      bottom: 0;
      width: 18px;
      height: 2px;
      border-radius: 999px;
      background: var(--water);
      transform: translateX(-50%);
    }

    .nav a::after {
      content: attr(aria-label);
      position: absolute;
      left: calc(100% + 10px);
      top: 50%;
      transform: translateY(-50%) translateX(-4px);
      padding: 5px 8px;
      border-radius: 9px;
      color: #fff;
      background: rgba(33,50,67,.86);
      font-size: 12px;
      line-height: 1;
      white-space: nowrap;
      opacity: 0;
      pointer-events: none;
      transition: opacity .16s ease, transform .16s ease;
      z-index: 20;
    }

    .nav a:hover::after {
      opacity: 1;
      transform: translateY(-50%) translateX(0);
    }

    .nav svg {
      width: 20px;
      height: 20px;
      stroke-width: 1.5;
    }

    .main {
      padding: 28px;
      display: grid;
      gap: 20px;
      height: 100%;
      min-height: 0;
      overflow: hidden;
      align-content: start;
    }

    body:has(#view-chat.active) .main {
      height: 100%;
      min-height: 0;
      overflow: hidden;
      align-content: stretch;
      grid-template-rows: auto minmax(0, 1fr);
    }

    .topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      min-height: 64px;
      padding: 8px 4px 4px;
    }

    .title h1 {
      margin: 0;
      font-family: var(--font-romance);
      font-size: 30px;
      font-weight: 700;
      line-height: 1.2;
      color: #223242;
    }

    .title p {
      margin: 6px 0 0;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.6;
    }

    .top-actions {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    @keyframes breathe {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.3; }
    }

    .online-dot {
      display: inline-block;
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: #4ecdc4;
      animation: breathe 2s ease-in-out infinite;
      vertical-align: middle;
      margin-left: 8px;
    }

    .icon-action {
      width: 38px;
      padding: 0;
      border-radius: 50%;
      color: rgba(102,120,136,.72);
      background: rgba(255,255,255,.42);
    }

    .icon-action svg {
      width: 20px;
      height: 20px;
      stroke-width: 1.5;
    }

    .drawer-backdrop {
      position: fixed;
      inset: 0;
      z-index: 24;
      background: rgba(33,50,67,.16);
      opacity: 0;
      pointer-events: none;
      transition: opacity .22s ease;
    }

    .drawer-backdrop.open {
      opacity: 1;
      pointer-events: auto;
    }

    .settings-drawer {
      position: fixed;
      top: 0;
      right: 0;
      z-index: 25;
      width: 320px;
      max-width: 100vw;
      height: 100dvh;
      padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
      background:
        linear-gradient(145deg, rgba(255,255,255,.68), rgba(239,249,247,.44)),
        linear-gradient(180deg, rgba(245,231,213,.32), rgba(190,225,237,.28));
      border-left: 1px solid rgba(255,255,255,.72);
      box-shadow: -22px 0 60px rgba(57,104,123,.18);
      backdrop-filter: blur(30px) saturate(1.18);
      -webkit-backdrop-filter: blur(30px) saturate(1.18);
      transform: translateX(102%);
      transition: transform .24s ease;
      overflow-y: auto;
    }

    .settings-drawer.open {
      transform: translateX(0);
    }

    .drawer-close {
      position: absolute;
      top: 14px;
      right: 14px;
    }

    .drawer-head {
      padding: 4px 44px 12px 0;
    }

    .drawer-head h2 {
      margin: 0;
      font-family: var(--font-romance);
      font-size: 21px;
      line-height: 1.2;
    }

    .drawer-head p {
      margin: 6px 0 0;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.5;
    }

    .drawer-section {
      padding: 16px 0;
      border-top: 1px solid rgba(87,134,153,.16);
    }

    .drawer-title {
      margin-bottom: 12px;
      color: rgba(102,120,136,.72);
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0;
    }

    .settings-row {
      display: grid;
      gap: 7px;
      margin-top: 12px;
    }

    .settings-row label,
    .settings-row .row-label {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.4;
    }

    .settings-row input[type="range"] {
      width: 100%;
      accent-color: var(--water);
    }

    .settings-row input[type="time"],
    .settings-row input[type="password"],
    .settings-row input[type="file"] {
      width: 100%;
      height: 36px;
      border: 1px solid rgba(87,134,153,.18);
      border-radius: 12px;
      padding: 0 10px;
      color: var(--ink);
      background: rgba(255,255,255,.68);
      outline: none;
    }

    .theme-toggle {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
    }

    .theme-toggle button {
      height: 32px;
      border: 1px solid rgba(87,134,153,.16);
      border-radius: 12px;
      color: var(--muted);
      background: rgba(255,255,255,.42);
      cursor: pointer;
    }

    .theme-toggle button.active {
      color: #fff;
      border-color: transparent;
      background: linear-gradient(135deg, #78c9b0, #238eb8);
    }

    .model-line,
    .about-line {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.5;
      word-break: break-word;
    }

    .model-line b,
    .about-line b {
      color: var(--ink);
      font-weight: 700;
      text-align: right;
    }

    .shell {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 340px;
      gap: 18px;
      align-items: stretch;
    }

    .view { display: none; }
    .view.active { display: grid; }

    .water-stage {
      min-height: 590px;
      border-radius: var(--radius);
      border: 1px solid rgba(255,255,255,.76);
      background:
        linear-gradient(145deg, rgba(255,255,255,.64), rgba(239,249,247,.38)),
        linear-gradient(180deg, rgba(245,231,213,.34), rgba(190,225,237,.26));
      box-shadow: var(--shadow);
      backdrop-filter: blur(30px) saturate(1.2);
      -webkit-backdrop-filter: blur(30px) saturate(1.2);
      position: relative;
      overflow: hidden;
      padding: 22px;
      display: grid;
      grid-template-rows: auto 1fr auto;
    }

    .water-stage::before {
      content: "";
      position: absolute;
      inset: 0;
      background:
        linear-gradient(rgba(255,255,255,.34) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.26) 1px, transparent 1px);
      background-size: 54px 54px;
      mask-image: linear-gradient(180deg, transparent, rgba(0,0,0,.18) 24%, rgba(0,0,0,.14) 70%, transparent);
      pointer-events: none;
    }

    .stage-head,
    .stage-foot {
      position: relative;
      z-index: 2;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      flex-wrap: wrap;
    }

    .kicker {
      font-size: 12px;
      color: var(--muted);
      text-transform: uppercase;
      font-weight: 700;
    }

    .stage-head strong {
      display: block;
      margin-top: 5px;
      font-family: var(--font-romance);
      font-size: 24px;
      line-height: 1.35;
    }

    .mood {
      display: flex;
      align-items: center;
      gap: 8px;
      min-height: 30px;
      padding: 0 10px;
      border-radius: 999px;
      background: rgba(255,255,255,.74);
      border: 1px solid rgba(120,201,176,.18);
      font-size: 12px;
      color: var(--muted);
    }

    .water-wrap {
      position: relative;
      z-index: 1;
      display: grid;
      place-items: center;
      min-height: 390px;
    }

    .water-orbit {
      width: min(430px, 76vw);
      aspect-ratio: 1;
      border-radius: 50%;
      position: relative;
      display: grid;
      place-items: center;
      background:
        linear-gradient(145deg, rgba(255,255,255,.82), rgba(176,225,223,.28) 28%, transparent 46%),
        radial-gradient(circle at 50% 56%, rgba(120,201,176,.70), rgba(35,142,184,.82) 46%, rgba(62,95,118,.88) 80%);
      box-shadow:
        inset 0 0 24px rgba(255,255,255,.56),
        inset 0 -22px 54px rgba(30,92,119,.24),
        0 28px 80px rgba(57,104,123,.24);
      overflow: hidden;
    }

    .water-orbit canvas {
      width: 100%;
      height: 100%;
      display: block;
      mix-blend-mode: screen;
    }

    .water-core {
      position: absolute;
      inset: 28%;
      border-radius: 50%;
      display: grid;
      place-items: center;
      text-align: center;
      color: #fff;
      background: rgba(35, 96, 124, .20);
      border: 1px solid rgba(255,255,255,.42);
      backdrop-filter: blur(5px);
      padding: 16px;
    }

    .water-core strong {
      display: block;
      font-family: var(--font-romance);
      font-size: 28px;
      line-height: 1.1;
    }

    .water-core span {
      display: block;
      margin-top: 6px;
      font-size: 12px;
      opacity: .9;
    }

    .mini-stats {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 10px;
      width: 100%;
    }

    .stat {
      min-height: 70px;
      border-radius: var(--radius-sm);
      background: rgba(255,255,255,.54);
      border: 1px solid rgba(87,134,153,.14);
      padding: 12px;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
    }

    .stat b {
      display: block;
      font-family: var(--font-romance);
      font-size: 22px;
      line-height: 1.1;
    }

    .stat span {
      display: block;
      margin-top: 8px;
      color: var(--muted);
      font-size: 12px;
    }

    .side {
      display: grid;
      gap: 14px;
      align-content: start;
    }

    .panel {
      border-radius: var(--radius);
      background: var(--panel);
      border: 1px solid rgba(255,255,255,.72);
      box-shadow: 0 16px 40px rgba(57,104,123,.12);
      padding: 16px;
      backdrop-filter: blur(28px) saturate(1.18);
      -webkit-backdrop-filter: blur(28px) saturate(1.18);
    }

    .panel.strong {
      background: var(--panel-strong);
    }

    .panel-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 12px;
    }

    .panel-title {
      font-size: 14px;
      font-weight: 760;
      font-family: var(--font-romance);
    }

    .tag {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      border-radius: 999px;
      padding: 0 9px;
      font-size: 12px;
      color: var(--muted);
      background: rgba(255,255,255,.52);
      border: 1px solid rgba(87,134,153,.12);
    }

    .tag.hot { color: #9a4c22; background: rgba(255,216,107,.34); }
    .tag.live { color: #08735e; background: rgba(101,216,185,.24); }
    .tag.rest { color: #22689a; background: rgba(157,227,255,.34); }

    .daily-line {
      display: grid;
      gap: 7px;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.55;
    }

    .note-list,
    .event-list {
      display: grid;
      gap: 10px;
    }

    .note,
    .event {
      padding: 10px;
      border-radius: var(--radius-sm);
      background: rgba(255,255,255,.48);
      border: 1px solid rgba(87,134,153,.12);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }

    .note p,
    .event p {
      margin: 0;
      line-height: 1.55;
      font-size: 13px;
    }

    .note small,
    .event small {
      display: block;
      margin-top: 6px;
      color: var(--muted);
      font-size: 11px;
    }

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

    .module {
      min-height: 94px;
      border-radius: var(--radius-sm);
      padding: 13px;
      background: rgba(255,255,255,.50);
      border: 1px solid rgba(87,134,153,.14);
      display: grid;
      align-content: space-between;
      gap: 12px;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
    }

    .module b {
      font-size: 14px;
      line-height: 1.35;
    }

    .module span {
      color: var(--muted);
      font-size: 12px;
    }

    .module.ready { border-color: rgba(101,216,185,.42); background: rgba(240,255,250,.48); }
    .module.next { border-color: rgba(255,216,107,.56); background: rgba(255,250,229,.52); }

    .toast {
      position: fixed;
      right: 22px;
      bottom: 22px;
      max-width: min(360px, calc(100vw - 44px));
      padding: 12px 14px;
      background: rgba(23,52,76,.92);
      color: #fff;
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      opacity: 0;
      transform: translateY(10px);
      transition: opacity .2s ease, transform .2s ease;
      pointer-events: none;
      z-index: 30;
      font-size: 13px;
    }

    .toast.show {
      opacity: 1;
      transform: translateY(0);
    }

    .float-ball {
      position: fixed !important;
      bottom: calc(32px + env(safe-area-inset-bottom)) !important;
      right: calc(24px + env(safe-area-inset-right)) !important;
      left: auto !important;
      top: auto !important;
      width: 52px !important;
      height: 52px !important;
      border-radius: 50% !important;
      background: linear-gradient(135deg, #4ecdc4, #6bb8d4) !important;
      box-shadow: 0 4px 20px rgba(78,180,180,0.5) !important;
      opacity: 1 !important;
      filter: none !important;
      cursor: pointer;
      touch-action: none;
      z-index: 9999 !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      animation: float-breathe 3s ease-in-out infinite !important;
    }

    @keyframes float-breathe {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.06); }
    }

    .float-ball.float-ball-tap {
      transform: scale(.92) !important;
      box-shadow: 0 2px 14px rgba(78,180,180,0.55) !important;
    }

    .float-menu-backdrop {
      position: fixed;
      inset: 0;
      z-index: 9997;
      display: none;
      background: transparent;
    }

    .float-menu-backdrop.open {
      display: block;
    }

    .float-menu {
      position: fixed;
      inset: 0;
      z-index: 9998;
      pointer-events: none;
    }

    .float-menu-btn {
      position: fixed;
      left: var(--menu-left, 0);
      top: var(--menu-top, 0);
      width: 44px;
      height: 44px;
      border: 1px solid rgba(255,255,255,.58);
      border-radius: 50%;
      color: #fff;
      background: linear-gradient(135deg, rgba(78,205,196,.82), rgba(107,184,212,.82));
      box-shadow: 0 4px 18px rgba(78,180,180,0.28);
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      transform: scale(.35);
      transition:
        left .34s cubic-bezier(0.34, 1.56, 0.64, 1),
        top .34s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity .18s ease,
        transform .34s cubic-bezier(0.34, 1.56, 0.64, 1);
      pointer-events: none;
      cursor: pointer;
    }

    .float-menu.open .float-menu-btn {
      opacity: 1;
      transform: scale(1);
      pointer-events: auto;
    }

    .float-menu-btn svg {
      width: 18px;
      height: 18px;
      stroke-width: 1.7;
    }

    .empty {
      color: var(--muted);
      font-size: 13px;
      line-height: 1.6;
    }

    .chat-view {
      height: 100%;
      min-height: 0;
      grid-template-rows: auto minmax(0, 1fr) auto auto auto;
      overflow: hidden;
      padding: 0;
      background: rgba(255,255,255,.52);
      position: relative;
    }

    body:has(#view-chat.active) .chat-view {
      height: 100%;
      min-height: 0;
    }

    .chat-head {
      min-height: 76px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 15px 18px;
      border-bottom: 1px solid rgba(255,255,255,.5);
      background: rgba(255,255,255,.48);
      backdrop-filter: blur(18px) saturate(1.16);
      -webkit-backdrop-filter: blur(18px) saturate(1.16);
    }

    .chat-person {
      display: flex;
      align-items: center;
      min-width: 0;
      gap: 12px;
    }

    .avatar {
      width: 44px;
      height: 44px;
      border-radius: 50%;
      flex: 0 0 auto;
      background:
        radial-gradient(circle at 32% 28%, rgba(255,255,255,.94), transparent 28%),
        linear-gradient(160deg, #f7d4c8, #78c9b0 50%, #238eb8);
      box-shadow: inset 0 0 18px rgba(255,255,255,.6), 0 12px 28px rgba(57,104,123,.20);
    }

    .chat-person b {
      display: block;
      font-family: var(--font-romance);
      font-size: 17px;
      line-height: 1.2;
    }

    .chat-person span {
      display: block;
      margin-top: 4px;
      color: var(--muted);
      font-size: 12px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 52vw;
    }

    .chat-log {
      min-height: 0;
      overflow-y: auto;
      flex: 1;
      padding: 22px 18px 26px;
      display: flex;
      flex-direction: column;
      gap: 0;
      background:
        linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,.04)),
        linear-gradient(90deg, rgba(255,248,239,.24), transparent 48%, rgba(219,242,241,.22)),
        linear-gradient(145deg, rgba(230,242,244,.38), rgba(255,255,255,.08));
      scroll-behavior: smooth;
    }

    .bubble-row {
      display: flex;
      width: 100%;
      align-items: flex-start;
      gap: 9px;
    }

    .bubble-row.assistant {
      align-items: flex-start;
    }

    .bubble-row + .bubble-row { margin-top: 12px; }
    .bubble-row.continuous { margin-top: 4px; }

    .bubble-row.user { justify-content: flex-end; }
    .bubble-row.assistant { justify-content: flex-start; }

    .chat-avatar-mini {
      width: var(--chat-avatar);
      height: var(--chat-avatar);
      border-radius: 50%;
      flex: 0 0 auto;
      box-shadow: 0 8px 18px rgba(57,104,123,.14);
      border: 1px solid rgba(255,255,255,.72);
    }

    .chat-avatar-mini.assistant {
      background:
        radial-gradient(circle at 35% 28%, rgba(255,255,255,.96), transparent 27%),
        linear-gradient(160deg, #f7d4c8, #78c9b0 52%, #238eb8);
    }

    .chat-avatar-mini.user {
      background: linear-gradient(135deg, #b8e4e4, #d4f0f0);
    }

    .chat-avatar-mini.user.has-image {
      background-size: cover;
      background-position: center;
    }

    .chat-avatar-mini.hidden-avatar {
      visibility: hidden;
    }

    .message-stack {
      display: grid;
      justify-items: start;
      max-width: 100%;
    }

    .bubble-row.user .message-stack {
      justify-items: end;
    }

    .bubble {
      width: fit-content;
      max-width: var(--chat-max);
      padding: var(--chat-pad-y) var(--chat-pad-x);
      border-radius: 18px;
      line-height: 1.54;
      font-size: var(--chat-font);
      word-break: break-word;
      box-shadow: 0 10px 26px rgba(57,104,123,.10);
    }

    .bubble-content {
      display: flex;
      flex-wrap: wrap;
      align-items: flex-end;
      gap: 4px;
    }

    .bubble-text {
      flex: 1 1 auto;
      white-space: pre-wrap;
      word-break: break-word;
      min-width: 2em;
    }

    .bubble-row.assistant .bubble {
      color: var(--ink);
      background: rgba(255,255,255,.70);
      border-radius: 4px 18px 18px 18px;
      border: 1px solid rgba(255,255,255,.82);
      backdrop-filter: blur(20px) saturate(1.12);
      -webkit-backdrop-filter: blur(20px) saturate(1.12);
    }

    .bubble-row.user .bubble {
      color: #2a5a5a;
      background: linear-gradient(135deg,
        rgba(100, 200, 200, 0.25),
        rgba(120, 180, 220, 0.2));
      border-radius: 18px 4px 18px 18px;
      border: 1px solid rgba(100, 200, 200, 0.3);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
    }

    .bubble-time {
      font-size: 11px;
      opacity: 0.5;
      white-space: nowrap;
      align-self: flex-end;
      line-height: 1.2;
    }

    .read-mark {
      display: inline-flex;
      align-items: center;
      font-weight: 700;
    }

    .chat-tools {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .bubble-tool {
      height: 28px;
      padding: 0 10px;
      border-radius: 999px;
      font-size: 12px;
    }

    .bubble-settings {
      position: absolute;
      top: 78px;
      right: 16px;
      width: min(280px, calc(100vw - 32px));
      padding: 14px;
      border-radius: 18px;
      background: rgba(255,255,255,.86);
      border: 1px solid rgba(255,255,255,.82);
      box-shadow: 0 18px 46px rgba(57,104,123,.18);
      backdrop-filter: blur(24px) saturate(1.14);
      -webkit-backdrop-filter: blur(24px) saturate(1.14);
      z-index: 6;
    }

    .bubble-settings.hidden { display: none; }

    .bubble-settings-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      margin-bottom: 10px;
      font-size: 13px;
      font-weight: 700;
      color: var(--ink);
    }

    .bubble-setting {
      display: grid;
      gap: 6px;
      margin-top: 10px;
    }

    .bubble-setting label {
      display: flex;
      justify-content: space-between;
      color: var(--muted);
      font-size: 12px;
    }

    .bubble-setting input {
      width: 100%;
      accent-color: var(--water);
    }

    .custom-css-editor {
      width: 100%;
      min-height: 150px;
      margin-top: 10px;
      padding: 10px;
      border: 1px solid rgba(87,134,153,.18);
      border-radius: 12px;
      color: var(--ink);
      background: rgba(255,255,255,.72);
      font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      resize: vertical;
    }

    .typing {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      min-width: 42px;
    }

    .typing i {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: rgba(23,52,76,.45);
      animation: typingDot 1.1s infinite ease-in-out;
    }

    .typing i:nth-child(2) { animation-delay: .15s; }
    .typing i:nth-child(3) { animation-delay: .3s; }

    @keyframes typingDot {
      0%, 80%, 100% { transform: translateY(0); opacity: .42; }
      40% { transform: translateY(-4px); opacity: .9; }
    }

    .chat-compose {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 8px;
      flex-shrink: 0;
      padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
      margin: 9px 12px calc(9px + env(safe-area-inset-bottom));
      border: 1px solid rgba(255,255,255,.6);
      border-radius: 24px;
      background: rgba(255,255,255,.4);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }

    .chat-compose textarea {
      min-height: 38px;
      max-height: 132px;
      resize: none;
      border: 1px solid rgba(87,134,153,.16);
      border-radius: 20px;
      padding: 8px 12px;
      outline: none;
      color: var(--ink);
      background: transparent;
      line-height: 1.55;
      box-shadow: none;
    }

    .send-btn {
      width: 36px;
      height: 36px;
      padding: 0;
      border-radius: 50%;
      color: #fff;
      font-size: 17px;
      background: rgba(78, 180, 180, 0.7);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border: none;
    }

    .send-btn:disabled {
      opacity: .45;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }

    .voice-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 14px;
    }

    .voice-card {
      min-height: 150px;
      border-radius: var(--radius-sm);
      padding: 14px;
      background: rgba(255,255,255,.50);
      border: 1px solid rgba(87,134,153,.14);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      display: grid;
      align-content: start;
      gap: 10px;
    }

    .voice-card.wide {
      grid-column: 1 / -1;
    }

    .voice-card b,
    .gift-card b,
    .wish-item b {
      display: block;
      font-family: var(--font-romance);
      font-size: 14px;
      line-height: 1.35;
    }

    .voice-card p,
    .gift-card p,
    .wish-item p {
      margin: 0;
      color: var(--muted);
      line-height: 1.58;
      font-size: 13px;
      white-space: pre-wrap;
      word-break: break-word;
    }

    .gift-layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 340px;
      gap: 14px;
    }

    .gift-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
    }

    .gift-card {
      min-height: 140px;
      border-radius: var(--radius-sm);
      padding: 14px;
      background: rgba(255,255,255,.50);
      border: 1px solid rgba(87,134,153,.14);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      display: grid;
      gap: 10px;
      align-content: space-between;
    }

    .gift-card .btn,
    .gift-form .btn {
      width: 100%;
    }

    .gift-form {
      display: grid;
      gap: 10px;
    }

    .gift-form input,
    .gift-form textarea {
      width: 100%;
      border: 1px solid rgba(87,134,153,.16);
      border-radius: var(--radius-sm);
      padding: 11px 12px;
      outline: none;
      color: var(--ink);
      background: rgba(255,255,255,.76);
    }

    .gift-form textarea {
      min-height: 84px;
      resize: vertical;
    }

    .wish-list {
      display: grid;
      gap: 10px;
      margin-top: 12px;
    }

    .wish-item {
      border-radius: var(--radius-sm);
      padding: 12px;
      background: rgba(255,255,255,.50);
      border: 1px solid rgba(87,134,153,.14);
    }

    .wish-item small {
      display: block;
      margin-top: 8px;
      color: var(--muted);
      font-size: 11px;
      word-break: break-all;
    }

    @media (max-width: 1120px) {
      .shell { grid-template-columns: 1fr; }
      .modules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .chat-view { min-height: 0; }
      .gift-layout { grid-template-columns: 1fr; }
    }

    @media (max-width: 767px) {
      body { overflow: hidden; }
      .main {
        height: 100%;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        gap: 10px;
        grid-template-rows: auto minmax(0, 1fr);
        align-content: stretch;
      }
      .topbar { align-items: flex-start; flex-direction: row; padding-top: 2px; }
      .title h1 { font-size: clamp(22px, 6vw, 25px); }
      .top-actions { width: auto; align-self: flex-start; justify-content: flex-end; padding-top: 0; }
      .top-actions .btn { flex: 0 0 auto; }
      .water-stage { min-height: auto; padding: 16px; }
      .water-wrap { min-height: 300px; }
      .water-orbit { width: min(310px, 82vw); }
      .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .voice-grid, .gift-grid { grid-template-columns: 1fr; }
      .water-core strong { font-size: 22px; }
      .chat-view {
        height: 100%;
        min-height: 0;
        border-radius: clamp(20px, 6vw, 26px);
      }
      .chat-log { padding: 18px 11px 18px; gap: 0; }
      .message-stack { max-width: min(78%, 560px); }
      .bubble-settings { top: 72px; right: 10px; }
      .settings-drawer { width: min(320px, 88vw); }
      .chat-compose { padding: 9px 10px calc(9px + env(safe-area-inset-bottom)); }
      .chat-person span { max-width: 46vw; }
    }

    @media (min-width: 768px) {
      .float-ball {
        display: none !important;
      }
    }

    /* ===== 设置抽屉视觉升级 ===== */
    input[type="range"] {
      -webkit-appearance: none;
      height: 3px;
      background: rgba(78, 180, 180, 0.2);
      border-radius: 2px;
      outline: none;
      cursor: pointer;
    }
    input[type="range"]::-webkit-slider-thumb {
      -webkit-appearance: none;
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background: linear-gradient(135deg, #4ecdc4, #6bb8d4);
      cursor: pointer;
      box-shadow: 0 2px 8px rgba(78,180,180,0.4);
    }
    input[type="range"]::-moz-range-thumb {
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background: linear-gradient(135deg, #4ecdc4, #6bb8d4);
      border: none;
      cursor: pointer;
      box-shadow: 0 2px 8px rgba(78,180,180,0.4);
    }
    .upload-btn {
      background: rgba(78,180,180,0.12);
      border: 1px dashed rgba(78,180,180,0.4);
      border-radius: 12px;
      padding: 8px 16px;
      color: #3aada5;
      cursor: pointer;
      width: 100%;
      font-size: 13px;
      transition: background .18s ease;
    }
    .upload-btn:hover { background: rgba(78,180,180,0.22); }
    .settings-btn {
      background: rgba(78,180,180,0.1);
      border: 1px solid rgba(78,180,180,0.3);
      border-radius: 12px;
      padding: 8px 16px;
      color: #2d5a5a;
      width: 100%;
      cursor: pointer;
      font-size: 13px;
      transition: background .18s ease;
    }
    .settings-btn:hover { background: rgba(78,180,180,0.18); }
    .font-select {
      width: 100%;
      height: 36px;
      border: 1px solid rgba(78,180,180,0.3);
      border-radius: 12px;
      padding: 0 10px;
      color: var(--ink);
      background: rgba(255,255,255,.68);
      outline: none;
      font-size: 13px;
      cursor: pointer;
    }
    .font-select:focus {
      border-color: rgba(78,180,180,0.6);
      box-shadow: 0 0 0 3px rgba(78,180,180,0.12);
    }

    /* ===== 底部工具栏 ===== */
    .chat-compose {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      gap: 8px;
      align-items: flex-end;
    }

    .compose-plus {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      border: 1px solid rgba(78,180,180,0.3);
      background: rgba(78,180,180,0.1);
      color: #3aada5;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
      transition: background .18s;
    }
    .compose-plus:hover { background: rgba(78,180,180,0.2); }
    .compose-plus svg { width: 20px; height: 20px; }

    /* ===== 九宫格面板 ===== */
    .plus-panel {
      display: none;
      background: rgba(255,255,255,0.96);
      border-top: 1px solid rgba(78,180,180,0.15);
      padding: 16px 18px;
    }
    .plus-panel.open { display: block; }

    .plus-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
    }

    .plus-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 7px;
      cursor: pointer;
      padding: 10px 6px;
      border-radius: 14px;
      transition: background .16s;
    }
    .plus-item:hover { background: rgba(78,180,180,0.1); }

    .plus-icon {
      width: 52px;
      height: 52px;
      border-radius: 14px;
      background: rgba(78,180,180,0.12);
      border: 1px solid rgba(78,180,180,0.2);
      display: flex;
      align-items: center;
      justify-content: center;
      color: #3aada5;
    }
    .plus-icon svg { width: 24px; height: 24px; stroke-width: 1.5; }

    .plus-label {
      font-size: 11px;
      color: var(--muted);
      text-align: center;
      line-height: 1.3;
    }

    /* ===== 弹窗通用 ===== */
    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 40;
      background: rgba(33,50,67,0.18);
      display: none;
      align-items: flex-end;
      justify-content: center;
      padding: 0;
    }
    .modal-backdrop.open {
      display: flex;
    }

    .modal-sheet {
      width: 100%;
      max-width: 640px;
      max-height: 80dvh;
      overflow-y: auto;
      background: rgba(255,255,255,0.96);
      border-radius: 24px 24px 0 0;
      padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
      box-shadow: 0 -16px 60px rgba(57,104,123,0.18);
      backdrop-filter: blur(28px);
      -webkit-backdrop-filter: blur(28px);
    }

    .modal-handle {
      width: 36px;
      height: 4px;
      border-radius: 999px;
      background: rgba(87,134,153,0.2);
      margin: 0 auto 16px;
    }

    .modal-title {
      font-family: var(--font-romance);
      font-size: 17px;
      font-weight: 700;
      margin-bottom: 14px;
      color: var(--ink);
    }

    .modal-input {
      width: 100%;
      border: 1px solid rgba(78,180,180,0.3);
      border-radius: 12px;
      padding: 10px 12px;
      color: var(--ink);
      background: rgba(255,255,255,0.8);
      outline: none;
      font-size: 14px;
      margin-bottom: 10px;
    }
    .modal-input:focus {
      border-color: rgba(78,180,180,0.6);
      box-shadow: 0 0 0 3px rgba(78,180,180,0.1);
    }

    .modal-textarea {
      width: 100%;
      min-height: 90px;
      border: 1px solid rgba(78,180,180,0.3);
      border-radius: 12px;
      padding: 10px 12px;
      color: var(--ink);
      background: rgba(255,255,255,0.8);
      outline: none;
      font-size: 14px;
      resize: none;
      margin-bottom: 10px;
    }

    .modal-btn-row {
      display: flex;
      gap: 8px;
      margin-top: 4px;
    }

    .modal-btn {
      flex: 1;
      height: 42px;
      border-radius: 12px;
      border: 1px solid rgba(78,180,180,0.3);
      background: rgba(78,180,180,0.1);
      color: #2d5a5a;
      font-size: 14px;
      cursor: pointer;
      transition: background .16s;
    }
    .modal-btn:hover { background: rgba(78,180,180,0.2); }
    .modal-btn.primary {
      background: linear-gradient(135deg, #4ecdc4, #6bb8d4);
      color: #fff;
      border-color: transparent;
    }

    /* ===== 表情包面板 ===== */
    .sticker-tabs {
      display: flex;
      gap: 8px;
      margin-bottom: 12px;
      overflow-x: auto;
      padding-bottom: 4px;
    }
    .sticker-tab {
      flex-shrink: 0;
      height: 30px;
      padding: 0 12px;
      border-radius: 999px;
      border: 1px solid rgba(78,180,180,0.25);
      background: rgba(255,255,255,0.6);
      color: var(--muted);
      font-size: 12px;
      cursor: pointer;
    }
    .sticker-tab.active {
      background: rgba(78,180,180,0.15);
      color: #3aada5;
      border-color: rgba(78,180,180,0.4);
    }
    .sticker-grid {
      display: grid;
      grid-template-columns: repeat(6, 1fr);
      gap: 8px;
      max-height: 240px;
      overflow-y: auto;
    }
    .sticker-item {
      aspect-ratio: 1;
      border-radius: 10px;
      background: rgba(78,180,180,0.06);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 26px;
      cursor: pointer;
      transition: background .14s, transform .14s;
      border: 1px solid transparent;
    }
    .sticker-item:hover {
      background: rgba(78,180,180,0.18);
      transform: scale(1.08);
      border-color: rgba(78,180,180,0.3);
    }
    .sticker-item img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      border-radius: 8px;
    }

    /* ===== 转账/红包卡片 ===== */
    .transfer-card {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      border-radius: 14px;
      background: linear-gradient(135deg, rgba(78,180,180,0.15), rgba(107,184,212,0.12));
      border: 1px solid rgba(78,180,180,0.25);
      min-width: 160px;
    }
    .transfer-icon {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: linear-gradient(135deg, #4ecdc4, #6bb8d4);
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      flex-shrink: 0;
    }
    .transfer-icon svg { width: 18px; height: 18px; }
    .transfer-info b {
      display: block;
      font-size: 15px;
      color: var(--ink);
    }
    .transfer-info span {
      font-size: 11px;
      color: var(--muted);
    }
    .hongbao-card {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 12px 16px;
      border-radius: 14px;
      background: linear-gradient(135deg, rgba(220,121,110,0.18), rgba(234,166,166,0.14));
      border: 1px solid rgba(220,121,110,0.25);
      min-width: 160px;
    }
    .hongbao-icon {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: linear-gradient(135deg, #dc796e, #eaa6a6);
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      flex-shrink: 0;
    }
    .hongbao-icon svg { width: 18px; height: 18px; }

    /* ===== Reroll ===== */
    .reroll-btn {
      font-size: 11px;
      color: var(--muted);
      background: none;
      border: none;
      cursor: pointer;
      padding: 2px 6px;
      border-radius: 6px;
      opacity: 0.6;
      transition: opacity .14s;
    }
    .reroll-btn:hover { opacity: 1; background: rgba(78,180,180,0.1); }
    .delete-bubble-btn {
      font-size: 11px;
      color: #dc796e;
      background: none;
      border: none;
      cursor: pointer;
      padding: 2px 6px;
      border-radius: 6px;
      opacity: 0;
      transition: opacity .14s;
    }
    .bubble-row:hover .delete-bubble-btn { opacity: 0.7; }
    .message-stack:hover .delete-bubble-btn { opacity: 0.7; }
    .bubble-actions {
      display: flex;
      gap: 2px;
      margin-top: 3px;
    }
    .bubble-row.assistant .bubble-actions { justify-content: flex-start; }
    .bubble-row.user .bubble-actions { justify-content: flex-end; }
