/* CSS reset (minimal) */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "ABeeZee", sans-serif;
  background: #f7f9ff;
  color: #0f172a;
}

/* Theme tokens */
:root {
  --bg: #f7f9ff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #6b7280;
  --primary: #5b6cff;
  --primary-600: #4e5fe8;
  --ring: #93c5fd;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(2,6,23,0.04);
  --shadow-md: 0 6px 24px rgba(2,6,23,0.08);
}

/* Layout */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.container { width: min(1240px, 94vw); margin: 0 auto; }
.app__main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 24px 0 32px;
}
.assistant {
  width: min(900px, 100%);
  display: flex;
  flex-direction: column;
}

/* Header */
.app__header { position: sticky; top: 0; z-index: 10; background: rgba(247,249,255,0.85); backdrop-filter: saturate(1.2) blur(8px); border-bottom: 1px solid var(--border); }
.app__header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: baseline; gap: 8px; font-weight: 800; color: var(--text); }
.brand__logo { font-size: 20px; }
.brand__name { font-size: 18px; }

/* Header Navigation - Design 2 style */
.header-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.header-nav__link {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.header-nav__link:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(91, 108, 255, 0.3);
}
.header-nav__link--active {
  background: linear-gradient(135deg, #5b6cff, #5561ff);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.header-nav__link--active:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}
.header-nav__auth {
  padding: 8px 20px;
}
.header-nav__settings {
  margin-left: 0;
}
.brand__sub { font-size: 14px; color: var(--muted); font-weight: 700; }

.settings-btn {
  margin-left: auto;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  transition: transform .1s ease, color .1s ease;
}
.settings-btn:hover { color: var(--primary); transform: rotate(10deg); }
.settings-btn:focus { outline: 3px solid var(--ring); outline-offset: 4px; border-radius: 50%; }

.header-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.header-actions .settings-btn {
  margin-left: 0;
}
.settings-indicator {
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
  background: rgba(91,108,255,0.12);
  border: 1px solid rgba(91,108,255,0.35);
  /* Give the indicator some breathing room from the brand/logo */
  margin-left: 32px;
}
/* Consistent left grouping for brand + indicator */
.header-left { display: inline-flex; align-items: baseline; }
.auth-button {
  border: 1px solid rgba(91, 108, 255, 0.4);
  background: rgba(91, 108, 255, 0.12);
  color: var(--primary);
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .14s ease, background-color .14s ease;
}
.auth-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.auth-button:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
}
.auth-button.auth-button--signed-in {
  color: #ffffff;
  background: linear-gradient(135deg, #5b6cff, #5561ff);
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(91, 108, 255, 0.28);
}
.auth-button.auth-button--signed-in:hover {
  box-shadow: 0 12px 26px rgba(91, 108, 255, 0.34);
}

/* Preview (in-assistant canvas) */
.preview__title { margin: 0 0 12px; font-size: 20px; font-weight: 800; letter-spacing: 0.2px; }
.preview__card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  padding-bottom: 96px;
  height: clamp(260px, 34vh, 360px);
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  position: relative;
}
.preview__placeholder { margin: 0; color: var(--muted); font-size: 1.25rem; font-weight: 700; white-space: pre-line; }

/* Ask AI - Output card (similar to Storymaker story card) */
.ask-output-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  padding-bottom: 220px; /* space for double-size bottom-right lottie */
  height: clamp(240px, 32vh, 360px);
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  position: relative;
}
.ask-output__placeholder {
  margin: 0; 
  color: var(--muted); 
  font-size: 1.1rem; 
  font-weight: 700; 
  white-space: pre-line;
}

/* Ask AI - Lottie overlay inside output card */
.ask-output__lottie {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 192px;
  height: 192px;
  pointer-events: none;
  opacity: 0.95;
}
.ask-output__lottie svg {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
}

/* Source badge for letter preview */
.preview__source {
  position: absolute;
  left: 24px;
  bottom: 24px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  background: rgba(15,23,42,0.06);
  border: 1px solid rgba(15,23,42,0.18);
}
.preview__source--ai {
  color: #16a34a;
  background: rgba(22,163,74,0.12);
  border-color: rgba(22,163,74,0.35);
}
.preview__source--fallback,
.preview__source--error {
  color: #b91c1c;
  background: rgba(185,28,28,0.12);
  border-color: rgba(185,28,28,0.35);
}
.preview__source--draft {
  color: var(--primary);
  background: rgba(91,108,255,0.12);
  border-color: rgba(91,108,255,0.35);
}

/* Assistant panel */
.assistant__title { margin: 0 0 12px; font-size: 20px; font-weight: 800; letter-spacing: 0.2px; }
.assistant__panel {
  flex: 1;
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  min-height: calc(100dvh - 140px);
}

.assistant__encouragement { 
  margin: 0; 
  font-weight: 700; 
  font-size: 1.25rem; 
  padding-right: 100px;
}
.assistant__hints { margin: 0; padding-left: 18px; color: var(--muted); }
.assistant__story {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  margin-bottom: auto;
}
.assistant__story .preview__card { flex: 1; }
.story-actions {
  position: absolute;
  right: 24px;
  bottom: 24px;
  display: none;
}
.story-actions__finish {
  min-width: 150px;
  font-size: 1.25rem;
  padding: 14px 20px;
  border-radius: 18px;
}
.story-actions.is-visible { display: flex; justify-content: flex-end; }

