/**
 * Bubble Playground - Full-Screen Chatbot Experience
 * The chatbot takes 100% of the viewport on both desktop and mobile
 */

/* Reset body for full-screen */
.playground-fullscreen-body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile */
  background: #FFFFFF;
}

/* Full-screen container */
.playground-fullscreen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  background: linear-gradient(180deg, #FAFAFA 0%, #FFFFFF 100%);

  /* Safe area support for notched phones (iPhone X+, modern Android) */
  padding-left: max(0px, env(safe-area-inset-left));
  padding-right: max(0px, env(safe-area-inset-right));
  padding-top: max(0px, env(safe-area-inset-top));
}

/* Header */
.playground-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: white;
  border-bottom: 1px solid #F0F0F0;
  flex-shrink: 0;
}

.playground-logo {
  display: flex;
  align-items: center;
  gap: 0.25em;
  text-decoration: none;
  color: #000;
}

.playground-logo svg {
  flex-shrink: 0;
}

.playground-logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.playground-lang-toggle {
  padding: 0.5rem 0.75rem;
  background: #F5F5F5;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #666666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.playground-lang-toggle:hover {
  background: #EEEEEE;
  color: #333333;
}

/* Close Button - Circular design matching demo overlays */
.playground-close-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #666666;
  transition: all 0.2s ease;
}

.playground-close-btn:hover {
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: scale(1.05);
  color: #333333;
}

.playground-close-btn:active {
  transform: scale(0.95);
}

/* Content wrapper - contains profile graph + chat side by side */
.playground-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

/* Chat Main - Takes remaining space */
.playground-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  min-width: 0; /* Allow shrinking */
}

.playground-chat-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
  overflow: hidden;
}

/* Messages Area */
.playground-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Scrollbar styling */
.playground-messages::-webkit-scrollbar {
  width: 6px;
}

.playground-messages::-webkit-scrollbar-track {
  background: transparent;
}

.playground-messages::-webkit-scrollbar-thumb {
  background: #E0E0E0;
  border-radius: 3px;
}

.playground-messages::-webkit-scrollbar-thumb:hover {
  background: #CCCCCC;
}

/* Message Bubbles */
.playground-message {
  display: flex;
  gap: 0.75rem;
  max-width: 90%;
  animation: messageSlideIn 0.3s ease-out forwards;
}

@media (max-width: 768px) {
  .playground-message {
    max-width: 85%;
  }
}

@media (max-width: 480px) {
  .playground-message {
    max-width: 88%;
    gap: 0.5rem;
  }
}

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

.playground-message.bot {
  align-self: flex-start;
}

.playground-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.playground-message .message-avatar {
  width: var(--avatar-size-md, 36px);
  height: var(--avatar-size-md, 36px);
  border-radius: 50%;
  background: linear-gradient(135deg, #333333, #555555);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.playground-message.user .message-avatar {
  display: none;
}

.playground-message .message-content {
  padding: 1rem 1.25rem;
  border-radius: 20px;
  font-size: 1rem;
  line-height: 1.5;
}

/* Multi-paragraph message styling (when content contains <br> tags) */
.playground-message .message-content br {
  display: block;
  content: '';
  margin: 0.5rem 0;
}

.playground-message .message-content br + br {
  margin-top: 0.25rem;
}

.playground-message.bot .message-content {
  background: #F5F5F5;
  color: #333333;
  border-bottom-left-radius: 6px;
}

.playground-message.user .message-content {
  background: linear-gradient(135deg, #333333, #444444);
  color: white;
  border-bottom-right-radius: 6px;
}

/* Option Chips Container (Scripted choices) */
/* NOTE: Button styles (.playground-option) are unified in styles.css as .chat-suggestion-btn */
.playground-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-left: 48px; /* Align with message content */
  align-items: center;
}

/* Navigation Cards */
.playground-nav-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-left: 48px;
}

