*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #07070f;
  --bg-sidebar: #0a0a14;
  --bg-chat: #07070f;
  --bg-input: rgba(20, 20, 28, 0.75);
  --bg-card: rgba(255, 255, 255, 0.035);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-msg-user: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(139, 92, 246, 0.1));
  --bg-msg-ai: rgba(255, 255, 255, 0.04);

  --accent: #06b6d4;
  --accent-light: #67e8f9;
  --accent-glow: rgba(6, 182, 212, 0.32);

  --violet: #8b5cf6;
  --violet-light: #a78bfa;
  --violet-glow: rgba(139, 92, 246, 0.3);

  --amber: #f59e0b;
  --amber-light: #fbbf24;
  --amber-glow: rgba(245, 158, 11, 0.3);

  --rose: #f43f5e;
  --rose-light: #fb7185;
  --rose-glow: rgba(244, 63, 94, 0.3);

  --blue: #3b82f6;
  --blue-light: #60a5fa;
  --blue-glow: rgba(59, 130, 246, 0.3);

  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.12);
  --red: #f87171;
  --warm: var(--amber);
  --warm-glow: var(--amber-glow);

  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-faint: #475569;
  --border: rgba(255, 255, 255, 0.05);
  --border-hover: rgba(255, 255, 255, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 280px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ─── Glass & Motion tokens (P1) ─── */
  --glass-bg: rgba(10, 10, 20, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: 20px;
  --shimmer: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
  --duration-fast: 0.15s;
  --duration-normal: 0.25s;
  --duration-slow: 0.4s;
}

html.playground, body.playground { height: 100%; overflow: hidden; }
html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

/* ─── AMBIENT BACKGROUND ─── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 1200px 800px at 15% 25%, rgba(6, 182, 212, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 900px 700px at 85% 75%, rgba(139, 92, 246, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse 700px 500px at 50% 50%, rgba(245, 158, 11, 0.04) 0%, transparent 55%);
  pointer-events: none; z-index: 0;
  animation: ambientShift 22s ease-in-out infinite alternate;
}

@keyframes ambientShift {
  0% { transform: translateX(-2%) translateY(-1%); }
  100% { transform: translateX(2%) translateY(1%); }
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.35s var(--ease-out);
  position: relative; z-index: 10;
}

.sidebar-header {
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #06b6d4, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.35), 0 4px 12px rgba(6, 182, 212, 0.18);
  flex-shrink: 0;
}
.brand-mark .svg-icon { width: 18px; height: 18px; color: #fff; stroke: #fff; }

.brand-text h1 { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.brand-text-sub { font-size: 11px; color: var(--text-faint); letter-spacing: 0.02em; margin-top: 2px; }

/* ─── NEW CHAT ─── */
.new-chat-btn {
  margin: 14px 14px 0;
  padding: 10px 16px;
  border-radius: 980px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  display: flex; align-items: center; gap: 8px;
  justify-content: center;
  letter-spacing: -0.01em;
}
.new-chat-btn:hover {
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--accent-light);
  background: rgba(6, 182, 212, 0.08);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.1);
}
.new-chat-btn svg { width: 15px; height: 15px; stroke-width: 2; }

/* ─── DEVICE PANEL ─── */
.section-label {
  padding: 16px 16px 6px;
  font-size: 10px; font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.device-list { padding: 3px 10px; overflow-y: auto; }

.device-card {
  padding: 12px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  margin-bottom: 3px;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}
.device-card::before {
  content: '';
  position: absolute; left: 0; top: 10px; bottom: 10px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-light));
  opacity: 0;
  transition: opacity 0.25s var(--ease-out);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}
.device-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.03), transparent);
  opacity: 0;
  transition: opacity 0.25s var(--ease-out);
  pointer-events: none;
}
.device-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
  transform: translateX(2px);
}
.device-card:hover::after { opacity: 1; }
.device-card.active {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.15);
}
.device-card.active::before { opacity: 1; }
.device-card.active::after { opacity: 1; }

.device-card-top { display: flex; align-items: center; gap: 12px; }

.device-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease-spring);
}
.device-card:hover .device-icon { transform: scale(1.08); }
.device-icon .svg-icon { width: 18px; height: 18px; }
.device-icon.ai {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(6, 182, 212, 0.1));
  color: var(--accent-light);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.15);
}
.device-icon.draw {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.16), rgba(244, 63, 94, 0.08));
  color: var(--rose-light);
  box-shadow: 0 0 14px rgba(244, 63, 94, 0.12);
}
.device-icon.write {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(245, 158, 11, 0.08));
  color: var(--amber-light);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.12);
}
.device-icon.human {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(139, 92, 246, 0.08));
  color: var(--violet-light);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.12);
}
.device-icon.voice {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(59, 130, 246, 0.08));
  color: var(--blue-light);
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.12);
}

/* Device card theme accents */
.device-card:has(.device-icon.ai).active {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.2);
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.08);
}
.device-card:has(.device-icon.draw).active {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.2);
  box-shadow: 0 0 24px rgba(244, 63, 94, 0.08);
}
.device-card:has(.device-icon.write).active {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.08);
}
.device-card:has(.device-icon.human).active {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.2);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.08);
}
.device-card:has(.device-icon.voice).active {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.08);
}

.device-meta { flex: 1; min-width: 0; }
.device-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; letter-spacing: -0.01em; }
.device-sub { font-size: 11px; color: var(--text-faint); display: flex; align-items: center; gap: 5px; margin-top: 2px; }

