:root {
  --panama-blue: #0038A8;
  --panama-red: #CE1126;
  --panama-white: #FFFFFF;

  --bg-main: #FAFAFA;
  --card-bg: #FFFFFF;
  --border-soft: #E6E8EB;

  --text-main: #0F172A;
  --text-muted: #64748B;

  --color-primary: var(--panama-blue);
  --color-secondary: var(--panama-red);
  --color-bg: var(--bg-main);
  --color-card: var(--card-bg);
  --color-text: var(--text-main);
  --color-muted: var(--text-muted);
  --color-border: var(--border-soft);
  --color-success: #DCFCE7;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --max-width: 640px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg-main); color: var(--text-main); letter-spacing: -0.2px; }
a { color: var(--color-primary); text-decoration: none; }
button { font: inherit; }
.wrap { width: min(100% - 24px, var(--max-width)); margin: 0 auto; }
.site-header { position: sticky; top: 0; z-index: 20; background: linear-gradient(to right, var(--panama-red), var(--panama-blue)); backdrop-filter: blur(8px); border-bottom: 1px solid var(--color-border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 112px; }
.brand { display: inline-flex; align-items: center; gap: 14px; font-weight: 800; font-size: 2.25rem; line-height: 1; }
.brand-logo { vertical-align: middle; border-radius: 4px; }
.brand-voz { color: var(--panama-white); text-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.brand-tu {
  color: var(--panama-white);
  -webkit-text-stroke: 1px var(--panama-text);
  text-shadow:
    1px 0 0 var(--panama-text),
    -1px 0 0 var(--panama-text),
    0 1px 0 var(--panama-text),
    0 -1px 0 var(--panama-text);
}
.brand-voto { color: var(--panama-white); text-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.link-btn { border: none; background: transparent; color: var(--panama-white); font-weight: 700; font-size: 1.125rem; text-shadow: 0 2px 4px rgba(0,0,0,0.4); padding: 10px 20px; cursor: pointer; }
.user-chip { display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 999px; background: #e0e7ff; color: #1d4ed8; font-size: 14px; }
.hero { padding: 24px 0 12px; }
.hero h1 { margin: 0 0 8px; font-size: 32px; line-height: 1.05; }
.hero p { margin: 0; color: var(--color-muted); }
.category-pills { display: flex; gap: 10px; overflow-x: auto; padding: 10px 0 18px; }
.pill { flex: 0 0 auto; padding: 10px 14px; border-radius: 999px; background: #fff; color: var(--color-text); border: 1px solid var(--color-border); }
.pill.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.feed-grid { display: grid; gap: 16px; padding-bottom: 24px; }
.card { background: var(--color-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.item-card h2, .item-card h2 a { color: var(--color-text); margin: 6px 0 10px; }
.item-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 700; }
.badge-category { background: #dbeafe; color: #1d4ed8; }
.badge-closed { background: #fee2e2; color: #b91c1c; }
.muted { color: var(--color-muted); font-size: 14px; }
.primary-btn, .secondary-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 16px; border-radius: 12px; text-decoration: none; cursor: pointer; border: none; }
.primary-btn { background: var(--color-primary); color: #fff; }
.secondary-btn { background: #fff; color: var(--color-text); border: 1px solid var(--color-border); }
.load-more { padding: 6px 0 28px; text-align: center; }
.mini-stats { display: grid; grid-template-columns: 38px 1fr 38px; gap: 10px; align-items: center; margin: 12px 0 18px; color: var(--color-muted); }
.mini-bar, .result-bar { background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.mini-bar { height: 8px; }
.mini-bar span, .fill { display: block; height: 100%; border-radius: inherit; transition: width .4s ease-out; }
.option-a { background: var(--color-primary); color: #fff; }
.option-b { background: var(--color-secondary); color: #fff; }
.item-shell { padding: 16px 0 24px; }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--color-muted); }
.vote-panel { display: grid; gap: 12px; margin: 24px 0 10px; }
.vote-card,
.feed-item {
  border-radius: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  box-shadow: 0 6px 18px rgba(0,0,0,0.04);
  padding: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.vote-card::before,
.feed-item::before {
  content: "";
  display: block;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(
    to right,
    var(--panama-blue),
    var(--panama-red)
  );
  margin: -16px -16px 12px -16px;
}

.vote-card:hover,
.feed-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.vote-btn {
  width: 100%;
  height: 80px;
  font-size: 20px;
  font-weight: 600;
  border-radius: 10px;
  margin-bottom: 12px;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.vote-yes {
  background: var(--panama-blue);
  color: white;
  box-shadow: 0 2px 6px rgba(0, 56, 168, 0.2);
}

.vote-no {
  background: var(--panama-red);
  color: white;
  box-shadow: 0 2px 6px rgba(206, 17, 38, 0.2);
}

.vote-btn:hover {
  opacity: 0.95;
}

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

.vote-question {
  margin: 0 0 16px;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text-main);
}

.hook {
  margin: 0 0 24px;
  color: var(--color-muted);
  font-size: 16px;
}

.results {
  margin-bottom: 24px;
}

.result-bar {
  width: 100%;
  height: 10px;
  background: #E5E7EB;
  border-radius: 999px;
  margin: 6px 0;
  overflow: hidden;
}

.bar-yes {
  height: 100%;
  background: var(--panama-blue);
}

.bar-no {
  height: 100%;
  background: var(--panama-red);
}

.result-text {
  font-weight: bold;
  margin: 8px 0;
  font-size: 18px;
}

.result-insight {
  font-weight: 600;
  color: var(--text-main);
  margin: 4px 0 0;
  font-size: 14px;
}

.inline-results {
  margin-top: 12px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
}

.inline-results .result-bar {
  height: 16px;
  margin-bottom: 6px;
}

.inline-results .result-text {
  font-weight: bold;
  font-size: 14px;
  margin: 6px 0;
}

.hook-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.context-content.hidden {
  display: none;
}

.context-toggle {
  margin-top: 12px;
  background: none;
  border: none;
  color: var(--panama-blue);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.result-insight.minority {
  color: var(--panama-red);
}

.results {
  animation: fadeIn 0.3s ease-out;
}

.login-prompt {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-main);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  text-align: center;
}

.login-text {
  font-size: 14px;
  margin-bottom: 8px;
}

.login-google,
.login-facebook {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
  border: none;
  cursor: pointer;
}

.login-google {
  background: var(--panama-white);
  border: 1px solid var(--border-soft);
}

.login-google:hover {
  background: var(--bg-main);
}

.login-facebook {
  background: #1877F2;
  color: #ffffff;
}

.login-dismiss {
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.hidden {
  display: none;
}

.feed-item { background: var(--color-card); }
.feed-item h2, .feed-item h2 a { color: var(--color-text); margin: 6px 0 10px; }
.vote-btn[disabled] { opacity: .7; cursor: progress; }
.results-panel { margin-top: 22px; }
.results-panel.is-hidden, .vote-panel.is-hidden { display: none; }
.result-row { margin-bottom: 16px; }
.result-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-weight: 700; }
.result-bar { height: 18px; }
.fill.option-a { background: var(--color-primary); }
.fill.option-b { background: var(--color-secondary); }
.is-user-choice .result-head span { color: #059669; }
.vote-count { color: var(--color-muted); margin: 12px 0 18px; }
.share-box { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.next-item { margin-top: 16px; }
.feedback { margin-top: 12px; min-height: 24px; color: #b91c1c; }
.alert { padding: 12px 14px; border-radius: 12px; margin: 16px 0; }
.alert-success { background: var(--color-success); color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.error-card, .prose-card { margin: 24px 0; }
.site-footer { 
  display: flex; 
  flex-direction: column;
  align-items: center;
  gap: 12px; 
  padding: 16px 0 32px; 
  color: var(--color-muted); 
}
.site-footer nav {
  display: flex;
  gap: 16px;
}
.site-footer a {
  color: var(--color-muted);
  font-size: 14px;
}
.site-footer a:hover {
  color: var(--color-primary);
}
.footer-copy {
  font-size: 13px;
  margin: 0;
  opacity: 0.8;
}

/* Breadcrumb styles */
nav[aria-label="Breadcrumb"] {
  padding: 12px 0;
  font-size: 14px;
}
nav[aria-label="Breadcrumb"] ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
nav[aria-label="Breadcrumb"] li:not(:last-child)::after {
  content: "›";
  margin-left: 8px;
  color: var(--color-muted);
}
nav[aria-label="Breadcrumb"] a {
  color: var(--color-primary);
}
nav[aria-label="Breadcrumb"] a:hover {
  text-decoration: underline;
}

/* ============================================
   COMPREHENSIVE RESPONSIVE BREAKPOINTS
   ============================================ */

/* Small phones: 320px - 480px */
@media (max-width: 480px) {
  :root { --max-width: 100%; }
  
  .wrap { width: calc(100% - 16px); padding: 0 8px; }
  
  /* Header */
  .header-inner { min-height: 60px; gap: 8px; }
  .brand { font-size: 1.1rem; gap: 8px; }
  .brand span { gap: 0; }
  .link-btn { font-size: 0.8rem; padding: 6px 10px; }
  
  /* Hero */
  .hero { padding: 16px 0 8px; }
  .hero h1 { font-size: 22px; margin: 0 0 6px; }
  .hero p { font-size: 14px; }
  
  /* Category pills */
  .category-pills { gap: 6px; padding: 8px 0 12px; }
  .pill { padding: 8px 12px; font-size: 13px; }
  
  /* Cards */
  .vote-card, .feed-item { padding: 12px; border-radius: 12px; }
  .vote-card::before, .feed-item::before { margin: -12px -12px 10px -12px; }
  
  /* Vote buttons */
  .vote-btn { height: 56px; font-size: 16px; border-radius: 10px; margin-bottom: 8px; }
  
  /* Typography */
  .vote-question { font-size: 18px; line-height: 1.35; }
  .hook { font-size: 14px; margin: 0 0 16px; }
  .hook-text { font-size: 12px; }
  
  /* Results */
  .result-bar { height: 8px; }
  .result-text { font-size: 16px; }
  .result-insight { font-size: 13px; }
  .inline-results { padding: 10px; }
  
  /* Login prompt */
  .login-prompt { padding: 10px; margin-top: 12px; }
  .login-google, .login-facebook { padding: 10px; font-size: 14px; }
  
  /* Share buttons */
  .share-box { flex-direction: column; gap: 8px; }
  .share-box .primary-btn, 
  .share-box .secondary-btn { 
    width: 100%; 
    min-height: 44px; 
    padding: 12px;
    font-size: 15px;
  }
  
  /* Footer */
  .site-footer { gap: 8px; padding: 12px 0 24px; }
  .site-footer nav { gap: 12px; }
  .site-footer a { font-size: 13px; }
  .footer-copy { font-size: 12px; }
  
  /* Breadcrumbs */
  nav[aria-label="Breadcrumb"] { font-size: 12px; padding: 8px 0; }
}

/* Regular phones: 481px - 768px */
@media (min-width: 481px) and (max-width: 768px) {
  :root { --max-width: 100%; }
  
  .wrap { width: calc(100% - 24px); padding: 0 12px; }
  
  .header-inner { min-height: 72px; }
  .brand { font-size: 1.35rem; }
  .link-btn { font-size: 0.9rem; padding: 8px 14px; }
  
  .hero h1 { font-size: 26px; }
  .vote-btn { height: 68px; font-size: 18px; }
  .vote-question { font-size: 19px; }
  
  /* Footer */
  .footer-copy { font-size: 12px; }
}

/* Tablets: 769px - 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --max-width: 720px; }
  
  .wrap { width: min(100% - 32px, var(--max-width)); }
  
  .header-inner { min-height: 90px; }
  .brand { font-size: 1.75rem; }
  .link-btn { font-size: 1rem; padding: 8px 16px; }
  
  .vote-btn { height: 72px; }
}

/* Small laptops: 1025px - 1280px */
@media (min-width: 1025px) and (max-width: 1280px) {
  :root { --max-width: 800px; }
  
  .wrap { width: min(100% - 40px, var(--max-width)); }
  
  .header-inner { min-height: 100px; }
  .brand { font-size: 2rem; }
  
  .vote-btn { height: 76px; }
}

/* Large screens: 1281px+ - Keep current layout */
@media (min-width: 1281px) {
  :root { --max-width: 960px; }
  
  .wrap { width: min(100% - 48px, var(--max-width)); }
}

/* Touch improvements for mobile */
@media (hover: none) and (pointer: coarse) {
  .vote-btn:active { transform: scale(0.97); }
  .pill:active { opacity: 0.8; }
  .login-google:active, .login-facebook:active { opacity: 0.9; }
  
  /* Larger touch targets */
  .vote-btn { min-height: 56px; }
  .pill { min-height: 40px; }
  .login-dismiss { min-height: 40px; padding: 8px 16px; }
  
  /* Disable hover effects on touch */
  .vote-card:hover, .feed-item:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  }
}

/* Landscape orientation on phones */
@media (max-height: 500px) and (orientation: landscape) {
  .header-inner { min-height: 50px; }
  .brand { font-size: 1.2rem; }
  .hero { padding: 12px 0 6px; }
  .hero h1 { font-size: 20px; }
  .vote-btn { height: 48px; font-size: 15px; }
}

/* High DPI / Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .brand-tu {
    -webkit-text-stroke: 0.5px var(--panama-text);
  }
}

/* Dark mode support (if system supports it) */
@media (prefers-color-scheme: dark) {
  /* Could add dark mode styles here if needed */
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Insights System */
.insights-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 24px 0;
}

.insight-card {
  display: flex;
  gap: 16px;
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s ease;
}

.insight-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(0, 56, 168, 0.1);
}

.insight-rank {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 50px;
}

.rank-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--panama-blue), var(--panama-red));
  color: white;
  border-radius: 50%;
  font-weight: 800;
  font-size: 18px;
}

.insight-content {
  flex: 1;
}

.insight-content h2 {
  margin: 0 0 12px 0;
  font-size: 18px;
  line-height: 1.4;
  color: var(--text-main);
}

.insight-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.insight-type {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.insight-type.strong_consensus {
  background: #DCFCE7;
  color: #166534;
}

.insight-type.majority {
  background: #DBEAFE;
  color: #1e40af;
}

.insight-type.divided {
  background: #FEF3C7;
  color: #92400e;
}

.insight-source {
  background: #F9FAFB;
  padding: 12px;
  border-radius: 8px;
  margin-top: 12px;
}

.source-question {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.vote-count {
  margin: 8px 0 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.view-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}

.view-link:hover {
  text-decoration: underline;
}

.insights-cta {
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, rgba(0, 56, 168, 0.05), rgba(206, 17, 38, 0.05));
  border-radius: 12px;
  margin: 40px 0;
}

.insights-cta h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
}

.insights-cta p {
  margin: 0 0 20px 0;
  color: var(--text-muted);
}

.primary-btn {
  display: inline-block;
  padding: 12px 32px;
  background: var(--color-primary);
  color: white;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.primary-btn:hover {
  background: var(--panama-red);
  transform: translateY(-2px);
}

.insight-banner {
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
  color: #ffffff;
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 20px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
}

.banner-header {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
  margin-bottom: 12px;
}

.banner-insight {
  font-size: 19px;
  line-height: 1.4;
  font-weight: 700;
  margin-bottom: 12px;
  color: #ffffff;
}

.banner-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.banner-votes {
  font-size: 14px;
  font-weight: 600;
  color: #60A5FA;
}

.banner-source {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.7;
}

.banner-timestamp {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.5;
  font-style: italic;
}

.hero-source {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}

.hero-source:hover {
  color: var(--color-primary);
}

.insight-inline {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-left: 3px solid var(--color-primary);
  padding: 14px;
  border-radius: 10px;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inline-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.inline-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
}

.insights-dashboard {
  margin: 32px 0;
}

.section-header {
  margin: 40px 0 20px 0;
  padding-bottom: 16px;
  border-bottom: 2px solid #E5E7EB;
}

.section-header h2 {
  margin: 0 0 6px 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
}

.section-header p {
  margin: 0;
  font-size: 15px;
  color: var(--text-muted);
}

.section-header.section-divided {
  border-bottom-color: #F59E0B;
}

.section-header.section-divided h2 {
  color: #B45309;
}

.insights-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 32px;
}

.insight-card-shareable {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  padding: 18px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.insight-card-shareable:hover {
  border-color: #D1D5DB;
  box-shadow: 0 8px 20px -4px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.insight-card-shareable.strong_consensus {
  border-left: 4px solid #22C55E;
}

.insight-card-shareable.majority {
  border-left: 4px solid #3B82F6;
}

.insight-card-shareable.divided {
  border-left: 4px solid #F59E0B;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}

.card-badge.strong_consensus {
  background: #DCFCE7;
  color: #166534;
}

.card-badge.majority {
  background: #DBEAFE;
  color: #1e40af;
}

.card-badge.divided {
  background: #FEF3C7;
  color: #92400e;
}

.card-rank {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.5;
}

.card-insight {
  margin: 0 0 16px 0;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 600;
  color: var(--text-main);
}

.card-results {
  background: #F9FAFB;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.mini-bar {
  height: 6px;
  background: #E5E7EB;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--panama-blue), var(--panama-blue));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.insight-card-shareable.divided .bar-fill {
  background: linear-gradient(90deg, #F59E0B, #F59E0B);
}

.mini-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.dot-separator {
  opacity: 0.4;
}

.card-cta {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  margin-top: 4px;
}

.card-cta:hover {
  color: var(--panama-red);
}

.hero-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}

/* Print styles */
@media print {
  .site-header, .login-prompt, .vote-panel button, .share-box { display: none; }
  .results-panel { display: block !important; }
  body { background: white; color: black; }
}
