/* Mobile-first wrapper constraints for Desktop viewing */
@media (min-width: 480px) {
  body {
    background: radial-gradient(circle at center, #111126 0%, #03030c 100%) !important;
  }
  .app-layout, 
  .auth-container, 
  .bottom-sheet, 
  .modal-command-palette, 
  .modal-onboarding,
  .custom-context-menu {
    max-width: 480px !important;
    width: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8) !important;
  }
  
  /* Sheets must stay centered when animated */
  .bottom-sheet.active .sheet-container {
    transform: translateY(0) !important;
  }
  
  .sheet-backdrop, 
  .onboarding-backdrop {
    max-width: 480px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 100% !important;
    right: auto !important;
  }
}

/* Base App Shell Layout */
.app-layout, .auth-container {
  width: 100%;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color-1);
  overflow: hidden;
  z-index: 10;
}

/* Auth Layout */
.auth-container {
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 20;
}

.auth-card {
  width: 100%;
  padding: 30px 24px;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo-text {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.auth-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.auth-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.auth-tab-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  color: var(--text-secondary);
  text-align: center;
}

.auth-tab-btn.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.oauth-separator {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  margin: 20px 0;
  gap: 10px;
}

.oauth-separator::before, .oauth-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

/* App Header Layout */
.app-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border-top: none;
  z-index: 15;
  flex-shrink: 0;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-title-text {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.25rem;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent) 0%, #06b6d4 100%);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.partner-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.partner-avatar-wrapper {
  position: relative;
  width: 36px;
  height: 36px;
}

#partner-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.partner-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

#partner-name {
  font-size: 0.875rem;
  font-weight: 600;
}

.partner-subtext {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.my-profile-avatar-wrapper {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--accent);
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  overflow: hidden;
  position: relative;
  background-size: cover;
  background-position: center;
}

/* App Main Layout Grid (Dikey 35% / 55%) */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.video-section {
  height: 32vh;
  min-height: 200px;
  position: relative;
  overflow: hidden;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 400ms var(--spring-gentle);
}

.video-section.mini-player-active {
  position: fixed !important;
  width: 160px;
  height: 90px;
  min-height: auto;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--accent);
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  z-index: 10000;
  cursor: grab;
  animation: fadeInBlur 300ms var(--spring-gentle) forwards;
}

.video-section.mini-player-active .player-overlay {
  display: none !important; /* Hide overlays in mini player */
}


.ambient-canvas {
  position: absolute;
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  filter: blur(50px) opacity(0.5);
  pointer-events: none;
  z-index: 1;
  transform: translateZ(0);
}

.video-outer-container {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.video-player-container {
  width: 100%;
  height: 100%;
}

.video-player-container iframe,
.video-player-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Video Overlay UI */
.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 40%, rgba(0,0,0,0.7) 100%);
  opacity: 0;
  transition: opacity var(--transition-normal);
  z-index: 5;
}

.video-outer-container:hover .player-overlay,
.player-overlay.visible {
  opacity: 1;
}

.player-overlay-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.video-title-display {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.overlay-btn {
  background: rgba(0, 0, 0, 0.4) !important;
  color: #fff !important;
  border-color: rgba(255,255,255,0.1) !important;
}

/* Double Tap overlay indicators */
.doubletap-indicator {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  transition: opacity 250ms ease;
}

.doubletap-indicator.left {
  left: 0;
  border-radius: 0 100px 100px 0;
}

.doubletap-indicator.right {
  right: 0;
  border-radius: 100px 0 0 100px;
}

.doubletap-indicator.active {
  opacity: 1;
  animation: double-tap-fade 500ms ease forwards;
}

@keyframes double-tap-fade {
  0% { opacity: 0; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.9); }
}

.tap-arrows {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -2px;
}

.doubletap-indicator span {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 4px;
}

.player-overlay-emojis {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.emoji-reaction-bubble {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 150ms var(--spring-bounce);
}

.emoji-reaction-bubble:hover {
  transform: scale(1.2);
}

.emoji-reaction-bubble:active {
  transform: scale(0.9);
}

.player-overlay-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-progress-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.progress-bar-container {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}

.progress-bar-container input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  border-radius: 2px;
  width: 0%;
  z-index: 1;
  pointer-events: none;
}

/* Floating Emoji Burst Canvas */
.emoji-burst-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  overflow: hidden;
}

.floating-emoji {
  position: absolute;
  font-size: 2.5rem;
  bottom: -50px;
  animation: float-up-emoji 2s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
  pointer-events: none;
}

