@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600&family=Space+Grotesk:wght@400;500;600&display=swap');

/* ====== TOKENS ====== */
:root {
  --bg: #f5efe8;
  --bg-card: #fff;
  --bg-dark: #18161b;
  --bg-input: #fdfcfa;
  --bg-input-alt: #f5efe8;
  --neutral: #e8ddd4;
  --neutral-dark: #cdbfb3;
  --border: #e2d8cf;
  --border-light: #f0e6dc;
  --border-card: #efe5db;
  --primary: #c9463d;
  --primary-light: #fce8e5;
  --primary-dark: #972f29;
  --text: #1e1b1a;
  --text-heading: #18161b;
  --muted: #6b605a;
  --notice-bg: #fff7ed;
  --notice-border: #f5dcc5;
  --radius: 18px;
  --radius-lg: 28px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.06);
  --shadow: 0 12px 40px rgba(24,22,21,.12);
  --transition: .2s ease;
  --hero-bg: linear-gradient(135deg, #18161b 0%, #2a2535 100%);
  --hero-text: #faf6f1;
  --hero-muted: rgba(255,255,255,.55);
  --hero-subtle: rgba(255,255,255,.07);
  font-size: 16px;
}

/* ====== DARK THEME ====== */
[data-theme="dark"] {
  --bg: #111113;
  --bg-card: #1c1c1e;
  --bg-dark: #0a0a0b;
  --bg-input: #222224;
  --bg-input-alt: #1a1a1c;
  --neutral: #2a2a2e;
  --neutral-dark: #3a3a3e;
  --border: #333338;
  --border-light: #2a2a2e;
  --border-card: #2a2a2e;
  --primary: #e05549;
  --primary-light: #2a1515;
  --primary-dark: #ff7b70;
  --text: #e0ddd8;
  --text-heading: #f0ece6;
  --muted: #8a857f;
  --notice-bg: #2a2018;
  --notice-border: #443525;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.2);
  --shadow: 0 12px 40px rgba(0,0,0,.3);
  --hero-bg: linear-gradient(135deg, #0a0a0b 0%, #16141a 100%);
  --hero-text: #f0ece6;
  --hero-muted: rgba(255,255,255,.45);
  --hero-subtle: rgba(255,255,255,.05);
}

/* ====== GIMFY THEME ====== */
[data-theme="gimfy"] {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-dark: #846A6A;
  --bg-input: #ffffff;
  --bg-input-alt: #f5f5f7;
  --neutral: #f0e8e8;
  --neutral-dark: #d4c4c4;
  --border: #e0d5d5;
  --border-light: #f0e8e8;
  --border-card: #e8dede;
  --primary: #846A6A;
  --primary-light: #f5eded;
  --primary-dark: #6b5454;
  --text: #846A6A;
  --text-heading: #846A6A;
  --muted: #9a8585;
  --notice-bg: #faf5f5;
  --notice-border: #e8dede;
  --shadow-sm: 0 2px 8px rgba(132,106,106,.06);
  --shadow: 0 12px 40px rgba(132,106,106,.1);
  --hero-bg: linear-gradient(135deg, #846A6A 0%, #9a8080 100%);
  --hero-text: #fafafa;
  --hero-muted: rgba(255,255,255,.65);
  --hero-subtle: rgba(255,255,255,.12);
}
*,*::before,*::after{box-sizing:border-box}

body {
  margin: 0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.hidden { display: none !important; }

h1,h2,h3,h4 {
  font-family: 'Fraunces', serif;
  margin: 0 0 .5rem;
  color: var(--text-heading);
}
p { margin: 0 0 .6rem; color: var(--muted); line-height: 1.5; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .7rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: .3rem;
}

/* ====== USER BAR ====== */
.user-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: .6rem;
}
.user-bar > div {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.user-bar__email {
  font-size: .82rem;
  color: var(--hero-muted);
  font-weight: 500;
}
.user-bar__btn {
  border-color: var(--hero-subtle) !important;
  color: var(--hero-muted) !important;
  font-size: .78rem !important;
  padding: .35rem .8rem !important;
}
.user-bar__btn:hover {
  border-color: var(--hero-muted) !important;
  color: var(--hero-text) !important;
}

/* ====== HERO ====== */
.hero {
  padding: 2.5rem clamp(1.2rem, 3vw, 3rem) 2rem;
  background: var(--hero-bg);
  color: var(--hero-text);
  text-align: center;
}
.hero__inner {
  max-width: 960px;
  margin: 0 auto;
}
.hero__text {
  margin-bottom: .4rem;
}
.hero h1 {
  color: var(--hero-text);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  line-height: 1.15;
  margin-bottom: .2rem;
}
.hero .eyebrow { color: var(--hero-muted); }

/* ====== TAB NAV ====== */
.tab-nav {
  display: inline-flex;
  gap: .35rem;
  margin-top: 1.4rem;
  background: var(--hero-subtle);
  padding: .3rem;
  border-radius: 999px;
}
.tab-link {
  border: none;
  background: transparent;
  color: var(--hero-muted);
  font-weight: 600;
  font-size: .88rem;
  padding: .55rem 1.3rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-family: inherit;
}
.tab-link:hover { color: var(--hero-text); }
.tab-link.active {
  background: var(--bg);
  color: var(--text-heading);
}

/* ====== BUTTONS ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: none;
  border-radius: 999px;
  padding: .7rem 1.5rem;
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.primary.danger { background: #b5312a; }
.btn.secondary { background: var(--bg-dark); color: #fff; }
.btn.secondary:hover { opacity: .85; }
.btn.ghost {
  background: transparent;
  border: 1.5px solid var(--neutral-dark);
  color: var(--text);
}
.btn.ghost:hover { border-color: var(--text); }
.btn.ghost.danger { border-color: rgba(201,70,61,.35); color: var(--primary); }
.btn.small { padding: .5rem 1rem; font-size: .82rem; }
.btn:disabled { opacity: .4; cursor: default; }

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
}

.btn-file {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--neutral);
  color: var(--bg-dark);
  padding: .5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: .82rem;
  font-family: inherit;
  transition: background var(--transition);
}
.btn-file:hover { background: var(--neutral-dark); }
.btn-file input { display: none; }

/* ====== LAYOUT ====== */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.8rem clamp(1.2rem, 3vw, 3rem) 3rem;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(1.2rem, 3vw, 2.2rem);
}

.panel__header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.6rem;
}
.panel__actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ====== EDIT NOTICE ====== */
.edit-notice {
  display: flex;
  align-items: center;
  gap: .8rem;
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-radius: var(--radius);
  padding: .7rem 1.1rem;
  margin-bottom: 1.2rem;
  font-size: .9rem;
}
.edit-notice__badge {
  background: var(--primary);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .2rem .6rem;
  border-radius: 999px;
  flex-shrink: 0;
}
.edit-notice__title {
  flex: 1;
  font-weight: 600;
  color: var(--text-heading);
}

/* ====== FORM WIZARD ====== */
.form-wizard { display: flex; flex-direction: column; gap: 1.2rem; }

.stepper-head {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding-bottom: .2rem;
}
.step-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: .5rem 1rem;
  background: var(--neutral);
  font-weight: 600;
  font-size: .82rem;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,.08);
  font-size: .75rem;
  font-weight: 700;
}
.step-pill.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}
.step-pill.active .step-num {
  background: var(--primary);
  color: #fff;
}