.status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-dot.on { background: var(--green); box-shadow: 0 0 6px rgba(52, 211, 153, 0.5); animation: statusPulse 2s ease-in-out infinite; }
.status-dot.off { background: var(--text-faint); }
.status-dot.busy { background: var(--warm); box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); animation: statusPulse 2s ease-in-out infinite; }
@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.device-tags { display: flex; gap: 5px; margin-top: 7px; padding-left: 48px; }
.tag {
  font-size: 10px; padding: 3px 10px;
  border-radius: 980px; font-weight: 500;
  background: rgba(255, 255, 255, 0.03); color: var(--text-faint);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.2s var(--ease-out);
}
.device-card:hover .tag { background: rgba(255, 255, 255, 0.05); }
.tag.draw-tag { background: rgba(6, 182, 212, 0.08); color: rgba(34, 211, 238, 0.8); border-color: rgba(6, 182, 212, 0.1); }
.tag.write-tag { background: rgba(245, 158, 11, 0.08); color: rgba(245, 158, 11, 0.7); border-color: rgba(245, 158, 11, 0.1); }
.tag.ai-tag { background: rgba(6, 182, 212, 0.08); color: rgba(34, 211, 238, 0.8); border-color: rgba(6, 182, 212, 0.1); }

/* ─── HISTORY ─── */
.history-list { padding: 3px 10px; overflow-y: auto; flex: 1; max-height: 220px; }
.history-item {
  padding: 8px 12px;
  border-radius: 10px; cursor: pointer;
  font-size: 12px; color: var(--text-dim);
  transition: all 0.2s var(--ease-out);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1px solid transparent;
}
.history-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.06);
  transform: translateX(2px);
}

/* ─── SIDEBAR FOOTER ─── */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-faint);
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
}
.sidebar-footer a { color: var(--accent-light); text-decoration: none; opacity: 0.7; transition: all 0.2s var(--ease-out); }
.sidebar-footer a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 2px; }

/* ─── MAIN ─── */
.main {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; position: relative; z-index: 1;
}

/* ─── TOPBAR ─── */
.topbar {
  padding: 0 20px; height: 52px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex; align-items: center;
  justify-content: space-between;
  background: rgba(10, 10, 15, 0.55);
  backdrop-filter: saturate(220%) blur(28px);
  -webkit-backdrop-filter: saturate(220%) blur(28px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.25);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.topbar-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 980px;
  font-size: 11px; font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.2s var(--ease-out);
}
.topbar-status.online { background: var(--green-dim); color: var(--green); border-color: rgba(52, 211, 153, 0.2); box-shadow: 0 0 12px rgba(52, 211, 153, 0.1); }
.topbar-status.offline { background: rgba(100, 116, 139, 0.1); color: var(--text-dim); border-color: rgba(255, 255, 255, 0.04); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-btn, .menu-toggle {
  height: 32px;
  padding: 0 14px;
  border-radius: 980px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim); font-size: 12px;
  cursor: pointer; transition: all 0.25s var(--ease-out);
  font-weight: 500; font-family: inherit;
  letter-spacing: -0.01em;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
}
.topbar-btn:hover, .menu-toggle:hover {
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--accent-light);
  background: rgba(6, 182, 212, 0.08);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.12);
  transform: translateY(-1px);
}
.topbar-btn:focus-visible, .menu-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.3);
}

.menu-toggle {
  display: none; padding: 0; width: 32px;
}

/* ─── CHAT AREA ─── */
.chat-area {
  flex: 1; overflow-y: auto;
  padding: 1.5rem 0 1.5rem;
}
.chat-inner {
  max-width: 800px; margin: 0 auto;
  padding: 0 2rem;
}

/* ─── WELCOME SCREEN ─── */
.welcome {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 55vh; text-align: center;
  padding: 2rem 0;
}

.welcome h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem); font-weight: 700;
  letter-spacing: -0.03em; margin-bottom: 0.6rem;
  line-height: 1.1;
  color: var(--text);
}
.welcome-desc {
  color: var(--text-muted); font-size: 1rem;
  max-width: 460px; margin-bottom: 2.5rem;
  line-height: 1.7;
}

/* Quick actions */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  max-width: 520px; width: 100%;
}
.qa-card {
  padding: 1.1rem 1.25rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.015) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.35s var(--ease-out);
  text-align: left;
  position: relative; overflow: hidden;
}
.qa-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0; transition: opacity 0.35s var(--ease-out);
}
.qa-card:hover {
  border-color: rgba(6, 182, 212, 0.25);
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%);
  transform: scale(1.03) translateY(-2px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), 0 0 32px rgba(6, 182, 212, 0.1);
}
.qa-card:active { transform: scale(0.98) translateY(0); }
.qa-card:hover::before { opacity: 1; }

.qa-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.75rem;
  transition: transform 0.3s var(--ease-spring);
}
.qa-card:hover .qa-icon { transform: scale(1.1) rotate(-3deg); }
.qa-icon .svg-icon { width: 18px; height: 18px; }
.qa-icon.draw { background: rgba(6, 182, 212, 0.14); color: var(--accent-light); box-shadow: 0 0 16px rgba(6, 182, 212, 0.14); }
.qa-icon.write { background: rgba(245, 158, 11, 0.14); color: var(--amber-light); box-shadow: 0 0 16px rgba(245, 158, 11, 0.14); }
.qa-icon.gift { background: rgba(244, 63, 94, 0.14); color: var(--rose-light); box-shadow: 0 0 16px rgba(244, 63, 94, 0.14); }
.qa-icon.status { background: rgba(16, 185, 129, 0.14); color: var(--green); box-shadow: 0 0 16px rgba(16, 185, 129, 0.14); }

