/* ============================================================
   PHONE SCREEN SIZE COMPARISON — STYLES
   Mobile-first, dark theme
   ============================================================ */

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface2: #1d1d1d;
  --border: #272727;
  --text: #f0f0f0;
  --muted: #999;
  --a: #5BC8FB;
  --b: #FF7043;
  --a-fill: rgba(91,200,251,0.13);
  --b-fill: rgba(255,112,67,0.13);
  --radius: 12px;
  --radius-sm: 8px;
}

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

html {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ============================================================
   APP SHELL
   ============================================================ */

#app {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px 56px;
}

/* ============================================================
   SELECTOR ROW
   ============================================================ */

.selector-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 4px;
}

.selector-btn {
  flex: 1;
  max-width: 260px;
  min-width: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  transition: border-color 0.15s, background 0.15s;
}

.selector-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selector-icon {
  flex-shrink: 0;
  font-size: 0.82rem;
  opacity: 0.45;
  line-height: 1;
  padding: 2px 0 2px 4px;
}

.selector-btn:hover {
  background: var(--surface2);
  border-color: #3a3a3a;
}

#btnA { border-color: rgba(91,200,251,0.35); }
#btnB { border-color: rgba(255,112,67,0.35);  }

.vs-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255,255,255,0.58);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.icon-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.32);
  padding: 4px 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.icon-btn:hover  { color: rgba(255,255,255,0.65); }
.icon-btn.copied { color: var(--a); }


/* ============================================================
   COMPARISON CARD  (toggle bar + visual, one block)
   ============================================================ */

.comparison-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0;
  overflow: hidden;
}

.card-toggle-bar {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 6px 14px 4px;
}

.dims-unit-bar {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 1px;
  visibility: hidden;
  white-space: nowrap;
}

.dims-unit-bar.visible {
  visibility: visible;
}

.overlay-share {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.overlay-share.visible {
  opacity: 1;
  pointer-events: all;
}

.unit-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.28);
  font-size: 0.68rem;
  font-weight: 500;
  padding: 4px 4px;
  transition: color 0.15s;
}

.unit-btn.active {
  color: rgba(255,255,255,0.62);
  font-weight: 700;
}

.unit-sep {
  color: rgba(255,255,255,0.45);
  font-size: 0.68rem;
  pointer-events: none;
}

.view-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 7px 12px;
  transition: background 0.15s, color 0.15s;
}

.view-btn.active {
  background: var(--surface2);
  color: var(--text);
  font-weight: 600;
}

/* ============================================================
   COMPARISON STAGE
   ============================================================ */

.comparison-stage {
  height: 260px; /* fallback before JS sets dynamic height */
  overflow: hidden;
  position: relative;
}

#comparisonSvg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ============================================================
   GUIDANCE
   ============================================================ */

.guidance-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
}

.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 12px;
}

.guidance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.guidance-card {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
}

.guidance-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}

.guidance-card-text {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.calc-note {
  font-size: 0.76rem;
  color: var(--muted);
}

.calc-note summary {
  cursor: pointer;
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.calc-note summary::before {
  content: '›';
  font-size: 1rem;
  transition: transform 0.2s;
  display: inline-block;
}

.calc-note[open] summary::before {
  transform: rotate(90deg);
}

.calc-note p {
  margin-top: 8px;
  line-height: 1.55;
  padding-left: 14px;
}

/* ============================================================
   ACCESSORIES
   ============================================================ */

.accessories-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 8px;
  margin-top: 0;
  margin-bottom: 6px;
}

.accessories-section .section-title {
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 0.78rem;
}

.accessories-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.accessory-phone {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}

.accessory-phone-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.accessory-links {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.accessory-link {
  font-size: 0.76rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
  display: inline-block;
}

.accessory-link:hover {
  color: var(--text);
}

.accessory-link::after {
  content: ' ↗';
  opacity: 0.5;
  font-size: 0.7em;
}

.affiliate-note {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}

/* ============================================================
   DETAILS / SPECS
   ============================================================ */

.details-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1px;
  overflow: hidden;
}

.details-summary {
  cursor: pointer;
  padding: 5px 14px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.details-summary::after {
  content: '▾';
  font-size: 0.75rem;
}

#detailsToggle[open] .details-summary::after {
  content: '▴';
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
  padding: 4px 20px 18px;
}

.detail-col-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-source {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--muted);
  opacity: 0.65;
  text-decoration: none;
  margin-left: 4px;
}