@keyframes float-up-emoji {
  0% {
    transform: translateY(0) scale(0.5) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
    transform: translateY(-20px) scale(1) rotate(5deg);
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-250px) scale(0.8) rotate(-15deg);
    opacity: 0;
  }
}

/* URL Input Section */
.url-bar-section {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  margin: 10px 16px;
  border-radius: var(--radius-md);
  gap: 8px;
  flex-shrink: 0;
}

.url-bar-section input {
  flex: 1;
  font-size: 0.875rem;
  color: #fff;
  transition: all var(--transition-fast);
}

.url-bar-section input.drag-over {
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed var(--accent) !important;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}

.url-bar-section input::placeholder {
  color: var(--text-muted);
}

.url-addon {
  width: 32px !important;
  height: 32px !important;
  background: transparent !important;
  border: none !important;
}

.url-addon:hover {
  background: rgba(255,255,255,0.06) !important;
}

/* Chat Section Layout */
.chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.chat-bar-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.chat-search-wrapper {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.chat-search-wrapper input {
  flex: 1;
  font-size: 0.875rem;
  padding: 6px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.08);
}

.pinned-banner {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--accent-bg);
  border-bottom: 1px solid var(--accent-glow);
  gap: 10px;
  flex-shrink: 0;
  cursor: pointer;
}

.pinned-icon {
  color: var(--accent);
}

.pinned-text {
  flex: 1;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

/* Messages List */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  
  /* Scroll-driven top fade mask */
  animation: chat-scroll-fade linear both;
  animation-timeline: scroll(self block);
  animation-range: 0 40px;
}

@keyframes chat-scroll-fade {
  from {
    mask-image: linear-gradient(to bottom, black 0%, black 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 100%);
  }
  to {
    mask-image: linear-gradient(to bottom, transparent 0%, black 40px, black 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 40px, black 100%);
  }
}

.chat-pull-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 100%;
  margin-top: -8px;
  margin-bottom: 8px;
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.chat-pull-indicator.visible {
  opacity: 1;
  height: 30px;
}

.chat-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.chat-empty-state p {
  font-size: 0.875rem;
  line-height: 1.4;
}

/* Typing indicator */
.typing-indicator {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.02);
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: dot-bounce 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 200ms; }
.typing-dots span:nth-child(3) { animation-delay: 400ms; }

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

/* Reply Preview Bar above input */
.reply-preview-bar {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: rgba(255,255,255,0.03);
  border-top: 1px solid rgba(255,255,255,0.06);
  gap: 12px;
  flex-shrink: 0;
}

.reply-preview-content {
  flex: 1;
  line-height: 1.3;
  overflow: hidden;
}

.reply-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}

.reply-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Rich Input Bar */
.chat-input-bar {
  padding: 10px 12px;
  margin: 10px 16px 16px 16px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input-bar textarea {
  width: 100%;
  max-height: 100px;
  min-height: 24px;
  resize: none;
  font-size: 0.93rem;
  line-height: 1.4;
  color: #fff;
  padding: 4px;
}

.chat-input-bar textarea::placeholder {
  color: var(--text-muted);
}

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

.voice-btn {
  position: relative;
}

.record-pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--color-error);
  animation: pulse-ring 1.5s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* ========================================== */
/*                BOTTOM SHEETS               */
/* ========================================== */
.bottom-sheet {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 100;
  visibility: hidden;
  transition: visibility 350ms;
}

.bottom-sheet.active {
  visibility: visible;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 350ms ease;
  z-index: 1;
}

.bottom-sheet.active .sheet-backdrop {
  opacity: 1;
}

.sheet-container {
  width: 100%;
  max-height: 85vh;
  min-height: 300px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border-bottom: none;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 350ms var(--spring-gentle);
  z-index: 2;
  background-color: var(--bg-color-2);
}

.bottom-sheet.active .sheet-container {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  margin: 10px auto;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.sheet-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.sheet-content {
  flex: 1;
  padding: 20px;
}

.overflow-y {
  overflow-y: auto;
}

/* ========================================== */
/*                PROFILE SHEET               */
/* ========================================== */
.profile-details-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.avatar-edit-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  margin-bottom: 14px;
}

.profile-avatar-big {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-size: 2.5rem;
  font-weight: bold;
  background: var(--accent-bg);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.avatar-edit-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  border: 2px solid var(--bg-color-2);
}

.profile-username-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-email-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.profile-edit-form {
  width: 100%;
}

