:root {
  --bg: #faf9f6;
  --bg-accent: #f0ede4;
  --panel: rgba(255, 255, 255, 0.88);
  --ink: #111827;
  --muted: #4b5563;
  --line: rgba(17, 24, 39, 0.08);
  --brand: #0f766e;
  --brand-light: #14b8a6;
  --brand-strong: #042f2e;
  --highlight: #f59e0b;
  --shadow: 
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05),
    0 30px 60px -12px rgba(15, 118, 110, 0.12);
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: "Outfit", sans-serif;
  color: var(--ink);
  background: 
    radial-gradient(at 0% 0%, rgba(15, 118, 110, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(245, 158, 11, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(20, 184, 166, 0.1) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(15, 118, 110, 0.08) 0px, transparent 50%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}

.shell {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  padding: 60px 0 80px;
}


.hero h1,
.panel h2,
.panel h3 {
  font-family: "Source Serif 4", serif;
  margin: 0;
}

.hero {
  margin-bottom: 40px;
  text-align: center;
}

h1 {
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--brand-strong), var(--brand));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}


.lede,
.summary,
label,
li,
.status {
  margin-top: 16px;
  padding: 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  text-align: center;
  font-weight: 500;
}

.status:not(:empty) {
  background: rgba(31, 29, 26, 0.03);
  border: 1px solid var(--line);
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--brand);
  margin-bottom: 12px;
  display: block;
}

.hero p {
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

.grid,
.columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.04),
    0 20px 60px rgba(40, 33, 25, 0.08);
}

form.panel {
  display: grid;
  gap: 12px;
}


label {
  display: grid;
  gap: 6px;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.85rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid rgba(31, 29, 26, 0.1);
  border-radius: 14px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  transition: all 200ms ease;
  outline: none;
}


.input-with-dropdown {
  position: relative;
  width: 100%;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: white;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 15px 35px rgba(0,0,0,0.12);
  z-index: 1000;
  max-height: 250px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: slideDownFade 0.2s ease-out;
}

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

.autocomplete-item {
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.autocomplete-item:hover {
  background: rgba(15, 118, 110, 0.08);
  color: var(--brand);
}

.autocomplete-item span.icon {
  font-size: 0.8rem;
  opacity: 0.6;
}

.mobile-input-group {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid rgba(31, 29, 26, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
  transition: all 200ms ease;
}

.mobile-input-group:focus-within {
  border-color: var(--brand);
  background: white;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
}

.mobile-input-group .prefix {
  padding: 0 16px;
  color: var(--muted);
  font-weight: 700;
  border-right: 1px solid var(--line);
  background: rgba(0,0,0,0.03);
  height: 100%;
  display: flex;
  align-items: center;
}

.mobile-input-group input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

#otp-section {
  background: rgba(15, 118, 110, 0.05);
  padding: 24px;
  border-radius: 24px;
  border: 1px dashed var(--brand);
  margin-top: 10px;
  animation: slideDown 400ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  background: white;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
}

.output-header h2 {
  font-size: 2rem;
  color: var(--brand-strong);
  font-family: "Source Serif 4", serif;
  margin: 8px 0;
}

.lesson-container .summary-card {
  padding: 32px;
  background: white;
  border-radius: 24px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

#profile-form h2 {
  font-size: 1.5rem;
  margin-bottom: 16px;
  color: var(--brand-strong);
  letter-spacing: -0.02em;
}

#profile-form label {
  color: var(--brand-strong);
}

#profile-form button[type="submit"] {
  margin-top: 10px;
  background: linear-gradient(135deg, var(--highlight), #d97706);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

#profile-form button[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: white;
  font-weight: 700;
  cursor: pointer;
  font-size: 1rem;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(19, 78, 74, 0.25);
}

.secondary-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 0;
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  font-weight: 500;
}

.secondary-btn:hover {
  background: transparent;
  color: var(--brand);
  box-shadow: none;
  transform: none;
}


.active-badge {
  display: inline-block;
  background: #dcfce7;
  color: #166534;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 12px;
  border: 1px solid #bbf7d0;
}

#profile-active-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#profile-active-view .active-badge {
  margin-bottom: 4px;
  font-size: 0.7rem;
  padding: 2px 10px;
}

#profile-active-view h2 {
  font-size: 1.25rem;
  margin: 0;
  color: var(--brand-strong);
}

#profile-active-view p {
  color: var(--muted);
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

#profile-container {
  min-height: auto;
  display: flex;
  flex-direction: column;
}

#profile-container.compact {
  padding: 24px;
}


.profile-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-top: 8px;
}

.output {
  margin-top: 18px;
}

.output-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.pill {
  background: rgba(245, 158, 11, 0.16);
  color: #9a6700;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 700;
}

ul {
  padding-left: 18px;
}

a {
  color: var(--brand-strong);
}

.quick-wins {
  display: grid;
  gap: 12px;
  background: rgba(15, 118, 110, 0.04);
  padding: 16px;
  border-radius: 20px;
  border: 1px dashed rgba(15, 118, 110, 0.2);
}

.label-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-strong);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--ink);
}

.checkbox-label input {
  width: auto;
}

.accent {
  color: var(--brand);
}

.history-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.history-item {
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.15);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--brand-strong);
}

@media (max-width: 860px) {
  .grid,
  .columns {
    grid-template-columns: 1fr;
  }

  .output-header {
    flex-direction: column;
  }
}

.lesson-container {
  margin-top: 32px;
  display: grid;
  gap: 24px;
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.summary-card {
  background: white;
  padding: 40px;
  border-radius: 32px;
  border: 1px solid var(--line);
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 
    0 2px 4px -1px rgba(0, 0, 0, 0.06),
    0 20px 25px -5px rgba(0, 0, 0, 0.1);
  line-height: 1.7;
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand);
}

