/* ============================================================
   MRJ3.0 — Mr. Jealousy Interior Intelligence Tool
   Design System & Page Styles
   ============================================================ */

/* ── FONTS ─────────────────────────────────────────────────── */

@font-face {
  font-family: 'MrGintoNord';
  src: url('fonts/MrGintoNord-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MrGintoNord';
  src: url('fonts/MrGintoNord-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MrGintoNord';
  src: url('fonts/MrGintoNord-Ultra.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Poppins';
  src: url('fonts/font-poppins-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Poppins';
  src: url('fonts/font-poppins-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Poppins';
  src: url('fonts/font-poppins-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ── DESIGN TOKENS ─────────────────────────────────────────── */

:root {
  --bg:            #F1D4D0;
  --bg-card:       #FFFFFF;
  --text-dark:     #111111;
  --text-mid:      #3D3D3D;
  --text-muted:    #6B6B6B;
  --accent:        #111111;
  --pink-light:    #F5F5F5;
  --pink-border:   #E5E5E5;
  --pink-bubble:   #E8D0CD;
  --overlay:       rgba(0, 0, 0, 0.45);

  --radius-card:   16px;
  --radius-btn:    999px;
  --radius-input:  12px;

  --shadow-card:   0 2px 16px rgba(0,0,0,0.08);
  --shadow-btn:    0 2px 8px rgba(2, 2, 2, 0.12);

  --font-heading:  'MrGintoNord', serif;
  --font-body:     'Poppins', sans-serif;
}

/* ── RESET & BASE ───────────────────────────────────────────── */

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

button {
  cursor: pointer;
  font-family: var(--font-body);
  border: none;
  background: none;
}

img {
  display: block;
  max-width: 100%;
}

/* ── LAYOUT ─────────────────────────────────────────────────── */

.app {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  overflow: hidden;
}

/* Each page is a full-screen section */
.page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  overflow: hidden;
}

.page.active {
  opacity: 1;
  pointer-events: all;
}

/* Top bar shared across pages */
.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 20px 24px 0;
  flex-shrink: 0;
}

.btn-close {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dark);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
}

.btn-close svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-dark);
  stroke-width: 2;
}

/* ── SPEECH BUBBLE AVATAR ───────────────────────────────────── */

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-mj {
  background: transparent;
}

.avatar-mj img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.avatar-dots {
  background: var(--pink-bubble);
}

.avatar-dots span {
  display: flex;
  gap: 3px;
  align-items: center;
}

.avatar-dots span i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dark);
  display: block;
}

.chat-line {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dark);
}

.chat-sequence {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dark);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.chat-msg.visible {
  opacity: 1;
  transform: none;
}

/* ── LOADING CAROUSEL ───────────────────────────────────────── */

.chat-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-text-carousel {
  position: relative;
  height: 1.5em;
  overflow: hidden;
  flex: 1;
}

.carousel-item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dark);
  transform: translateY(110%);
  opacity: 0;
  transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 1.2s ease;
}

.carousel-item.active {
  transform: translateY(0);
  opacity: 1;
}

.carousel-item.leaving {
  transform: translateY(-110%);
  opacity: 0;
  transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.8s ease;
}

/* ── PAGE 1: LANDING ────────────────────────────────────────── */

#page-landing {
  justify-content: flex-start;
}

.landing-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 40px 40px;
  width: 100%;
  max-width: 640px;
  align-self: center;
}

.landing-content .avatar-mj {
  margin-bottom: 24px;
}

.landing-headline {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.05;
  color: var(--text-dark);
  margin-bottom: 32px;
  letter-spacing: -0.01em;
}

.upload-card {
  background: var(--bg-card);
  border: 2px dashed var(--pink-border);
  border-radius: var(--radius-card);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.upload-card:hover,
.upload-card.drag-over {
  border-color: var(--accent);
  background: var(--pink-light);
}

.upload-card input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
  line-height: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.upload-icon img {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin: 0 auto;
}

.upload-primary {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.upload-primary strong {
  font-weight: 700;
}

.upload-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

.landing-disclaimer {
  margin-top: 32px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
}

/* ── PAGE 2: LOADING (ALTERNATIVE) ─────────────────────────── */

#page-loading {
  justify-content: flex-start;
  align-items: center;
}

#page-loading .topbar {
  width: 100%;
  flex-shrink: 0;
}