.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.text-link-btn {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

.text-link-btn.danger-color {
  color: var(--color-error);
}

.stats-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* History lists layout */
.watch-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.history-card {
  display: flex;
  align-items: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.015);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.03);
  gap: 10px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.history-card:hover {
  background: rgba(255,255,255,0.04);
}

.history-thumb {
  width: 50px;
  height: 35px;
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  background-color: rgba(255,255,255,0.04);
}

.history-details {
  flex: 1;
  min-width: 0;
  line-height: 1.2;
}

.history-title {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

.history-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.empty-placeholder {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
}

/* ========================================== */
/*                PLAYLIST SHEET              */
/* ========================================== */
.sheet-tabs {
  display: flex;
  gap: 16px;
}

.sheet-tab-btn {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}

.sheet-tab-btn.active {
  color: var(--text-primary);
  border-color: var(--accent);
}

.playlist-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.playlist-length-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.playlist-items-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.playlist-item-card {
  display: flex;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius-md);
  gap: 12px;
  cursor: grab;
  position: relative;
}

.playlist-item-card:active {
  cursor: grabbing;
}

.playlist-item-card.dragging {
  opacity: 0.5;
  border: 1px dashed var(--accent);
}

.playlist-thumb {
  width: 70px;
  height: 40px;
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
  background-color: rgba(255,255,255,0.03);
  flex-shrink: 0;
}

.playlist-details {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.playlist-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ========================================== */
/*                 STATS SHEET                */
/* ========================================== */
.streak-banner {
  display: flex;
  align-items: center;
  padding: 16px;
  border-radius: var(--radius-lg);
  gap: 14px;
  margin-bottom: 20px;
}

.streak-icon {
  font-size: 2.2rem;
  animation: pulse-glow 1.5s infinite;
}

.streak-details h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.streak-details p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.analytics-card {
  background: rgba(255,255,255,0.015);
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.analytics-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.chart-summary {
  display: flex;
  gap: 14px;
  font-size: 0.75rem;
  margin-bottom: 12px;
}

.chart-summary-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-summary-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.chart-summary-item .dot.together { background-color: var(--accent); }
.chart-summary-item .dot.solo { background-color: rgba(255,255,255,0.15); }

.pie-chart-container {
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.simple-pie-chart {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  /* Computed dynamically in stats.js */
  background: conic-gradient(var(--accent) 0% 70%, rgba(255,255,255,0.1) 70% 100%);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Weekly Bar Chart Layout */
.bar-chart-container {
  display: flex;
  height: 150px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 10px 8px;
  gap: 10px;
}

.chart-bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar-fill {
  width: 100%;
  background: linear-gradient(to top, var(--accent) 0%, var(--accent-light) 100%);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  box-shadow: 0 2px 6px var(--accent-glow);
  transition: height 600ms cubic-bezier(0.1, 1, 0.1, 1);
}

.chart-bar-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 500;
}

.chart-bar-val {
  font-size: 0.6rem;
  color: var(--text-secondary);
  margin-bottom: 2px;
  font-weight: 600;
}

/* Hourly Heatmap Layout */
.heatmap-container {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.02);
  color: var(--text-muted);
}

.heatmap-cell.level-1 { background-color: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.15); color: #fff; }
.heatmap-cell.level-2 { background-color: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.35); color: #fff; }
.heatmap-cell.level-3 { background-color: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.6); color: #fff; }
.heatmap-cell.level-4 { background-color: var(--accent); color: #fff; box-shadow: 0 0 8px var(--accent-glow); }

/* ========================================== */
/*                SETTINGS SHEET              */
/* ========================================== */
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  gap: 16px;
}

.setting-item.toggle-item {
  justify-content: space-between;
}

.setting-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.setting-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.setting-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

.setting-item select {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
}

/* ========================================== */
/*               COMMAND PALETTE              */
/* ========================================== */
.modal-command-palette {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 50px;
  padding-left: 16px;
  padding-right: 16px;
}

.palette-container {
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: 60vh;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  border-color: rgba(255,255,255,0.12);
  overflow: hidden;
}

.palette-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 12px;
}

.palette-header input {
  flex: 1;
  font-size: 1rem;
  color: #fff;
}

.palette-header input::placeholder {
  color: var(--text-muted);
}

.shortcut-tip {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
}

.palette-results {
  flex: 1;
  padding: 8px;
}

.palette-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  gap: 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.palette-item:hover, .palette-item.selected {
  background: var(--accent-bg);
  color: #fff;
}

.palette-item-icon {
  font-size: 1.1rem;
  opacity: 0.8;
}

.palette-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.palette-item-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.palette-item-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ========================================== */
/*                 ONBOARDING                 */
/* ========================================== */
.modal-onboarding {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}

.onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(5px);
  z-index: 1;
}

