/* ============================================================
   0percetai — Apple-Level Polish
   Designed with Apple's design language in mind.
   Ultra-clean, precise, premium.
   ============================================================ */

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --color-bg: #ffffff;
  --color-bg-secondary: #f8fafc;
  --color-bg-tertiary: #f1f5f9;
  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-text-tertiary: #94a3b8;
  --color-text-quaternary: #cbd5e1;
  --color-accent: #007AFF;
  --color-accent-hover: #0066d6;
  --color-accent-light: rgba(0, 122, 255, 0.06);
  --color-accent-border: rgba(0, 122, 255, 0.12);
  --color-success: #34C759;
  --color-error: #FF3B30;
  --color-border: rgba(0, 0, 0, 0.04);
  --color-border-strong: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.06);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --ease-spring: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  font-feature-settings: 'kern' 1, 'liga' 1;
}

::selection {
  background: rgba(0, 122, 255, 0.12);
  color: var(--color-text-primary);
}

::-moz-selection {
  background: rgba(0, 122, 255, 0.12);
  color: var(--color-text-primary);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--color-text-primary);
  background: var(--color-bg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior: none;
  line-height: 1.5;
  letter-spacing: -0.011em;
}

* {
  -webkit-tap-highlight-color: transparent;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.06); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.12); }

html {
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.06) transparent;
}

/* ============================================================
   FOCUS VISIBLE — Apple HIG accessibility
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.root-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header-title-wrap {
  min-width: 0;
}

.header-title {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.022em;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-subtitle {
  font-size: 0.62rem;
  color: var(--color-text-tertiary);
  line-height: 1.2;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edition-badge {
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--color-text-quaternary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--color-border);
  white-space: nowrap;
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 56px 20px 32px;
  position: relative;
  z-index: 2;
}

/* ============================================================
   HERO — Apple product page style
   ============================================================ */
.hero-section {
  text-align: center;
  margin-bottom: 48px;
}

.hero-title {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.035em;
  color: var(--color-text-primary);
  margin-bottom: 16px;
  padding: 0 8px;
}

.hero-title .accent {
  color: var(--color-accent);
}

.hero-subtitle {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  max-width: 440px;
  margin: 0 auto;
  padding: 0 16px;
  letter-spacing: -0.01em;
}

.hero-br {
  display: none;
}

/* ============================================================
   TOOL SECTION
   ============================================================ */
.tool-section {
  margin-bottom: 0;
}

/* Input panel header */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  gap: 8px;
}

.panel-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Action bar */
.action-bar {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.prefs-toggle {
  font-size: 0.7rem;
  color: var(--color-text-quaternary);
  transition: color 0.3s var(--ease-spring);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border: none;
  background: none;
  font-family: inherit;
  padding: 0;
}

.prefs-toggle:hover {
  color: var(--color-text-tertiary);
}

.prefs-toggle svg.chevron-icon {
  transition: transform 0.4s var(--ease-spring);
}

.prefs-toggle svg.chevron-icon.up {
  transform: rotate(180deg);
}

/* Preferences panel inner layout */
.prefs-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-bottom: 4px;
}