.form-step { display: none; }
.form-step.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.stepper-nav {
  display: flex;
  justify-content: center;
  gap: .8rem;
  padding-top: .6rem;
}

/* ====== CARD ====== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.4rem;
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: .7rem;
}
.card h3 { color: var(--primary); font-size: 1.1rem; }

/* ====== FORM FIELDS ====== */
label {
  display: flex;
  flex-direction: column;
  font-size: .78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  gap: .25rem;
}
.field-pair {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: .6rem;
  align-items: end;
}
.label-sm { font-size: .72rem; }
.label-sm input {
  background: var(--bg-input-alt);
  border-color: var(--border);
}

input, textarea, select {
  padding: .65rem .85rem;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  font-size: .92rem;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text);
  transition: border-color var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
}
textarea { resize: vertical; min-height: 80px; }

/* ====== OPERA LIST ====== */
.opera-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
}
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  grid-column: 1 / -1;
}

.opera-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.3rem;
  border: 1.5px solid var(--border-card);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.opera-card:hover {
  border-color: var(--neutral-dark);
  box-shadow: var(--shadow-sm);
}
.opera-card__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .3rem 0 0;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 500;
  gap: .3rem;
  transition: color var(--transition);
}
.opera-card__toggle svg {
  transition: transform var(--transition);
}
.opera-card.expanded .opera-card__toggle svg {
  transform: rotate(180deg);
}
.opera-card__details {
  display: none;
}
.opera-card.expanded .opera-card__details {
  display: block;
}
.opera-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .5rem;
}
.opera-card__head h4 { font-size: 1.05rem; margin: 0; color: var(--text-heading); }
.opera-card__actions {
  display: flex;
  gap: .3rem;
  flex-shrink: 0;
}
.opera-card__actions button {
  background: none;
  border: 1.5px solid var(--neutral);
  border-radius: 10px;
  padding: .3rem .65rem;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  color: var(--muted);
}
.opera-card__actions button:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.opera-card__actions button.delete-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.opera-meta { font-size: .85rem; color: var(--muted); margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem; }
.chip {
  background: var(--neutral);
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 500;
}