.story-final-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
  justify-content: center;
}
.story-final-actions__button {
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  min-width: 180px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .16s ease, background-color .16s ease;
  box-shadow: var(--shadow-sm);
  color: var(--text);
  background: rgba(15, 23, 42, 0.06);
}
.story-final-actions__button:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}
.story-final-actions__button--primary {
  color: #ffffff;
  background: linear-gradient(135deg, #5b6cff, #5561ff);
  box-shadow: 0 12px 22px rgba(91,108,255,0.32);
}
.story-final-actions__button--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(91,108,255,0.36);
}
.story-final-actions__button--ghost {
  color: var(--primary);
  background: rgba(91,108,255,0.12);
}
.story-final-actions__button--ghost:hover {
  transform: translateY(-2px);
  background: rgba(91,108,255,0.2);
}

.story-final-actions__button--mode {
  color: #ffffff;
  background: linear-gradient(135deg, #f97316, #fb923c);
  box-shadow: 0 12px 22px rgba(249, 115, 22, 0.32);
}
.story-final-actions__button--mode:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(249, 115, 22, 0.36);
}

@media (max-width: 600px) {
  .story-final-actions__button {
    flex: 1 1 calc(33.333% - 12px);
    min-width: 0;
  }
}

/* Edit Toggle Switch */
.edit-toggle-wrapper {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.edit-toggle-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-light);
}

.edit-toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.edit-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.edit-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 20px;
}

.edit-toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.edit-toggle-switch input:checked + .edit-toggle-slider {
  background-color: var(--primary);
}

.edit-toggle-switch input:checked + .edit-toggle-slider:before {
  transform: translateX(16px);
}

.edit-toggle-switch input:focus + .edit-toggle-slider {
  box-shadow: 0 0 1px var(--primary);
}

/* Prompt Items with Edit/Delete */
.prompt-item {
  position: relative;
  margin-bottom: 12px;
  padding: 12px 16px;
  background: rgba(91, 108, 255, 0.05);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.prompt-item:hover {
  background: rgba(91, 108, 255, 0.08);
}

.prompt-item__text {
  margin: 0 0 8px 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
}

.prompt-item__actions {
  display: flex;
  gap: 8px;
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, height 0.2s ease;
}

/* Show buttons when edit mode is active */
.preview__card.edit-mode-active .prompt-item__actions {
  opacity: 1;
  height: auto;
}

.prompt-item__btn {
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.prompt-item__btn--edit {
  background: rgba(91, 108, 255, 0.1);
  color: var(--primary);
}

.prompt-item__btn--edit:hover {
  background: rgba(91, 108, 255, 0.2);
  transform: translateY(-1px);
}

.prompt-item__btn--delete {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.prompt-item__btn--delete:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: translateY(-1px);
}

/* Edit Prompt Modal */
body.edit-prompt-modal-open { overflow: hidden; }
.edit-prompt-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 10000;
}

.edit-prompt-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
}

.edit-prompt-modal__dialog {
  position: relative;
  width: min(500px, 92vw);
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 32px 64px rgba(15, 23, 42, 0.3);
  z-index: 1;
}

.edit-prompt-modal__dialog h3 {
  margin: 0 0 16px 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.edit-prompt-modal__input {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  line-height: 1.6;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 16px;
}

.edit-prompt-modal__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.1);
}

.edit-prompt-modal__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.edit-prompt-modal__comparison {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
}

.edit-prompt-modal__old,
.edit-prompt-modal__new {
  flex: 1;
}

.edit-prompt-modal__old strong,
.edit-prompt-modal__new strong {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.edit-prompt-modal__old p,
.edit-prompt-modal__new p {
  margin: 0;
  padding: 12px;
  background: #fff;
  border-radius: 6px;
  line-height: 1.6;
}

.edit-prompt-modal__old p {
  color: var(--muted);
  text-decoration: line-through;
}

.edit-prompt-modal__new p {
  color: var(--text);
  font-weight: 600;
}

.edit-prompt-modal__arrow {
  text-align: center;
  font-size: 1.5rem;
  color: var(--primary);
  margin: 8px 0;
}

.edit-prompt-modal__errors {
  margin-bottom: 16px;
  padding: 12px;
  background: #fef2f2;
  border-left: 3px solid #ef4444;
  border-radius: 8px;
}

.edit-prompt-modal__error {
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: #991b1b;
  line-height: 1.5;
}

.edit-prompt-modal__error:last-child {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .edit-prompt-modal__dialog {
    padding: 20px;
  }
}

/* Learning Words (Vocabulary Feature) */
.learning-word {
  position: relative;
  display: inline;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.learning-word:hover {
  color: var(--primary-600);
  background: rgba(91, 108, 255, 0.08);
  border-radius: 4px;
  padding: 2px 4px;
  margin: 0 -2px;
}


body.story-mode-open { overflow: hidden; }
.story-mode[hidden] { display: none; }
.story-mode {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 999;
}
.story-mode__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}
.story-mode__dialog {
  position: relative;
  width: min(640px, 92vw);
  max-height: min(90vh, 640px);
  background: #fff;
  border-radius: 28px;
  padding: 28px 32px;
  box-shadow: 0 32px 48px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 1;
  overflow: hidden;
}
.story-mode__close {
  justify-self: end;
  background: rgba(15, 23, 42, 0.08);
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
}
.story-mode__close:hover { background: rgba(15, 23, 42, 0.15); }
.story-mode__close:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}
.story-mode__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 320px;
  justify-content: center;
  gap: 18px;
  flex: 1;
}
.story-mode__emoji {
  font-size: clamp(3rem, 8vw, 4.5rem);
  line-height: 1;
}
.story-mode__emoji img.emoji {
  width: 1em;
  height: 1em;
  display: inline-block;
}
.story-mode__page-label {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
}
.story-mode__page-title {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}
.story-mode__page-label:empty,
.story-mode__page-title:empty {
  display: none;
}
.story-mode__page-text {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.6;
  text-align: left;
  max-height: 240px;
  overflow-y: auto;
  width: 100%;
}
.story-mode__page-text.is-hidden { display: none; }
.story-mode__nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.story-mode__nav-btn {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 12px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .16s ease, background-color .16s ease;
}
.story-mode__nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.story-mode__nav-btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}
.story-mode__nav-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #5b6cff, #5561ff);
  box-shadow: 0 12px 22px rgba(91,108,255,0.32);
}
.story-mode__nav-btn--primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(91,108,255,0.36);
}
.story-mode__nav-btn--ghost {
  color: var(--primary);
  background: rgba(91,108,255,0.12);
  box-shadow: var(--shadow-sm);
}
.story-mode__nav-btn--ghost:hover:not(:disabled) {
  transform: translateY(-2px);
  background: rgba(91,108,255,0.2);
}
.story-mode.is-loading .story-mode__nav-btn {
  opacity: 0.35;
  pointer-events: none;
}