.prefs-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prefs-label {
  font-size: 0.66rem;
  color: var(--color-text-tertiary);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Error message — Apple alert style */
.error-message {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(255, 59, 48, 0.05);
  border: 1px solid rgba(255, 59, 48, 0.1);
  color: var(--color-error);
  font-size: 0.82rem;
  font-weight: 500;
  max-width: 100%;
  text-align: center;
  letter-spacing: -0.01em;
}

/* Output panel */
.output-wrap {
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* How it works */
.how-it-works-section {
  margin-top: 64px;
}

.section-eyebrow {
  text-align: center;
  font-size: 0.7rem;
  color: var(--color-text-quaternary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 32px;
}

.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.step-card-text {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  padding: 0 8px;
  letter-spacing: -0.005em;
}

/* Trust section */
.trust-section {
  margin-top: 64px;
  text-align: center;
}

.trust-divider {
  margin-bottom: 32px;
  max-width: 120px;
  margin-left: auto;
  margin-right: auto;
}

.trust-badges-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 8px;
}

/* Footer — Apple ultra-minimal */
.site-footer {
  margin-top: auto;
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--color-border);
}

.footer-inner {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
}

.footer-text {
  font-size: 0.68rem;
  color: var(--color-text-quaternary);
  letter-spacing: 0.02em;
}

/* ============================================================
   BACKGROUND ATMOSPHERE — Apple refined
   Pure white with the subtlest warm-gray hint
   ============================================================ */
.bg-atmosphere {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70vh;
  background: linear-gradient(
    180deg,
    rgba(248, 250, 252, 0.6) 0%,
    rgba(248, 250, 252, 0.25) 30%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
  will-change: auto;
}

/* ============================================================
   FLOATING ORB — near-invisible Apple-style ambient glow
   ============================================================ */
.bg-orb {
  position: fixed;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(
    ellipse at 40% 40%,
    rgba(0, 122, 255, 0.025) 0%,
    rgba(0, 122, 255, 0.015) 25%,
    rgba(0, 122, 255, 0.005) 45%,
    transparent 65%
  );
  pointer-events: none;
  z-index: 0;
  animation: orb-drift 24s ease-in-out infinite;
  will-change: transform;
  @media (prefers-reduced-motion: reduce) {
    animation: none;
  }
}

@keyframes orb-drift {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  33% { transform: translateX(-48%) translateY(12px); }
  66% { transform: translateX(-52%) translateY(-8px); }
}

/* ---- Grain — ultra-subtle texture ---- */
.bg-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.012;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  @media (prefers-reduced-motion: reduce) {
    display: none;
  }
}

/* ============================================================
   BRAND PILL — Apple icon badge
   ============================================================ */
.brand-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.72rem;
  color: #ffffff;
  background: var(--color-accent);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2), 0 0 0 0.5px rgba(0, 122, 255, 0.08);
  flex-shrink: 0;
  letter-spacing: -0.03em;
  transition: transform 0.4s var(--ease-spring), box-shadow 0.4s var(--ease-spring);
  will-change: transform;
}

.brand-pill:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.25), 0 0 0 0.5px rgba(0, 122, 255, 0.12);
}

/* ============================================================
   GRADIENT DIVIDER — Apple-style hairline
   ============================================================ */
.gradient-divider {
  height: 0.5px;
  background: linear-gradient(90deg, transparent, rgba(0, 122, 255, 0.1), transparent);
  border: none;
}

/* ============================================================
   CARD / PANEL SYSTEM — iOS frosted glass
   ============================================================ */
.glass-panel {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-xl);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.7) inset,
    var(--shadow-sm),
    var(--shadow-md);
  transition: box-shadow 0.4s var(--ease-spring), border-color 0.4s var(--ease-spring);
  contain: layout style;
}

@supports not (backdrop-filter: blur(1px)) {
  .glass-panel {
    background: rgba(255, 255, 255, 0.95);
    box-shadow:
      0 0 0 0.5px rgba(255, 255, 255, 0.5) inset,
      var(--shadow-sm),
      var(--shadow-md);
  }
}

.glass-panel:hover {
  border-color: rgba(0, 0, 0, 0.07);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.7) inset,
    var(--shadow-sm),
    var(--shadow-lg);
}

.glass-panel:focus-within {
  border-color: var(--color-accent-border);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.7) inset,
    var(--shadow-sm),
    var(--shadow-md),
    0 0 0 3px rgba(0, 122, 255, 0.06);
}

/* ============================================================
   TEXTAREA — Apple editor
   ============================================================ */
.editor-area {
  width: 100%;
  min-height: 200px;
  padding: 18px 20px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.75;
  color: var(--color-text-primary);
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  caret-color: var(--color-accent);
  letter-spacing: -0.011em;
}

.editor-area::placeholder {
  color: rgba(148, 163, 184, 0.45);
  letter-spacing: -0.008em;
}

/* ============================================================
   OUTPUT AREA
   ============================================================ */