.detail-source:hover {
  opacity: 1;
  text-decoration: underline;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--surface2);
}

.detail-key {
  font-size: 0.73rem;
  color: var(--muted);
  flex-shrink: 0;
}

.detail-val {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
}


/* ============================================================
   CITATION (machine-readable summary for search / LLMs)
   ============================================================ */

.citation-section {
  padding: 10px 4px 6px;
}

/* ============================================================
   POPULAR COMPARISONS
   ============================================================ */

.popular-section {
  padding: 18px 4px 8px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}

.popular-heading {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 10px;
}

.popular-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.popular-list a {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.45);
  text-decoration: none;
}

.popular-list a:hover { color: rgba(255,255,255,0.8); }

.citation-text {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ============================================================
   PICKER DROPDOWN
   ============================================================ */

.picker-dropdown {
  position: fixed;
  z-index: 200;
  background: #181818;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(250px, calc(100vw - 32px));
  max-height: 340px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  animation: ddFadeIn 0.14s ease;
}

.picker-dropdown[hidden] { display: none; }

@keyframes ddFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.picker-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.picker-back-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}

.picker-back-btn:hover { color: var(--text); }

.picker-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 2px 4px;
  margin-left: auto;
  transition: color 0.15s;
}

.picker-close-btn:hover { color: var(--text); }

.picker-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.picker-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.modal-group-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid #1a1a1a;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 12px 16px;
  text-align: left;
  transition: background 0.1s;
}

.modal-group-btn:hover { background: var(--surface2); }

.modal-group-btn::after {
  content: '›';
  font-size: 1.2rem;
  color: var(--muted);
  line-height: 1;
}

.modal-phone-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid #1a1a1a;
  color: var(--text);
  font-size: 0.85rem;
  padding: 11px 16px;
  text-align: left;
  transition: background 0.1s;
}

.modal-phone-btn:hover { background: var(--surface2); }
.modal-phone-btn.selected { color: var(--a); }

.modal-phone-size {
  font-size: 0.76rem;
  color: var(--muted);
  flex-shrink: 0;
  margin-left: 8px;
}

@media (max-width: 360px) {
  .view-btn {
    font-size: 0.72rem;
    padding: 7px 8px;
  }
}

@media (min-width: 480px) {
  html { font-size: 17px; }
  .view-btn { font-size: 0.84rem; padding: 8px 14px; }
  .card-toggle-bar { padding-top: 12px; }
  .selector-btn { max-width: none; padding: 6px 10px; }
}

@media (min-width: 640px) {
  html { font-size: 18px; }
  .view-btn { font-size: 0.88rem; padding: 9px 16px; }
  .card-toggle-bar { padding-top: 16px; }
  .selector-btn { max-width: none; padding: 5px 10px; }
}


/* ============================================================
   KEY DIFFERENCES + FAQ (comparison pages)
   ============================================================ */

.key-diffs-section,
.faq-section {
  max-width: 680px;
  margin: 0 auto 24px;
  padding: 0 16px;
}

.key-diffs-heading,
.faq-heading {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.key-diffs-text {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
}

.faq-list { list-style: none; }

.faq-item {
  border-top: 1px solid var(--border);
  padding: 12px 0;
}

.faq-item:last-child { border-bottom: 1px solid var(--border); }

.faq-q {
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  margin-bottom: 6px;
}

.faq-a {
  font-size: 0.84rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.6;
  margin: 0;
}