#page-loading .loading-inner-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.loading-inner {
  width: 100%;
  max-width: 600px;
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.progress-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 24px 28px;
  box-shadow: var(--shadow-card);
}

.progress-track {
  height: 8px;
  background: #E8D0CD;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  width: 0%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-disclaimer {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── PAGE 3: RESULT ─────────────────────────────────────────── */

#page-result {
  flex-direction: column;
  overflow: hidden;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  padding: 14px 24px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

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

.result-header-title {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.avatar-mj--white {
  background: white;
  padding: 6px;
}

.result-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
  padding: 16px;
  gap: 16px;
}

/* Left panel: before/after */
.result-left {
  flex: 1;
  position: relative;
  background: #FFFFFF;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.before-after-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: col-resize;
  -webkit-user-select: none;
  user-select: none;
}

.ba-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  background: #FFFFFF;
}

.ba-before {
  z-index: 1;
}

.ba-after {
  z-index: 2;
  clip-path: inset(0 50% 0 0);
}

.ba-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: white;
  z-index: 3;
  transform: translateX(-50%);
}

.ba-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.ba-handle svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-dark);
  stroke-width: 2;
}

/* Before / After labels */
.ba-label {
  position: absolute;
  bottom: 14px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  color: var(--text-dark);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.ba-label--before {
  left: 14px;
}

.ba-label--after {
  right: 14px;
}

/* Windofy watermark — rechtsboven op het visualisatieresultaat */
.ba-watermark {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 80px;
  height: auto;
  z-index: 6;
  opacity: 0.70;
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.25));
}

.result-actions {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.45);
}

.btn-outline {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1.5px solid var(--text-dark);
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  background: transparent;
  transition: background 0.18s, color 0.18s;
}

.btn-outline:hover {
  background: var(--text-dark);
  color: white;
}

/* Right panel: config */
.result-right {
  width: 420px;
  flex-shrink: 0;
  background: #FFFFFF;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.result-right::-webkit-scrollbar {
  width: 4px;
}

.result-right::-webkit-scrollbar-track {
  background: transparent;
}

.result-right::-webkit-scrollbar-thumb {
  background: var(--pink-border);
  border-radius: 999px;
}

.result-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
  flex-shrink: 0;
}

.config-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Section dividers */
.config-section {
  padding: 18px 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.config-section:last-child {
  border-bottom: none;
}

.config-section--no-border  { border-bottom: none; }
.config-section--cta-top    { border-bottom: none; padding-top: 4px; padding-bottom: 4px; }
.config-section--cta-bottom { border-bottom: none; padding-top: 4px; }

.color-cta-links--spaced { margin-top: 14px; }

.section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Selected color hero */
.color-hero {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  aspect-ratio: 16 / 7;
  background: #000000;
  margin-bottom: 10px;
}

.color-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
}

/* Full-product JPEG photos: zoom in and anchor to the left tip of the slats.
   Slats run right→left; the left tip sits at ~28% from the image edge.
   Scale up to crop out the black background on both sides. */
.color-hero img.hero-img--product {
  object-fit: cover;
  object-position: 28% center;
  transform: scale(1.65);
  transform-origin: 28% center;
}

.color-hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 14px;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.color-hero-name {
  color: white;
  font-size: 15px;
  font-weight: 700;
}

.color-hero-material {
  color: rgba(255,255,255,0.8);
  font-size: 12px;
  font-weight: 400;
}

.btn-kleuren {
  display: flex;
  align-items: center;
  gap: 4px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn-kleuren svg {
  width: 14px;
  height: 14px;
  stroke: white;
  stroke-width: 2.5;
}

.color-cta-links {
  display: flex;
  gap: 20px;
  margin-top: 4px;
}

.color-cta-links a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dark);
  text-decoration: underline;
}

/* Suggestion cards — 2×2 grid of square product-photo tiles */
.suggestion-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.suggestion-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1.5px solid var(--pink-border);
  border-radius: var(--radius-input);
  cursor: pointer;
  transition: border-color 0.18s;
  background: var(--bg-card);
  overflow: hidden;
}

.suggestion-card:hover {
  border-color: var(--text-dark);
}

.suggestion-card.selected {
  border-color: var(--text-dark);
}

.suggestion-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 0;
  flex-shrink: 0;
  background: var(--pink-light);
  display: block;
}