.opera-steps { display: flex; flex-direction: column; gap: .6rem; margin-top: .4rem; }
.opera-step { border-top: 1px solid var(--border-light); padding-top: .5rem; }
.opera-step strong { color: var(--text-heading); font-size: .85rem; }
.detail-list {
  list-style: none;
  padding: 0;
  margin: .3rem 0 0;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.detail-list li { font-size: .85rem; color: var(--muted); line-height: 1.4; }
.detail-list strong { color: var(--primary-dark); font-weight: 600; }

/* ====== DYNAMIC COMP FIELDS ====== */
.comp-row {
  position: relative;
}
.comp-remove-btn {
  position: absolute;
  top: 0;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--muted);
  font-size: .85rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 1;
}
.comp-remove-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* ====== FLASHCARD ====== */
.fc-toolbar {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}
.fc-toolbar select {
  flex: 1;
  min-width: 180px;
}
.fc-toggles {
  display: flex;
  gap: .8rem;
  align-items: center;
}

/* ====== QUIZ MODE ====== */
.fc-quiz-options {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: .8rem;
}
.quiz-option {
  background: rgba(255,255,255,.08);
  border: 1.5px solid rgba(255,255,255,.15);
  border-radius: 12px;
  padding: .7rem 1rem;
  color: #f0e9e0;
  font-size: .9rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
  transition: all var(--transition);
}
.quiz-option:hover:not(.quiz-option--locked) {
  border-color: rgba(255,255,255,.4);
  background: rgba(255,255,255,.12);
}
.quiz-option--correct {
  border-color: #4caf50 !important;
  background: rgba(76,175,80,.2) !important;
  color: #a5d6a7 !important;
}
.quiz-option--wrong {
  border-color: #ef5350 !important;
  background: rgba(239,83,80,.15) !important;
  color: #ef9a9a !important;
}
.quiz-option--locked {
  cursor: default;
  opacity: .7;
}
.quiz-option--locked.quiz-option--correct,
.quiz-option--locked.quiz-option--wrong { opacity: 1; }

.fc-quiz-score {
  text-align: center;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  margin: .6rem 0 0;
}

.toggle {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.toggle input[type='checkbox'] {
  width: 40px;
  height: 22px;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid var(--neutral-dark);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  background: var(--bg);
  transition: all var(--transition);
  flex-shrink: 0;
}
.toggle input[type='checkbox']::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--neutral-dark);
  transition: transform var(--transition), background var(--transition);
}
.toggle input[type='checkbox']:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.toggle input[type='checkbox']:checked::after {
  transform: translateX(18px);
  background: #fff;
}

.fc-card {
  background: var(--bg-dark);
  color: #f0e9e0;
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 1.8rem;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .8rem;
  box-shadow: var(--shadow);
  position: relative;
}
.fc-card__label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: rgba(255,255,255,.35);
  margin: 0;
}
.fc-card__prompt {
  font-family: 'Fraunces', serif;
  font-size: 1.2rem;
  line-height: 1.4;
  margin: 0;
  color: #faf6f1;
}
.fc-card__answer {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity .3s ease, max-height .4s ease;
  font-size: .95rem;
  line-height: 1.55;
  color: #d4ccc3;
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 0;
  margin-top: 0;
  white-space: pre-line;
}
.fc-card.show-answer .fc-card__answer {
  opacity: 1;
  max-height: 600px;
  padding-top: .8rem;
  margin-top: .4rem;
}