.output-area {
  min-height: 200px;
  padding: 18px 20px;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.8;
  color: var(--color-text-primary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-overflow-scrolling: touch;
  letter-spacing: -0.011em;
}

.output-area .placeholder {
  color: rgba(148, 163, 184, 0.35);
  font-style: normal;
  font-weight: 400;
}

/* ============================================================
   PRIMARY CTA BUTTON — Apple primary action
   ============================================================ */
.btn-refine {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 44px;
  min-height: 48px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #ffffff;
  background: var(--color-accent);
  box-shadow:
    0 0.5px 1px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 122, 255, 0.18);
  cursor: pointer;
  transition: all 0.35s var(--ease-spring);
  position: relative;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  will-change: transform;
}

.btn-refine::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 50%);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.35s var(--ease-spring);
}

.btn-refine:hover:not(:disabled)::before {
  opacity: 1;
}

.btn-refine:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--color-accent-hover);
  box-shadow:
    0 0.5px 1px rgba(0, 0, 0, 0.06),
    0 4px 16px rgba(0, 122, 255, 0.24);
}

.btn-refine:active:not(:disabled) {
  transform: translateY(0px) scale(0.98);
  background: #0055b3;
  box-shadow:
    0 0.5px 1px rgba(0, 0, 0, 0.04);
  transition-duration: 0.12s;
}

.btn-refine:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
  background: var(--color-text-tertiary);
  transform: none;
}

/* ============================================================
   SPINNER — Apple activity dots
   ============================================================ */
.spinner-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.spinner-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  animation: dot-bounce 1.4s var(--ease-spring) infinite;
  will-change: transform, opacity;
}

.spinner-dots span:nth-child(2) { animation-delay: 0.16s; }
.spinner-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.5); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* ============================================================
   GHOST BUTTON — Apple secondary action
   ============================================================ */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  min-height: 36px;
  border: 0.5px solid var(--color-border-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--color-text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  -webkit-user-select: none;
  user-select: none;
  letter-spacing: -0.006em;
}

.btn-ghost:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  border-color: rgba(0, 0, 0, 0.12);
}

.btn-ghost:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

.btn-ghost.small {
  font-size: 0.7rem;
}

/* ============================================================
   COUNTER BADGE — SF Mono style
   ============================================================ */
.counter-badge {
  font-family: "SF Mono", "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 0.66rem;
  color: var(--color-text-tertiary);
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.02);
  white-space: nowrap;
  flex-shrink: 0;
}

.counter-badge.hidden-xs {
  display: none;
}

/* ============================================================
   ANIMATIONS — Apple spring motion
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s var(--ease-spring) forwards;
  will-change: transform, opacity;
}

.animate-fade-in {
  animation: fadeIn 0.5s var(--ease-smooth) forwards;
}

.animate-delay-100 { animation-delay: 80ms; }
.animate-delay-200 { animation-delay: 160ms; }
.animate-delay-300 { animation-delay: 280ms; }
.animate-delay-400 { animation-delay: 400ms; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .animate-fade-in-up,
  .animate-fade-in {
    animation: none;
    opacity: 1 !important;
  }
  .bg-orb {
    animation: none;
  }
  .btn-refine:hover:not(:disabled) {
    transform: none;
  }
  .brand-pill:hover {
    transform: none;
  }
  .glass-panel {
    transition: none;
  }
  .btn-refine {
    transition: none;
  }
  .prefs-toggle svg.chevron-icon {
    transition: none;
  }
  .prefs-toggle {
    transition: none;
  }
  .btn-ghost {
    transition: none;
  }
}

/* ============================================================
   SUCCESS INDICATOR — Apple confirmation style
   ============================================================ */
.success-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 100px;
  background: rgba(52, 199, 89, 0.06);
  border: 0.5px solid rgba(52, 199, 89, 0.12);
  color: var(--color-success);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  animation: scaleIn 0.4s var(--ease-spring-bounce) forwards;
}