@media (max-width: 600px) {
  .story-mode__dialog {
    padding: 24px;
    gap: 20px;
  }
  .story-mode__nav {
    flex-direction: column;
  }
  .story-mode__nav-btn {
    width: 100%;
  }
}

/* Expressive Mode - independent from Story Mode */
body.expressive-mode-open { overflow: hidden; }
.expressive-mode[hidden] { display: none; }
.expressive-mode {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 999;
}
.expressive-mode__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}
.expressive-mode__dialog {
  position: relative;
  width: min(640px, 92vw);
  max-height: min(90vh, 640px);
  background: #fff;
  border-radius: 28px;
  padding: 28px 32px;
  box-shadow: 0 32px 48px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 1;
  overflow: hidden;
}
.expressive-mode__close {
  justify-self: end;
  background: rgba(15, 23, 42, 0.08);
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
}
.expressive-mode__close:hover { background: rgba(15, 23, 42, 0.15); }
.expressive-mode__close:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}
.expressive-mode__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 320px;
  justify-content: center;
  gap: 18px;
  flex: 1;
}
.expressive-mode__emoji {
  font-size: clamp(3rem, 8vw, 4.5rem);
  line-height: 1;
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.expressive-mode__emoji img.emoji {
  width: 1em;
  height: 1em;
  display: inline-block;
}
.expressive-mode__page-label {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
}
.expressive-mode__page-title {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}
.expressive-mode__page-label:empty,
.expressive-mode__page-title:empty {
  display: none;
}
.expressive-mode__page-text {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.6;
  text-align: left;
  max-height: 240px;
  overflow-y: auto;
  width: 100%;
}
.expressive-mode__page-text.is-hidden { display: none; }
.expressive-mode__nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.expressive-mode__nav-btn {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 12px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .16s ease, background-color .16s ease;
}
.expressive-mode__nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.expressive-mode__nav-btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}
.expressive-mode__nav-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #5b6cff, #5561ff);
  box-shadow: 0 12px 22px rgba(91,108,255,0.32);
}
.expressive-mode__nav-btn--primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(91,108,255,0.36);
}
.expressive-mode__nav-btn--ghost {
  color: var(--primary);
  background: rgba(91,108,255,0.12);
  box-shadow: var(--shadow-sm);
}
.expressive-mode__nav-btn--ghost:hover:not(:disabled) {
  transform: translateY(-2px);
  background: rgba(91,108,255,0.2);
}
.expressive-mode.is-loading .expressive-mode__nav-btn {
  opacity: 0.35;
  pointer-events: none;
}

@media (max-width: 600px) {
  .expressive-mode__dialog {
    padding: 24px;
    gap: 20px;
  }
  .expressive-mode__nav {
    flex-direction: column;
  }
  .expressive-mode__nav-btn {
    width: 100%;
  }
}

/* Word Explorer Modal */
body.word-explorer-open { overflow: hidden; }
.word-explorer[hidden] { display: none; }
.word-explorer {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1000;
}

.word-explorer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
}

.word-explorer__dialog {
  position: relative;
  width: min(520px, 92vw);
  max-height: min(85vh, 700px);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 32px 64px rgba(15, 23, 42, 0.3);
  z-index: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.word-explorer__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(15, 23, 42, 0.08);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.word-explorer__close:hover {
  background: rgba(15, 23, 42, 0.15);
  transform: scale(1.1);
}

.word-explorer__close:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.word-explorer__content {
  padding: 32px;
  overflow-y: auto;
}

.word-explorer__header {
  text-align: center;
  margin-bottom: 28px;
}

.word-explorer__emoji {
  font-size: 3.5rem;
  margin-bottom: 12px;
}

.word-explorer__title {
  margin: 0;
  font-size: 2rem;
  color: var(--primary);
  font-weight: 800;
}

.word-explorer__body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.word-explorer__section {
  background: var(--bg);
  border-radius: 16px;
  padding: 20px;
  border-left: 4px solid var(--primary);
}

.word-explorer__section-title {
  margin: 0 0 12px 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.word-explorer__definition,
.word-explorer__example,
.word-explorer__story {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
}

.word-explorer__actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.word-explorer__action-btn {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .16s ease, background-color .16s ease;
}

.word-explorer__action-btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.word-explorer__action-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #5b6cff, #5561ff);
  box-shadow: 0 12px 22px rgba(91,108,255,0.32);
}

.word-explorer__action-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(91,108,255,0.36);
}