.qa-title { font-size: 0.85rem; font-weight: 700; margin-bottom: 0.25rem; letter-spacing: -0.01em; }
.qa-desc { font-size: 0.75rem; color: var(--text-muted); line-height: 1.5; }

/* ─── MESSAGES ─── */
.message {
  display: flex; gap: 0.75rem;
  margin-bottom: 1.75rem;
  opacity: 0;
  animation: msgIn 0.5s var(--ease-out) forwards;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.message.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 32px; height: 32px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 3px;
  transition: transform 0.2s var(--ease-spring);
}
.message:hover .msg-avatar { transform: scale(1.05); }
.msg-avatar .svg-icon { width: 15px; height: 15px; }
.msg-avatar.ai {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(6, 182, 212, 0.1));
  border: 1px solid rgba(6, 182, 212, 0.2);
  color: var(--accent-light);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.12);
}
.msg-avatar.user {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.12));
  border: 1px solid rgba(139, 92, 246, 0.22);
  color: var(--violet-light);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.12);
}

.msg-body { max-width: 85%; min-width: 0; }
.msg-bubble {
  padding: 0.9rem 1.2rem;
  border-radius: 20px;
  font-size: 0.9rem; line-height: 1.8;
  word-wrap: break-word;
  border: 1px solid transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s var(--ease-out);
}
.message:hover .msg-bubble { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); }
.message.user .msg-bubble {
  background: var(--bg-msg-user);
  border-color: rgba(6, 182, 212, 0.2);
  border-bottom-right-radius: 5px;
  color: var(--text);
}
.message.ai .msg-bubble {
  background: var(--bg-msg-ai);
  border-color: rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 5px;
}

.msg-meta {
  font-size: 0.7rem; color: var(--text-faint);
  margin-top: 0.4rem; padding: 0 0.3rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.message.user .msg-meta { justify-content: flex-end; }
.msg-model {
  padding: 0.1rem 0.5rem; border-radius: 980px;
  background: rgba(6, 182, 212, 0.12); color: var(--accent-light);
  font-size: 0.65rem; font-weight: 600;
  border: 1px solid rgba(6, 182, 212, 0.15);
}

/* ─── IMAGE CARD & LIGHTBOX ─── */
.media-card {
  display: inline-block;
  max-width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  cursor: zoom-in;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}
.media-card:hover { transform: scale(1.02); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4); }
.media-card img { display: block; max-width: 100%; height: auto; }

.lightbox {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}
.lightbox.open { display: flex; opacity: 1; }
.lightbox img {
  max-width: 92vw; max-height: 92vh;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  transform: scale(0.95);
  transition: transform 0.3s var(--ease-out);
}
.lightbox.open img { transform: scale(1); }

/* ─── TYPING ─── */
.typing-indicator {
  display: none; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0;
}
.typing-indicator.active { display: flex; }
.typing-dots { display: flex; gap: 5px; }
.typing-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-muted); opacity: 0.3;
  animation: dotPulse 1.4s var(--ease-out) infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 60%, 100% { opacity: 0.2; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1.1); }
}
.typing-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

/* ─── INPUT AREA ─── */
.input-area {
  padding: 0.75rem 1.5rem calc(0.8rem + env(safe-area-inset-bottom));
  background: rgba(10, 10, 15, 0.65);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  position: relative;
  z-index: 5;
}
.input-area::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.3), rgba(139, 92, 246, 0.3), transparent);
}
.input-inner {
  max-width: 800px; margin: 0 auto;
  display: flex; gap: 0.6rem; align-items: flex-end;
}

.input-wrapper { flex: 1; position: relative; }
.input-field {
  width: 100%; padding: 0.8rem 4rem 0.8rem 1.25rem;
  border-radius: 28px;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 0.9rem; font-family: inherit;
  resize: none; outline: none;
  min-height: 52px; max-height: 160px;
  line-height: 1.55;
  transition: border-color 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), background 0.3s var(--ease-out);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.input-field:focus {
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.1), 0 0 30px rgba(6, 182, 212, 0.08);
  background: rgba(20, 20, 28, 0.9);
}
.input-field::placeholder { color: var(--text-faint); transition: color 0.2s var(--ease-out); }
.input-field:focus::placeholder { color: var(--text-dim); }

.input-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.input-pill, .mic-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 980px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.25s var(--ease-out);
  font-weight: 500;
}
.input-pill:hover, .mic-btn:hover {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.25);
  color: var(--accent-light);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.1);
}
.input-pill svg, .mic-btn svg { width: 14px; height: 14px; }
.mic-btn { width: 36px; padding: 0; justify-content: center; }
.mic-btn.listening {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.35);
  color: var(--rose-light);
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.14);
  animation: micPulse 1.2s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.2); }
  50% { box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
}

.send-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  border: none; color: #fff;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}
.send-btn:hover {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--violet-light) 100%);
  transform: scale(1.06);
  box-shadow: 0 8px 32px rgba(6, 182, 212, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}
.send-btn:active { transform: scale(0.96); }
.send-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; background: linear-gradient(135deg, rgba(6, 182, 212, 0.4), rgba(139, 92, 246, 0.25)); }
.send-btn svg { width: 20px; height: 20px; }
.send-btn .spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}
.send-btn.loading svg { display: none; }
.send-btn.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.input-hint {
  text-align: center; font-size: 0.68rem;
  color: var(--text-faint); margin-top: 0.5rem;
  opacity: 0.5;
  letter-spacing: 0.02em;
}
.input-hint a { color: var(--text-muted); text-decoration: none; transition: color 0.2s var(--ease-out); }
.input-hint a:hover { color: var(--accent-light); text-decoration: underline; }

