/* ==========================================================================
   autodocsAI / INALIVE Platform - Premium Modern Theme & Design System
   ========================================================================== */

:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;

  --gradient-spark: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --gradient-glow: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #d946ef 100%);
  --gradient-dark: linear-gradient(180deg, #0b0f19 0%, #111827 100%);

  /* UI Dark Colors */
  --bg-app: #0b0f19;
  --bg-sidebar: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --bg-input: rgba(15, 23, 42, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --sidebar-width: 440px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 25px var(--primary-glow);
  --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Reset & Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   Header Navbar
   ========================================================================== */
.app-header {
  height: var(--header-height);
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 100;
  flex-shrink: 0;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--gradient-spark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
  animation: pulse-glow 3s infinite alternate;
}

@keyframes pulse-glow {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.03); filter: brightness(1.15); }
}

.portal-brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  transition: var(--transition-smooth);
}
.portal-brand-link:hover {
  filter: brightness(1.15);
}

.portal-brand-logo-img {
  height: 28px;
  width: auto;
  max-width: 175px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(0, 255, 60, 0.35));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.portal-brand-link:hover .portal-brand-logo-img {
  transform: scale(1.03);
  filter: drop-shadow(0 0 16px rgba(0, 255, 60, 0.65));
}

.portal-badge-pill {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.brand-separator {
  color: rgba(255, 255, 255, 0.2);
  font-size: 1.1rem;
  font-weight: 300;
  user-select: none;
}

/* ==========================================================================
   INALIVE App Switcher (1ボタンでアプリ切り替えランチャー)
   ========================================================================== */
.app-switcher-wrapper {
  position: relative;
}

.btn-app-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.85rem;
  color: var(--text-main);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  backdrop-filter: blur(8px);
}

.btn-app-switcher:hover,
.btn-app-switcher.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.25);
  transform: translateY(-1px);
}

.app-badge-icon {
  font-size: 0.95rem;
}

.active-app-name {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.01em;
}

.app-status-pill {
  font-size: 0.65rem;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-full);
  padding: 1px 6px;
  text-transform: uppercase;
}

.switcher-arrow {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.btn-app-switcher.active .switcher-arrow {
  transform: rotate(180deg);
}

/* App Launcher Dropdown */
.app-launcher-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 360px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.15);
  backdrop-filter: blur(24px);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slide-down 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-launcher-dropdown.active {
  display: flex;
}

.launcher-header {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.launcher-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.launcher-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.launcher-badge {
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-full);
  padding: 2px 7px;
}

.launcher-grid {
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 380px;
  overflow-y: auto;
}

.launcher-app-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
  color: inherit;
  position: relative;
}

.launcher-app-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(3px);
}

.launcher-app-item.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
}

.launcher-app-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.launcher-app-item.active .launcher-app-icon {
  background: var(--gradient-spark);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.launcher-app-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.launcher-app-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.launcher-app-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.launcher-app-tag {
  font-size: 0.625rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.launcher-app-tag.active {
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.launcher-app-tag.coming-soon {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.launcher-app-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.launcher-footer {
  padding: 0.65rem 1.1rem;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-title span {
  background: var(--gradient-spark);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}
.status-dot.generating {
  background: var(--accent-amber);
  box-shadow: 0 0 10px var(--accent-amber);
  animation: blink 1s infinite alternate;
}
@keyframes blink {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-header {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-header:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* ==========================================================================
   Language Selector (i18n: Client-side Toggle Pill)
   ========================================================================== */
.lang-selector-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: var(--transition-smooth);
}

.lang-selector-pill:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.btn-lang-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  white-space: nowrap;
}

.btn-lang-choice .lang-flag-icon {
  font-size: 0.85rem;
  line-height: 1;
  filter: saturate(0.9);
  transition: transform 0.2s ease;
}

.btn-lang-choice:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.btn-lang-choice:hover .lang-flag-icon {
  transform: scale(1.15);
}

.btn-lang-choice.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.32) 0%, rgba(168, 85, 247, 0.28) 100%);
  border-color: rgba(129, 140, 248, 0.55);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font-weight: 700;
}

.btn-lang-choice.active .lang-flag-icon {
  filter: saturate(1.2);
}

/* ==========================================================================
   API Key Header Button (Highlight & Prompt State)
   ========================================================================== */
.btn-api-key-header {
  position: relative;
  overflow: visible;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-api-key-icon {
  font-size: 0.95rem;
  display: inline-block;
  line-height: 1;
}

.btn-api-key-label {
  font-weight: 600;
  font-size: 0.825rem;
}

.btn-api-key-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  line-height: 1.2;
}

/* APIキー未設定時の強調・アピールスタイル (目を引くオレンジ/アンバー発光 & パルス) */
.btn-header.needs-key {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(239, 68, 68, 0.28) 100%);
  border: 1.5px solid #f59e0b;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
  animation: apiKeyPulseAttention 2.4s infinite cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.btn-header.needs-key:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.38) 0%, rgba(239, 68, 68, 0.42) 100%);
  border-color: #fbbf24;
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.7);
  transform: translateY(-2px) scale(1.03);
}

.btn-header.needs-key .btn-api-key-icon {
  animation: keyWiggle 3s infinite ease-in-out;
}

