
    /* vrm-viewer.css — VRMビューアー固有スタイル（共通スタイルはcommon.cssを参照） */

    html {
      height: 100%;
      margin: 0;
      padding: 0;
      overflow: hidden;
    }

    body {
      height: 100%;
      margin: 0;
      padding: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    /* Main layout */
    .main {
      flex: 1;
      display: flex;
      position: relative;
      overflow: hidden;
      height: calc(100vh - 64px);
    }

    /* 3D Canvas */
    #vrm-canvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      display: block;
    }

    /* Loading overlay */
    #loading-overlay {
      position: absolute;
      inset: 0;
      background: var(--bg);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 16px;
      z-index: 50;
      transition: opacity 0.5s ease;
    }

    #loading-overlay.hidden {
      opacity: 0;
      pointer-events: none;
    }

    .loading-text {
      font-size: 15px;
      color: var(--text-muted);
    }

    .loading-progress {
      font-size: 12px;
      color: var(--text-dim);
    }

    /* Error overlay */
    #error-overlay {
      position: absolute;
      inset: 0;
      background: var(--bg);
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 16px;
      z-index: 50;
      padding: 24px;
      text-align: center;
    }

    #error-overlay.visible {
      display: flex;
    }

    .error-icon {
      font-size: 48px;
    }

    .error-title {
      font-size: 18px;
      font-weight: 700;
      color: var(--red);
    }

    .error-desc {
      font-size: 14px;
      color: var(--text-muted);
      max-width: 480px;
    }

    /* Controls panel */
    .controls {
      position: absolute;
      top: 16px;
      right: 16px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      z-index: 10;
    }

    .control-card {
      background: rgba(26, 29, 39, 0.92);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 14px 16px;
      backdrop-filter: blur(12px);
      min-width: 200px;
    }

    .control-title {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-dim);
      margin-bottom: 10px;
    }

    .btn-group {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }

    .btn {
      background: var(--card2);
      border: 1px solid var(--border);
      color: var(--text-muted);
      padding: 7px 14px;
      border-radius: var(--radius-sm);
      cursor: pointer;
      font-size: 12px;
      font-family: inherit;
      transition: all 0.2s;
      white-space: nowrap;
    }

    .btn:hover {
      border-color: var(--accent);
      color: var(--text);
    }

    .btn.active {
      background: rgba(124, 58, 237, 0.2);
      border-color: var(--accent);
      color: var(--accent-light);
    }

    /* Subtitle display — positioned above chat panel */
    #subtitle {
      position: absolute;
      bottom: 80px; /* sits above the chat-panel input row */
      left: 20px;
      right: 20px;
      z-index: 10;
      text-align: center;
      font-size: 16px;
      font-weight: 600;
      color: var(--text);
      padding: 10px 20px;
      background: rgba(15, 17, 23, 0.8);
      border-radius: var(--radius);
      border: 1px solid var(--border);
      min-height: 48px;
      display: flex;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(8px);
      text-shadow: 0 1px 4px rgba(0,0,0,0.8);
      word-break: break-all;
    }

    /* Chat panel — input row only, pinned to bottom */
    .chat-panel {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      z-index: 10;
      padding: 12px 20px 16px;
      background: linear-gradient(to top, rgba(15, 17, 23, 0.98) 70%, transparent);
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    #subtitle.empty {
      color: var(--text-dim);
      font-weight: 400;
      font-size: 13px;
    }

    #subtitle.thinking {
      color: var(--accent-light);
    }

    #subtitle.ai {
      color: var(--text);
    }

    #subtitle.user {
      color: var(--text-muted);
      font-style: italic;
    }

    #subtitle.system {
      color: var(--text-dim);
      font-style: italic;
    }

    /* Chat input row */
    .chat-input-row {
      display: flex;
      gap: 8px;
      align-items: center;
    }

    .chat-input {
      flex: 1;
      background: rgba(31, 34, 53, 0.9);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 10px 14px;
      color: var(--text);
      font-size: 14px;
      font-family: inherit;
      outline: none;
      transition: border-color 0.2s;
      backdrop-filter: blur(8px);
    }

    .chat-input:focus {
      border-color: var(--accent);
    }

    .chat-input::placeholder {
      color: var(--text-dim);
    }

    .chat-send-btn {
      background: var(--accent);
      border: none;
      color: #fff;
      padding: 10px 18px;
      border-radius: var(--radius-sm);
      cursor: pointer;
      font-size: 13px;
      font-family: inherit;
      font-weight: 600;
      transition: all 0.2s;
      white-space: nowrap;
    }

    .chat-send-btn:hover {
      background: var(--accent-light);
    }

    .chat-send-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .ctrl-btn {
      background: rgba(30, 30, 50, 0.8);
      border: 1px solid rgba(255,255,255,0.15);
      color: #e2e8f0;
      padding: 7px 14px;
      border-radius: 8px;
      cursor: pointer;
      font-size: 12px;
      font-family: inherit;
      transition: all 0.2s;
      white-space: nowrap;
    }
    .ctrl-btn:hover {
      border-color: #7c3aed;
      color: #fff;
      background: rgba(124, 58, 237, 0.2);
    }
    .ctrl-btn.primary {
      background: linear-gradient(135deg, #7c3aed, #a855f7);
      border-color: transparent;
      color: #fff;
    }

    .mic-btn {
      background: var(--card2);
      border: 1px solid var(--border);
      color: var(--text-muted);
      width: 40px;
      height: 40px;
      border-radius: var(--radius-sm);
      cursor: pointer;
      font-size: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
      flex-shrink: 0;
    }

    .mic-btn:hover {
      border-color: var(--accent);
      color: var(--text);
    }

    .mic-btn.connected {
      background: rgba(34, 197, 94, 0.15);
      border-color: var(--green);
      color: var(--green);
    }

    .mic-btn.recording {
      background: rgba(239, 68, 68, 0.15);
      border-color: var(--red);
      color: var(--red);
      animation: mic-pulse 1s ease infinite;
    }

    @keyframes mic-pulse {
      0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
      50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    }

    /* Info hint */
    .hint {
      position: absolute;
      bottom: 130px;
      left: 16px;
      font-size: 11px;
      color: var(--text-dim);
      background: rgba(26, 29, 39, 0.7);
      padding: 6px 10px;
      border-radius: 6px;
      backdrop-filter: blur(8px);
      pointer-events: none;
    }


    /* Mic status label */
    .mic-status-label {
      font-size: 11px;
      color: var(--text-dim);
      white-space: nowrap;
      flex-shrink: 0;
    }
    .mic-status-label.connected { color: var(--green); }
    .mic-status-label.recording { color: var(--red); }
    .mic-status-label.processing { color: var(--blue); }
    .mic-status-label.speaking { color: var(--accent-light); }
    .mic-status-label.speaking { color: var(--green); }

    /* Voice mode selector */
    .mode-btn {
      padding: 6px 14px;
      background: var(--card2);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      color: var(--text-muted);
      font-size: 12px;
      font-family: inherit;
      cursor: pointer;
      transition: all 0.2s;
    }
    .mode-btn:hover {
      border-color: var(--accent);
      color: var(--text);
    }
    .mode-btn.active {
      background: var(--accent-glow);
      border-color: var(--accent);
      color: var(--accent-light);
    }

    /* Kokoro voice selector */
    .voice-select {
      padding: 6px 10px;
      background: var(--card2);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      color: var(--text-muted);
      font-size: 12px;
      font-family: inherit;
      cursor: pointer;
      transition: all 0.2s;
      appearance: none;
      -webkit-appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238892a4' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 8px center;
      padding-right: 24px;
    }
    .voice-select:hover {
      border-color: var(--accent);
      color: var(--text);
    }
    .voice-select:focus {
      outline: none;
      border-color: var(--accent);
      color: var(--text);
    }
    .voice-select option {
      background: var(--card);
      color: var(--text);
    }

    /* Responsive — tablet */
    @media (max-width: 640px) {
      .header { padding: 0 12px; height: 56px; }
      .header-subtitle { display: none; }
      .nav-link { padding: 4px 8px; font-size: 11px; }
      .controls { top: 8px; right: 8px; }
      .control-card { padding: 10px 12px; min-width: 160px; }
      .chat-panel { padding: 10px 12px; }
      .hint { display: none; }
      body { height: 100dvh; overflow: hidden; }
      .main { height: calc(100dvh - 56px); }
    }

    /* Responsive — smartphone */
    @media (max-width: 600px) {
      /* Body: use dynamic viewport height, safe-area for notch/home bar */
      body {
        height: 100dvh;
        overflow: hidden;
      }

      /* Header: compact */
      .header {
        padding: 0 8px;
        height: 48px;
      }

      .header-subtitle { display: none; }

      .header-icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
      }

      .header-title { font-size: 15px; }

      .header-right { gap: 2px; }

      .nav-link {
        padding: 4px 6px;
        font-size: 11px;
      }

      /* Main: fill remaining height */
      .main { height: calc(100dvh - 48px); }

      /* Controls panel: compact, horizontal layout */
      .controls {
        top: 8px;
        right: 8px;
        gap: 6px;
      }

      .control-card {
        padding: 8px 10px;
        min-width: 0;
        border-radius: var(--radius-sm);
      }

      .control-title {
        font-size: 10px;
        margin-bottom: 6px;
      }

      .btn-group { gap: 4px; }

      .btn {
        padding: 5px 9px;
        font-size: 11px;
      }

      /* Hint: hide */
      .hint { display: none; }

      /* Chat panel: fixed to bottom, above keyboard safe area */
      .chat-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + 8px);
        background: var(--card);
        border-top: 1px solid var(--border);
        z-index: 200;
        /* Override gradient background */
        background-image: none;
        gap: 6px;
      }

      /* Subtitle: fixed above the fixed chat bar */
      #subtitle {
        position: fixed;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        left: 12px;
        right: 12px;
        font-size: 14px;
        padding: 8px 14px;
        min-height: 40px;
        z-index: 190;
      }

      /* Chat input: font-size 16px prevents iOS zoom-in */
      .chat-input {
        font-size: 16px;
        padding: 8px 10px;
      }

      /* Send button */
      .chat-send-btn {
        padding: 8px 14px;
        font-size: 12px;
      }

      /* Mic button: 48px minimum tap target */
      .mic-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
        flex-shrink: 0;
      }

      /* Mic status label: keep short */
      .mic-status-label {
        font-size: 10px;
      }

      /* Loading overlay: adjust text sizes */
      .loading-text { font-size: 13px; }
      .loading-progress { font-size: 11px; }
    }

    @media (max-width: 600px) {
    }
  