/* ─── CODE BLOCKS ─── */
.code-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  margin: 0.6rem 0;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}
.code-lights { display: flex; gap: 7px; }
.code-lights span { width: 11px; height: 11px; border-radius: 50%; transition: transform 0.2s var(--ease-spring); }
.code-card:hover .code-lights span { transform: scale(1.1); }
.code-lights span:nth-child(1) { background: #ff5f56; }
.code-lights span:nth-child(2) { background: #ffbd2e; }
.code-lights span:nth-child(3) { background: #27c93f; }
.copy-btn {
  font-size: 11px; color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  font-family: inherit;
  font-weight: 500;
}
.copy-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.1); }
.copy-btn.copied { color: var(--green); background: var(--green-dim); border-color: rgba(52, 211, 153, 0.2); }
.code-card pre {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.9rem 1.1rem;
  margin: 0;
  overflow-x: auto;
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.82rem; line-height: 1.7;
}
.msg-bubble code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15rem 0.4rem; border-radius: 8px;
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.82rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.msg-bubble pre code { background: none; padding: 0; border: none; }

/* ─── TOAST ─── */
.toast {
  position: fixed;
  bottom: max(28px, calc(env(safe-area-inset-bottom) + 28px));
  right: 28px;
  max-width: 340px;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(20, 20, 26, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4);
  transform: translateY(24px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s var(--ease-out);
  z-index: 2000;
}
.toast.show { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
.toast.error { border-color: rgba(248, 113, 113, 0.3); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4), 0 0 20px rgba(248, 113, 113, 0.05); }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none; align-items: center; justify-content: center;
  z-index: 3000;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}
.modal-overlay.open { display: flex; opacity: 1; }
.modal {
  width: 100%; max-width: 400px;
  background: rgba(20, 20, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(6, 182, 212, 0.05);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s var(--ease-out);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.01em; }
.modal-desc { font-size: 13.5px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.6; }
.modal-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  margin-bottom: 18px;
  transition: all 0.25s var(--ease-out);
}
.modal-input:focus {
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.1);
  background: rgba(0, 0, 0, 0.5);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; }
.modal-btn {
  padding: 10px 18px;
  border-radius: 980px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  font-weight: 500;
}
.modal-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.modal-btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.35);
}
.modal-btn.primary:hover {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--violet-light) 100%);
  box-shadow: 0 6px 24px rgba(6, 182, 212, 0.45);
  transform: translateY(-1px);
}

/* ─── MOBILE ─── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0;
    height: 100%; z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.4s var(--ease-out);
    width: 85vw;
    max-width: 300px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none; position: fixed;
    inset: 0; background: rgba(0, 0, 0, 0.6);
    z-index: 199;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.35s var(--ease-out);
  }
  .sidebar-overlay.open { display: block; opacity: 1; }
  .menu-toggle { display: flex; }
  .quick-grid { grid-template-columns: 1fr; }
  .input-area { padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom)); }
  .welcome h2 { font-size: 1.4rem; }
  .msg-body { max-width: 92%; }
  .topbar { padding: 0 14px; height: 48px; }
  .chat-inner { padding: 0 1rem; }
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 980px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

/* ─── SVG ICON BASE ─── */
.svg-icon {
  display: inline-block; vertical-align: middle;
  width: 1em; height: 1em;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ─── REDUCED MOTION ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .message { opacity: 1; transform: none; }
  .canvas-ring, .canvas-draw-path, .canvas-write-line { animation: none; }
  body::before { animation: none; }
}

/* ─── SELECTION ─── */
::selection {
  background: rgba(6, 182, 212, 0.35);
  color: var(--text);
}

/* ─── FOCUS STYLES ─── */
*:focus-visible {
  outline: 2px solid rgba(6, 182, 212, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ─── API PLAYGROUND ─── */
.playground-page {
  --pg-surface: #0f111a;
  --pg-surface-2: rgba(255, 255, 255, 0.035);
  --pg-border: rgba(255, 255, 255, 0.07);
  --pg-radius: 16px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.playground-topbar {
  padding: 0 20px;
  height: 52px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 10, 15, 0.55);
  backdrop-filter: saturate(220%) blur(28px);
  -webkit-backdrop-filter: saturate(220%) blur(28px);
  flex-shrink: 0;
}
.playground-topbar-left { display: flex; align-items: center; gap: 12px; }
.playground-topbar-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.playground-topbar-title .svg-icon { width: 18px; height: 18px; color: var(--accent-light); }
.playground-topbar-right { display: flex; align-items: center; gap: 8px; }

.playground-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  overflow: hidden;
  min-height: 0;
}

.playground-panel {
  background: var(--pg-surface);
  border: 1px solid var(--pg-border);
  border-radius: var(--pg-radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.playground-panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--pg-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.playground-panel-title { font-size: 13px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.playground-panel-sub { font-size: 11px; color: var(--text-dim); }

.playground-controls {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex-shrink: 0;
  border-bottom: 1px solid var(--pg-border);
}
.pg-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pg-control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pg-control label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pg-control input[type="text"],
.pg-control input[type="number"],
.pg-control input[type="range"],
.pg-control select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: all 0.2s var(--ease-out);
}
.pg-control input:focus,
.pg-control select:focus {
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
  background: rgba(0, 0, 0, 0.45);
}
.pg-control input::placeholder { color: var(--text-faint); }
.pg-control input[type="range"] {
  padding: 0;
  height: 4px;
  border-radius: 980px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  cursor: pointer;
}
.pg-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.5);
  cursor: pointer;
}
.pg-range-hint {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
}
.pg-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
}
.pg-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.playground-editor-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}
#pgEditor {
  position: absolute;
  inset: 0;
}

