/* ============================================
   KALEI DESIGN SYSTEM
   Extracted from soft-elegance-final.svg
   ============================================ */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
  /* Backgrounds */
  --void: #050508;
  --kalei-navy: #0A0E1A;
  --deep-glass: #121628;
  --twilight: #1C2240;

  /* Jewel Tones */
  --amethyst: #8B5CF6;
  --amethyst-light: #A78BFA;
  --amethyst-dark: #6D28D9;
  --sapphire: #3B82F6;
  --sapphire-light: #60A5FA;
  --sapphire-dark: #1D4ED8;
  --emerald: #10B981;
  --emerald-light: #34D399;
  --emerald-dark: #047857;
  --ruby: #EF4444;
  --amber: #F59E0B;
  --amber-light: #FCD34D;
  --amber-dark: #B45309;
  --rose: #EC4899;
  --rose-light: #F9A8D4;
  --indigo: #6366F1;
  --indigo-light: #818CF8;

  /* Text */
  --pure-light: #FFFFFF;
  --soft-light: #E2E8F0;
  --dim-light: #94A3B8;
  --faint-light: #475569;

  /* Prismatic Gradient */
  --prismatic: linear-gradient(135deg, #8B5CF6, #3B82F6, #10B981, #F59E0B, #EC4899);
  --prismatic-subtle: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(59,130,246,0.15), rgba(16,185,129,0.15), rgba(245,158,11,0.15), rgba(236,72,153,0.15));

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Shadows (glow-based, not drop-shadow) */
  --glow-amethyst: 0 0 20px rgba(139, 92, 246, 0.3);
  --glow-sapphire: 0 0 20px rgba(59, 130, 246, 0.3);
  --glow-emerald: 0 0 20px rgba(16, 185, 129, 0.3);
  --glow-amber: 0 0 20px rgba(245, 158, 11, 0.3);
  --glow-rose: 0 0 20px rgba(236, 72, 153, 0.3);
  --glow-white: 0 0 16px rgba(255, 255, 255, 0.15);

  /* Device frame */
  --device-width: 390px;
  --device-height: 844px;
  --status-bar-height: 54px;
  --tab-bar-height: 83px;
  --nav-header-height: 56px;
}

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

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

body {
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: var(--font-primary);
  color: var(--pure-light);
  -webkit-font-smoothing: antialiased;
}

/* --- Device Frame --- */
.device-frame {
  width: var(--device-width);
  height: var(--device-height);
  background: var(--void);
  border-radius: 44px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.06), 0 20px 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}

/* --- Status Bar --- */
.status-bar {
  height: var(--status-bar-height);
  padding: 14px 28px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: transparent;
  position: relative;
  z-index: 10;
}
.status-bar .time {
  font-size: 15px;
  font-weight: 600;
  color: var(--pure-light);
}
.status-bar .icons {
  display: flex;
  gap: 6px;
  align-items: center;
}
.status-bar .icons svg { width: 16px; height: 16px; }

/* --- Navigation Header --- */
.nav-header {
  height: var(--nav-header-height);
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.nav-header .nav-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--pure-light);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.nav-header .nav-back {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--amethyst-light);
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
}
.nav-header .nav-back svg {
  width: 20px;
  height: 20px;
}
.nav-header .nav-action {
  color: var(--dim-light);
  cursor: pointer;
}

/* --- Screen Content Area --- */
.screen-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-4);
  position: relative;
}
.screen-content::-webkit-scrollbar { display: none; }
.screen-content.no-pad { padding: 0; }
.screen-content.centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* --- Tab Bar --- */
.tab-bar {
  height: var(--tab-bar-height);
  background: var(--kalei-navy);
  border-top: 1px solid var(--twilight);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  text-decoration: none;
  min-width: 60px;
}
.tab-item svg {
  width: 24px;
  height: 24px;
}
.tab-item .tab-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tab-item.inactive svg { fill: var(--dim-light); stroke: var(--dim-light); }
.tab-item.inactive .tab-label { color: var(--faint-light); }
.tab-item.active .tab-label { color: var(--pure-light); }

/* Active tab colors by type */
.tab-item.active[data-tab="turn"] svg { fill: var(--amethyst); stroke: var(--amethyst); }
.tab-item.active[data-tab="turn"] .tab-label { color: var(--amethyst-light); }
.tab-item.active[data-tab="mirror"] svg { fill: var(--amber); stroke: var(--amber); }
.tab-item.active[data-tab="mirror"] .tab-label { color: var(--amber-light); }
.tab-item.active[data-tab="lens"] svg { fill: var(--emerald); stroke: var(--emerald); }
.tab-item.active[data-tab="lens"] .tab-label { color: var(--emerald-light); }
.tab-item.active[data-tab="gallery"] svg { fill: var(--sapphire); stroke: var(--sapphire); }
.tab-item.active[data-tab="gallery"] .tab-label { color: var(--sapphire-light); }
.tab-item.active[data-tab="you"] svg { fill: var(--soft-light); stroke: var(--soft-light); }
.tab-item.active[data-tab="you"] .tab-label { color: var(--soft-light); }