.suggestion-info {
  padding: 8px 10px 10px;
  min-width: 0;
}

.suggestion-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-material {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.suggestion-chevron {
  display: none;
}

/* Primary action button */
.btn-primary {
  width: 100%;
  padding: 15px 24px;
  background: var(--text-dark);
  color: white;
  border-radius: var(--radius-btn);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.18s, transform 0.1s;
  margin: 4px 0;
}

.btn-primary:hover {
  opacity: 0.88;
}

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

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── RADIO GROUPS ───────────────────────────────────────────── */

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.radio-group.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 0;
}

/* Ensure dot + label sit at the same baseline across all grid-2 groups */
.radio-group.grid-2 .radio-item {
  padding: 5px 0;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 0;
}

.radio-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #C0B8B6;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
  background: white;
}

.radio-dot::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dark);
  opacity: 0;
  transition: opacity 0.15s;
}

.radio-item.selected .radio-dot {
  border-color: var(--text-dark);
}

.radio-item.selected .radio-dot::after {
  opacity: 1;
}

.radio-label {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-dark);
}

.radio-icon-svg {
  width: 36px;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Info icon */
.info-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #BBBBBB;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #888;
  cursor: default;
  flex-shrink: 0;
  line-height: 1;
  font-style: italic;
  font-family: Georgia, serif;
  font-weight: 700;
}

/* Technical check data */
.tech-check-table {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: 13px;
}

.tech-check-table dt {
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
}

.tech-check-table dd {
  color: var(--text-dark);
  font-weight: 500;
}

/* Special considerations */
.special-text {
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.65;
}

/* Style description block */
.style-description {
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.75;
  padding-top: 4px;
}

/* ── COLOR FLYOUT ────────────────────────────────────────────── */

.flyout-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.flyout-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.flyout-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  background: var(--bg-card);
  z-index: 101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
}

.flyout-overlay.open .flyout-panel {
  transform: translateX(0);
}

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

.flyout-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.flyout-material-toggle {
  display: flex;
  gap: 0;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  flex-shrink: 0;
}

.flyout-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-content: start;
}

.flyout-list::-webkit-scrollbar {
  width: 4px;
}

.flyout-list::-webkit-scrollbar-thumb {
  background: var(--pink-border);
  border-radius: 999px;
}

.flyout-item {
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: var(--radius-input);
  cursor: pointer;
  transition: border-color 0.15s;
  border: 1.5px solid var(--pink-border);
  overflow: hidden;
}

.flyout-item:hover {
  border-color: var(--text-dark);
}

.flyout-item.selected {
  border-color: var(--text-dark);
  box-shadow: 0 0 0 1px var(--text-dark);
}

.flyout-thumb-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  overflow: hidden;
  background: var(--pink-light);
  flex-shrink: 0;
}

.flyout-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.flyout-info {
  padding: 8px 10px 10px;
  min-width: 0;
}