.btn-api-key-badge.needs-key {
  background: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.badge-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  display: inline-block;
  animation: blinkDot 1s infinite alternate;
}

/* APIキー設定済みのスマートスタイル */
.btn-header.configured {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #f1f5f9;
}

.btn-header.configured:hover {
  background: rgba(34, 197, 94, 0.22);
  border-color: rgba(34, 197, 94, 0.6);
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.4);
}

.btn-api-key-badge.configured {
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.5);
  color: #4ade80;
}

/* 注意を促すシェイクアニメーション */
.shake-attention {
  animation: shakeBtn 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97) both !important;
}

@keyframes apiKeyPulseAttention {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7), 0 0 10px rgba(245, 158, 11, 0.4);
    border-color: #f59e0b;
  }
  50% {
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0), 0 0 20px rgba(239, 68, 68, 0.6);
    border-color: #fbbf24;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0), 0 0 10px rgba(245, 158, 11, 0.4);
    border-color: #f59e0b;
  }
}

@keyframes keyWiggle {
  0%, 75%, 100% { transform: rotate(0deg); }
  80% { transform: rotate(-16deg) scale(1.15); }
  85% { transform: rotate(16deg) scale(1.15); }
  90% { transform: rotate(-10deg) scale(1.1); }
  95% { transform: rotate(8deg) scale(1.05); }
}

@keyframes blinkDot {
  from { opacity: 0.3; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1.1); }
}

@keyframes shakeBtn {
  10%, 90% { transform: translate3d(-1px, 0, 0) scale(1.03); }
  20%, 80% { transform: translate3d(2px, 0, 0) scale(1.03); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0) scale(1.05); }
  40%, 60% { transform: translate3d(4px, 0, 0) scale(1.05); }
}

/* サイドバーのキー未設定誘導バナー */
.sidebar-key-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(239, 68, 68, 0.15) 100%);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  margin-bottom: 0.55rem;
  font-size: 0.75rem;
  animation: noticeFadeIn 0.3s ease-out;
}

.sidebar-key-notice.hidden {
  display: none !important;
}

.key-notice-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #fbbf24;
  font-weight: 500;
}

.key-notice-icon {
  font-size: 0.85rem;
}

.btn-notice-key-config {
  background: #f59e0b;
  border: none;
  color: #0f172a;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
}

.btn-notice-key-config:hover {
  background: #fbbf24;
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

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

.select-model {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: var(--transition-smooth);
}
.select-model:focus {
  border-color: var(--primary);
}

/* ==========================================================================
   Main Workspace Layout
   ========================================================================== */
.app-workspace {
  flex: 1 0 auto;
  min-height: 100vh;
  height: 100vh;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Left: Chat & Controls Sidebar */
.sidebar-panel {
  width: var(--sidebar-width);
  min-width: 360px;
  max-width: 580px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
}

.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.btn-icon-text {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}
.btn-icon-text:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

/* Chat Messages Container */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Message Styles */
.message {
  display: flex;
  flex-direction: column;
  max-width: 95%;
  animation: fadeIn 0.25s ease-out;
}

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

.message.user {
  align-self: flex-end;
}

.message.assistant {
  align-self: flex-start;
}

.message-bubble {
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.55;
  position: relative;
  word-break: break-word;
}

.message.user .message-bubble {
  background: var(--primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.message.assistant .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

.message-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.message.user .message-meta {
  justify-content: flex-end;
}

/* Suggestion & Templates Drawer */
.templates-section {
  padding: 0.85rem 1.25rem;
  background: rgba(15, 23, 42, 0.5);
  border-bottom: 1px solid var(--border-color);
}

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.scroll-nav-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scroll-hint-text {
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  opacity: 0.75;
}

.btn-scroll-nav {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-scroll-nav:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #ffffff;
  border-color: var(--primary);
  transform: scale(1.08);
}

.templates-chips-wrapper {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.45rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.4) transparent;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  cursor: grab;
}

.templates-chips-wrapper:active {
  cursor: grabbing;
}

.templates-chips-wrapper::-webkit-scrollbar {
  height: 5px;
}
.templates-chips-wrapper::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 9999px;
}
.templates-chips-wrapper::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.35);
  border-radius: 9999px;
}
.templates-chips-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.7);
}

.template-chip {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.38rem 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
  user-select: none;
}

.template-chip:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary-light);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Quick Refine Actions */
.quick-refine-wrapper {
  background: rgba(15, 23, 42, 0.4);
  border-top: 1px solid var(--border-color);
  padding: 0.45rem 1.25rem 0.5rem;
}

.quick-refine-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.refine-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

.quick-refine-bar {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.35) transparent;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  cursor: grab;
}

.quick-refine-bar:active {
  cursor: grabbing;
}

.quick-refine-bar::-webkit-scrollbar {
  height: 4px;
}
.quick-refine-bar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 9999px;
}
.quick-refine-bar::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 9999px;
}
.quick-refine-bar::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.65);
}

.refine-pill {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
  user-select: none;
}
.refine-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Input Area */
.chat-input-area {
  padding: 1rem 1.25rem 1.25rem;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
}