.word-explorer__action-btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.word-explorer__action-btn--ghost {
  color: var(--primary);
  background: rgba(91,108,255,0.12);
  box-shadow: var(--shadow-sm);
}

.word-explorer__action-btn--ghost:hover {
  transform: translateY(-2px);
  background: rgba(91,108,255,0.2);
}

@media (max-width: 600px) {
  .word-explorer__content {
    padding: 24px;
  }
  
  .word-explorer__title {
    font-size: 1.6rem;
  }
  
  .word-explorer__actions {
    flex-direction: column;
  }
  
  .word-explorer__action-btn {
    width: 100%;
  }
}

/* Recipient picker: big kid-friendly cards */
.recipient-picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.recipient-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 160px;
  padding: 20px;
  border-radius: 24px;
  border: 1px solid #d9d9ee;
  background: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  font-weight: 800;
  color: var(--text);
  transition: transform .06s ease, box-shadow .15s ease;
}
.recipient-option:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.recipient-option:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }

.recipient-option__emoji {
  font-size: clamp(3rem, 8vw, 4.5rem);
  line-height: 1;
}
.recipient-option__text {
  font-size: clamp(1.4rem, 3.5vw, 1.9rem);
  text-align: center;
  line-height: 1.3;
}

@media (max-width: 600px) {
  .recipient-picker__grid {
    grid-template-columns: 1fr 1fr;
  }
  .recipient-option {
    min-height: 140px;
    padding: 18px;
  }
}

/* Prompt card */
.prompt-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  background: #f4f6ff;
  border: 1px dashed #cfd7ff;
  border-radius: 16px;
  margin-top: auto;
}
.prompt-card.is-busy { opacity: 0.8; }
.prompt-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prompt-card__text {
  margin: 0;
  font-weight: 700;
  font-size: 1.25rem;
  flex: 1;
}

.refresh-suggestions-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid var(--primary);
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-suggestions-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: rotate(90deg);
}

.refresh-suggestions-btn:active {
  transform: rotate(180deg) scale(0.95);
}

.refresh-suggestions-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.prompt-card__suggestions {
  display: flex;
  gap: 28px;
  justify-content: center;
  align-items: stretch;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 12px;
  padding-bottom: 4px;
}
.prompt-card__suggestions::-webkit-scrollbar { height: 6px; }
.prompt-card__suggestions::-webkit-scrollbar-thumb { background: rgba(91,108,255,0.35); border-radius: 999px; }
.suggestion {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 220px;
  padding: 24px;
  border-radius: 28px;
  border: 1px solid #d9d9ee;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  transition: transform .06s ease, box-shadow .15s ease;
  box-shadow: var(--shadow-sm);
  scroll-snap-align: center;
}
.suggestion__emoji {
  font-size: 4rem;
  line-height: 1;
}
/* Category buttons: match Story Maker emoji sizing */
.suggestion--category .suggestion__emoji {
  font-size: clamp(3rem, 8vw, 4.5rem);
}
.suggestion__emoji img.emoji {
  width: 4rem;
  height: 4rem;
  display: block;
}
/* Ensure category emoji images scale with font size like Story Maker */
.suggestion--category .suggestion__emoji img.emoji {
  width: 1em;
  height: 1em;
  display: inline-block;
}
.suggestion__text {
  font-size: 1.4rem;
  text-align: center;
  line-height: 1.35;
}
.suggestion[disabled] { opacity: 0.5; cursor: not-allowed; }
.suggestion:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.suggestion:focus { outline: 3px solid var(--ring); outline-offset: 2px; }

.prompt-card__form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.prompt-card__form input {
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid #d9d9ee;
  font-size: 1.15rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ask-ai textarea#ask-input {
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid #d9d9ee;
  font-size: 1.15rem;
  transition: border-color .15s ease, box-shadow .15s ease;
  resize: none;
}
.ask-ai textarea#ask-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(91,108,255,0.15);
}
.prompt-card__form button {
  min-width: 96px;
  font-size: 1.15rem;
  border-radius: 14px;
  padding: 0 20px;
}
.prompt-card__form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(91,108,255,0.15); }

button, input, textarea {
  font-family: inherit;
}