.flyout-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flyout-material {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Material toggle — segmented pill, strict separation */
.mat-toggle {
  display: flex;
  gap: 0;
  width: 100%;
  background: var(--pink-light);
  border: 1px solid var(--pink-border);
  border-radius: 999px;
  padding: 4px;
  position: relative;
}

.mat-toggle .radio-item {
  flex: 1;
  justify-content: center;
  gap: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  position: relative;
}

.mat-toggle .radio-dot {
  display: none;
}

.mat-toggle .radio-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.mat-toggle .radio-item.selected {
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.mat-toggle .radio-item.selected .radio-label {
  color: var(--text-dark);
}

.mat-toggle .radio-item + .radio-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 1px;
  background: var(--pink-border);
  opacity: 1;
  transition: opacity 0.15s;
}

.mat-toggle .radio-item.selected + .radio-item::before,
.mat-toggle .radio-item:has(+ .radio-item.selected)::before,
.mat-toggle .radio-item.selected::before {
  opacity: 0;
}

/* ── ERROR STATE ─────────────────────────────────────────────── */

.error-banner {
  display: none;
  background: #FFF0F0;
  border: 1px solid #FFBBBB;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 0 20px 16px;
  font-size: 13px;
  color: #991111;
  line-height: 1.55;
}

.error-banner.visible {
  display: block;
}

/* ── UTILITY ─────────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

.spin {
  animation: spin 1s linear infinite;
}

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

/* ── RENDER LOADER ─────────────────────────────────────────────── */

.render-loader {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 50;
  border-radius: var(--radius-card);
}

/* White circular card holding the animation */
.mrjl-card {
  position: relative;
  width: 160px;
  height: 160px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

/* ── Phase layers ── */
.mrjl-logo,
.mrjl-spin {
  position: absolute;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.mrjl-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

#mrjl-heart,
#mrjl-bubble {
  transform-box: fill-box;
  transform-origin: center;
}

/* ── KEYFRAMES ── */

/* Logo enter */
@keyframes mrjl-heart-in {
  from { opacity: 0; transform: scale(0.5) rotate(-90deg); }
  to   { opacity: 1; transform: scale(1)   rotate(0deg);   }
}
@keyframes mrjl-bubble-in {
  from { opacity: 0; transform: scale(0.5) rotate(90deg); }
  to   { opacity: 1; transform: scale(1)   rotate(0deg);  }
}

/* Logo intertwine (heart) */
@keyframes mrjl-heart-twine {
  0%   { transform: translate(0,    0)    scale(1)    rotate(0deg);   }
  25%  { transform: translate(12px,-10px) scale(1.25) rotate(180deg); }
  50%  { transform: translate(-15px,12px) scale(0.9)  rotate(360deg); }
  75%  { transform: translate(8px, -8px)  scale(1.15) rotate(540deg); }
  100% { transform: translate(0,    0)    scale(1)    rotate(720deg); }
}

/* Logo intertwine (bubble) */
@keyframes mrjl-bubble-twine {
  0%   { transform: translate(0,    0)     scale(1)    rotate(0deg);    opacity: 1;   }
  25%  { transform: translate(-18px,12px)  scale(0.75) rotate(-180deg); opacity: 0.6; }
  50%  { transform: translate(20px,-18px)  scale(1.1)  rotate(-360deg); opacity: 0.6; }
  75%  { transform: translate(-10px,12px)  scale(0.85) rotate(-540deg); opacity: 0.6; }
  100% { transform: translate(0,    0)     scale(1)    rotate(-720deg); opacity: 1;   }
}

/* Logo exit */
@keyframes mrjl-logo-out {
  from { opacity: 1; transform: scale(1)   rotate(0deg);   }
  to   { opacity: 0; transform: scale(0.5) rotate(180deg); }
}

/* Spinner entrance (spring feel) */
@keyframes mrjl-spin-in {
  0%   { opacity: 0; transform: scale(0)    rotate(-180deg); }
  55%  { opacity: 1; transform: scale(1.18) rotate(12deg);   }
  75%  { opacity: 1; transform: scale(0.92) rotate(-6deg);   }
  100% { opacity: 1; transform: scale(1)    rotate(0deg);    }
}

/* Spinner bounce + rotate loop */
@keyframes mrjl-bounce {
  0%   { transform: translateY(-15px) rotate(0deg);   }
  50%  { transform: translateY(15px)  rotate(360deg); }
  100% { transform: translateY(-15px) rotate(720deg); }
}

/* Dot scale pulse */
@keyframes mrjl-dot-pulse {
  0%, 100% { transform: scale(1);   }
  50%       { transform: scale(0.4); }
}

/* Square morph */
@keyframes mrjl-sq-morph {
  0%, 100% { border-radius: 0%;  transform: rotate(-45deg) scale(1);   }
  50%       { border-radius: 50%; transform: rotate(-45deg) scale(0.5); }
}

/* Shadow pulse */
@keyframes mrjl-shadow {
  0%, 100% { transform: scaleX(1.2); opacity: 0.5; }
  50%       { transform: scaleX(0.6); opacity: 0.15; }
}

/* ── PHASE STATES ── */

/* Logo — hidden by default */
.mrjl-logo { opacity: 0; }

/* Logo enter */
.mrjl-logo.is-enter #mrjl-heart {
  animation: mrjl-heart-in 0.8s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.mrjl-logo.is-enter #mrjl-bubble {
  animation: mrjl-bubble-in 0.8s cubic-bezier(0.34,1.56,0.64,1) 0.1s forwards;
}
.mrjl-logo.is-enter {
  opacity: 1;
}

/* Logo intertwine */
.mrjl-logo.is-twine {
  opacity: 1;
}
.mrjl-logo.is-twine #mrjl-heart {
  animation: mrjl-heart-twine 1.5s cubic-bezier(0.45,0,0.55,1) forwards;
}
.mrjl-logo.is-twine #mrjl-bubble {
  animation: mrjl-bubble-twine 1.5s cubic-bezier(0.45,0,0.55,1) forwards;
}

