/* Hide app-container when in sutra mode */
body.sutra-mode .app-container {
  display: none;
}

/* =====================
   APP MODE TOGGLE
   ===================== */

.app-mode-toggle {
  display: flex;
  align-items: center;
  background: var(--snow);
  border-radius: 100px;
  padding: 4px;
  margin: 2rem 1.5rem 0;
  width: fit-content;
  gap: 2px;
}

.mode-btn {
  padding: 9px 22px;
  border-radius: 100px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--sub);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 1, 0.2, 1);
  letter-spacing: -0.01em;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.mode-btn.active {
  background: var(--text);
  color: #fff;
}

.mode-btn:not(.active):hover {
  color: var(--text);
}

/* =====================
   SUTRA SCREEN
   ===================== */

.sutra-screen {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-w);
  height: 100%;
  background: var(--bg);
  z-index: 5000;
  display: none;
  overflow-y: auto;
  padding-top: 4rem;
}

.sutra-screen.visible {
  display: block;
}

.sutra-input-section {
  padding: 1.25rem 1.5rem 1.5rem;
}

.sutra-headline {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 1rem;
}

.sutra-input-wrap {
  position: relative;
  margin-bottom: 0.75rem;
}

.sutra-textarea {
  width: 100%;
  min-height: 130px;
  background: var(--snow);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 1.4rem 1.4rem 2.5rem;
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.65;
  resize: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  display: block;
}

.sutra-textarea:focus {
  border-color: rgba(0, 0, 0, 0.18);
  outline: none;
}

.sutra-textarea::placeholder {
  color: var(--sub);
  opacity: 0.5;
}

#sutraCharCount {
  position: absolute;
  bottom: 1rem;
  right: 1.25rem;
  font-size: 0.72rem;
  color: var(--sub);
  opacity: 0.4;
  pointer-events: none;
}

.distill-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 1rem 2rem;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 1, 0.2, 1);
  letter-spacing: -0.01em;
  margin-top: 0.25rem;
  -webkit-tap-highlight-color: transparent;
}

.distill-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

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

.distill-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.distill-btn .material-symbols-rounded {
  font-size: 18px !important;
  transition: transform 0.3s;
}

.distill-btn.loading .material-symbols-rounded {
  animation: sutra-spin 1s linear infinite;
}

@keyframes sutra-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* =====================
   INLINE CARDS
   ===================== */

#sutraCardsInline {
  padding: 0 1.5rem 4rem;
}

.sutra-results-header {
  padding: 1.75rem 1.5rem 1.25rem;
}

.sutra-friction-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sub);
  opacity: 0.6;
  margin-bottom: 0.3rem;
}

.sutra-friction-text {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.sutra-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  padding: 0 1.5rem 4rem;
}

.sutra-card {
  border-radius: 24px;
  padding: 1.5rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 1, 0.2, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.sutra-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
}

.sutra-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.sutra-card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sutra-card-name {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.5;
}

.sutra-card-role {
  font-size: 0.82rem;
  color: var(--sub);
  font-weight: 500;
}

.layer-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 4px;
  width: fit-content;
}

.layer-logic   { background: #ece8ff; color: #5c45d6; }
.layer-mastery { background: #e6f9f0; color: #1a7a4a; }
.layer-life    { background: #fff3e0; color: #b85c00; }

.sutra-card-expand-icon {
  font-size: 18px !important;
  color: var(--sub);
  opacity: 0.35;
  transition: transform 0.3s cubic-bezier(0.2, 1, 0.2, 1), opacity 0.2s;
  flex-shrink: 0;
  margin-top: 2px;
}

.sutra-card.expanded .sutra-card-expand-icon {
  transform: rotate(45deg);
  opacity: 0.6;
}

.sutra-card-sutra {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.38;
  letter-spacing: -0.02em;
}

/* Expanded body */
.sutra-card-body {
  display: none;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  animation: sutra-expand 0.25s ease;
}

.sutra-card.expanded .sutra-card-body {
  display: block;
}

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

.sutra-bhashya-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sub);
  opacity: 0.5;
  margin-bottom: 0.75rem;
}

.sutra-bhashya {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.sutra-bhashya-part {
  font-size: 0.88rem;
  color: var(--sub);
  line-height: 1.65;
}

.sutra-bhashya-part.resolution {
  color: var(--text);
  font-weight: 500;
}

.sutra-scripture {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  color: var(--sub);
  opacity: 0.55;
  font-style: italic;
}

.sutra-scripture .material-symbols-rounded {
  font-size: 14px !important;
  font-style: normal;
  opacity: 0.7;
}

/* =====================
   RESPONSIVE
   ===================== */

@media (max-width: 768px) {
  .sutra-input-section {
    padding: 1rem 1rem 1.25rem;
  }

  .sutra-cards-grid {
    grid-template-columns: 1fr;
  }

  #sutraCardsInline {
    padding: 0 1rem 3rem;
  }

  .sutra-results-header {
    padding: 1rem 0 1rem;
  }
}