.input-container {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.input-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.prompt-textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  min-height: 54px;
  max-height: 160px;
  line-height: 1.5;
  user-select: text !important;
  -webkit-user-select: text !important;
  ime-mode: auto !important;
  pointer-events: auto !important;
}
.prompt-textarea::placeholder {
  color: var(--text-dim);
}

.input-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.25rem;
}

.char-counter {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.btn-send {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.45rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
}
.btn-send:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}
.btn-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ==========================================================================
   Right: Real-time Preview Panel & Right-side Vertical Toolbar
   ========================================================================== */
.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: row; /* 横並び: 左プレビュー、右ツールバー */
  background: #060911;
  overflow: hidden;
  position: relative;
  height: 100%;
}

/* Preview Content Container (上下いっぱいまで拡大) */
.preview-stage {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.04) 0%, transparent 60%);
  position: relative;
  min-width: 0;
}

/* Preview Toolbar (右側に縦並び配置) */
.preview-toolbar {
  width: 58px;
  height: 100%;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--border-color);
  border-bottom: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0.65rem 0.25rem;
  gap: 0.35rem;
  z-index: 20;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ツールバー用スクロールバーのカスタマイズ（極細・透過） */
.preview-toolbar::-webkit-scrollbar {
  width: 3px;
}
.preview-toolbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
}

/* Viewport Switcher (縦型ピル) */
.device-switcher {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  padding: 3px;
  border-radius: var(--radius-sm);
  gap: 2px;
  width: 100%;
  box-sizing: border-box;
}

.btn-device {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.15rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: var(--transition-smooth);
  width: 100%;
  box-sizing: border-box;
}

.btn-device-icon {
  font-size: 0.9rem;
  line-height: 1.1;
}

.btn-device-label {
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.btn-device.active, .btn-device:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

/* Preview Actions Container (縦一列配置) */
.preview-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.btn-tool {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  box-sizing: border-box;
}
.btn-tool:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-tool-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}
.btn-tool-primary:hover {
  background: var(--primary-dark);
  color: #ffffff;
}

.btn-tool-accent {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
}
.btn-tool-accent:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.btn-tool-edit {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}
.btn-tool-edit.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.6);
  color: #c7d2fe;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.35);
  font-weight: 600;
}
.btn-tool-edit.active:hover {
  background: rgba(99, 102, 241, 0.3);
  border-color: var(--primary-light);
  color: #ffffff;
}

/* Floating Direct Edit Indicator Badge */
.direct-edit-hint {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 10;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.direct-edit-hint.hidden {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

.direct-edit-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #818cf8;
  box-shadow: 0 0 8px #818cf8;
  animation: pulse-dot 1.8s infinite ease-in-out;
}

.toolbar-divider {
  width: 32px;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin: 4px auto;
}

/* Auto-save Status Badge */
.autosave-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-full);
  width: 32px;
  height: 32px;
  padding: 0;
  cursor: help;
  margin: 0;
  box-sizing: border-box;
}

.autosave-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Device Frames */
.viewport-frame {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  position: relative;
}

.viewport-frame.tablet {
  width: 768px;
  height: 94%;
  border-radius: var(--radius-lg);
}

.viewport-frame.mobile {
  width: 390px;
  height: 844px;
  max-height: 94%;
  border-radius: 36px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 8px #1e293b;
}

.preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* Code View Mode */
.code-viewer-container {
  display: none;
  width: 100%;
  height: 100%;
  background: #0d1117;
  color: #e6edf3;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  padding: 1.25rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* Loading Overlay */
.preview-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  gap: 1.25rem;
}

.preview-loading-overlay.active {
  display: flex;
}

.loader-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}
@keyframes spin {
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  text-align: center;
}
.loading-subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Empty State / Welcome Screen */
.preview-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem;
  max-width: 520px;
  color: var(--text-muted);
}
.welcome-icon {
  font-size: 3.5rem;
  margin-bottom: 1.25rem;
  background: var(--gradient-spark);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.welcome-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}
.welcome-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 1.5rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-box,
.modal-card {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
}
.btn-close:hover {
  color: var(--text-main);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-tip-box {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 0.825rem;
  color: #c7d2fe;
  line-height: 1.5;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-text {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-smooth);
}
.input-text:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastIn 0.3s ease-out;
  pointer-events: auto;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast.success { border-left: 4px solid var(--accent-emerald); }
.toast.info { border-left: 4px solid var(--primary); }
.toast.warning { border-left: 4px solid var(--accent-amber); }
.toast.error { border-left: 4px solid #ef4444; }

/* ==========================================================================
   App Startup Splash Screen
   ========================================================================== */
.app-splash-screen {
  position: fixed;
  inset: 0;
  background-color: #080b12;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s;
}

.app-splash-screen.fade-out {
  opacity: 0;
  transform: scale(1.05);
  visibility: hidden;
  pointer-events: none;
}

.splash-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.splash-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  animation: splashPulse 6s ease-in-out infinite alternate;
}

.splash-glow-1 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
  top: 15%;
  left: 20%;
}

.splash-glow-2 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
  bottom: 10%;
  right: 20%;
  animation-delay: -3s;
}

@keyframes splashPulse {
  0% { transform: scale(0.9) translate(0, 0); opacity: 0.25; }
  100% { transform: scale(1.15) translate(20px, -20px); opacity: 0.45; }
}