/* Logo exit */
.mrjl-logo.is-exit {
  animation: mrjl-logo-out 0.7s cubic-bezier(0.55,0,1,0.45) forwards;
}

/* Spinner — hidden by default */
.mrjl-spin { opacity: 0; pointer-events: none; }

/* Spinner entrance */
.mrjl-spin.is-enter {
  animation: mrjl-spin-in 0.65s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

/* Spinner active (bounce loop) */
.mrjl-spin.is-active {
  opacity: 1;
}

/* Dots layout */
.mrjl-dots {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mrjl-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #E03E52;
  border-radius: 50%;
  animation: mrjl-dot-pulse 2.88s cubic-bezier(0.75,0,0.5,1) infinite;
}
.mrjl-tl { top: 0;    left: 0;  animation-delay: 0.576s; }
.mrjl-tr { top: 0;    right: 0; animation-delay: 0.288s; }

.mrjl-sq {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) rotate(-45deg);
  width: 14px;
  height: 14px;
  background: #E03E52;
  animation: mrjl-sq-morph 2.88s cubic-bezier(0.75,0,0.5,1) infinite;
}

.mrjl-bounce {
  animation: mrjl-bounce 2.88s cubic-bezier(0.75,0,0.5,1) infinite;
}

.mrjl-shadow {
  width: 40px;
  height: 8px;
  background: rgba(0,0,0,0.2);
  border-radius: 50%;
  filter: blur(3px);
  margin-top: 8px;
  animation: mrjl-shadow 2.88s cubic-bezier(0.75,0,0.5,1) infinite;
}

/* ── RESPONSIVE — TABLET (769px–1199px) ─────────────────────── */

@media (min-width: 769px) and (max-width: 1199px) {
  .result-right {
    width: 340px;
  }

  .landing-content {
    padding: 24px 32px 40px;
  }
}

/* ── RESPONSIVE — LARGE SCREEN (≥1200px) ────────────────────── */

@media (min-width: 1200px) {
  .landing-content {
    max-width: 720px;
    padding: 32px 48px 48px;
  }

  .landing-headline {
    font-size: 3.75rem;
    margin-bottom: 40px;
  }

  .loading-inner {
    max-width: 680px;
  }

  .result-right {
    width: 460px;
  }

  .flyout-panel {
    width: 420px;
  }
}

/* ── RESPONSIVE — MOBILE ─────────────────────────────────────── */

@media (max-width: 768px) {
  html, body {
    overflow: hidden; /* Zelfde als desktop — pages scrollen intern */
  }

  /* WORTELFIX: alle pages als overlay (zelfde als desktop) */
  .page {
    position: fixed;
    inset: 0;
    min-height: unset;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Landing */
  .landing-content {
    padding: 16px 20px 32px;
  }

  .landing-headline {
    font-size: clamp(1.9rem, 9vw, 2.6rem);
  }

  .upload-card {
    padding: 36px 20px;
  }

  /* Loading — fixed overlay: altijd volledig viewport, ook in portrait mode */
  #page-loading {
    position: fixed;
    inset: 0;
    min-height: unset;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    z-index: 5;
  }

  #page-loading .topbar {
    position: static;
    width: 100%;
    flex-shrink: 0;
    padding: 20px 20px 0;
  }

  #page-loading .loading-inner-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  #page-loading .loading-inner {
    width: 100%;
    padding: 0 20px;
    gap: 20px;
  }


  /* Result: scrollt intern, layout gestapeld op mobiel */
  #page-result {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .result-body {
    flex-direction: column;
    overflow: visible;
  }

  .result-left {
    flex: none;
    height: 56vw;
    min-height: 220px;
  }

  .result-right {
    width: 100%;
    border-left: none;
    border-top: 1px solid rgba(0,0,0,0.06);
    overflow-y: visible;
  }

  /* Flyout becomes bottom sheet on mobile */
  .flyout-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }

  .flyout-overlay.open .flyout-panel {
    transform: translateY(0);
  }
}