.playground-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--pg-border);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.pg-btn {
  height: 36px;
  padding: 0 16px;
  border-radius: 980px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pg-btn:hover {
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--accent-light);
  background: rgba(6, 182, 212, 0.08);
  transform: translateY(-1px);
}
.pg-btn .svg-icon { width: 14px; height: 14px; }
.pg-btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.35);
}
.pg-btn.primary:hover {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--violet-light) 100%);
  box-shadow: 0 6px 24px rgba(6, 182, 212, 0.45);
}
.pg-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.playground-response-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pg-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 980px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}
.pg-meta-pill.ok { color: var(--green); border-color: rgba(52, 211, 153, 0.2); background: var(--green-dim); }
.pg-meta-pill.error { color: var(--red); border-color: rgba(248, 113, 113, 0.2); background: rgba(248, 113, 113, 0.1); }

.playground-response-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted);
}
.playground-response-body .pg-chunk-error {
  color: var(--red);
}

.playground-chart-wrap {
  height: 180px;
  border-top: 1px solid var(--pg-border);
  padding: 12px;
  flex-shrink: 0;
}
#pgTokenChart { width: 100%; height: 100%; }

.playground-history {
  grid-column: 1 / -1;
  background: var(--pg-surface);
  border: 1px solid var(--pg-border);
  border-radius: var(--pg-radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 180px;
  max-height: 240px;
}
.playground-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}
.pg-history-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pg-history-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}
.pg-history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pg-history-time { font-size: 11px; color: var(--text-dim); }
.pg-history-status {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 980px;
  font-weight: 700;
}
.pg-history-status.ok { color: var(--green); background: var(--green-dim); }
.pg-history-status.error { color: var(--red); background: rgba(248, 113, 113, 0.12); }
.pg-history-url { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-history-tokens { font-size: 11px; color: var(--text-dim); }
.pg-history-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* Monaco overrides to fit theme */
.monaco-editor, .monaco-editor .overflow-guard, .monaco-editor .margin, .monaco-editor .monaco-editor-background { border-radius: 0 0 var(--pg-radius) var(--pg-radius); }

@media (max-width: 900px) {
  .playground-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .playground-panel { min-height: 0; }
  .playground-history { max-height: none; }
  .playground-history-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .playground-topbar { padding: 0 12px; height: 48px; }
  .playground-body { padding: 10px; gap: 10px; }
  .pg-control-row { grid-template-columns: 1fr; }
  .playground-actions { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════════
   AUTH PAGES — Login / Register (P1 visual polish)
   ═══════════════════════════════════════════════════════════════ */

/* ─── Nebula background ─── */
.auth-nebula {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  pointer-events: none;
}
.auth-nebula::before,
.auth-nebula::after {
  content: ''; position: absolute; border-radius: 50%;
  filter: blur(100px); opacity: 0.5;
  animation: nebulaDrift 18s ease-in-out infinite alternate;
}
.auth-nebula::before {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.22) 0%, transparent 70%);
  top: -15%; left: -10%;
}
.auth-nebula::after {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.18) 0%, transparent 70%);
  bottom: -10%; right: -8%;
  animation-delay: -9s;
  animation-direction: alternate-reverse;
}
@keyframes nebulaDrift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(30px, -20px) scale(1.08); }
  100% { transform: translate(-20px, 15px) scale(0.95); }
}

/* ─── Auth card — glass morphism ─── */
.auth-card {
  position: relative;
  width: 100%; max-width: 420px;
  background: var(--glass-bg) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius) !important;
  padding: 44px 36px !important;
  z-index: 1;
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
  animation: cardEnter 0.6s var(--ease-out) both;
}
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Shimmer sweep on card top edge */
.auth-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(6, 182, 212, 0.4) 30%,
    rgba(139, 92, 246, 0.4) 70%,
    transparent 100%
  );
  border-radius: var(--radius) var(--radius) 0 0;
  animation: shimmerSweep 4s ease-in-out infinite;
}
@keyframes shimmerSweep {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* ─── Logo entrance ─── */
.auth-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 22px !important;
  animation: logoEnter 0.7s var(--ease-spring) 0.15s both;
}
@keyframes logoEnter {
  from { opacity: 0; transform: scale(0.7) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.auth-logo svg {
  width: 36px !important; height: 36px !important;
  color: var(--accent-light) !important;
  filter: drop-shadow(0 0 12px rgba(6, 182, 212, 0.4));
}
.auth-logo span {
  font-size: 1.1rem; font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent-light), var(--violet-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Auth headings ─── */
.auth-card h1 {
  font-size: 1.6rem !important; margin-bottom: 6px !important;
  text-align: center; letter-spacing: -0.03em;
  animation: fadeUp 0.5s var(--ease-out) 0.25s both;
}
.auth-card .subtitle {
  color: var(--text-muted); text-align: center;
  margin-bottom: 30px !important; font-size: 0.92rem;
  animation: fadeUp 0.5s var(--ease-out) 0.35s both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Auth form ─── */
.auth-form {
  display: flex; flex-direction: column; gap: 18px;
  animation: fadeUp 0.5s var(--ease-out) 0.45s both;
}
.auth-form label {
  display: flex; flex-direction: column; gap: 7px;
  color: var(--text-muted); font-size: 0.88rem; font-weight: 500;
}

/* ─── Input with shimmer border ─── */
.auth-input-wrap {
  position: relative; border-radius: var(--radius-sm);
  overflow: hidden;
}
.auth-input-wrap::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: var(--radius-sm);
  padding: 1px;
  background: linear-gradient(135deg,
    rgba(6, 182, 212, 0.25),
    rgba(139, 92, 246, 0.15),
    rgba(6, 182, 212, 0.25)
  );
  background-size: 200% 200%;
  animation: borderShimmer 3s ease-in-out infinite;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
  pointer-events: none;
}
.auth-input-wrap:focus-within::before { opacity: 1; }
@keyframes borderShimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.auth-form input,
.auth-input-wrap input {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit; font-size: 0.92rem;
  outline: none;
  transition:
    border-color var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out),
    background var(--duration-normal) var(--ease-out);
}
.auth-form input:focus,
.auth-input-wrap input:focus {
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.1), 0 0 24px rgba(6, 182, 212, 0.06);
  background: rgba(0, 0, 0, 0.45);
}
.auth-form input::placeholder { color: var(--text-faint); }

/* ─── Auth button — gradient glow ─── */
.auth-btn {
  position: relative;
  padding: 13px !important;
  border-radius: var(--radius-sm) !important;
  border: none !important;
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%) !important;
  color: #fff !important;
  font-weight: 600 !important; font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow:
    0 4px 20px rgba(6, 182, 212, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  overflow: hidden;
}
.auth-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 8px 32px rgba(6, 182, 212, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.15) inset;
  filter: brightness(1.08);
}
.auth-btn:active { transform: translateY(0) scale(0.98); }
.auth-btn:disabled {
  opacity: 0.5 !important; cursor: not-allowed;
  transform: none !important; filter: none !important;
  box-shadow: none !important;
}
/* Button shimmer sweep */
.auth-btn::after {
  content: '';
  position: absolute; top: 0; left: -100%; width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: none;
  animation: btnShimmer 3s ease-in-out infinite;
}
@keyframes btnShimmer {
  0%, 100% { left: -100%; }
  50%      { left: 140%; }
}
.auth-btn:disabled::after { animation: none; }