.onboarding-card {
  width: 100%;
  max-width: 380px;
  padding: 30px 24px;
  z-index: 2;
  text-align: center;
}

.onboarding-slides-container {
  position: relative;
  height: 240px;
  overflow: hidden;
  margin-bottom: 20px;
}

.onboarding-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateX(50px);
  pointer-events: none;
  transition: all 400ms var(--spring-gentle);
}

.onboarding-slide.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.onboarding-slide.passed {
  transform: translateX(-50px);
}

.onboarding-illustration {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: pulse-glow 2s infinite;
}

.onboarding-slide h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.onboarding-slide p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.onboarding-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.onboarding-dots {
  display: flex;
  gap: 6px;
}

.onboarding-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transition: background var(--transition-fast);
}

.onboarding-dots .dot.active {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

/* ========================================== */
/*                CONTEXT MENU                */
/* ========================================== */
.custom-context-menu {
  position: fixed;
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  padding: 6px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  min-width: 160px;
}

.context-menu-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  gap: 10px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.context-menu-item:hover {
  background: var(--accent-bg);
  color: #fff;
}

.context-menu-item.danger {
  color: var(--color-error);
}

.context-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ========================================== */
/*                GIF PICKER                  */
/* ========================================== */
.gif-results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.gif-result-card {
  aspect-ratio: 1.5;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  border: 1px solid transparent;
}

.gif-result-card:hover {
  border-color: var(--accent);
}

.gif-result-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ========================================== */
/*              TOAST MESSAGES                */
/* ========================================== */
.toast-container {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 360px;
  padding-top: 12px;
}

.toast {
  background: rgba(15, 15, 30, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-top: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--glass-shadow);
  pointer-events: auto;
  transform: translateY(-20px);
  opacity: 0;
  transition: all 300ms var(--spring-bounce);
}

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

.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
}

.toast-message {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-error); }
.toast.warning { border-left: 3px solid var(--color-warn); }
.toast.info { border-left: 3px solid var(--color-info); }
.toast.milestone {
  border: 1px solid var(--accent);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(15, 15, 30, 0.85) 100%);
  box-shadow: 0 8px 24px var(--accent-glow);
}

/* ========================================== */
/*           CHAT BUBBLES PREMIUM STYLING     */
/* ========================================== */
.msg-container {
  display: flex;
  width: 100%;
  margin-bottom: 8px;
  align-items: flex-end;
  gap: 8px;
  animation: messageSlideIn 300ms var(--spring-bounce) forwards;
  opacity: 0;
  transform: translateY(15px);
}

.msg-me {
  justify-content: flex-end;
}

.msg-them {
  justify-content: flex-start;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  margin-bottom: 4px;
}

.msg-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-bottom: 4px;
}

.msg-bubble-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

.msg-me .msg-bubble-wrapper {
  align-items: flex-end;
}

.msg-them .msg-bubble-wrapper {
  align-items: flex-start;
}

.msg-sender {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 4px;
  margin-left: 4px;
}

.msg-content {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.93rem;
  line-height: 1.4;
  word-break: break-word;
  position: relative;
}

.msg-me .msg-content {
  border-bottom-right-radius: 4px;
  background: linear-gradient(135deg, hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.25) 0%, hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.15) 100%);
  border-color: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.25);
  color: #ffffff;
}

.msg-them .msg-content {
  border-bottom-left-radius: 4px;
  background: var(--glass-bg);
  border-color: var(--glass-border);
}

.msg-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.msg-sending {
  opacity: 0.65;
}

.msg-sending .msg-time {
  color: var(--accent-light);
  font-weight: 500;
}

.msg-reply-link {
  display: block;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.25);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-target-username {
  font-weight: 700;
  color: var(--accent-light);
  margin-right: 4px;
}

.msg-reactions-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: -6px;
  margin-bottom: 2px;
  z-index: 1;
}

.msg-reaction-badge {
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: transform 150ms var(--spring-bounce);
}

.msg-edited-badge {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
}

.msg-gif-wrapper, .msg-image-preview {
  max-width: 220px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 4px;
}

.msg-gif-wrapper img, .msg-image-preview img {
  width: 100%;
  height: auto;
  display: block;
}