/* Buttons */
.btn { padding: 10px 12px; border-radius: 12px; border: 1px solid #d9d9ee; background: #fff; cursor: pointer; font-weight: 700; transition: transform .06s ease, box-shadow .15s ease, background-color .15s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn--primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn--primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn--ghost { background: transparent; }

.btn[aria-pressed="true"] { background: #e7ebff; border-color: #5b6cff; }

/* Token banner */
.token-banner { padding: 10px 12px; border-radius: 12px; background: #fff6d6; border: 1px solid #ffe08a; color: #6a4d00; font-weight: 700; box-shadow: var(--shadow-sm); }

/* Settings page */
.settings-container { padding: 24px 0 40px; }
.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  width: min(720px, 100%);
  margin: 24px auto 0;
}
.settings-title { margin: 0 0 12px; }
.settings-form { display: grid; gap: 16px; }
.settings-field { display: grid; gap: 8px; }
.settings-field label { font-weight: 700; }
.settings-field select, .settings-field input, .settings-field textarea {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #d9d9ee;
  font-size: 1.05rem;
}
.settings-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.settings-actions .btn { display: inline-flex; align-items: center; justify-content: center; }

/* Parent sheet */
.parent-sheet[hidden] { display: none; }
.parent-sheet__backdrop { position: fixed; inset: 0; background: rgba(2,6,23,0.45); opacity: 0; transition: opacity .2s ease; }
.parent-sheet__content { position: fixed; right: 0; top: 0; width: min(420px, 92vw); height: 100vh; background: #fff; border-left: 1px solid var(--border); padding: 20px; display: grid; grid-template-rows: auto 1fr auto; gap: 16px; box-shadow: -8px 0 24px rgba(2,6,23,0.12); transform: translateX(16px); opacity: 0; transition: transform .25s ease, opacity .25s ease; }
.parent-sheet__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }
.parent-sheet__stat { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid #e7e7ef; border-radius: 10px; }
.parent-sheet__actions { display: flex; justify-content: flex-end; }

.parent-sheet[hidden] .parent-sheet__backdrop { opacity: 0; }
.parent-sheet:not([hidden]) .parent-sheet__backdrop { opacity: 1; }
.parent-sheet:not([hidden]) .parent-sheet__content { transform: translateX(0); opacity: 1; }

.settings-sheet[hidden] { display: none; }
.settings-sheet__backdrop { position: fixed; inset: 0; background: rgba(2,6,23,0.45); opacity: 0; transition: opacity .2s ease; }
.settings-sheet__content { position: fixed; right: 16px; top: 80px; width: min(280px, 92vw); background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-md); display: grid; gap: 16px; opacity: 0; transform: translateY(-6px); transition: opacity .2s ease, transform .2s ease; }
.settings-sheet__label { font-weight: 600; }
.settings-sheet__select { padding: 10px 12px; border-radius: 10px; border: 1px solid #d9d9ee; font-weight: 600; }
.settings-sheet__actions { display: flex; justify-content: flex-end; gap: 8px; }
.settings-sheet:not([hidden]) .settings-sheet__backdrop { opacity: 1; }
.settings-sheet:not([hidden]) .settings-sheet__content { opacity: 1; transform: translateY(0); }

/* Visually hidden utility */
.visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

/* Stories Link */
.stories-link:hover {
  background: var(--bg) !important;
  color: var(--primary) !important;
}

/* Auth Modal */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.auth-modal__dialog {
  position: relative;
  background: white;
  border-radius: 16px;
  padding: 32px;
  width: min(420px, 90vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: authModalSlideIn 0.2s ease-out;
}
@keyframes authModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.auth-modal__dialog h2 {
  margin: 0 0 24px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}
.auth-modal__tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.auth-modal__tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.auth-modal__tab:hover {
  color: var(--text);
}
.auth-modal__tab--active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.auth-modal__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-modal__input {
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  transition: all 0.2s;
}
.auth-modal__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.1);
}
.auth-modal__submit {
  padding: 14px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-modal__submit:hover:not(:disabled) {
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(91, 108, 255, 0.3);
}
.auth-modal__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.auth-modal__error {
  min-height: 20px;
  color: #dc2626;
  font-size: 14px;
  text-align: center;
}
.auth-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-modal__close:hover {
  background: var(--border);
  color: var(--text);
}

/* Google Sign-In Button */
.auth-modal__google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: white;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  color: #3c4043;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 20px;
}

.auth-modal__google-btn:hover:not(:disabled) {
  background: #f8f9fa;
  box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
}

.auth-modal__google-btn:active {
  background: #f1f3f4;
}

.auth-modal__google-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-modal__google-btn svg {
  flex-shrink: 0;
}

/* Divider */
.auth-modal__divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0;
  color: #666;
  font-size: 14px;
}

.auth-modal__divider::before,
.auth-modal__divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #ddd;
}

.auth-modal__divider span {
  padding: 0 10px;
}

/* Responsive */
@media (max-width: 900px) {
  .app__main { padding: 16px 0 32px; }
  .assistant { width: 100%; }
  .assistant__panel { position: static; }
  .preview__card { height: clamp(220px, 32vh, 320px); }
  .prompt-card__suggestions { justify-content: flex-start; }
  .suggestion { flex: 0 0 200px; height: 200px; }
}

/* ============================================ */
/* ADD DETAILS MODAL STYLES */
/* ============================================ */

.add-details-dialog {
  max-width: 900px;
  width: 90vw;
}

.add-details-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
}

.add-details-left,
.add-details-right {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sentence-starters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sentence-starter-btn {
  padding: 1rem 1.5rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.sentence-starter-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.sentence-starter-btn.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(91, 108, 255, 0.3);
}

.sentence-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 200px;
}

.suggestion-btn {
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.suggestion-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.suggestion-placeholder {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 2rem;
  margin: 0;
}

.custom-input-section {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.custom-completion-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s ease;
}

.custom-completion-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.1);
}

.refresh-btn {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: rotate(90deg);
}

@media (max-width: 768px) {
  .add-details-dialog {
    max-width: 95vw;
  }
  
  .add-details-body {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .sentence-starter-btn {
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
  }
  
  .custom-input-section {
    flex-direction: column;
    align-items: stretch;
  }
  
  .refresh-btn {
    align-self: center;
    min-width: 60px;
  }
}

/* ============================================ */
/* VOCABULARY PAGE STYLES */
/* ============================================ */

/* ============================================ */
/* SIDEBAR NAVIGATION STYLES */
/* ============================================ */
:root {
  --sidebar-expanded-width: 220px;
  --sidebar-collapsed-width: 64px;
}

body.with-sidebar { padding-left: var(--sidebar-expanded-width); }
body.with-sidebar.sidebar-collapsed { padding-left: var(--sidebar-collapsed-width); }

.side-nav {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-expanded-width);
  background: #ffffff;
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
}
.sidebar-collapsed .side-nav { width: var(--sidebar-collapsed-width); }