/* --- Typography --- */
.display-xl { font-family: var(--font-display); font-size: 40px; font-weight: 700; line-height: 1.1; }
.display-lg { font-family: var(--font-display); font-size: 32px; font-weight: 700; line-height: 1.15; }
.display-md { font-size: 24px; font-weight: 600; line-height: 1.2; }
.heading { font-size: 20px; font-weight: 600; line-height: 1.3; }
.subheading { font-size: 16px; font-weight: 600; line-height: 1.4; }
.body-lg { font-size: 17px; font-weight: 400; line-height: 1.5; }
.body { font-size: 15px; font-weight: 400; line-height: 1.5; }
.body-sm { font-size: 13px; font-weight: 400; line-height: 1.5; }
.label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }

.text-pure { color: var(--pure-light); }
.text-soft { color: var(--soft-light); }
.text-dim { color: var(--dim-light); }
.text-faint { color: var(--faint-light); }
.text-amethyst { color: var(--amethyst-light); }
.text-sapphire { color: var(--sapphire-light); }
.text-emerald { color: var(--emerald-light); }
.text-amber { color: var(--amber-light); }
.text-rose { color: var(--rose-light); }

.text-prismatic {
  background: var(--prismatic);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-primary);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}
.btn-primary {
  height: 52px;
  padding: 0 var(--space-6);
  background: var(--amethyst);
  color: var(--pure-light);
  font-size: 16px;
  border-radius: var(--radius-lg);
  width: 100%;
  box-shadow: var(--glow-amethyst);
}
.btn-primary:hover { background: var(--amethyst-light); }
.btn-primary.btn-emerald { background: var(--emerald); box-shadow: var(--glow-emerald); }
.btn-primary.btn-amber { background: var(--amber); box-shadow: var(--glow-amber); color: var(--void); }
.btn-primary.btn-rose { background: var(--rose); box-shadow: var(--glow-rose); }

.btn-secondary {
  height: 44px;
  padding: 0 var(--space-5);
  background: var(--deep-glass);
  color: var(--soft-light);
  font-size: 15px;
  border-radius: var(--radius-md);
  border: 1px solid var(--twilight);
  width: 100%;
}
.btn-secondary:hover { background: var(--twilight); }

.btn-ghost {
  height: 40px;
  padding: 0 var(--space-4);
  background: transparent;
  color: var(--amethyst-light);
  font-size: 15px;
  border-radius: var(--radius-md);
}
.btn-ghost:hover { background: rgba(139, 92, 246, 0.1); }

.btn-sm { height: 36px; font-size: 13px; padding: 0 var(--space-3); border-radius: var(--radius-sm); }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: var(--radius-md); }
.btn-disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* --- Inputs --- */
.input-field {
  width: 100%;
  height: 48px;
  background: var(--deep-glass);
  border: 1px solid var(--twilight);
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-family: var(--font-primary);
  font-size: 16px;
  color: var(--pure-light);
  outline: none;
  transition: border-color 0.2s;
}
.input-field::placeholder { color: var(--faint-light); }
.input-field:focus { border-color: var(--amethyst); }

.textarea-field {
  width: 100%;
  min-height: 120px;
  background: var(--deep-glass);
  border: 1px solid var(--twilight);
  border-radius: var(--radius-lg);
  padding: 14px;
  font-family: var(--font-primary);
  font-size: 17px;
  line-height: 1.5;
  color: var(--pure-light);
  outline: none;
  resize: none;
  transition: border-color 0.2s;
}
.textarea-field::placeholder { color: var(--faint-light); }
.textarea-field:focus { border-color: var(--amethyst); }

.input-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--dim-light);
  margin-bottom: var(--space-2);
  display: block;
}

/* --- Cards --- */
.card {
  background: var(--kalei-navy);
  border: 1px solid rgba(28, 34, 64, 0.6);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  position: relative;
  overflow: hidden;
}
.card-elevated {
  background: var(--deep-glass);
  border-color: var(--twilight);
}
.card-pattern {
  padding: 0;
  overflow: hidden;
}
.card-pattern .pattern-visual {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--void);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  position: relative;
  overflow: hidden;
}
.card-pattern .pattern-content {
  padding: var(--space-3) var(--space-4);
}

.card-action {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background 0.15s;
}
.card-action:hover { background: var(--deep-glass); }
.card-action .card-action-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-action .card-action-text { flex: 1; }
.card-action .card-action-chevron { color: var(--faint-light); }