/* ─── Error message — shake animation ─── */
.auth-error {
  color: var(--rose-light) !important;
  background: rgba(244, 63, 94, 0.1) !important;
  border: 1px solid rgba(244, 63, 94, 0.2);
  padding: 11px 14px !important;
  border-radius: var(--radius-sm) !important;
  font-size: 0.88rem !important;
  line-height: 1.5;
  animation: errorShake 0.4s var(--ease-out);
}
@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(5px); }
  60%  { transform: translateX(-3px); }
  80%  { transform: translateX(2px); }
}

/* ─── Auth footer link ─── */
.auth-footer {
  text-align: center; margin-top: 22px;
  color: var(--text-muted); font-size: 0.88rem;
  animation: fadeUp 0.5s var(--ease-out) 0.55s both;
}
.auth-footer a {
  color: var(--accent-light); text-decoration: none;
  font-weight: 500;
  transition: color var(--duration-fast) var(--ease-out);
}
.auth-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Password strength bar (register page) ─── */
.pw-strength {
  display: flex; gap: 4px; margin-top: 4px;
  height: 3px; border-radius: 980px; overflow: hidden;
}
.pw-strength-bar {
  flex: 1; border-radius: 980px;
  background: rgba(255, 255, 255, 0.06);
  transition: background var(--duration-normal) var(--ease-out);
}
.pw-strength[data-level="1"] .pw-strength-bar:nth-child(1) { background: var(--rose); }
.pw-strength[data-level="2"] .pw-strength-bar:nth-child(-n+2) { background: var(--amber); }
.pw-strength[data-level="3"] .pw-strength-bar:nth-child(-n+3) { background: var(--accent); }
.pw-strength[data-level="4"] .pw-strength-bar { background: var(--green); }
.pw-strength-hint {
  font-size: 0.75rem; margin-top: 3px;
  color: var(--text-faint);
  transition: color var(--duration-fast) var(--ease-out);
}
.pw-strength[data-level="1"] + .pw-strength-hint { color: var(--rose-light); }
.pw-strength[data-level="2"] + .pw-strength-hint { color: var(--amber-light); }
.pw-strength[data-level="3"] + .pw-strength-hint { color: var(--accent-light); }
.pw-strength[data-level="4"] + .pw-strength-hint { color: var(--green); }

/* ─── Enhanced Toast (P1) ─── */
.toast {
  display: flex; align-items: center; gap: 10px;
  max-width: 380px;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(20, 20, 26, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text);
  font-size: 13px; line-height: 1.5;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4);
  transform: translateY(24px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s var(--ease-out);
  z-index: 2000;
  overflow: hidden;
  position: relative;
}
.toast.show { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
.toast-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.toast-icon .svg-icon { width: 18px; height: 18px; }
.toast-body { flex: 1; min-width: 0; }
.toast-progress {
  position: absolute; bottom: 0; left: 0; height: 2px;
  border-radius: 0 0 14px 14px;
  background: var(--accent);
  transition: width 0.1s linear;
}
.toast.error { border-color: rgba(248, 113, 113, 0.3); }
.toast.error .toast-progress { background: var(--rose); }
.toast.warning { border-color: rgba(245, 158, 11, 0.3); }
.toast.warning .toast-progress { background: var(--amber); }
.toast.success .toast-icon { color: var(--green); }
.toast.error .toast-icon { color: var(--rose-light); }
.toast.warning .toast-icon { color: var(--amber-light); }
.toast.info .toast-icon { color: var(--accent-light); }

/* ─── Auth page mobile ─── */
@media (max-width: 480px) {
  .auth-card { padding: 32px 22px !important; margin: 0 8px; }
  .auth-card h1 { font-size: 1.35rem !important; }
  .auth-nebula::before { width: 350px; height: 350px; }
  .auth-nebula::after  { width: 300px; height: 300px; }
}

/* ═══════════════════════════════════════════════════════════════
   P2 — WELCOME SCREEN ENHANCEMENT + DEVICE/KEY/USAGE POLISH
   ═══════════════════════════════════════════════════════════════ */

/* ─── Welcome screen decorative orb ─── */
.welcome-orb {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(139, 92, 246, 0.15));
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.5rem;
  position: relative;
  animation: orbFloat 4s ease-in-out infinite;
}
.welcome-orb::before {
  content: '';
  position: absolute; inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, transparent 70%);
  animation: orbPulse 3s ease-in-out infinite;
}
.welcome-orb svg { width: 32px; height: 32px; color: var(--accent-light); position: relative; z-index: 1; }
@keyframes orbFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes orbPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.1); }
}