.success-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulse-dot 2.5s var(--ease-spring) infinite;
  will-change: transform, opacity;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* ============================================================
   HOW IT WORKS — STEP CARDS — Apple feature cards
   ============================================================ */
.step-card {
  text-align: center;
  padding: 28px 16px;
  transition: background 0.3s var(--ease-spring);
}

.step-card + .step-card {
  border-top: 0.5px solid var(--color-border);
}

@media (min-width: 640px) {
  .step-card + .step-card {
    border-top: none;
  }
  .step-card:not(:last-child) {
    border-right: 0.5px solid var(--color-border);
  }
  .step-card {
    padding: 32px 20px;
  }
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--color-accent);
  background: var(--color-accent-light);
  border: 0.5px solid var(--color-accent-border);
  margin-bottom: 16px;
}

/* ============================================================
   PREFERENCES PANEL — Apple Settings style
   ============================================================ */
.preferences-panel {
  overflow: hidden;
  transition: max-height 0.45s var(--ease-spring), opacity 0.35s var(--ease-spring), margin 0.35s var(--ease-spring);
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.preferences-panel.open {
  max-height: 200px;
  opacity: 1;
  margin-top: 16px;
}

/* ---- Intensity Toggle — iOS segmented control ---- */
.intensity-group {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.03);
  border: 0.5px solid var(--color-border-strong);
  border-radius: 10px;
  overflow: hidden;
}

.intensity-btn {
  padding: 8px 16px;
  min-height: 36px;
  border: none;
  background: transparent;
  color: var(--color-text-tertiary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  -webkit-user-select: none;
  user-select: none;
  letter-spacing: -0.006em;
}

.intensity-btn:first-child { border-radius: 9px 0 0 9px; }
.intensity-btn:last-child { border-radius: 0 9px 9px 0; }

.intensity-btn.active {
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 122, 255, 0.2);
}

.intensity-btn:hover:not(.active) {
  color: var(--color-text-secondary);
  background: rgba(0, 0, 0, 0.02);
}

.intensity-btn:active {
  transform: scale(0.95);
  transition-duration: 0.1s;
}

/* ============================================================
   SECTION DIVIDER — Apple hairline
   ============================================================ */
.section-border {
  border-top: 0.5px solid var(--color-border);
}

/* ============================================================
   TRUST BADGE — Apple feature pills
   ============================================================ */
.trust-badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-text-tertiary);
  padding: 6px 14px;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.015);
  border: 0.5px solid var(--color-border);
  letter-spacing: 0.005em;
  transition: all 0.3s var(--ease-spring);
  white-space: nowrap;
}

.trust-badge:hover {
  background: var(--color-accent-light);
  border-color: var(--color-accent-border);
  color: var(--color-accent);
}

/* ============================================================
   HEADER BLUR — iOS navigation bar
   ============================================================ */
.header-blur {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.06);
}

@supports not (backdrop-filter: blur(1px)) {
  .header-blur {
    background: rgba(255, 255, 255, 0.96);
  }
}

/* ============================================================
   ICON BUTTON — Apple toolbar button
   ============================================================ */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  border: none;
  background: transparent;
  color: var(--color-text-quaternary);
  -webkit-user-select: none;
  user-select: none;
}

.icon-btn:hover {
  color: var(--color-text-secondary);
  background: rgba(0, 0, 0, 0.03);
}

.icon-btn:active {
  transform: scale(0.92);
  transition-duration: 0.1s;
}

/* ============================================================
   POST-OUTPUT REVIEW REMINDER — iOS notification style
   ============================================================ */
.review-reminder {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: rgba(0, 122, 255, 0.04);
  border: 0.5px solid rgba(0, 122, 255, 0.08);
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  line-height: 1.55;
  letter-spacing: -0.008em;
  margin-top: 16px;
  animation: fadeInUp 0.5s var(--ease-spring) forwards;
}

.review-reminder-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--color-accent);
  opacity: 0.7;
}

.review-reminder-icon svg {
  width: 100%;
  height: 100%;
}

