    :root {
      --bg: #f9f8f5;
      --surface: #ffffff;
      --line: #e5e2d9;
      --text: #2c2c34;
      --text-soft: #2c2c34;
      --accent: #5b6abf;
      --accent-ink: #2c2c34;
      --bubble-user: #f4f3ee;
      --bubble-user-text: #2c2c34;
      --bubble-ai: #ffffff;
      --bubble-ai-text: #2c2c34;
      --warn: #f59e0b;
      --error: #ef4444;
      --shadow: 0 18px 40px rgba(0,0,0,0.06);
      --motion-smooth: cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    * { box-sizing: border-box; }

    html, body {
      margin: 0;
      min-height: 100%;
      background: radial-gradient(1300px 700px at 50% -200px, #f4f3ee 0%, #f9f8f5 45%, #f9f8f5 100%);
      color: var(--text);
      font-family: "Inter", "Segoe UI", sans-serif;
    }

    .app {
      width: 100%;
      margin: 0 auto;
      min-height: calc(100vh - 20px);
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
    }

    .panel {
      border: 1px solid var(--line);
      border-radius: 20px;
      background: #ffffff;
      box-shadow: var(--shadow);
      overflow: hidden;
      backdrop-filter: blur(4px);
    }

    .left {
      display: grid;
      grid-template-rows: auto 1fr auto;
      min-height: 0;
    }

    .left-head {
      padding: 12px;
      border-bottom: 1px solid var(--line);
      display: grid;
      gap: 8px;
      background: rgba(0,0,0,0.02);
    }

    .brand {
      margin: 0;
      font-family: "Instrument Serif", sans-serif;
      font-size: 20px;
      letter-spacing: 0.02em;
    }

    .sub {
      font-size: 12px;
      color: var(--text-soft);
    }

    .row {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
    }

    .search {
      width: 100%;
      border: 1px solid #c0bfba;
      border-radius: 11px;
      background: #ffffff;
      color: #2c2c34;
      padding: 10px 12px;
      outline: none;
    }

    .search:focus {
      border-color: #2c2c34;
      box-shadow: 0 0 0 3px rgba(96, 141, 207, 0.25);
    }

    button,
    input {
      font: inherit;
    }

    button {
      border: 1px solid #c0bfba;
      border-radius: 10px;
      background: #ffffff;
      color: #2c2c34;
      
      padding: 8px 10px;
      cursor: pointer;
    }

    button:hover {
      background: #f4f3ee;
      border-color: #2c2c34;
    }

    button.primary {
      background: var(--accent);
      border-color: var(--accent);
      color: var(--accent-ink);
      
    }

    button.primary:hover {
      background: #5b6abf;
    }

    .filter.active {
      border-color: #60d48a;
      background: #f4f3ee;
      color: #2c2c34;
    }

    .danger {
      border-color: #c0bfba;
      background: #ffffff;
      color: #2c2c34;
    }

    .danger:hover {
      border-color: #2c2c34;
      background: #f4f3ee;
    }

    .list {
      padding: 8px;
      overflow: auto;
      display: grid;
      gap: 8px;
      align-content: start;
    }

    .entry {
      border: 1px solid #f4f3ee;
      border-radius: 14px;
      background: #ffffff;
      padding: 10px;
      display: grid;
      gap: 7px;
      transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    }

    .entry:hover {
      border-color: #c0bfba;
      transform: translateY(-1px);
      box-shadow: 0 10px 18px rgba(8, 17, 30, 0.08);
    }

    .entry.active {
      border-color: #2c2c34;
      background: linear-gradient(180deg, #f4f3ee, #f4f3ee);
    }

    .entry.stagger-in {
      animation: cardIn 0.24s var(--motion-smooth) both;
      animation-delay: calc(var(--stagger, 0) * 14ms);
    }

    .entry strong {
      font-size: 14px;
      line-height: 1.28;
      color: #2c2c34;
    }

    .small {
      font-size: 12px;
      color: var(--text-soft);
    }

    .chip {
      border: 1px solid #c0bfba;
      background: #ffffff;
      color: #2c2c34;
      border-radius: 999px;
      font-size: 11px;
      
      padding: 4px 8px;
      display: inline-block;
    }

    .left-foot {
      border-top: 1px solid #f4f3ee;
      background: #f4f3ee;
      flex-shrink: 0;
    }

    .nav {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
    }

    .nav .logo { grid-column: 1 / -1; justify-content: center; }

    .nav a {
      text-decoration: none;
      color: #2c2c34;
      border: none;
      border-top: 2px solid transparent;
      border-right: 1px solid #f4f3ee;
      text-align: center;
      padding: 10px 6px;
      font-size: 11.5px;
      
      background: transparent;
      transition: color 0.12s, background 0.12s;
      white-space: nowrap;
    }

    .nav a:last-child { border-right: none; }
    .nav a:hover { color: #2c2c34; background: rgba(0,0,0,0.03); }
    .nav a.active {
      color: #5b6abf;
      border-top-color: #5b6abf;
      background: rgba(91,106,191,.05);
    }

    .right {
      display: grid;
      grid-template-rows: auto 1fr auto;
      min-height: 0;
    }

    .right-head {
      border-bottom: 1px solid var(--line);
      padding: 10px 12px;
      background: rgba(0,0,0,0.02);
      display: flex;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
      align-items: center;
    }

    .right-head h1 {
      margin: 0;
      font-family: "Instrument Serif", sans-serif;
      font-size: 18px;
      letter-spacing: -0.01em;
    }

    .status {
      color: #2c2c34;
      font-size: 12px;
    }

    .status.warn { color: #f6d27c; }
    .status.error { color: #ff9b9b; }

    .stream {
      padding: 14px;
      overflow: auto;
      display: grid;
      gap: 10px;
      align-content: start;
      background-color: #f9f8f5;
      background-image:
        radial-gradient(rgba(91,106,191,0.04) 1px, transparent 1px),
        linear-gradient(180deg, rgba(91,106,191,0.03), transparent);
      background-size: 22px 22px, 100% 100%;
    }

    .msg {
      max-width: min(840px, 95%);
      border-radius: 14px;
      padding: 10px 12px;
      border: 1px solid rgba(0,0,0,0.06);
      box-shadow: 0 7px 18px rgba(0,0,0,0.02);
    }

    .msg.stagger-in {
      animation: bubbleIn 0.22s var(--motion-smooth) both;
      animation-delay: calc(var(--stagger, 0) * 20ms);
    }

    .msg.user {
      margin-left: auto;
      background: var(--bubble-user);
      color: var(--bubble-user-text);
      border-color: #2c2c34;
    }

    .msg.assistant {
      margin-right: auto;
      background: var(--bubble-ai);
      color: var(--bubble-ai-text);
      border-color: #2c2c34;
    }

    .msg-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
      font-size: 11px;
      
      opacity: 0.82;
    }

    .msg-body {
      display: grid;
      gap: 8px;
      line-height: 1.38;
      font-size: 14px;
    }

    .expr {
      border: 1px solid #f4f3ee;
      border-radius: 9px;
      background: #f8fbff;
      padding: 8px;
      overflow-x: auto;
      white-space: nowrap;
      font-size: 13px;
    }

    .thumb {
      width: min(340px, 100%);
      border: 1px solid #f4f3ee;
      border-radius: 10px;
      overflow: hidden;
      background: #fff;
    }

    .thumb img {
      display: block;
      width: 100%;
      height: auto;
    }

    .step {
      border: 1px solid #f4f3ee;
      border-radius: 10px;
      background: #f6faff;
      padding: 8px;
      display: grid;
      gap: 5px;
    }

    .empty {
      color: #555560;
      font-size: 13px;
    }

    .right-foot {
      border-top: 1px solid var(--line);
      padding: 10px;
      background: rgba(0,0,0,0.02);
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
    }

    .right-foot a {
      text-decoration: none;
      border: 1px solid #c0bfba;
      border-radius: 10px;
      background: #ffffff;
      color: #2c2c34;
      
      padding: 8px 10px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
    }

    @keyframes bubbleIn {
      from {
        opacity: 0;
        transform: translateY(4px) scale(0.995);
      }
      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    @keyframes cardIn {
      from {
        opacity: 0;
        transform: translateY(4px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @media (prefers-reduced-motion: reduce) {
      .entry,
      .msg {
        animation: none !important;
        transition: none !important;
      }
    }

    /* Desktop (1021px+) */
    @media (min-width: 1021px) {
      .app {
        width: min(1240px, calc(100vw - 18px));
        height: calc(100vh - 20px);
        grid-template-columns: 370px minmax(0, 1fr);
        margin: 10px auto;
      }
    }

    /* ── Mobile improvements ────────────────────────────────── */
    .left {
      max-height: 45vh;
    }

    .left-head {
      padding: 12px;
    }

    .right-head {
      padding: 12px;
    }

    @media (min-width: 1021px) {
      .left {
        max-height: none;
      }
    }

    /* Bottom nav: safe area + touch targets */
    .left-foot {
      padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .nav a {
      min-height: 44px;
      display: inline-flex;
      align-items: center;
      padding: 8px 12px;
    }
  

    /* Stacked layout (<1021px): app-style fixed bottom nav, matches /play/ */
    @media (max-width: 1020px) {
      .left .left-foot {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        background: #ffffff;
        border-top: 1px solid var(--line, #e5e2d9);
        padding-bottom: env(safe-area-inset-bottom, 0px);
      }
      .left .nav { grid-template-columns: repeat(6, 1fr); }
      .left .nav .logo { display: none !important; }
      .panel { backdrop-filter: none; }
      .left .nav a {
        font-size: 10.5px;
        padding: 12px 2px;
        border-right: none;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }
      .app { padding-bottom: 62px; align-content: start; }
    }