.side-nav__inner { display: flex; flex-direction: column; height: 100%; }
.side-nav__toggle {
  border: none;
  background: transparent;
  font-size: 20px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
}
.side-nav__brand { display: flex; align-items: center; gap: 10px; padding: 12px; text-decoration: none; color: inherit; }
.side-nav__brand-icon { font-size: 20px; }
.side-nav__brand-text { font-weight: 700; }
.sidebar-collapsed .side-nav__brand-text { display: none; }

.side-nav__indicator { padding: 8px 12px; color: var(--muted); font-size: 13px; }
.sidebar-collapsed .side-nav__indicator { display: none; }

.side-nav__links { list-style: none; margin: 8px 0 0 0; padding: 0; flex: 1; }
.side-nav__item {}
.side-nav__link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-decoration: none; color: var(--text); border-radius: 8px; margin: 2px 8px; }
.side-nav__link:hover { background: var(--bg); }
.side-nav__icon { font-size: 20px; width: 24px; text-align: center; }
.side-nav__text { white-space: nowrap; }
.sidebar-collapsed .side-nav__text { display: none; }
.side-nav__item.is-active .side-nav__link { background: var(--bg); color: var(--primary); }

.side-nav__footer { padding: 12px; border-top: 1px solid var(--border); }
.side-nav__footer .auth-button { width: 100%; }

/* ============================================ */
/* LITTLE LETTERS PAGE STYLES */
/* ============================================ */

body.letters-page {
  --bg: #ffffff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  color: var(--text);
}

.letters-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.letters-header {
  position: sticky;
  top: 0;
  z-index: 12;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.2) blur(12px);
}

.letters-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 24px;
}

.letters-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
}

.letters-brand__icon {
  font-size: 28px;
}
.letters-brand__icon svg {
  width: 28px;
  height: 28px;
  display: block;
}

.letters-brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.letters-brand__name {
  font-size: 18px;
}

.letters-brand__sub {
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.letters-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.letters-nav__link {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.letters-nav__link:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(91, 108, 255, 0.3);
}

.letters-nav__link--active {
  background: linear-gradient(135deg, #5b6cff, #5561ff);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

.letters-nav__link--active:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.letters-nav__auth {
  padding: 8px 20px;
}

.letters-hero {
  padding: 72px 0 48px;
  background: #ffffff;
}

.letters-hero__inner {
  display: grid;
  gap: 48px;
  align-items: center;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.letters-eyebrow {
  margin: 0 0 12px 0;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.2em;
}

.letters-title {
  margin: 0;
  font-size: clamp(2.4rem, 2.8vw + 1.8rem, 3.4rem);
  line-height: 1.1;
  font-weight: 800;
}

.letters-subtitle {
  margin: 18px 0 32px 0;
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 540px;
}

.letters-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.letters-hero__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  background: #ffffff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.letters-hero__back:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.letters-hero__cta[disabled] {
  cursor: not-allowed;
  opacity: 0.7;
}

.letters-hero__card {
  background: #ffffff;
  border: none;
  border-radius: 24px;
  padding: 32px;
  box-shadow: none;
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text);
  position: relative;
}

/* Ensure Lottie artwork blends white to page background */
.letters-hero-lottie svg {
  display: block;
  width: 100%;
  height: 100%;
  background: #ffffff;
  mix-blend-mode: normal;
}

.letters-hero__caption {
  display: block;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--muted);
}

.letters-builder {
  padding: 56px 0 72px;
}

.letters-builder__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.letters-builder__header h2 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
}