/* ============================================================
   POST-OUTPUT REVIEW TIPS — Apple checklist
   ============================================================ */
.review-tips {
  padding: 0;
  margin: 12px 0 0 30px;
  list-style: none;
}

.review-tips li {
  position: relative;
  padding: 3px 0;
  font-size: 0.74rem;
  color: var(--color-text-tertiary);
  line-height: 1.5;
  letter-spacing: -0.006em;
}

.review-tips li::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-text-quaternary);
}

/* ============================================================
   DISCLAIMER SECTION — Apple legal text
   ============================================================ */
.disclaimer-section {
  margin-top: 40px;
  padding: 0 8px;
  text-align: center;
}

.disclaimer-text {
  font-size: 0.65rem;
  color: var(--color-text-quaternary);
  line-height: 1.6;
  letter-spacing: 0.005em;
  max-width: 480px;
  margin: 0 auto;
}

.disclaimer-text + .disclaimer-text {
  margin-top: 6px;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS — Mobile-first, Apple HIG
   ============================================================ */

/* --- Very small phones (320px) --- */
@media (max-width: 374px) {
  .editor-area,
  .output-area {
    min-height: 160px;
    padding: 14px 16px;
  }

  .btn-refine {
    padding: 12px 20px;
    font-size: 0.88rem;
  }

  .step-card {
    padding: 20px 12px;
  }

  .trust-badge {
    font-size: 0.62rem;
    padding: 5px 10px;
  }

  .review-reminder {
    padding: 12px 14px;
    font-size: 0.76rem;
  }

  .disclaimer-text {
    font-size: 0.62rem;
  }
}

/* --- Small phones (375px-479px) --- */
@media (min-width: 375px) and (max-width: 479px) {
  .editor-area,
  .output-area {
    min-height: 180px;
    padding: 16px 18px;
  }
}

/* --- Standard mobile (480px-639px) --- */
@media (min-width: 480px) and (max-width: 639px) {
  .editor-area,
  .output-area {
    min-height: 200px;
  }
}

/* --- Phone landscape --- */
@media (max-width: 767px) and (orientation: landscape) {
  .editor-area,
  .output-area {
    min-height: 140px;
    max-height: 200px;
  }

  .preferences-panel.open {
    max-height: 120px;
  }
}

/* --- Tablet --- */
@media (min-width: 768px) and (max-width: 1023px) {
  .editor-area,
  .output-area {
    min-height: 220px;
  }
}

/* --- Desktop --- */
@media (min-width: 1024px) {
  .editor-area,
  .output-area {
    min-height: 260px;
  }
}

/* ---- sm (640px+) ---- */
@media (min-width: 640px) {
  .header-inner {
    padding: 14px 24px;
  }

  .edition-badge {
    display: inline-block;
  }

  .main-content {
    padding: 96px 24px 48px;
  }

  .hero-section {
    margin-bottom: 80px;
  }

  .hero-title {
    font-size: 2.2rem;
    letter-spacing: -0.04em;
    margin-bottom: 20px;
    padding: 0 8px;
  }

  .hero-br {
    display: block;
  }

  .hero-subtitle {
    font-size: 0.95rem;
    max-width: 460px;
    padding: 0;
  }

  .action-bar {
    padding: 20px 24px;
    gap: 14px;
  }

  .panel-header {
    padding: 12px 24px;
  }

  .btn-refine {
    width: auto;
  }

  .steps-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .how-it-works-section {
    margin-top: 112px;
  }

  .section-eyebrow {
    margin-bottom: 40px;
  }

  .trust-section {
    margin-top: 112px;
  }

  .trust-divider {
    margin-bottom: 40px;
  }

  .trust-badges-wrap {
    gap: 10px;
  }

  .footer-inner {
    padding: 24px;
  }

  .counter-badge.hidden-xs {
    display: inline;
  }

  .prefs-inner {
    flex-direction: row;
    gap: 20px;
  }

  .review-reminder {
    padding: 16px 20px;
    font-size: 0.82rem;
  }

  .disclaimer-section {
    margin-top: 48px;
  }
}