.fc-actions {
  display: flex;
  justify-content: center;
  gap: .5rem;
  margin-top: 1rem;
}
.fc-actions .btn { min-width: 0; }
.fc-counter {
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
  margin-top: .8rem;
}

/* ====== FLASHCARD GATE ====== */
.fc-gate {
  text-align: center;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .8rem;
}
.fc-gate__lock {
  color: var(--muted);
  opacity: .5;
  margin-bottom: .4rem;
}
.fc-gate h2 {
  margin-bottom: .2rem;
}
.fc-gate > p {
  max-width: 420px;
  line-height: 1.55;
}
.fc-gate__buttons {
  display: flex;
  gap: .6rem;
  margin-top: .6rem;
  flex-wrap: wrap;
  justify-content: center;
}
.fc-gate__status {
  font-size: .85rem;
  margin-top: .6rem;
  min-height: 1.3em;
}
.fc-gate__status.error { color: var(--primary); }
.fc-gate__status.success { color: #2e7d32; }
.fc-gate__status.loading { color: var(--muted); }

.fc-content { display: flex; flex-direction: column; }

/* ====== SUBSCRIPTION ====== */
.fc-subscription {
  display: flex;
  justify-content: center;
  margin-top: 1.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--neutral);
}

/* ====== CONFIRM / AUTH DIALOG ====== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
}
.confirm-dialog {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 380px;
  width: 90%;
  box-shadow: var(--shadow);
  text-align: center;
}
.confirm-dialog p {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 1.4rem;
  line-height: 1.45;
}
.confirm-actions {
  display: flex;
  gap: .6rem;
  justify-content: center;
}

/* ====== AUTH DIALOG ====== */
.auth-dialog {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow);
  position: relative;
}
.auth-close {
  position: absolute;
  top: .8rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: .2rem;
  transition: color var(--transition);
}
.auth-close:hover { color: var(--text); }
.auth-tabs {
  display: flex;
  gap: .3rem;
  background: var(--neutral);
  border-radius: 999px;
  padding: .25rem;
  margin-bottom: 1.4rem;
}
.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: .55rem .8rem;
  font-size: .85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--muted);
  transition: all var(--transition);
}
.auth-tab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: .8rem;
}
.auth-form .btn {
  margin-top: .4rem;
  width: 100%;
}
.auth-status {
  font-size: .85rem;
  text-align: center;
  min-height: 1.3em;
  margin-top: .6rem;
  margin-bottom: 0;
}
.auth-status.error { color: var(--primary); }
.auth-status.success { color: #2e7d32; }

/* ====== PREMIUM BANNER ====== */
.premium-banner {
  background: var(--hero-bg);
  padding: 3rem clamp(1.2rem, 3vw, 3rem);
  text-align: center;
}
.premium-banner__inner {
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
}
.premium-banner__text h2 {
  color: var(--hero-text);
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  line-height: 1.2;
  margin-bottom: .4rem;
}
.premium-banner__text p {
  color: var(--hero-muted);
  margin: 0;
}
.premium-banner__text .eyebrow {
  color: var(--hero-muted);
}
.premium-btn {
  padding: .85rem 2.4rem;
  font-size: 1rem;
  box-shadow: 0 4px 20px rgba(201,70,61,.35);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.premium-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(201,70,61,.45);
}

/* ====== FOOTER ====== */
footer {
  text-align: center;
  padding: 2rem 1.5rem 1.5rem;
  font-size: .8rem;
  border-top: 1px solid var(--neutral);
  margin-top: 1rem;
}
.footer__credit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: .5rem;
  font-size: .78rem;
  color: var(--muted);
}
.footer__credit a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: opacity var(--transition);
}
.footer__credit a:hover { opacity: .7; }
.footer__logo {
  height: 18px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}