.splash-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 440px;
  width: 90%;
  padding: 2.5rem;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 30px rgba(99, 102, 241, 0.2);
  animation: splashAppear 0.5s ease-out;
}

@keyframes splashAppear {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.splash-logo-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.splash-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #6366f1, #a855f7, #ec4899, #06b6d4, #6366f1);
  animation: splashSpin 3s linear infinite;
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}

@keyframes splashSpin {
  100% { transform: rotate(360deg); }
}

.splash-logo {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #052e16, #064e3b);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px rgba(34, 197, 94, 0.5);
  animation: splashBob 2.5s ease-in-out infinite;
}

.splash-emblem-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(0, 255, 80, 0.6));
}

.splash-banner-box {
  margin: 0.75rem 0 0.5rem;
  display: flex;
  justify-content: center;
}

.splash-logo-img {
  height: 44px;
  width: auto;
  max-width: 85vw;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(0, 255, 80, 0.45));
}

@keyframes splashBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.splash-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 0.35rem;
}

.splash-title span {
  background: var(--gradient-spark);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.splash-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.splash-loader-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.splash-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.splash-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--gradient-spark);
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.8);
  transition: width 0.35s ease-out;
  position: relative;
}

.splash-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: splashShimmer 1.5s infinite;
}

@keyframes splashShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.splash-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.splash-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: splashDotPulse 1.2s infinite;
}

@keyframes splashDotPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
}

.splash-footer-badge {
  font-size: 0.725rem;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 1.2rem;
  width: 100%;
}

/* ==========================================================================
   Google Authentication & User Profile Styles
   ========================================================================== */
.auth-header-section {
  display: flex;
  align-items: center;
  position: relative;
}

.btn-google-login {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-google-login:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.google-icon {
  flex-shrink: 0;
}

.user-profile-wrapper {
  position: relative;
}

.user-profile-wrapper.hidden {
  display: none !important;
}

.user-profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 12px 4px 6px;
  border-radius: var(--radius-full);
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition-smooth);
}

.user-profile-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: var(--border-active);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-name {
  font-weight: 600;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-plan-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.menu-arrow {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* User Dropdown Menu */
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 0.6rem 0;
  z-index: 200;
  display: none;
  backdrop-filter: blur(20px);
  animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-dropdown-menu.active {
  display: block;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
  padding: 0.5rem 1rem;
}

.dropdown-user-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}

.dropdown-user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  word-break: break-all;
  margin-top: 2px;
}

.dropdown-plan-tag {
  font-size: 0.72rem;
  color: #a5b4fc;
  margin-top: 6px;
}

.user-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0.4rem 0;
}

.dropdown-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0.6rem 1rem;
  color: var(--text-main);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.dropdown-item.logout {
  color: #f87171;
}

.dropdown-item.logout:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

/* Demo Login Button */
.btn-demo-login {
  width: 100%;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  border: 1px dashed rgba(168, 85, 247, 0.4);
  color: #c084fc;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-demo-login:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3) 0%, rgba(168, 85, 247, 0.3) 100%);
  border-color: rgba(168, 85, 247, 0.8);
  color: #fff;
  transform: translateY(-1px);
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1rem 0;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-divider span {
  padding: 0 0.8rem;
}

/* ==========================================================================
   Enhanced BYOK API Key UI Styles
   ========================================================================== */
.api-key-input-row {
  display: flex;
  align-items: center;
  position: relative;
}

.api-key-input-row .input-text {
  padding-right: 42px;
}

.btn-toggle-visibility {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  opacity: 0.65;
  transition: var(--transition-smooth);
}

.btn-toggle-visibility:hover {
  opacity: 1;
}

.api-key-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.key-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: #334155;
  color: #cbd5e1;
}

.status-badge.valid {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-badge.invalid {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.status-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-test-connection {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-test-connection:hover {
  background: rgba(99, 102, 241, 0.3);
  color: #fff;
  border-color: rgba(99, 102, 241, 0.7);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
  border-color: rgba(239, 68, 68, 0.7);
}

/* ==========================================================================
   Auth Protection & Logged-Out Hero State
   ========================================================================== */
.auth-protected.hidden {
  display: none !important;
}

/* 未ログイン時は左サイドバーが隠れるためプレビュー領域をフル幅に */
.sidebar-panel.hidden {
  display: none !important;
}

/* Logged-out Hero Container */
.logged-out-hero {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: radial-gradient(circle at 50% 30%, rgba(99, 102, 241, 0.15) 0%, rgba(11, 15, 25, 0.98) 70%);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow-y: auto;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.logged-out-hero.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.hero-card {
  max-width: 600px;
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 40px rgba(99, 102, 241, 0.2);
  position: relative;
  overflow: hidden;
  animation: heroCardEntrance 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes heroCardEntrance {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.hero-portal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  color: #4ade80;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.hero-badge-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.hero-logo-box {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0 1rem;
}

.hero-brand-logo {
  max-width: 320px;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 25px rgba(0, 255, 80, 0.4));
  transition: transform 0.3s ease, filter 0.3s ease;
}

.hero-brand-logo:hover {
  transform: scale(1.02);
  filter: drop-shadow(0 0 35px rgba(0, 255, 80, 0.65));
}

.hero-main-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.15;
}

.hero-main-title span {
  background: var(--gradient-spark);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-concept {
  font-size: 0.95rem;
  color: #e2e8f0;
  line-height: 1.6;
  margin: 1rem auto 1.5rem;
  font-style: italic;
  max-width: 520px;
}

.hero-app-intro-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  text-align: left;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

.hero-app-intro-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-spark);
}

.intro-app-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: #818cf8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.intro-app-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  margin: 0.25rem 0 0.4rem;
}

.intro-app-title span {
  color: #818cf8;
}

.intro-app-desc {
  font-size: 0.85rem;
  color: #94a3b8;
  line-height: 1.5;
}

.hero-feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.hero-pill {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

/* Hero Highlight Boxes (プライバシー完全保証 & 制限なしの自由) */
.hero-highlight-box {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.15rem;
  text-align: left;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  transition: var(--transition-smooth);
}

.hero-highlight-box:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.4);
}