.playground-nav-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  min-height: 44px;
  background: white;
  border: 1px solid #E5E5E5;
  border-radius: 16px;
  text-decoration: none;
  color: #333333;
  transition: all 0.2s ease;
}

.playground-nav-card:hover {
  border-color: #333333;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.playground-nav-card .nav-card-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333333;
  flex-shrink: 0;
}

.playground-nav-card .nav-card-icon svg {
  width: 20px;
  height: 20px;
}

.playground-nav-card .nav-card-content {
  flex: 1;
}

.playground-nav-card .nav-card-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.playground-nav-card .nav-card-description {
  display: block;
  font-size: 0.875rem;
  color: #666666;
}

.playground-nav-card .nav-card-arrow {
  color: #999999;
  transition: transform 0.2s ease;
}

.playground-nav-card:hover .nav-card-arrow {
  transform: translateX(4px);
  color: #333333;
}

/* Personalized Recommendation Card */
.playground-recommendation {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1.25rem 1.5rem;
  margin-left: 48px;
  background: linear-gradient(135deg, var(--bubble-primary) 0%, #764ba2 100%);
  border-radius: 16px;
  color: white;
  animation: fadeInSlide 0.5s ease-out;
}

.playground-recommendation .recommendation-content {
  font-size: 0.95rem;
  line-height: 1.6;
}

.playground-recommendation .recommendation-content p {
  margin: 0;
}

.playground-recommendation .recommendation-content strong {
  color: #FFE066;
  font-weight: 600;
}

.playground-recommendation .recommendation-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  color: white;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  width: fit-content;
}

