/* ═══════════════════════════════════════════════════════════════════════════
   FIELDMAP PLAYGROUND PAGE STYLES
   Consistent with design system (glass morphism, typography, spacing)
   Interactive map exploration with region intelligence
   ═══════════════════════════════════════════════════════════════════════════ */

.fieldmap-page {
  --section-spacing: 6rem;
  --card-padding: 2rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   QUOTA EXCEEDED BANNER
   ═══════════════════════════════════════════════════════════════════════════ */

.quota-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(185, 28, 28, 0.95));
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease-out;
}

.quota-banner.active {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.quota-banner-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 1280px;
  width: 100%;
}

.quota-banner-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.quota-banner-text {
  flex: 1;
}

.quota-banner-title {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.25rem;
}

.quota-banner-message {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
}

.quota-banner-close {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ffffff;
  font-size: 1.25rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.quota-banner-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.quota-banner-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.9rem;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 20px;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.quota-banner-cta:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION CONTAINERS
   ═══════════════════════════════════════════════════════════════════════════ */

.section-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (min-width: 768px) {
  .section-container {
    padding: 0 2rem;
  }
}

.fieldmap-section {
  padding: var(--section-spacing) 0;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION HEADERS
   ═══════════════════════════════════════════════════════════════════════════ */

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header-left {
  text-align: left;
  margin-bottom: 2.5rem;
}

.section-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.section-eyebrow::before,
.section-eyebrow::after {
  content: "";
  width: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
}

.section-header-left .section-eyebrow::after {
  display: none;
}

.section-header-left .section-eyebrow::before {
  width: 32px;
  height: 2px;
  background: var(--gradient-primary);
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-primary);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.section-subtitle {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 800px;
  margin: 1rem auto 0;
}

.section-header-left .section-subtitle {
  margin: 1rem 0 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HERO SECTION
   ═══════════════════════════════════════════════════════════════════════════ */

.hero-section {
  padding: 3rem 0 4rem;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.5rem 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hero-badge-dot {
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

.hero-badge-text {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.hero-title {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 600;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  max-width: 900px;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.hero-title-highlight {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 800px;
  margin-bottom: 2rem;
}

/* Purpose Card */
.purpose-card {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.5rem;
  max-width: 900px;
}

.purpose-card-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fbbf24;
  margin-bottom: 0.5rem;
}

.purpose-card-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURE CARDS GRID
   ═══════════════════════════════════════════════════════════════════════════ */

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

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

@media (max-width: 640px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
}

.feature-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: all 0.4s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(16, 185, 129, 0.3);
}

.feature-number {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.feature-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.feature-text {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOW TO USE STEPS
   ═══════════════════════════════════════════════════════════════════════════ */

.howto-container {
  background: rgba(16, 185, 129, 0.05);
  border: 1px dashed rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

.howto-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .howto-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.howto-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.howto-step-number {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-primary);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.howto-step-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MEDIA GRID (VIDEO + PROBLEMS)
   ═══════════════════════════════════════════════════════════════════════════ */

.media-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

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

.problems-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.problems-card-header {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.problem-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.problem-pill {
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-full);
  color: var(--color-accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PLAYGROUND SHELL
   ═══════════════════════════════════════════════════════════════════════════ */

.playground-shell {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: 2rem;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3);
}

.playground-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.playground-title-block {
  flex: 1;
  min-width: 280px;
}

.playground-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.playground-subtitle {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 600px;
}

.playground-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.playground-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.playground-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.75rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-full);
  color: var(--color-primary);
}

.playground-badge.secondary {
  background: rgba(148, 163, 184, 0.1);
  border-color: var(--glass-border);
  color: var(--text-muted);
}

/* Playground Divider */
.playground-divider {
  border: none;
  border-top: 1px dashed var(--glass-border);
  margin: 0 0 1.25rem;
}

/* Helper Bar */
.helper-bar {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.helper-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.helper-step {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-full);
  color: var(--color-accent);
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   MAP + CONTENT LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.map-content-wrapper {
  display: flex;
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  min-height: 680px;
  height: 70vh;
  max-height: 900px;
}

@media (max-width: 991px) {
  .map-content-wrapper {
    flex-direction: column;
    height: auto;
  }
}

/* Map Panel */
.map-panel {
  position: relative;
  width: 45%;
  min-width: 360px;
  height: 100%;
  background: rgba(15, 23, 42, 0.5);
  border-right: 1px solid var(--glass-border);
}

@media (max-width: 991px) {
  .map-panel {
    width: 100%;
    height: 300px;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
  }
}

#map {
  width: 100%;
  height: 100%;
}

.map-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-control-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.5rem 0.85rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s ease;
}

.map-control-btn:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

.map-control-btn.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
  color: var(--color-primary);
}

/* Map Spinner */
.map-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  z-index: 1000;
}

.map-spinner.active {
  display: flex;
}

.spinner-ring {
  width: 40px;
  height: 40px;
  border: 3px solid var(--glass-border);
  border-radius: 50%;
  border-top-color: var(--color-primary);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner-text {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Content Panel */
.content-panel {
  flex: 1;
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.3);
  overflow: hidden;
}

@media (max-width: 991px) {
  .content-panel {
    width: 100%;
    min-height: 400px;
    height: 400px;
  }
}

/* Tab Navigation */
.tab-navigation {
  display: flex;
  background: rgba(15, 23, 42, 0.5);
  border-bottom: 1px solid var(--glass-border);
}

.tab-btn {
  flex: 1;
  padding: 0.85rem 1rem;
  background: transparent;
  border: none;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.tab-btn:hover {
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--color-primary);
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 0;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
}

/* Tab Content */
.tab-content {
  display: none;
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  min-height: 0;
}

.tab-content.active {
  display: block;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.empty-state-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.empty-state-text {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 300px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   REGION INFO CARD
   ═══════════════════════════════════════════════════════════════════════════ */

.region-info-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.region-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.region-description {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  white-space: pre-line;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

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

.stat-item {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.stat-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.crops-section {
  margin-top: 1rem;
}

.crop-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.crop-chip {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-full);
  color: var(--color-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHAT PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-header {
  background: rgba(15, 23, 42, 0.5);
  padding: 1rem;
  border-bottom: 1px solid var(--glass-border);
}

.chat-context {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-message {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-lg);
  max-width: 85%;
  font-size: 0.9rem;
  line-height: 1.6;
  animation: messageSlide 0.25s ease;
}

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

.chat-message.user {
  align-self: flex-end;
  background: var(--gradient-primary);
  color: var(--bg-primary);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.chat-message.assistant {
  align-self: flex-start;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MARKDOWN CONTENT STYLES (for assistant messages)
   ═══════════════════════════════════════════════════════════════════════════ */

.chat-message.assistant .markdown-content {
  font-size: 0.9rem;
  line-height: 1.7;
}

.chat-message.assistant .markdown-content p {
  margin: 0 0 0.75rem 0;
}

.chat-message.assistant .markdown-content p:last-child {
  margin-bottom: 0;
}

.chat-message.assistant .markdown-content h1,
.chat-message.assistant .markdown-content h2,
.chat-message.assistant .markdown-content h3,
.chat-message.assistant .markdown-content h4,
.chat-message.assistant .markdown-content h5,
.chat-message.assistant .markdown-content h6 {
  margin: 1rem 0 0.5rem 0;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-message.assistant .markdown-content h1:first-child,
.chat-message.assistant .markdown-content h2:first-child,
.chat-message.assistant .markdown-content h3:first-child {
  margin-top: 0;
}

.chat-message.assistant .markdown-content h1 { font-size: 1.25rem; }
.chat-message.assistant .markdown-content h2 { font-size: 1.1rem; }
.chat-message.assistant .markdown-content h3 { font-size: 1rem; }

.chat-message.assistant .markdown-content ul,
.chat-message.assistant .markdown-content ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.chat-message.assistant .markdown-content li {
  margin: 0.25rem 0;
}

.chat-message.assistant .markdown-content code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--color-primary);
}

.chat-message.assistant .markdown-content pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  overflow-x: auto;
}

.chat-message.assistant .markdown-content pre code {
  background: transparent;
  padding: 0;
  font-size: 0.85rem;
}

.chat-message.assistant .markdown-content blockquote {
  border-left: 3px solid var(--color-primary);
  margin: 0.75rem 0;
  padding: 0.5rem 0 0.5rem 1rem;
  background: rgba(16, 185, 129, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.chat-message.assistant .markdown-content blockquote p {
  margin: 0;
}

.chat-message.assistant .markdown-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-message.assistant .markdown-content a:hover {
  color: var(--color-accent);
}

.chat-message.assistant .markdown-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

.chat-message.assistant .markdown-content em {
  font-style: italic;
}

.chat-message.assistant .markdown-content hr {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin: 1rem 0;
}

.chat-message.assistant .markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.85rem;
}

.chat-message.assistant .markdown-content th,
.chat-message.assistant .markdown-content td {
  border: 1px solid var(--glass-border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.chat-message.assistant .markdown-content th {
  background: rgba(0, 0, 0, 0.2);
  font-weight: 600;
}

.chat-message.assistant .markdown-content tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.1);
}

.chat-input-area {
  padding: 1rem;
  background: rgba(15, 23, 42, 0.5);
  border-top: 1px solid var(--glass-border);
}

.chat-input-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--text-primary);
  resize: none;
  min-height: 36px;
  max-height: 120px;
}

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

.chat-input:focus {
  outline: none;
}

.chat-send-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.6rem 1.25rem;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-full);
  color: var(--bg-primary);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   SETTINGS PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

.settings-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.settings-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.setting-group {
  margin-bottom: 1rem;
}

.setting-group:last-child {
  margin-bottom: 0;
}

.setting-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: block;
}

.setting-select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--text-primary);
  cursor: pointer;
}

.setting-select:focus {
  outline: none;
  border-color: rgba(16, 185, 129, 0.3);
}

.setting-button {
  width: 100%;
  padding: 0.65rem 1rem;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: var(--radius-md);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: #f87171;
  cursor: pointer;
  transition: all 0.3s ease;
}

.setting-button:hover {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.4);
}

.setting-note {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* Style preview badges */
.style-preview-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

@media (max-width: 640px) {
  .style-preview-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.style-preview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem;
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
}

.style-preview-item:hover {
  border-color: rgba(16, 185, 129, 0.3);
}

.style-preview-item.active {
  border-color: var(--color-primary);
  background: rgba(16, 185, 129, 0.1);
}

.style-preview-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.style-preview-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.style-preview-item.active .style-preview-label {
  color: var(--color-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAPLIBRE OVERRIDES
   ═══════════════════════════════════════════════════════════════════════════ */

.maplibregl-popup-content {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.85rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.4);
}

.maplibregl-popup-tip {
  border-top-color: var(--glass-bg) !important;
}

.maplibregl-ctrl-group {
  background: rgba(15, 23, 42, 0.9) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-md) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.maplibregl-ctrl-group button {
  background: transparent !important;
  border-color: var(--glass-border) !important;
}

.maplibregl-ctrl-group button:hover {
  background: rgba(16, 185, 129, 0.1) !important;
}

.maplibregl-ctrl-group button + button {
  border-top-color: var(--glass-border) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCROLL REVEAL ANIMATION
   ═══════════════════════════════════════════════════════════════════════════ */

.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal[data-delay="1"] { transition-delay: 0.1s; }
.reveal[data-delay="2"] { transition-delay: 0.2s; }
.reveal[data-delay="3"] { transition-delay: 0.3s; }
.reveal[data-delay="4"] { transition-delay: 0.4s; }


/* ════════════════════════════════════════════════════════════════════════════
   PASTE this block at the END of your fieldmap_playground.css
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Back button ─────────────────────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
}
.back-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ── Panel helpers ───────────────────────────────────────────────────────── */
.panel-section {
  margin-top: 16px;
}
.panel-hint {
  margin-top: 16px;
  font-size: 0.78rem;
  opacity: 0.4;
  line-height: 1.5;
}
.region-role {
  font-size: 0.75rem;
  opacity: 0.5;
  margin: 4px 0 14px;
  text-transform: capitalize;
}

/* ── Key-points collapsible ──────────────────────────────────────────────── */
.key-points-details {
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  overflow: hidden;
}
.key-points-summary {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  list-style: none;
  user-select: none;
  letter-spacing: 0.01em;
}
.key-points-summary::-webkit-details-marker { display: none; }
.key-points-summary::after  { content: "  ▾"; opacity: 0.45; }
details[open] .key-points-summary::after { content: "  ▴"; }

.key-points-list {
  margin: 0;
  padding: 10px 14px 12px 26px;
}
.key-point-item {
  font-size: 0.79rem;
  line-height: 1.55;
  opacity: 0.72;
  margin-bottom: 5px;
}

/* ── Agro-ecological zones ───────────────────────────────────────────────── */
.zones-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}
.zone-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.79rem;
  padding: 5px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.zone-name  { opacity: 0.82; }
.zone-share { font-size: 0.72rem; opacity: 0.48; white-space: nowrap; margin-left: 8px; }

/* ── Risk badges (country panel) ─────────────────────────────────────────── */
.risk-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  border: 1px solid;
  text-transform: capitalize;
  white-space: nowrap;
}

/* ── District select ─────────────────────────────────────────────────────── */
.district-select {
  width: 100%;
  margin-top: 8px;
  padding: 9px 36px 9px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(255,255,255,0.4)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  /* Scrollable list on desktop (size attr set in JS for long lists) */
  overflow-y: auto;
}
.district-select:focus {
  outline: none;
  border-color: #22c55e;
  background-color: rgba(255, 255, 255, 0.1);
}
.district-select option {
  background: #1e293b;
  color: #fff;
  padding: 8px 12px;
  white-space: normal;
  word-wrap: break-word;
}
/* Mobile: restore native picker for better scroll UX on long lists */
@media (max-width: 639px) {
  .district-select {
    appearance: auto;
    -webkit-appearance: menulist;
    background-image: none;
    font-size: 16px; /* prevent iOS zoom */
    min-height: 44px; /* thumb-friendly tap target */
    padding: 10px 12px;
  }
}

/* ── Weather card wrapper ────────────────────────────────────────────────── */
.weather-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

/* Current conditions */
.weather-card-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.weather-district-name {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: #22c55e;
}
.weather-current-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.weather-temp-block {
  display: flex;
  flex-direction: column;
}
.weather-temp-main {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}
.weather-feels {
  font-size: 0.72rem;
  opacity: 0.5;
  margin-top: 3px;
}
.weather-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.76rem;
  opacity: 0.65;
  margin-left: auto;
  text-align: right;
}

/* Spray status */
.spray-status-block {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.spray-status-label  { font-size: 0.86rem; font-weight: 700; }
.spray-reason-text   { font-size: 0.75rem; opacity: 0.6; margin-top: 3px; line-height: 1.4; }

.spray-status-spray-safe    { background: rgba(34,  197, 94,  0.1); border-left: 3px solid #22c55e; }
.spray-status-spray-caution { background: rgba(245, 158, 11,  0.1); border-left: 3px solid #f59e0b; }
.spray-status-spray-unsafe  { background: rgba(239, 68,  68,  0.1); border-left: 3px solid #ef4444; }
.spray-status-spray-unknown { background: rgba(107, 114, 128, 0.1); border-left: 3px solid #6b7280; }

/* Ops risk strip */
.ops-risk-row {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.ops-risk-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  font-size: 0.82rem;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
}
.ops-risk-item:last-child { border-right: none; }
.ops-risk-label {
  font-size: 0.68rem;
  opacity: 0.5;
  text-align: center;
}

/* 5-day forecast */
.forecast-section {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.forecast-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.forecast-day-card {
  flex: 0 0 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: background 0.15s;
}
.forecast-day-card:hover { background: rgba(255,255,255,0.08); }
.forecast-date   { font-size: 0.62rem; opacity: 0.5; text-align: center; line-height: 1.2; }
.forecast-icon   { width: 28px; height: 28px; }
.forecast-temps  { display: flex; gap: 4px; font-size: 0.78rem; }
.forecast-max    { font-weight: 700; }
.forecast-min    { opacity: 0.5; }
.forecast-pop    { font-size: 0.63rem; opacity: 0.55; }

/* Season climate grid */
.season-section { padding: 12px 16px; }
.season-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 8px;
}
.season-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 9px 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  text-align: center;
}
.season-stat-value { font-size: 0.88rem; font-weight: 700; color: #22c55e; }
.season-stat-label { font-size: 0.63rem; opacity: 0.5; margin-top: 3px; line-height: 1.3; }

/* Loading shimmer for weather card */
.weather-loading {
  text-align: center;
  padding: 22px;
  opacity: 0.5;
  font-size: 0.83rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  margin-top: 4px;
}
.weather-error {
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  font-size: 0.82rem;
  margin-top: 4px;
}


/* ── Smart Thinking Indicator ────────────────────────────────────────────── */
/* REPLACES the old .thinking-bubble block in fieldmap_playground.css        */

.thinking-indicator {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  max-width: 320px;
}

.thinking-indicator-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}

.thinking-pulse {
  position: relative;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.thinking-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  animation: thinking-glow 1.8s ease-in-out infinite;
}

.thinking-pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(34, 197, 94, 0.3);
  animation: thinking-ring-expand 1.8s ease-in-out infinite;
}

@keyframes thinking-glow {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); }
  50%      { opacity: 0.6; box-shadow: 0 0 12px rgba(34, 197, 94, 0.2); }
}

@keyframes thinking-ring-expand {
  0%   { transform: scale(0.8); opacity: 0.6; }
  50%  { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(0.8); opacity: 0; }
}

.thinking-stage-text {
  font-size: 0.82rem;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.4;
  min-height: 1.2em;
}

.thinking-stage-text .thinking-highlight {
  color: #22c55e;
  font-weight: 600;
}

/* Step progress trail */
.thinking-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 16px 12px;
  margin-left: 4px;
  border-left: 1px dashed rgba(34, 197, 94, 0.2);
  margin-top: -2px;
}

.thinking-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.thinking-step.visible {
  opacity: 1;
  transform: translateY(0);
}

.thinking-step.completed .thinking-step-icon {
  color: #22c55e;
}

.thinking-step.completed .thinking-step-label {
  opacity: 0.5;
}

.thinking-step.active .thinking-step-label {
  color: var(--text-primary, #e2e8f0);
}

.thinking-step-icon {
  font-size: 0.72rem;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  color: var(--text-muted, #64748b);
  transition: color 0.3s ease;
}

.thinking-step-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--text-muted, #64748b);
  transition: color 0.3s ease, opacity 0.3s ease;
}

/* Elapsed timer */
.thinking-elapsed {
  padding: 0 16px 10px;
  margin-left: 4px;
}

.thinking-elapsed-text {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
  opacity: 0.5;
}
/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE-FIRST RESPONSIVE ADDITIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Mobile < 640px ─────────────────────────────────────────────────────── */
@media (max-width: 639px) {

  /* Hero */
  .hero-section   { padding: 2rem 0 1.5rem; }
  .hero-title     { font-size: clamp(1.5rem, 6vw, 2rem) !important; }
  .hero-subtitle  { font-size: 0.9rem; line-height: 1.7; }
  .purpose-card   { padding: 1rem; font-size: 0.85rem; }

  /* Grids */
  .features-grid  { grid-template-columns: 1fr !important; gap: 0.85rem; }
  .feature-card   { padding: 1.25rem; }
  .howto-grid     { grid-template-columns: 1fr !important; }
  .howto-step     { padding: 0.85rem 1rem; font-size: 0.85rem; }

  /* Playground shell */
  .playground-shell   { padding: 1rem; border-radius: var(--radius-lg); }
  .playground-header  { flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
  .playground-controls { align-items: flex-start; }
  .section-container  { padding: 0 0.85rem; }
  .fieldmap-section   { padding: 1rem 0 2rem; }
  .fieldmap-page      { padding-bottom: 3rem; }

  /* Helper bar */
  .helper-bar {
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0.75rem 0;
    gap: 0.5rem;
    flex-wrap: nowrap;
  }
  .helper-bar::-webkit-scrollbar { display: none; }
  .helper-chip { flex-shrink: 0; white-space: nowrap; min-height: 36px; }

  /* Map + content stacked */
  .map-content-wrapper {
    height: auto;
    flex-direction: column;
    border-radius: var(--radius-lg);
    min-height: 0;
  }

  .map-panel {
    width: 100%;
    height: 260px;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
  }

  .map-control-btn {
    padding: 0.6rem 1rem;
    min-height: 40px;
    font-size: 0.72rem;
  }

  /* Content panel: full width, enough height to read */
  .content-panel {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 480px;
    display: flex;
    flex-direction: column;
  }

  /* Tabs */
  .tab-navigation { gap: 0; }
  .tab-btn {
    font-size: 0.72rem !important;
    padding: 10px 4px !important;
    letter-spacing: 0.03em;
    flex: 1;
  }

  /* Tab content area */
  .tab-content {
    padding: 12px !important;
    flex: 1;
  }

  /* Chat container fills the tab */
  .chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 400px;
  }

  /* Context bar */
  .chat-context {
    font-size: 0.82rem !important;
    padding: 8px 10px !important;
    line-height: 1.45;
  }

  /* Messages area: scrollable, readable */
  .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    gap: 10px;
    word-break: break-word;
    min-height: 180px;
    max-height: none;
  }

  /* Message bubbles: full width, easy to read */
  .chat-message {
    max-width: 100% !important;
    font-size: 0.92rem !important;
    line-height: 1.6 !important;
    padding: 10px 13px !important;
  }

  .chat-message.user      { align-self: flex-end; max-width: 88% !important; }
  .chat-message.assistant { align-self: flex-start; max-width: 100% !important; }

  /* Markdown in assistant messages */
  .chat-message.assistant .markdown-content { font-size: 0.9rem; line-height: 1.65; }

  /* Input area */
  .chat-input-area   { padding: 8px !important; }
  .chat-input-wrapper { gap: 6px !important; padding: 8px !important; }
  .chat-input {
    font-size: 16px !important; /* prevents iOS auto-zoom */
    min-height: 44px;
  }
  .chat-send-btn {
    padding: 10px 14px !important;
    font-size: 0.8rem !important;
    min-height: 44px;
    white-space: nowrap;
  }

  /* Empty state */
  .empty-state        { padding: 24px 12px !important; }
  .empty-state-title  { font-size: 1rem !important; }
  .empty-state-text   { font-size: 0.87rem !important; max-width: 100%; }

  /* Region info */
  .region-info-card   { padding: 1rem; }
  .region-title       { font-size: 1.1rem; }
  .region-description { font-size: 0.87rem; }

  /* Weather card */
  .season-stats-grid  { grid-template-columns: repeat(2, 1fr); }
  .weather-temp-main  { font-size: 1.35rem; }

  /* District select — native picker on mobile */
  .district-select {
    appearance: auto;
    -webkit-appearance: menulist;
    background-image: none;
    font-size: 16px;
    min-height: 44px;
    padding: 10px 12px;
  }
}

/* ── Tablet 640–991px ────────────────────────────────────────────────────── */
@media (min-width: 640px) and (max-width: 991px) {

  .map-content-wrapper {
    height: auto;
    flex-direction: column;
    min-height: 0;
  }

  .map-panel {
    width: 100%;
    height: 320px;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
  }

  .content-panel {
    width: 100%;
    min-height: 420px;
    height: auto;
  }

  .chat-container {
    min-height: 380px;
  }

  .chat-message {
    max-width: 92% !important;
    font-size: 0.92rem;
  }

  .playground-shell { padding: 1.5rem; }
  .hero-title { font-size: clamp(1.75rem, 4vw, 2.5rem) !important; }
}