.hero-highlight-box.privacy {
  border-left: 4px solid #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(15, 23, 42, 0.8) 100%);
}

.hero-highlight-box.freedom {
  border-left: 4px solid #8b5cf6;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(15, 23, 42, 0.8) 100%);
}

.highlight-badge-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.highlight-badge-pill.freedom {
  color: #c084fc;
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.35);
}

.highlight-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.45;
  margin-bottom: 0.45rem;
}

.highlight-text {
  font-size: 0.825rem;
  color: #cbd5e1;
  line-height: 1.6;
}

.highlight-text strong {
  color: #ffffff;
  background: var(--gradient-spark);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-login-action-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.hero-login-prompt {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 0.25rem;
}

.btn-hero-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: #ffffff;
  color: #1f2937;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: var(--transition-smooth);
}

.btn-hero-google:hover {
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.25);
}

.btn-hero-demo {
  background: rgba(99, 102, 241, 0.12);
  border: 1px dashed rgba(168, 85, 247, 0.4);
  color: #c084fc;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-hero-demo:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(168, 85, 247, 0.8);
  color: #fff;
  transform: translateY(-1px);
}

.hero-security-note {
  margin-top: 1.25rem;
  font-size: 0.75rem;
  color: #64748b;
}

.auth-modal-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.auth-modal-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(0, 255, 80, 0.35));
}

/* ==========================================================================
   INALIVE Public Metrics & Transparency Dashboard Styles
   ========================================================================== */

/* Header & Hero Trigger Buttons */
.btn-metrics-header {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-metrics-header * {
  pointer-events: none;
}

.btn-metrics-header:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.6);
  color: #6ee7b7;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
  transform: translateY(-1px);
}

.metrics-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  display: inline-block;
  animation: metricsDotPulse 1.8s infinite ease-in-out;
}

@keyframes metricsDotPulse {
  0% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 4px #10b981; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px #34d399; }
  100% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 4px #10b981; }
}

.btn-hero-metrics {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #a7f3d0;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-hero-metrics:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: #34d399;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.2);
}

/* Modal Customization */
#metricsModal {
  z-index: 1050;
}

.modal-box-metrics {
  max-width: 780px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.metrics-modal-body {
  overflow-y: auto;
  padding-right: 6px;
}

.metrics-modal-logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 9999px;
  margin-bottom: 4px;
}

.metrics-live-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #34d399;
  letter-spacing: 0.05em;
}

.metrics-intro-text {
  font-size: 0.84rem;
  line-height: 1.6;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid #10b981;
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1.25rem;
}

/* 1. Privacy Guarantee Grid */
.privacy-guarantee-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .privacy-guarantee-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.privacy-stat-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(52, 211, 153, 0.22);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.75rem;
  text-align: center;
  position: relative;
  transition: var(--transition-smooth);
}

.privacy-stat-card:hover {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(15, 23, 42, 0.95);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.privacy-stat-icon {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.privacy-stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.45rem;
  font-weight: 800;
  color: #38bdf8;
  line-height: 1.2;
}

.privacy-stat-val.success-val {
  color: #34d399;
}

.privacy-stat-val .unit {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  margin-left: 2px;
}

.privacy-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-top: 4px;
}

.privacy-stat-sub {
  font-size: 0.65rem;
  color: #94a3b8;
  margin-top: 2px;
}

/* Section Title */
.metrics-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.metrics-update-time {
  font-size: 0.7rem;
  font-weight: normal;
  color: #64748b;
  font-family: 'JetBrains Mono', monospace;
}

/* 2. Vitals Stats Grid */
.vitals-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
  .vitals-stats-grid {
    grid-template-columns: 1fr;
  }
}

.vital-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  transition: var(--transition-smooth);
}

.vital-card:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

.vital-card.highlight-vital {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(168, 85, 247, 0.12));
  border-color: rgba(168, 85, 247, 0.35);
}

.vital-card.highlight-vital .vital-num {
  color: #c084fc;
}

.vital-icon {
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
}

.vital-content {
  flex: 1;
}

.vital-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.1;
}

.vital-name {
  font-size: 0.74rem;
  color: #94a3b8;
  margin-top: 3px;
}