/* ====== NAVBAR ====== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg-card) 85%, transparent);
  border-bottom: 1px solid var(--border-light);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.navbar__inner {
  max-width: 1060px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .7rem clamp(1rem, 3vw, 2rem);
}
.navbar__logo {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-heading);
  text-decoration: none;
  cursor: pointer;
}
.navbar__right {
  display: flex;
  align-items: center;
  gap: .6rem;
}

/* ====== THEME SWITCHER ====== */
.theme-switcher {
  display: flex;
  gap: .25rem;
  background: var(--neutral);
  padding: .2rem;
  border-radius: 999px;
}
.theme-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  background: transparent;
}
.theme-btn::after {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: block;
}
.theme-btn[data-theme-val="default"]::after { background: #c9463d; }
.theme-btn[data-theme-val="dark"]::after { background: #333; }
.theme-btn[data-theme-val="gimfy"]::after { background: #846A6A; }
.theme-btn.active {
  border-color: var(--primary);
  background: var(--bg-card);
}

/* ====== NAVBAR AUTH ====== */
.nav-login-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: .45rem 1.1rem;
  font-size: .82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition);
}
.nav-login-btn:hover { background: var(--primary-dark); }
.nav-user {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.nav-user__email {
  font-size: .82rem;
  color: var(--muted);
  font-weight: 500;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-user__logout {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: .35rem .8rem;
  font-size: .78rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
}
.nav-user__logout:hover { border-color: var(--primary); color: var(--primary); }

/* ====== LANDING PAGE ====== */
.landing { overflow: hidden; }

.landing-hero {
  background: var(--hero-bg);
  padding: clamp(3rem, 8vw, 6rem) clamp(1.2rem, 3vw, 3rem) clamp(4rem, 9vw, 7rem);
  text-align: center;
  position: relative;
}
.landing-hero::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: clamp(30px, 5vw, 60px);
  background: var(--bg);
  clip-path: ellipse(55% 100% at 50% 100%);
}
.landing-hero h1 {
  color: var(--hero-text);
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
  margin-bottom: .8rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}
.landing-hero > p {
  color: var(--hero-muted);
  font-size: clamp(.95rem, 1.8vw, 1.15rem);
  max-width: 500px;
  margin: 0 auto 2rem;
  line-height: 1.55;
}
.landing-hero .eyebrow {
  color: var(--hero-muted);
  margin-bottom: .8rem;
}
.landing-cta-group {
  display: flex;
  gap: .8rem;
  justify-content: center;
  flex-wrap: wrap;
}
.landing-cta-group .btn { padding: .8rem 2rem; font-size: .95rem; }
.landing-cta-group .btn.ghost {
  border-color: var(--hero-subtle);
  color: var(--hero-muted);
}
.landing-cta-group .btn.ghost:hover {
  border-color: var(--hero-muted);
  color: var(--hero-text);
}

/* ====== FEATURES ====== */
.landing-features {
  max-width: 960px;
  margin: 0 auto;
  padding: 3rem clamp(1.2rem, 3vw, 3rem);
}
.landing-features h2 {
  text-align: center;
  margin-bottom: .4rem;
}
.landing-features > p {
  text-align: center;
  max-width: 480px;
  margin: 0 auto 2rem;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  max-width: 900px;
  margin: 0 auto;
}
.feature-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.feature-card:hover {
  border-color: var(--neutral-dark);
  box-shadow: var(--shadow-sm);
}
.feature-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .8rem;
}
.feature-card h3 {
  font-size: .95rem;
  margin-bottom: .3rem;
}
.feature-card p {
  font-size: .85rem;
  margin: 0;
  line-height: 1.5;
}
.feature-card__badge {
  display: inline-block;
  background: var(--neutral);
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .15rem .5rem;
  border-radius: 999px;
  margin-bottom: .6rem;
}
.feature-card__badge--premium {
  background: var(--primary-light);
  color: var(--primary);
}

/* ====== PRICING ====== */
.landing-pricing {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem clamp(1.2rem, 3vw, 3rem) 3.5rem;
}
.landing-pricing h2 {
  text-align: center;
  margin-bottom: .4rem;
}
.landing-pricing > p {
  text-align: center;
  max-width: 420px;
  margin: 0 auto 2rem;
}
.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}
.pricing-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2rem 1.6rem;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.pricing-card--featured {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  position: relative;
}
.pricing-card__tag {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .25rem .8rem;
  border-radius: 999px;
}
.pricing-card h3 {
  font-size: 1.1rem;
  margin-bottom: .1rem;
}
.pricing-card__price {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: .1rem;
}
.pricing-card__price span {
  font-size: .85rem;
  font-weight: 400;
  color: var(--muted);
  font-family: 'Space Grotesk', sans-serif;
}
.pricing-card__desc {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 1.2rem;
}
.pricing-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1;
}
.pricing-card li {
  font-size: .88rem;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  line-height: 1.4;
}
.pricing-card li::before {
  content: '';
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-light);
  flex-shrink: 0;
  margin-top: 2px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c9463d' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px;
}
.pricing-card .btn { width: 100%; }

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  .hero { padding: 2rem 1rem 1.6rem; }
  .hero h1 { font-size: 1.4rem; }

  .tab-nav {
    display: flex;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  .tab-link {
    flex: 1;
    text-align: center;
    padding: .5rem .6rem;
    font-size: .8rem;
    min-width: 0;
  }

  main { padding: 1.2rem .8rem 2rem; }
  .panel { padding: 1rem; border-radius: 20px; }

  .panel__header {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .panel__actions {
    justify-content: center;
    width: 100%;
  }

  .stepper-head {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .4rem;
  }
  .step-pill {
    font-size: .75rem;
    padding: .45rem .7rem;
    justify-content: center;
    text-align: center;
  }
  .step-num { width: 20px; height: 20px; font-size: .7rem; }

  .stepper-nav { flex-wrap: wrap; }
  .stepper-nav .btn { flex: 1; min-width: 120px; }

  .field-pair { grid-template-columns: 1fr; }
  .card { padding: 1rem; }

  .opera-list { grid-template-columns: 1fr; }
  .opera-card { padding: 1rem; }
  .opera-card__head { flex-direction: column; gap: .4rem; }
  .opera-card__actions { align-self: flex-end; }

  .fc-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .fc-toolbar select { width: 100%; min-width: 0; }
  .fc-toggles { width: 100%; justify-content: center; }
  .toggle { justify-content: center; }

  .fc-card { padding: 1.4rem 1.2rem; min-height: 180px; border-radius: 20px; }
  .fc-card__prompt { font-size: 1.05rem; }

  .fc-actions { flex-direction: row; flex-wrap: wrap; }
  .fc-actions .btn { flex: 1; min-width: 0; font-size: .82rem; padding: .6rem .5rem; }

  .confirm-dialog { margin: 1rem; padding: 1.5rem; }

  .edit-notice { flex-wrap: wrap; justify-content: center; text-align: center; }

  .fc-gate { padding: 2rem 1rem; }
  .fc-gate__buttons { width: 100%; }
  .fc-gate__buttons .btn { flex: 1; min-width: 0; }

  .premium-banner { padding: 2rem 1rem; }
  .premium-btn { width: 100%; }

  .user-bar { justify-content: center; }

  footer { padding: 1.5rem 1rem; }

  .navbar__inner { padding: .6rem .8rem; }
  .navbar__logo { font-size: .92rem; }
  .nav-user__email { display: none; }
  .theme-switcher { gap: .15rem; padding: .15rem; }
  .theme-btn { width: 24px; height: 24px; }
  .theme-btn::after { width: 12px; height: 12px; }

  .landing-hero { padding: 2.5rem 1rem 3.5rem; }
  .landing-hero h1 { font-size: 1.6rem; }
  .landing-cta-group { flex-direction: column; align-items: center; gap: .6rem; }
  .landing-cta-group .btn { width: 100%; max-width: 280px; }

  .landing-features { padding: 2rem 1rem; }
  .landing-features h2 { font-size: 1.3rem; }
  .features-grid { grid-template-columns: 1fr; gap: .8rem; }
  .feature-card { padding: 1.2rem; }
  .feature-card__icon { width: 36px; height: 36px; margin-bottom: .6rem; }

  .landing-pricing { padding: 1.5rem 1rem 2.5rem; }
  .landing-pricing h2 { font-size: 1.3rem; }
  .pricing-grid { grid-template-columns: 1fr; gap: 1.4rem; }
  .pricing-card { padding: 1.5rem 1.2rem; }
  .pricing-card__price { font-size: 1.6rem; }

  .auth-dialog { padding: 1.5rem; margin: .5rem; max-width: calc(100vw - 1rem); }
  .auth-form label { font-size: .72rem; }
}

@media (max-width: 380px) {
  .navbar__right { gap: .4rem; }
  .nav-login-btn { padding: .4rem .8rem; font-size: .75rem; }
  .nav-user__logout { padding: .3rem .6rem; font-size: .72rem; }
  .nav-user__email { max-width: 80px; font-size: .7rem; }
}