.playground-recommendation .recommendation-cta:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.playground-recommendation .recommendation-cta svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 600px) {
  .playground-recommendation {
    margin-left: 28px;
    padding: 1rem;
  }

  .playground-recommendation .recommendation-cta {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .playground-recommendation {
    margin-left: 0;
  }
}

/* Typing Indicator */
.playground-typing {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 48px;
}

.playground-typing-bubble {
  display: flex;
  gap: 4px;
  padding: 1rem 1.25rem;
  background: #F5F5F5;
  border-radius: 20px;
  border-bottom-left-radius: 6px;
}

.playground-typing-bubble span {
  width: 8px;
  height: 8px;
  background: #AAAAAA;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.playground-typing-bubble span:nth-child(1) { animation-delay: -0.32s; }
.playground-typing-bubble span:nth-child(2) { animation-delay: -0.16s; }
.playground-typing-bubble span:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Input Area */
.playground-input-area {
  flex-shrink: 0;
  padding: 1rem 0 calc(1.5rem + max(0px, env(safe-area-inset-bottom)));
  background: white;
  border-top: 1px solid #F0F0F0;
}

.playground-input-form {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.playground-input {
  flex: 1;
  padding: 1rem 1.5rem;
  background: #F5F5F5;
  border: 2px solid transparent;
  border-radius: 50px;
  font-size: 1rem;
  outline: none;
  transition: all 0.2s ease;
}

.playground-input:focus {
  background: white;
  border-color: #333333;
}

.playground-input::placeholder {
  color: #999999;
}

/* Mic Button - Voice Input */
.playground-mic-btn {
  width: 52px;
  height: 52px;
  background: #F5F5F5;
  border: 2px solid #E5E5E5;
  border-radius: 50%;
  color: #666666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.playground-mic-btn:hover {
  background: #EEEEEE;
  border-color: #333333;
  color: #333333;
}

.playground-mic-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Recording state - pulsing animation */
.playground-mic-btn.recording {
  background: #FF4444;
  border-color: #FF4444;
  color: white;
  animation: micPulse 1.5s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(255, 68, 68, 0);
  }
}

/* Send Button */
.playground-send-btn {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #333333, #444444);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.playground-send-btn:hover {
  background: linear-gradient(135deg, #444444, #555555);
  transform: scale(1.05);
}

.playground-send-btn:active {
  transform: scale(0.98);
}

.playground-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Quick Action Buttons */
.playground-quick-actions {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  align-items: center;
}

.playground-quick-actions::-webkit-scrollbar {
  display: none;
}

.playground-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.875rem;
  min-height: 44px;
  background: white;
  border: 1px solid #E5E5E5;
  border-radius: 50px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #555555;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
  vertical-align: middle;
}

.playground-action .action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.playground-action .action-icon svg {
  width: 14px;
  height: 14px;
}

.playground-action:hover {
  border-color: #333333;
  color: #333333;
}

.playground-action.primary {
  background: linear-gradient(135deg, #333333, #444444);
  color: white;
  border: none;
}

.playground-action.primary:hover {
  background: linear-gradient(135deg, #444444, #555555);
}

.playground-action.purple {
  background: linear-gradient(135deg, var(--bubble-primary), #764ba2);
  color: white;
  border: none;
}

.playground-action.purple:hover {
  background: linear-gradient(135deg, #5a6fd6, #6a4190);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--bubble-primary-30);
}

/* Profile Result Card */
.playground-profile-card {
  background: linear-gradient(135deg, #333333, #444444);
  border-radius: 20px;
  padding: 1.5rem;
  margin-top: 1rem;
  margin-left: 48px;
  color: white;
  animation: cardSlideIn 0.4s ease-out forwards;
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.playground-profile-card .profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.playground-profile-card .profile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.playground-profile-card .profile-icon svg {
  width: 18px;
  height: 18px;
}

.playground-profile-card .profile-description {
  font-size: 1rem;
  opacity: 0.9;
  margin: 0 0 1rem 0;
  line-height: 1.4;
}

.playground-profile-card .profile-allocation {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.playground-profile-card .allocation-item {
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 0.875rem;
}

.playground-profile-card .profile-spectrum {
  margin-bottom: 1rem;
}

.playground-profile-card .spectrum-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  position: relative;
  margin-bottom: 0.5rem;
}

.playground-profile-card .spectrum-marker {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.playground-profile-card .spectrum-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  opacity: 0.7;
}

.playground-profile-card .profile-note {
  font-size: 0.8rem;
  opacity: 0.7;
  font-style: italic;
  margin: 0;
}

/* Isolate hover effects for non-touch devices */
@media (hover: hover) {
  .playground-lang-toggle:hover {
    background: #EEEEEE;
    color: #333333;
  }

  .playground-close-btn:hover {
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
    color: #333333;
  }

  /* NOTE: .playground-option hover styles are now in styles.css (.chat-suggestion-btn) */

  .playground-nav-card:hover {
    border-color: #333333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
  }

  .playground-nav-card:hover .nav-card-arrow {
    transform: translateX(4px);
    color: #333333;
  }

  .playground-action:hover {
    border-color: #333333;
    color: #333333;
  }

  .playground-action.primary:hover {
    background: linear-gradient(135deg, #444444, #555555);
  }

  .playground-action.purple:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a4190);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--bubble-primary-30);
  }

  .playground-mic-btn:hover {
    background: #EEEEEE;
    border-color: #333333;
    color: #333333;
  }

  .playground-send-btn:hover {
    background: linear-gradient(135deg, #444444, #555555);
    transform: scale(1.05);
  }
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .playground-header {
    padding: 0.75rem 1rem;
  }

  .playground-logo img {
    height: 24px;
  }

  .playground-exit-btn span {
    display: none;
  }

  .playground-chat-wrapper {
    padding: 0 0.75rem;
  }

  .playground-message {
    max-width: 90%;
  }

  .playground-message .message-avatar {
    width: var(--avatar-size-sm, 32px);
    height: var(--avatar-size-sm, 32px);
  }

  .playground-message .message-content {
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
  }

  .playground-options {
    padding-left: 40px;
  }

  /* NOTE: .playground-option styles unified in styles.css (.chat-suggestion-btn) */

  .playground-nav-cards {
    padding-left: 40px;
  }

  .playground-input {
    padding: 0.875rem 1.25rem;
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .playground-mic-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
  }

  .playground-mic-btn svg {
    width: 22px;
    height: 22px;
  }

  .playground-send-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
  }

  .playground-send-btn svg {
    width: 22px;
    height: 22px;
  }

  .playground-input-area {
    padding: 0.75rem 0 1rem;
  }

  .playground-profile-card {
    margin-left: 40px;
    padding: 1.25rem;
  }

  /* Allow allocation items to wrap on mobile */
  .playground-profile-card .profile-allocation {
    flex-wrap: wrap;
  }
}

/* Extra small screens (360px and below) */
@media (max-width: 360px) {
  .playground-header {
    padding: 0.65rem 0.75rem;
  }

  .playground-lang-toggle {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }

  .playground-chat-wrapper {
    padding: 0 0.5rem;
  }

  .playground-messages {
    padding: 1rem 0;
  }

  .playground-message {
    max-width: 95%;
    gap: 0.5rem;
  }

  .playground-message .message-avatar {
    width: var(--avatar-size-xs, 28px);
    height: var(--avatar-size-xs, 28px);
  }

  .playground-message .message-content {
    padding: 0.75rem 0.875rem;
    font-size: 0.9rem;
  }

  .playground-options {
    padding-left: 28px;
    gap: 0.375rem;
  }

  /* NOTE: .playground-option styles unified in styles.css (.chat-suggestion-btn) */

  .playground-nav-cards {
    padding-left: 28px;
  }

  .playground-nav-card {
    padding: 0.875rem 1rem;
  }

  .playground-nav-card .nav-card-icon {
    width: 20px;
    height: 20px;
  }

  .playground-nav-card .nav-card-icon svg {
    width: 18px;
    height: 18px;
  }

  .playground-input-form {
    gap: 0.5rem;
  }

  .playground-input {
    padding: 0.75rem 1rem;
    font-size: 16px;
  }

  .playground-mic-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .playground-mic-btn svg {
    width: 20px;
    height: 20px;
  }

  .playground-send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .playground-send-btn svg {
    width: 20px;
    height: 20px;
  }

  .playground-input-area {
    padding: 0.65rem 0 0.85rem;
  }

  /* Hide quick-action text labels on very small screens */
  .playground-action span:not(.action-icon) {
    display: none;
  }

  /* Make quick-action buttons square with proper spacing */
  .playground-action {
    padding: 0.625rem;
    min-width: 40px;
    height: 40px;
    width: 40px;
    justify-content: center;
    align-items: center;
  }

  /* Increase icon size for better visibility on very small screens */
  .playground-action .action-icon {
    width: 20px;
    height: 20px;
  }

  .playground-action .action-icon svg {
    width: 20px;
    height: 20px;
  }

  .playground-quick-actions {
    gap: 0.375rem;
  }

  .playground-profile-card {
    margin-left: 28px;
    padding: 1rem;
  }

  .playground-profile-card .profile-description {
    font-size: 0.95rem;
  }

  .playground-profile-card .profile-allocation {
    gap: 0.5rem;
  }

  .playground-profile-card .allocation-item {
    padding: 0.375rem 0.5rem;
    font-size: 0.8rem;
  }

  .playground-typing {
    padding-left: 28px;
  }
}

/* Very small screens (380px) */
@media (max-width: 380px) {
  .playground-options {
    padding-left: 0;
  }

  .playground-nav-cards {
    padding-left: 0;
  }

  .playground-profile-card {
    margin-left: 0;
  }

  .playground-typing {
    padding-left: 0;
  }
}

/* ========================================
   MOBILE FIX: Nav Cards & Input Area
   Compact icon bubbles for arena/simulator on mobile
   ======================================== */
@media (max-width: 800px) {
  .playground-nav-cards {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto auto !important;
    gap: 0.75rem !important;
    padding: 0 0.5rem 1rem !important;
    margin: 0 !important;
    width: 100% !important;
  }

  /* Arena and Simulator: icon-only bubbles side by side */
  .playground-nav-card:nth-child(1),
  .playground-nav-card:nth-child(2) {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 70px !important;
    padding: 0.75rem !important;
    gap: 0.5rem !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
  }

  .playground-nav-card:nth-child(1) .nav-card-icon,
  .playground-nav-card:nth-child(2) .nav-card-icon {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .playground-nav-card:nth-child(1) .nav-card-content,
  .playground-nav-card:nth-child(2) .nav-card-content {
    display: block !important;
    text-align: center !important;
  }

  .playground-nav-card:nth-child(1) .nav-card-title,
  .playground-nav-card:nth-child(2) .nav-card-title {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }

  .playground-nav-card:nth-child(1) .nav-card-description,
  .playground-nav-card:nth-child(2) .nav-card-description {
    display: none !important;
  }

  .playground-nav-card:nth-child(1) .nav-card-arrow,
  .playground-nav-card:nth-child(2) .nav-card-arrow {
    display: none !important;
  }

  /* Resources card: full width row below */
  .playground-nav-card:nth-child(3) {
    grid-column: 1 / -1 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 44px !important;
    padding: 0.75rem 1rem !important;
    gap: 1rem !important;
    border-radius: 24px !important;
    justify-content: flex-start !important;
  }

  .playground-nav-card:nth-child(3) .nav-card-icon {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    flex-shrink: 0 !important;
  }

  .playground-nav-card:nth-child(3) .nav-card-content {
    flex: 1 !important;
    min-width: 0 !important;
  }

  .playground-nav-card:nth-child(3) .nav-card-title {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 0.9rem !important;
    margin-bottom: 0 !important;
  }

  .playground-nav-card:nth-child(3) .nav-card-description {
    display: none !important;
  }

  .playground-nav-card:nth-child(3) .nav-card-arrow {
    display: none !important;
  }

  /* Fix input placeholder truncation */
  .playground-input {
    padding: 0.625rem 0.875rem !important;
    font-size: 0.875rem !important;
  }

  .playground-input::placeholder {
    font-size: 0.8rem !important;
  }
}

@media (max-width: 480px) {
  .playground-nav-cards {
    gap: 0.5rem !important;
  }

  .playground-nav-card:nth-child(1),
  .playground-nav-card:nth-child(2) {
    min-height: 60px !important;
    padding: 0.625rem !important;
    border-radius: 16px !important;
  }

  .playground-nav-card:nth-child(1) .nav-card-icon,
  .playground-nav-card:nth-child(2) .nav-card-icon {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
  }

  .playground-nav-card:nth-child(1) .nav-card-title,
  .playground-nav-card:nth-child(2) .nav-card-title {
    font-size: 0.7rem !important;
  }

  .playground-nav-card:nth-child(3) {
    padding: 0.625rem 0.75rem !important;
  }

  .playground-nav-card:nth-child(3) .nav-card-icon {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
  }

  .playground-nav-card:nth-child(3) .nav-card-title {
    font-size: 0.8rem !important;
  }

  .playground-input {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8rem !important;
  }
}

/* ========================================
   CRITICAL FIX: Quick Actions Mobile Layout
   Force vertical stacking on narrow screens
   ======================================== */
@media (max-width: 640px) {
  .playground-quick-actions {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    gap: 0.5rem !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    padding: 0.5rem 0 !important;
    width: 100% !important;
  }

  .playground-action {
    width: 100% !important;
    justify-content: center !important;
    padding: 0.75rem 1rem !important;
    min-height: 44px !important;
    white-space: nowrap !important;
    border-radius: 24px !important;
  }

  .playground-action .action-icon {
    width: 18px !important;
    height: 18px !important;
  }

  .playground-action .action-icon svg {
    width: 18px !important;
    height: 18px !important;
  }
}

@media (max-width: 480px) {
  .playground-action {
    padding: 0.625rem 0.875rem !important;
    font-size: 0.8rem !important;
  }
}

@media (max-width: 360px) {
  .playground-quick-actions {
    gap: 0.375rem !important;
  }

  .playground-action {
    padding: 0.5rem 0.75rem !important;
    min-height: 40px !important;
    font-size: 0.75rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROFILE GRAPH - Left sidebar showing evolving risk profile
   ═══════════════════════════════════════════════════════════════════════════ */

.profile-graph-container {
  position: relative; /* Required for absolute positioning of toggle button */
  flex-shrink: 0;
  width: 280px;
  min-width: 280px;
  display: flex;
  border-right: 1px solid #F0F0F0;
  background: #FAFAFA;
  transition: width 0.3s ease, min-width 0.3s ease;
}

.profile-graph-panel {
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.profile-graph-panel.collapsed {
  transform: translateX(-240px);
}

.profile-graph-panel.collapsed .profile-graph-content {
  opacity: 0;
  pointer-events: none;
}

/*
 * Browser Compatibility Note:
 * The :has() selector requires Safari 15.4+, Chrome 105+, Firefox 121+.
 * For older browsers, JavaScript should add .panel-collapsed class to .profile-graph-container
 * as a fallback. See duplicate rules below using .panel-collapsed class.
 */
.profile-graph-container:has(.profile-graph-panel.collapsed) {
  width: 48px;
  min-width: 48px;
}

/* Fallback for browsers without :has() support - requires JS to add .panel-collapsed to container */
.profile-graph-container.panel-collapsed {
  width: 48px;
  min-width: 48px;
}

/* Toggle button - ALWAYS visible, positioned on the container not the panel */
.profile-graph-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: white;
  border: 1px solid #E5E5E5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: all 0.3s ease;
}

/* When collapsed on desktop, position toggle at right edge of 48px container */
.profile-graph-container.panel-collapsed .profile-graph-toggle,
.profile-graph-container:has(.profile-graph-panel.collapsed) .profile-graph-toggle {
  right: 6px;
}

.profile-graph-toggle:hover {
  background: #F5F5F5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-50%) scale(1.05);
}

.profile-graph-toggle .toggle-icon {
  width: 18px;
  height: 18px;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-graph-toggle .toggle-icon svg {
  width: 18px;
  height: 18px;
}

/* Content area */
.profile-graph-content {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

/* Header */
.profile-graph-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #E5E5E5;
}

.profile-graph-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bubble-primary), #764ba2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-graph-icon svg {
  width: 18px;
  height: 18px;
}

.profile-graph-title {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  margin: 0;
}

/* Risk Gauge */
.profile-risk-gauge {
  margin-bottom: 1.5rem;
}

.risk-gauge-track {
  position: relative;
  height: 8px;
  background: #E5E5E5;
  border-radius: 4px;
  overflow: visible;
  margin-bottom: 0.5rem;
}

.risk-gauge-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bubble-primary) 0%, #764ba2 100%);
  transition: width 0.5s ease, background 0.5s ease;
}

.risk-gauge-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #764ba2;
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: left 0.5s ease, background-color 0.5s ease, opacity 0.3s ease;
}

.risk-gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #999;
  margin-top: 0.25rem;
}

.risk-profile-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.risk-profile-name .profile-icon {
  width: 24px;
  height: 24px;
  color: #764ba2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}

.risk-profile-name .profile-icon svg {
  width: 24px;
  height: 24px;
}

.risk-profile-name .profile-name-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
}

.risk-score-value {
  font-size: 2rem;
  font-weight: 700;
  color: #764ba2;
  margin-top: 0.5rem;
  transition: color 0.3s ease;
}

/* Confidence bar */
.profile-confidence {
  margin-bottom: 1.5rem;
}

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

.confidence-label {
  font-size: 0.8rem;
  color: #666;
  font-weight: 500;
}

.confidence-value {
  font-size: 0.8rem;
  color: #333;
  font-weight: 600;
}

.confidence-track {
  height: 6px;
  background: #E5E5E5;
  border-radius: 3px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: #6B7280;
  border-radius: 3px;
  transition: width 0.5s ease, background-color 0.3s ease;
}

/* Traits */
.profile-traits {
  margin-top: 1rem;
}

.traits-header {
  margin-bottom: 0.75rem;
}

.traits-label {
  font-size: 0.8rem;
  color: #666;
  font-weight: 500;
}

.traits-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.traits-list .no-traits {
  font-size: 0.75rem;
  color: #999;
  font-style: italic;
}

.trait-tag {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  background: white;
  border: 1px solid #E5E5E5;
  border-radius: 12px;
  font-size: 0.75rem;
  color: #555;
  transition: all 0.2s ease;
}

.trait-tag:hover {
  background: #F5F5F5;
  border-color: #D0D0D0;
}

.trait-tag.trait-more {
  background: #F0F0F0;
  color: #888;
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT: Content wrapper handles side-by-side layout
   ═══════════════════════════════════════════════════════════════════════════ */

/* Layout is now handled by .playground-content-wrapper defined above */

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE: Profile Graph Mobile Behavior
   Push-content layout with circular toggle button at left edge
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Hide logo text on mobile - show only icon */
  .playground-logo-text {
    display: none;
  }

  /* On mobile, content wrapper keeps row direction for push effect */
  .playground-content-wrapper {
    flex-direction: row;
    position: relative;
  }

  /* Profile panel pushes content */
  .profile-graph-container {
    position: relative;
    width: 280px;
    min-width: 280px;
    height: 100%;
    z-index: 10;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
    transition: width 0.3s ease, min-width 0.3s ease;
    background: #FAFAFA;
    flex-shrink: 0;
    overflow: visible; /* Allow toggle button to show when collapsed */
  }

  /* When collapsed, collapse to 0 width (no negative margin) */
  .profile-graph-container.panel-collapsed,
  .profile-graph-container:has(.profile-graph-panel.collapsed) {
    width: 0;
    min-width: 0;
    box-shadow: none;
  }

  .profile-graph-panel {
    width: 280px;
    min-width: 280px;
    transform: none !important; /* Override desktop transform */
    overflow: hidden;
  }

  .profile-graph-panel.collapsed .profile-graph-content {
    opacity: 0;
    pointer-events: none;
  }

  /* Toggle button - same circular style as desktop */
  .profile-graph-toggle {
    position: fixed;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    right: auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    color: #666;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #E5E5E5;
    z-index: 101;
    transition: left 0.3s ease;
  }

  /* When panel is expanded, move toggle to panel edge */
  .profile-graph-container:not(.panel-collapsed) .profile-graph-toggle,
  .profile-graph-container:not(:has(.profile-graph-panel.collapsed)) .profile-graph-toggle {
    left: 236px;
  }

  .profile-graph-toggle .toggle-icon {
    color: #666;
    width: 18px;
    height: 18px;
  }

  .profile-graph-toggle .toggle-icon svg {
    stroke: currentColor;
    width: 18px;
    height: 18px;
  }

  /* No overlay needed for push layout */
  .profile-graph-container::before {
    display: none;
  }
}

@media (max-width: 480px) {
  .profile-graph-container {
    width: 240px;
    min-width: 240px;
  }

  .profile-graph-panel {
    width: 240px;
    min-width: 240px;
  }

  /* Toggle position when expanded */
  .profile-graph-container:not(.panel-collapsed) .profile-graph-toggle,
  .profile-graph-container:not(:has(.profile-graph-panel.collapsed)) .profile-graph-toggle {
    left: 196px;
  }

  .profile-graph-content {
    padding: 1rem;
  }

  .risk-score-value {
    font-size: 1.75rem;
  }
}