/* 3. Two Columns Breakdown */
.metrics-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 0.75rem;
}

@media (max-width: 680px) {
  .metrics-two-col {
    grid-template-columns: 1fr;
  }
}

.metrics-col-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 0.9rem;
}

.col-card-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
}

.metric-bar-item {
  margin-bottom: 0.7rem;
}

.metric-bar-item:last-child {
  margin-bottom: 0;
}

.metric-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #cbd5e1;
  margin-bottom: 3px;
}

.metric-bar-labels .count {
  font-family: 'JetBrains Mono', monospace;
  color: #94a3b8;
  font-weight: 600;
}

.metric-progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  overflow: hidden;
}

.metric-progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric-progress-fill.green {
  background: linear-gradient(90deg, #10b981, #06b6d4);
}

.metric-progress-fill.purple {
  background: linear-gradient(90deg, #8b5cf6, #ec4899);
}

.breakdown-loading {
  font-size: 0.75rem;
  color: #64748b;
  text-align: center;
  padding: 1.5rem 0;
}

.metrics-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.85rem;
}

/* ==========================================================================
   Project Save Destination Modal Styles (Local JSON / Google Drive)
   ========================================================================== */
/* ==========================================================================
   Save Destination Modal & Google Cloud Drive Integration
   ========================================================================== */
.hidden {
  display: none !important;
}

.modal-box-save-dest {
  max-width: 580px;
  width: 94%;
}

.save-dest-intro {
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.save-dest-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.save-dest-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  color: inherit;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.save-dest-card:not(:disabled):not(.disabled):hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.save-dest-card.drive-card:not(:disabled):not(.disabled):hover {
  border-color: rgba(66, 133, 244, 0.5);
  box-shadow: 0 8px 24px rgba(66, 133, 244, 0.18);
}

/* Disabled & Setup Needed states */
.save-dest-card:disabled,
.save-dest-card.disabled,
.save-dest-card.needs-client-id {
  opacity: 0.62;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.02) !important;
  border-color: rgba(255, 255, 255, 0.07) !important;
  transform: none !important;
  box-shadow: none !important;
}

.save-dest-card:disabled .btn-dest-action,
.save-dest-card.disabled .btn-dest-action,
.save-dest-card.needs-client-id .btn-dest-action {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #94a3b8 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  cursor: not-allowed;
}

.save-dest-card-icon {
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  flex-shrink: 0;
}

.save-dest-card-info {
  flex: 1;
  min-width: 0;
}

.save-dest-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main, #f8fafc);
  margin-bottom: 0.25rem;
}

.save-dest-card-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.save-dest-card-badge.drive {
  background: rgba(66, 133, 244, 0.18);
  color: #93c5fd;
  border: 1px solid rgba(66, 133, 244, 0.3);
}

.save-dest-card-badge.warning {
  background: rgba(234, 179, 8, 0.2);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.4);
}

.save-dest-card-desc {
  font-size: 0.76rem;
  color: var(--text-muted, #94a3b8);
  margin: 0;
  line-height: 1.4;
}

.save-dest-card-action {
  flex-shrink: 0;
}

.btn-dest-action {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.15s ease;
}

.save-dest-card:not(:disabled):not(.disabled):hover .btn-dest-action {
  background: #6366f1;
  color: #ffffff;
  border-color: #6366f1;
}

.save-dest-card.drive-card:not(:disabled):not(.disabled):hover .btn-dest-action.drive {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* Drive 保存の進捗 / 完了表示エリア */
.drive-save-status-area {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.drive-save-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: #93c5fd;
}

.loader-spinner-sm {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.drive-save-success {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.drive-success-badge {
  font-size: 0.88rem;
  font-weight: 600;
  color: #34d399;
}

.drive-file-meta {
  font-size: 0.75rem;
  color: #cbd5e1;
  margin: 0;
  word-break: break-all;
}

.drive-success-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Google Cloud OAuth Client ID セットアップボックス */
.drive-client-setup-box {
  margin-top: 1rem;
  padding: 1rem 1.15rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(234, 179, 8, 0.25);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.drive-client-setup-box.configured {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(15, 23, 42, 0.6);
}

.setup-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.setup-box-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fde047;
  display: flex;
  align-items: center;
  gap: 6px;
}

.drive-client-setup-box.configured .setup-box-title {
  color: #34d399;
}

.setup-links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-gcp-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(66, 133, 244, 0.15);
  border: 1px solid rgba(66, 133, 244, 0.35);
  color: #93c5fd;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-gcp-link:hover {
  background: rgba(66, 133, 244, 0.3);
  color: #ffffff;
  border-color: rgba(66, 133, 244, 0.6);
}

.setup-steps-list {
  font-size: 0.74rem;
  color: #cbd5e1;
  line-height: 1.55;
  margin: 0;
  padding-left: 1.25rem;
}

.setup-steps-list li {
  margin-bottom: 0.25rem;
}

.setup-steps-list strong {
  color: #f8fafc;
}

.origin-copy-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.73rem;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.origin-code {
  font-family: 'JetBrains Mono', monospace;
  color: #38bdf8;
  font-size: 0.76rem;
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-copy-origin {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-origin:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.drive-client-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.drive-client-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 7px 10px;
  color: #fff;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  transition: all 0.2s ease;
}

.drive-client-input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

.drive-client-input::placeholder {
  color: #64748b;
  font-family: inherit;
}

.drive-client-status-msg {
  font-size: 0.74rem;
  line-height: 1.4;
}

.drive-client-status-msg.success {
  color: #34d399;
}

.drive-client-status-msg.warning {
  color: #fde047;
}

.btn-tool-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
}

.btn-tool-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* ==========================================================================
   Drive File List in Restore Modal
   ========================================================================== */
.drive-file-list-container {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 280px;
  overflow-y: auto;
}

.drive-file-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: #93c5fd;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.5rem;
}

.drive-file-list-loading,
.drive-file-list-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1.25rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.drive-file-list-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.drive-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  transition: all 0.15s ease;
}

.drive-file-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(66, 133, 244, 0.4);
}