/* ─── Device tile enhancements ─── */
.device-tile {
  position: relative;
  transition: border-color var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}
.device-tile:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

/* Running gradient border for busy devices */
.device-tile.busy {
  border-image: linear-gradient(135deg, var(--accent), var(--violet), var(--accent)) 1;
  border-image-slice: 1;
  animation: busyGlow 2s ease-in-out infinite alternate;
}
@keyframes busyGlow {
  0%   { box-shadow: 0 0 12px rgba(6, 182, 212, 0.08); }
  100% { box-shadow: 0 0 24px rgba(139, 92, 246, 0.12); }
}

/* Online pulse badge */
.status-badge.on .status-dot {
  animation: statusPulse 2s ease-in-out infinite;
}

/* Device empty state illustration */
.device-empty-illust {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 24px; color: var(--text-muted); text-align: center;
}
.device-empty-illust svg {
  width: 64px; height: 64px; color: var(--text-faint);
  margin-bottom: 16px; opacity: 0.5;
}
.device-empty-illust p { font-size: 0.92rem; line-height: 1.6; max-width: 280px; }

/* Drawer section divider */
.drawer-section + .drawer-section {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 20px;
}

/* ─── Key page card layout ─── */
.key-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 16px;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.key-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--violet));
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}
.key-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}
.key-card:hover::before { opacity: 1; }

.key-card-info { flex: 1; min-width: 0; }
.key-card-name { font-weight: 600; font-size: 0.92rem; margin-bottom: 4px; }
.key-card-meta { display: flex; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--text-muted); }
.key-card-prefix {
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, monospace;
  color: var(--accent-light); font-size: 0.82rem;
}
.key-card-status {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 980px;
  font-size: 0.72rem; font-weight: 600;
}
.key-card-status.active { background: var(--green-dim); color: var(--green); }
.key-card-status.revoked { background: rgba(248, 113, 113, 0.1); color: var(--red); }

.key-card-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Key mask/reveal toggle */
.key-toggle-vis {
  width: 32px; height: 32px;
  border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-fast) var(--ease-out);
}
.key-toggle-vis:hover {
  border-color: rgba(6, 182, 212, 0.3);
  color: var(--accent-light);
  background: rgba(6, 182, 212, 0.08);
}
.key-toggle-vis svg { width: 16px; height: 16px; }

/* Copy button with feedback */
.key-copy-btn {
  height: 32px; padding: 0 12px;
  border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim); font-size: 0.8rem; font-weight: 500;
  cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all var(--duration-fast) var(--ease-out);
}
.key-copy-btn:hover {
  border-color: rgba(6, 182, 212, 0.3);
  color: var(--accent-light);
  background: rgba(6, 182, 212, 0.08);
}
.key-copy-btn.copied {
  border-color: rgba(52, 211, 153, 0.3);
  color: var(--green);
  background: var(--green-dim);
}
.key-copy-btn svg { width: 14px; height: 14px; }

/* Key delete button */
.key-del-btn {
  width: 32px; height: 32px;
  border-radius: 8px; border: 1px solid transparent;
  background: transparent;
  color: var(--text-faint); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-fast) var(--ease-out);
}
.key-del-btn:hover {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.2);
  color: var(--rose-light);
}
.key-del-btn svg { width: 16px; height: 16px; }

/* Key empty state */
.key-empty-illust {
  display: flex; flex-direction: column; align-items: center;
  padding: 56px 24px; color: var(--text-muted); text-align: center;
}
.key-empty-illust svg {
  width: 56px; height: 56px; color: var(--text-faint);
  margin-bottom: 14px; opacity: 0.4;
}
.key-empty-illust p { font-size: 0.9rem; line-height: 1.6; }

/* ─── Usage page summary card color bar ─── */
.summary-card {
  position: relative;
  overflow: hidden;
}
.summary-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: 0 3px 3px 0;
}
.summary-card.card-tokens::before { background: var(--accent); }
.summary-card.card-requests::before { background: var(--violet); }
.summary-card.card-cost::before { background: var(--amber); }

/* Chart card subtle divider */
.chart-card {
  position: relative;
}
.chart-card::after {
  content: '';
  position: absolute; bottom: 0; left: 20px; right: 20px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}

/* ─── Global empty state illustration ─── */
.empty-illust {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 24px; color: var(--text-muted); text-align: center;
}
.empty-illust svg {
  width: 56px; height: 56px; color: var(--text-faint);
  margin-bottom: 14px; opacity: 0.4;
}
.empty-illust p { font-size: 0.9rem; line-height: 1.6; max-width: 280px; }