.summary-card .summary {
  font-size: 1.25rem;
  margin: 0;
  color: var(--ink);
  font-family: "Source Serif 4", serif;
  text-align: left;
  padding: 0;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.card {
  background: white;
  padding: 28px;
  border-radius: 24px;
  border: 1px solid var(--line);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  border-color: rgba(15, 118, 110, 0.3);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.card-header .icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.card-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-strong);
  margin: 0;
}

.lesson-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 16px;
}

.lesson-list li {
  font-size: 0.95rem;
  line-height: 1.6;
  position: relative;
  padding-left: 28px;
  color: var(--muted);
  text-align: left;
  margin: 0;
  background: transparent;
  border: none;
}

.lesson-list li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--brand);
  font-size: 1.1rem;
  top: -2px;
}

.horizontal-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.horizontal-sources li {
  padding-left: 0;
}

.horizontal-sources li::before {
  content: none;
}

.horizontal-sources a {
  display: inline-block;
  padding: 10px 18px;
  background: rgba(15, 118, 110, 0.05);
  color: var(--brand-strong);
  border-radius: 14px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 200ms ease;
  border: 1px solid transparent;
}

.horizontal-sources a:hover {
  background: var(--brand);
  color: white;
  transform: scale(1.02);
}

.quiz-card {
  background: linear-gradient(135deg, #ffffff, #f0fdfa);
  border-color: rgba(15, 118, 110, 0.2);
}

.quiz-card .card-header h3 {
  color: #0d9488;
}

.suggestions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: -4px;
  margin-bottom: 12px;
}

.suggestion-chip {
  font-size: 0.8rem;
  background: white;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  border: 1.5px solid var(--line);
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--muted);
  font-weight: 500;
}

.suggestion-chip:hover {
  background: var(--brand);
  color: white;
  border-color: var(--brand-strong);
  transform: translateY(-1px);
}

.profile-info-pill {
  display: inline-flex;
  align-items: center;
  margin-top: 12px;
  padding: 6px 16px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--brand-strong);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(15, 118, 110, 0.15);
  opacity: 0;
  transition: all 400ms ease;
}

.profile-info-pill.visible {
  opacity: 1;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.4); }
  70% { box-shadow: 0 0 0 15px rgba(15, 118, 110, 0); }
  100% { box-shadow: 0 0 0 0 rgba(15, 118, 110, 0); }
}

.highlight-pulse {
  animation: pulse 1.5s infinite;
  border-color: var(--brand) !important;
}

/* Loading Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 252, 246, 0.95);
  backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--line);
  border-top: 4px solid var(--brand);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loader-content p {
  font-family: "Source Serif 4", serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--brand-strong);
  margin: 0;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#learn-form.locked {
  opacity: 0.6;
  pointer-events: none;
  filter: grayscale(0.8);
  transition: all 600ms ease;
}

#learn-form.unlocked {
  opacity: 1;
  pointer-events: all;
  filter: grayscale(0);
  border-color: var(--brand);
  box-shadow: 0 10px 40px rgba(15, 118, 110, 0.15);
}

.ready-badge {
  display: inline-block;
  background: var(--brand);
  color: white;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 12px;
  vertical-align: middle;
  transform: translateY(-2px);
  animation: bounce 2s infinite;
  box-shadow: 0 4px 10px rgba(15, 118, 110, 0.3);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {transform: translateY(-2px);}
  40% {transform: translateY(-8px);}
  60% {transform: translateY(-5px);}
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(31, 29, 26, 0.4);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
}

.modal-container {
  background: white;
  width: min(1000px, 95vw);
  max-height: 92vh;
  border-radius: 40px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 80px rgba(15, 118, 110, 0.1);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 48px 48px 24px;
  background: linear-gradient(135deg, #f0fdfa 0%, #ffffff 100%);
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  font-size: 2.8rem;
  margin: 4px 0;
  color: var(--brand-strong);
  font-family: "Source Serif 4", serif;
  letter-spacing: -0.02em;
}

.modal-content {
  padding: 32px 48px 48px;
  overflow-y: auto;
  flex: 1;
  display: grid;
  gap: 32px;
  background: #fafafa;
}

.deep-dive-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px dashed var(--line);
  animation: fadeIn 0.4s ease-out;
}

.deep-dive-section h4 {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.detailed-text {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--muted);
  white-space: pre-wrap;
}

.text-link-btn {
  background: none;
  border: none;
  color: var(--brand);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 12px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  margin-top: 12px;
}

.text-link-btn:hover {
  color: var(--brand-strong);
  transform: translateX(4px);
}

.modal-footer {
  padding: 24px 48px;
  background: white;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}

.history-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.history-section h3 {
  font-size: 1.4rem;
  margin-bottom: 24px;
  color: var(--brand-strong);
  font-family: "Source Serif 4", serif;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  list-style: none;
  padding: 0;
}

.history-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.history-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(15, 118, 110, 0.15);
  border-color: var(--brand-light);
}

.history-card .concept-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brand-strong);
  margin: 0;
}

.history-card .domain-meta {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand);
  font-weight: 700;
}

.history-card .summary-snippet {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.view-lesson-btn {
  background: #f0fdfa;
  color: var(--brand);
  border: 1px solid #ccfbf1;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
  text-align: center;
  margin-top: auto;
}

.view-lesson-btn:hover {
  background: var(--brand);
  color: white;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.2);
}

.lesson-container .view-details-btn {
  margin-top: 24px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: white;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.2);
  transition: all 0.3s ease;
}

.lesson-container .view-details-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(15, 118, 110, 0.3);
}