.drive-file-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.drive-file-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drive-file-item-meta {
  font-size: 0.7rem;
  color: #94a3b8;
}

.btn-restore-file {
  background: rgba(66, 133, 244, 0.2);
  border: 1px solid rgba(66, 133, 244, 0.4);
  color: #93c5fd;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-restore-file:hover {
  background: #2563eb;
  color: #ffffff;
}

.btn-restore-as-new {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-restore-as-new:hover {
  background: #059669;
  color: #ffffff;
}

.btn-rename-file {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-rename-file:hover {
  background: #d97706;
  border-color: #d97706;
  color: #ffffff;
}

.btn-rename-file:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-delete-file {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.btn-delete-file:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.drive-file-item-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ==========================================================================
   Drive File Rename Modal
   ========================================================================== */
.modal-box-rename {
  max-width: 480px;
}

.rename-current-info {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}

.rename-current-label {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.rename-current-val {
  color: #f1f5f9;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Drive Save Config Panel & Mode Selection
   ========================================================================= */
.drive-save-config-panel {
  margin-top: 0.85rem;
  padding: 1rem 1.15rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  animation: fadeIn 0.25s ease-out;
}

.drive-save-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.drive-save-config-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #93c5fd;
}

.btn-unlink-drive {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-unlink-drive:hover {
  background: #dc2626;
  color: #ffffff;
}

.drive-save-mode-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (max-width: 640px) {
  .drive-save-mode-group {
    grid-template-columns: 1fr;
  }
}

.drive-mode-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.drive-mode-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(96, 165, 250, 0.4);
}

.drive-mode-card.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.drive-mode-card input[type="radio"] {
  margin-top: 3px;
  accent-color: #3b82f6;
  cursor: pointer;
}

.drive-mode-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drive-mode-main {
  font-size: 0.8rem;
  font-weight: 700;
  color: #f8fafc;
}

.drive-mode-sub {
  font-size: 0.7rem;
  color: #94a3b8;
  line-height: 1.35;
  word-break: break-all;
}

.drive-save-filename-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.drive-save-filename-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: #cbd5e1;
}

.drive-filename-input-inner {
  display: flex;
}

.drive-filename-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 8px 12px;
  color: #ffffff;
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.drive-filename-input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}

.drive-save-exec-wrap {
  display: flex;
  justify-content: flex-end;
}

.btn-execute-drive-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
}

.btn-execute-drive-save:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

.btn-execute-drive-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 復元ファイル一覧のエラー表示 */
.drive-file-list-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-sm {
  padding: 3px 8px !important;
  font-size: 0.72rem !important;
}

.drive-file-list-error {
  padding: 0.85rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: center;
}

.drive-file-error-msg {
  font-size: 0.78rem;
  color: #fca5a5;
  line-height: 1.4;
  word-break: break-all;
}

.drive-file-error-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Accessibility screen-reader only utility */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ==========================================================================
   Right Column: Project Management Drawer (保存・復元統合パネル)
   ========================================================================== */
.project-drawer {
  width: 380px;
  min-width: 340px;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 15;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.22s ease,
              border-color 0.22s ease;
  overflow: hidden;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
}

.project-drawer.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  border-left-color: transparent !important;
  opacity: 0 !important;
  pointer-events: none !important;
  box-shadow: none !important;
}

/* Drawer Header */
.drawer-header {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 15, 29, 0.75);
  flex-shrink: 0;
}

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.drawer-icon {
  font-size: 1.15rem;
}

.drawer-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  margin: 0;
}

.btn-drawer-collapse {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.btn-drawer-collapse:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* Drawer Tabs */
.drawer-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid var(--border-color);
  padding: 4px 10px 0;
  gap: 6px;
  flex-shrink: 0;
}

.drawer-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 0.55rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.drawer-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.drawer-tab.active {
  color: #c7d2fe;
  border-bottom-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
}

/* Tab Panes */
.drawer-tab-pane {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.drawer-tab-pane.hidden {
  display: none !important;
}

/* Storage Selector (Local vs Google Drive) */
.storage-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.btn-storage-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.5rem 0.4rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  position: relative;
}

.btn-storage-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.btn-storage-tab.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.badge-needs-setup {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.5);
}

/* Current Active Editing Card */
.current-editing-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

.current-editing-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, #818cf8, #3b82f6);
}