.letters-builder__subtitle {
  margin: 8px 0 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.letters-builder__status {
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(91, 108, 255, 0.1);
  border: 1px dashed rgba(91, 108, 255, 0.35);
  color: var(--primary);
  font-weight: 600;
}

.letters-layout {
  display: grid;
  gap: 32px;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: start;
}

.letters-panel {
  background: var(--card);
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.letters-panel--inputs {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.letters-panel--preview {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.letters-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.letters-field-group {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.letters-field label,
.letters-field__label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--text);
}

.letters-field input,
.letters-field select,
.letters-field textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-size: 1rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.letters-field textarea {
  resize: vertical;
  min-height: 120px;
}

.letters-field input:disabled,
.letters-field select:disabled,
.letters-field textarea:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: rgba(91, 108, 255, 0.08);
  border-color: rgba(91, 108, 255, 0.15);
}

.letters-field__note {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.letters-tone-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.letters-pill {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px dashed rgba(91, 108, 255, 0.4);
  background: rgba(91, 108, 255, 0.1);
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.letters-pill:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.letters-pill--active {
  background: linear-gradient(135deg, #5b6cff, #5561ff);
  border-style: solid;
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 20px rgba(91, 108, 255, 0.25);
  cursor: pointer;
}

.letters-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.letters-buttons .btn {
  flex: 1 1 220px;
  min-width: 200px;
}

.letters-buttons .btn[disabled] {
  cursor: not-allowed;
  opacity: 0.7;
}

.letters-suggestions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.letters-suggestions h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.letters-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.letters-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.03);
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.letters-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.letters-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.letters-actions .btn {
  flex: 1 1 200px;
}

.letters-actions .btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.letters-prompt-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.letters-prompt-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.letters-prompt-card__question {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.letters-prompt-card__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.letters-prompt-card__suggestion {
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid rgba(91, 108, 255, 0.25);
  background: rgba(91, 108, 255, 0.12);
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.letters-prompt-card__suggestion:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  background: rgba(91, 108, 255, 0.2);
}

.letters-prompt-card__form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.letters-prompt-card__form input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.letters-prompt-card__form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(91, 108, 255, 0.15);
  outline: none;
}

.letters-prompt-card__submit {
  flex: 0 0 auto;
}

.letters-prompt-card__form--completed input {
  background: rgba(15, 23, 42, 0.05);
  cursor: not-allowed;
}

.letters-prompt-card__form--completed .letters-prompt-card__submit {
  cursor: not-allowed;
  opacity: 0.6;
}

.letters-assistant {
  background: rgba(91, 108, 255, 0.08);
  border: 1px solid rgba(91, 108, 255, 0.18);
  border-radius: 18px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.letters-assistant__encouragement {
  margin: 0;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}

.letters-assistant__suggestions {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.letters-preview-card {
  background: var(--bg);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.letters-preview-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.letters-preview-card__badge {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(91, 108, 255, 0.16);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.letters-preview-card__hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.letters-preview-card__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
}

.letters-preview-card__paragraphs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.letters-preview-card__placeholder {
  color: var(--muted);
  font-style: italic;
}

.letters-preview-card__line {
  margin: 0;
}

.letters-preview-card__line--salutation,
.letters-preview-card__line--closing {
  font-style: italic;
  color: var(--primary);
  font-weight: 600;
}

.letters-preview-card__line--signature {
  font-family: "ABeeZee", cursive;
  letter-spacing: 0.12em;
  color: rgba(15, 23, 42, 0.7);
}

.letters-collector-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
}

.letters-collector-list li {
  list-style: disc;
}

.letters-collector-list strong {
  color: var(--primary);
}

.letters-preview-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.letters-preview-card__status {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
}

.letters-preview-card__export {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.letters-preview-card__export:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  background: rgba(91, 108, 255, 0.1);
}

.letters-tips {
  background: rgba(91, 108, 255, 0.06);
  border-radius: 20px;
  padding: 24px;
  border: 1px solid rgba(91, 108, 255, 0.1);
}

.letters-tips h3 {
  margin: 0 0 16px 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.letters-tips ul {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text);
}

.letters-roadmap {
  padding: 72px 0;
  background: linear-gradient(180deg, rgba(91, 108, 255, 0.06), transparent 60%);
}

.letters-roadmap__inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.letters-roadmap__inner h2 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
}

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

.letters-roadmap__card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.letters-roadmap__card h3 {
  margin: 0 0 12px 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.letters-roadmap__card p {
  margin: 0;
  color: var(--muted);
}

.letters-footer {
  padding: 24px 0 36px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.letters-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.95rem;
  color: var(--muted);
}

.letters-footer__link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.letters-footer__link:hover {
  text-decoration: underline;
}

@media (max-width: 960px) {
  .letters-builder__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .letters-layout {
    grid-template-columns: 1fr;
  }

  .letters-buttons .btn {
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .letters-header__inner {
    flex-direction: column;
    justify-content: center;
    height: auto;
    padding: 16px 0;
  }

  .letters-nav {
    width: 100%;
    justify-content: center;
  }

  .letters-hero {
    padding: 56px 0 40px;
  }

  .letters-hero__inner {
    gap: 32px;
  }

  .letters-panel--inputs,
  .letters-panel--preview {
    padding: 24px;
  }

  .letters-preview-card__footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .letters-builder {
    padding: 40px 0 56px;
  }

  .letters-hero__card {
    padding: 24px;
  }
}

.vocabulary-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

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

.vocabulary-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 12px 0;
}

.vocabulary-subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0;
}

/* Stats Cards */
.vocabulary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: linear-gradient(135deg, #5b6cff, #5561ff);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  color: #fff;
  box-shadow: 0 8px 16px rgba(91, 108, 255, 0.25);
}

.stat-card__value {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.stat-card__label {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Search */
.vocabulary-search {
  margin-bottom: 32px;
}

.vocabulary-search__input {
  width: 100%;
  padding: 16px 20px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vocabulary-search__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.1);
}

/* Loading State */
.vocabulary-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.loading-spinner {
  font-size: 3rem;
  margin-bottom: 16px;
  animation: spin 2s linear infinite;
}

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

/* Empty State */
.vocabulary-empty {
  text-align: center;
  padding: 60px 20px;
}

.empty-state__icon {
  font-size: 5rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state__title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px 0;
}

.empty-state__text {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 400px;
  margin: 0 auto;
}

/* Words Grid */
.vocabulary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 1.1rem;
}

/* Word Card */
.word-card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
}

.word-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(2, 6, 23, 0.12);
  border-color: var(--primary);
}

.word-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.word-card__word {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0;
  flex: 1;
}

.word-card__age {
  background: rgba(91, 108, 255, 0.1);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.word-card__definition {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 16px 0;
  min-height: 60px;
}

.word-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.word-card__date {
  font-size: 0.85rem;
  color: var(--muted);
}

.word-card__delete {
  background: rgba(239, 68, 68, 0.1);
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.word-card__delete:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: scale(1.1);
}

/* Word Detail Modal */
body.word-detail-modal-open { overflow: hidden; }
.word-detail-modal[hidden] { display: none; }
.word-detail-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1000;
}

.word-detail-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
}

.word-detail-modal__dialog {
  position: relative;
  width: min(520px, 92vw);
  max-height: min(85vh, 700px);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 32px 64px rgba(15, 23, 42, 0.3);
  z-index: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.word-detail-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(15, 23, 42, 0.08);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.word-detail-modal__close:hover {
  background: rgba(15, 23, 42, 0.15);
  transform: scale(1.1);
}

.word-detail-modal__content {
  padding: 32px;
  overflow-y: auto;
}

.word-detail-modal__header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.word-detail-modal__title {
  font-size: 2rem;
  color: var(--primary);
  font-weight: 800;
  margin: 0 0 8px 0;
}

.word-detail-modal__meta {
  display: flex;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.word-detail-modal__body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.word-detail-modal__section {
  background: var(--bg);
  border-radius: 12px;
  padding: 16px;
}

.word-detail-modal__section h4 {
  margin: 0 0 10px 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.word-detail-modal__section p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
}

.word-detail-modal__actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.btn {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .16s ease, background-color .16s ease;
  font-family: inherit;
}

.btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #5b6cff, #5561ff);
  box-shadow: 0 12px 22px rgba(91,108,255,0.32);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(91,108,255,0.36);
}

.btn--ghost {
  color: var(--primary);
  background: rgba(91,108,255,0.12);
  box-shadow: var(--shadow-sm);
}

.btn--ghost:hover {
  transform: translateY(-2px);
  background: rgba(91,108,255,0.2);
}

.btn--danger {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 12px 22px rgba(239, 68, 68, 0.32);
}

.btn--danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(239, 68, 68, 0.36);
}

@media (max-width: 600px) {
  .vocabulary-title {
    font-size: 2rem;
  }

  .vocabulary-stats {
    grid-template-columns: 1fr;
  }

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

  .word-detail-modal__content {
    padding: 24px;
  }

  .word-detail-modal__title {
    font-size: 1.6rem;
  }

  .word-detail-modal__actions {
    flex-direction: column;
  }
}


/* ============================================ */
/* VOCABULARY PAGE STYLES */
/* ============================================ */



/* ============================================ */
/* PROFILE & SUBSCRIPTION PAGE STYLES */
/* ============================================ */

/* Profile Page Container */
.profile-page {
  min-height: 100vh;
  background: var(--background);
}

.profile-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* Subscription Current Plan */
.subscription-current {
  margin-bottom: 32px;
  padding: 24px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.subscription-tier-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Tier Badges */
.tier-badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tier-badge-free {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: white;
}

.tier-badge-plus {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
}

.tier-badge-business {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
}

.tier-badge-enterprise {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.tier-badge-school {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
}

.status-active {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-cancelled {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-past_due {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-paused {
  background: rgba(156, 163, 175, 0.1);
  color: #6b7280;
  border: 1px solid rgba(156, 163, 175, 0.3);
}

.status-expired {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
  border: 1px solid rgba(107, 114, 128, 0.3);
}

.status-trialing {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Subscription Info Grid */
.subscription-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-label {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 1.125rem;
  color: var(--text);
  font-weight: 600;
}

/* Billing History */
.billing-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.billing-history-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  align-items: center;
}

.billing-date {
  font-size: 0.95rem;
  color: var(--text);
}

.billing-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.billing-status {
  font-size: 0.875rem;
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 600;
}

.billing-status-paid,
.billing-status-refunded {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.billing-status-pending {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.billing-status-failed {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .subscription-info-grid {
    grid-template-columns: 1fr;
  }

  .billing-history-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .billing-date,
  .billing-amount {
    font-size: 0.875rem;
  }
}


/* ============================================ */
/* MODAL STYLES (for Enterprise Contact & Other Modals) */
/* ============================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

.modal__dialog {
  position: relative;
  background: var(--card, white);
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease-out;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

.modal__close:hover {
  color: var(--text);
}

.modal__body {
  color: var(--text);
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* Modal Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal Form Styles */
.modal form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.modal input,
.modal textarea {
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.2s;
}

.modal input:focus,
.modal textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.1);
}

.modal textarea {
  min-height: 120px;
  resize: vertical;
}

/* Verification Notice */
.verification-notice {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: #fff;
  border: 2px solid #fbbf24;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.1);
  margin: 16px 0;
  animation: slideInUp 0.3s ease-out;
}

.verification-notice__icon {
  font-size: 48px;
  flex-shrink: 0;
  animation: bounce 2s infinite;
}

.verification-notice__content {
  flex: 1;
}

.verification-notice__content h3 {
  margin: 0 0 8px 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #92400e;
  font-family: 'Comic Neue', cursive;
}

.verification-notice__content p {
  margin: 0 0 16px 0;
  color: #78350f;
  line-height: 1.5;
}

.verification-notice__content strong {
  color: #451a03;
}

.verification-notice__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn--small {
  padding: 8px 16px;
  font-size: 0.875rem;
  border-radius: 6px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.btn--primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn--secondary {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #d1d5db;
}

.btn--secondary:hover {
  background: #e5e7eb;
  color: #374151;
}

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

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translateY(0);
  }
  40%, 43% {
    transform: translateY(-8px);
  }
  70% {
    transform: translateY(-4px);
  }
  90% {
    transform: translateY(-2px);
  }
}

/* Responsive Modal */
@media (max-width: 768px) {
  .modal {
    padding: 0;
  }

  .modal__dialog {
    border-radius: 0;
    max-height: 100vh;
    height: 100vh;
    padding: 24px;
  }

  .modal__title {
    font-size: 1.25rem;
  }

  .verification-notice {
    flex-direction: column;
    text-align: center;
  }

  .verification-notice__actions {
    justify-content: center;
  }

  .btn--small {
    flex: 1;
    min-width: 120px;
  }
}