/* ═══════════════════════════════════════════════════════════════
   P3 — HANDWRITING + USAGE + DETAILS POLISH
   ═══════════════════════════════════════════════════════════════ */

/* ─── Handwriting form card ─── */
.handwriting-form {
  position: relative;
  overflow: hidden;
}
.handwriting-form::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.3), rgba(139, 92, 246, 0.3), transparent);
}

/* Form controls — unified dark inputs */
.form-group textarea,
.form-group select {
  transition: border-color var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out),
              background var(--duration-normal) var(--ease-out);
}
.form-group textarea:focus,
.form-group select:focus {
  border-color: rgba(245, 158, 11, 0.5) !important;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.08), 0 0 20px rgba(245, 158, 11, 0.05) !important;
  background: rgba(0, 0, 0, 0.45) !important;
  outline: none;
}

/* Range slider accent */
.form-group input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 980px;
  background: rgba(255, 255, 255, 0.1);
  outline: none; cursor: pointer;
}
.form-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
  cursor: pointer;
  transition: transform 0.15s var(--ease-spring);
}
.form-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Generate button — warm gradient */
.handwriting-form .btn-primary {
  position: relative;
  padding: 12px 24px !important;
  border-radius: var(--radius-sm) !important;
  background: linear-gradient(135deg, var(--amber) 0%, var(--violet) 100%) !important;
  color: #fff !important;
  font-weight: 600 !important;
  font-size: 0.95rem;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-out);
}
.handwriting-form .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  filter: brightness(1.08);
}
.handwriting-form .btn-primary:active { transform: translateY(0) scale(0.98); }
.handwriting-form .btn-primary:disabled {
  opacity: 0.5 !important; cursor: not-allowed;
  transform: none !important; filter: none !important;
  box-shadow: none !important;
}

/* Result area — decorative border glow */
.result-area {
  position: relative;
}
.result-area::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.25), transparent);
}

/* SVG preview container */
.svg-preview {
  background: #fff;
  border-radius: var(--radius-sm);
  overflow: hidden;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ─── Usage page enhancements ─── */
.usage-main .summary-card .value {
  letter-spacing: -0.02em;
  transition: color var(--duration-fast) var(--ease-out);
}
.summary-card.card-tokens .value { color: var(--accent-light); }
.summary-card.card-requests .value { color: var(--violet-light); }
.summary-card.card-cost .value { color: var(--amber-light); }

/* Chart card subtle top accent */
.chart-card {
  position: relative;
}
.chart-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

/* Usage table row hover */
.usage-table tr {
  transition: background var(--duration-fast) var(--ease-out);
}
.usage-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Pager button polish */
.pager button {
  transition: all var(--duration-fast) var(--ease-out);
}
.pager button:hover:not(:disabled) {
  border-color: rgba(6, 182, 212, 0.3);
  color: var(--accent-light);
  background: rgba(6, 182, 212, 0.06);
}

/* Period select focus */
.period-select:focus {
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
  outline: none;
}

/* ─── Handwriting page mobile ─── */
@media (max-width: 640px) {
  .handwriting-main { padding: 20px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   P4 — GLOBAL MICRO INTERACTIONS + MISSING ITEMS
   ═══════════════════════════════════════════════════════════════ */

/* ─── 4.2.1 Button active feedback ─── */
.btn-primary:active,
.btn-danger:active,
.btn-secondary:active,
.topbar-btn:active,
.new-chat-btn:active,
.pg-btn:active,
.modal-btn:active,
.input-pill:active,
.mic-btn:active {
  transform: scale(0.97);
  transition: transform var(--duration-fast) ease;
}

/* ─── 4.2.3 Skeleton loading ─── */
.skeleton {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  min-height: 1em;
}
.skeleton::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--shimmer);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Skeleton variants */
.skeleton-text {
  height: 14px;
  border-radius: 6px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.04);
}
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 65%; }
.skeleton-text.long { width: 90%; }
.skeleton-card {
  height: 80px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

/* ─── 4.2.4 Page transition ─── */
main {
  animation: pageIn var(--duration-normal) var(--ease-out);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Usage empty state ─── */
.usage-empty-illust {
  display: flex; flex-direction: column; align-items: center;
  padding: 56px 24px; color: var(--text-muted); text-align: center;
  grid-column: 1 / -1;
}
.usage-empty-illust svg {
  width: 56px; height: 56px; color: var(--text-faint);
  margin-bottom: 14px; opacity: 0.4;
}
.usage-empty-illust p { font-size: 0.9rem; line-height: 1.6; }

/* ─── Unbind confirmation enhancement ─── */
.unbind-warning {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.15);
  margin-bottom: 18px;
}
.unbind-warning svg {
  width: 20px; height: 20px; flex-shrink: 0;
  color: var(--rose-light); margin-top: 1px;
}
.unbind-warning-text { font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; }
.unbind-warning-text strong { color: var(--text); font-weight: 600; }
.unbind-device-name {
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, monospace;
  color: var(--accent-light); font-size: 0.82rem;
  background: rgba(6, 182, 212, 0.08);
  padding: 2px 8px; border-radius: 6px;
  margin-top: 4px; display: inline-block;
}

/* Danger button — enhanced */
.btn-danger.confirm {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.2), rgba(244, 63, 94, 0.12));
  border-color: rgba(244, 63, 94, 0.4);
  color: var(--rose-light);
  font-weight: 600;
  transition: all var(--duration-normal) var(--ease-out);
}
.btn-danger.confirm:hover {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.3), rgba(244, 63, 94, 0.18));
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.15);
  transform: translateY(-1px);
}
.btn-danger.confirm:active { transform: scale(0.97); }