.current-editing-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.editing-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 1.8s infinite ease-in-out;
}

.current-editing-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #34d399;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.current-editing-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-rename-drive-mini {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1.4;
}

.btn-rename-drive-mini:hover {
  background: rgba(245, 158, 11, 0.28);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.6);
}

.btn-unlink-drive-mini {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-unlink-drive-mini:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.current-editing-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f8fafc;
  word-break: break-all;
  line-height: 1.35;
}

.current-editing-meta {
  font-size: 0.68rem;
  color: #94a3b8;
}

/* Save Actions (Overwrite vs New) */
.drawer-save-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.save-button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-drawer-primary {
  background: linear-gradient(135deg, #4f46e5, #3b82f6);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 0.6rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-drawer-primary:hover {
  background: linear-gradient(135deg, #4338ca, #2563eb);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.45);
  transform: translateY(-1px);
}

.btn-drawer-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-drawer-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* New Save Form */
.drawer-new-save-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  animation: fadeIn 0.2s ease-out;
}

.new-save-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #c7d2fe;
}

.new-save-input-row {
  display: flex;
  gap: 6px;
}

.drawer-input-text {
  flex: 1;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  color: #f8fafc;
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.drawer-input-text:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.btn-drawer-execute {
  background: #10b981;
  border: none;
  color: #ffffff;
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-drawer-execute:hover {
  background: #059669;
}

/* Local Quick Actions */
.local-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 0.75rem;
}

.btn-local-sub {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.45rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-local-sub:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

/* List Headers */
.list-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.5rem;
}

.list-section-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.02em;
}

.list-section-count {
  font-size: 0.7rem;
  color: #64748b;
}

.btn-refresh-list {
  background: transparent;
  border: none;
  color: #818cf8;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.btn-refresh-list:hover {
  background: rgba(99, 102, 241, 0.15);
}

/* Project Card List */
.project-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-card-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all 0.18s ease;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.project-card-item:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Active Editing Highlight */
.project-card-item.active-editing {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(59, 130, 246, 0.12));
  border: 1px solid rgba(99, 102, 241, 0.7) !important;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.25);
}

.project-card-item.active-editing::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: #818cf8;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.project-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.project-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #f1f5f9;
  word-break: break-all;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-active-now {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  white-space: nowrap;
}

.project-card-meta {
  font-size: 0.68rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

/* Drive Prompt Card (when Client ID is missing) */
.drive-prompt-card {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.prompt-card-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.prompt-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.prompt-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fcd34d;
}

.prompt-card-desc {
  font-size: 0.74rem;
  color: #cbd5e1;
  line-height: 1.4;
  margin: 0;
}

.btn-open-config-tab {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #ffffff;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  align-self: flex-start;
  margin-top: 0.35rem;
  transition: all 0.15s ease;
}

.btn-open-config-tab:hover {
  background: #b45309;
}

/* Drive List Status Messages */
.drive-list-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 1.5rem 1rem;
  font-size: 0.78rem;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px dashed var(--border-color);
  text-align: center;
}

.drive-list-msg.error {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

.btn-retry-sm {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.7rem;
  cursor: pointer;
}

/* Config Pane (Tab 2) */
.config-pane-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.config-header-box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.config-main-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.config-sub-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.gcp-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-gcp-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: #93c5fd;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.5rem;
  border-radius: 6px;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-gcp-card:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #ffffff;
}

.config-guide-steps {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.72rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.step-num {
  background: rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.oauth-url-guide-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.oauth-guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.oauth-env-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
  letter-spacing: 0.03em;
}

.oauth-env-badge.prod {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.oauth-notice-tip {
  font-size: 0.65rem;
  color: #f59e0b;
  font-weight: 600;
}

.url-guide-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.origin-title-label {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.label-sub-note {
  font-size: 0.63rem;
  color: #fca5a5;
  font-weight: 500;
}

.url-pill-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.origin-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 3px 6px;
  transition: border-color 0.15s ease;
}

.origin-pill:hover {
  border-color: rgba(99, 102, 241, 0.4);
}

.origin-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #a5f3fc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-origin-copy {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-origin-copy:hover {
  background: rgba(99, 102, 241, 0.3);
  border-color: var(--primary);
  color: #ffffff;
}

.client-id-form-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.client-id-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #c7d2fe;
}

.client-id-btn-row {
  display: flex;
  gap: 6px;
}

.btn-save-client-id {
  flex: 1;
  background: linear-gradient(135deg, #4f46e5, #3b82f6);
  border: none;
  color: #ffffff;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-save-client-id:hover {
  background: linear-gradient(135deg, #4338ca, #2563eb);
}

.btn-clear-client-id {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.client-id-status-msg {
  font-size: 0.72rem;
  line-height: 1.35;
}
.client-id-status-msg.success { color: #34d399; }
.client-id-status-msg.warning { color: #fbbf24; }

/* ==========================================================================
   Full Viewport Workspace & Footer Out-of-View Positioning
   ========================================================================== */
.app-workspace {
  min-height: 100vh;
  height: 100vh;
  flex: 1 0 auto;
}

#inaliveGlobalFooter {
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  margin-top: 60px; /* 初期画面では画面外に配置され、スクロール時のみ閲覧可能 */
}