/* --- Chips / Tags --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 28px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
}
.chip-amethyst { background: rgba(139,92,246,0.15); color: var(--amethyst-light); }
.chip-sapphire { background: rgba(59,130,246,0.15); color: var(--sapphire-light); }
.chip-emerald { background: rgba(16,185,129,0.15); color: var(--emerald-light); }
.chip-amber { background: rgba(245,158,11,0.15); color: var(--amber-light); }
.chip-rose { background: rgba(236,72,153,0.15); color: var(--rose-light); }

/* --- Fragment Highlight --- */
.fragment-highlight {
  position: relative;
  display: inline;
}
.fragment-highlight::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--amber);
  border-radius: 2px;
  opacity: 0.6;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
  animation: fragmentGlow 2s ease-in-out infinite;
}
.fragment-icon {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  color: var(--amber);
  animation: fragmentPulse 2s ease-in-out infinite;
}

/* --- Chat Bubbles (Mirror) --- */
.chat-bubble {
  max-width: 80%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-3);
  font-size: 16px;
  line-height: 1.5;
}
.chat-bubble.user {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.2);
  margin-left: auto;
  border-bottom-right-radius: var(--space-1);
}
.chat-bubble.ai {
  background: var(--kalei-navy);
  border: 1px solid var(--twilight);
  margin-right: auto;
  border-bottom-left-radius: var(--space-1);
  color: var(--soft-light);
}

/* --- Progress Ring --- */
.progress-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring .progress-text {
  position: absolute;
  font-size: 20px;
  font-weight: 700;
  color: var(--pure-light);
}
.progress-ring .progress-label {
  position: absolute;
  top: 58%;
  font-size: 11px;
  color: var(--dim-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Modals --- */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 8, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.modal-overlay.centered { align-items: center; }

.modal-sheet {
  width: 100%;
  max-height: 70%;
  background: var(--kalei-navy);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: var(--space-6) var(--space-4) var(--space-8);
  position: relative;
}
.modal-sheet .modal-handle {
  width: 36px;
  height: 4px;
  background: var(--twilight);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-5);
}
.modal-card {
  width: 340px;
  background: var(--kalei-navy);
  border: 1px solid var(--twilight);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
}

/* --- Dividers --- */
.divider {
  height: 1px;
  background: var(--twilight);
  margin: var(--space-4) 0;
}

/* --- Section Headers --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.section-header .section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--dim-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.section-header .section-action {
  font-size: 13px;
  color: var(--amethyst-light);
  cursor: pointer;
}

/* --- Stat Block --- */
.stat-row {
  display: flex;
  gap: var(--space-3);
}
.stat-block {
  flex: 1;
  background: var(--deep-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  text-align: center;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--pure-light);
}
.stat-label {
  font-size: 11px;
  color: var(--dim-light);
  margin-top: 2px;
}

/* --- Toggle / Radio --- */
.radio-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--deep-glass);
  border: 1px solid var(--twilight);
  border-radius: var(--radius-lg);
  cursor: pointer;
  margin-bottom: var(--space-2);
  transition: all 0.2s;
}
.radio-option.selected {
  border-color: var(--amethyst);
  background: rgba(139, 92, 246, 0.08);
}
.radio-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--twilight);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.radio-option.selected .radio-dot {
  border-color: var(--amethyst);
}
.radio-option.selected .radio-dot::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amethyst);
}

/* --- Step Progress --- */
.step-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) 0;
}
.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--twilight);
}
.step-dot.active { background: var(--amethyst); box-shadow: 0 0 8px rgba(139, 92, 246, 0.4); }
.step-dot.completed { background: var(--emerald); }
.step-label {
  font-size: 12px;
  color: var(--dim-light);
  margin-left: var(--space-2);
}

/* --- Reframe Blocks --- */
.reframe-block {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  border-left: 3px solid;
}
.reframe-block.amethyst { border-color: var(--amethyst); background: rgba(139,92,246,0.06); }
.reframe-block.sapphire { border-color: var(--sapphire); background: rgba(59,130,246,0.06); }
.reframe-block.emerald { border-color: var(--emerald); background: rgba(16,185,129,0.06); }
.reframe-block .reframe-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}
.reframe-block.amethyst .reframe-label { color: var(--amethyst-light); }
.reframe-block.sapphire .reframe-label { color: var(--sapphire-light); }
.reframe-block.emerald .reframe-label { color: var(--emerald-light); }
.reframe-block .reframe-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--soft-light);
}

/* --- Animations (from soft-elegance SVG language) --- */
@keyframes breathing {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
@keyframes fragmentGlow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}
@keyframes fragmentPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes prismaticShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Loading shimmer effect */
.loading-shimmer {
  background: linear-gradient(90deg, var(--deep-glass) 25%, rgba(28,34,64,0.6) 50%, var(--deep-glass) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* Breathing aura (decorative background) */
.aura {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.15;
  animation: breathing 6s ease-in-out infinite;
  pointer-events: none;
}

/* --- Utilities --- */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
