/* ── Formula Flashcards Plugin – scoped to .fmf-app ── */
@import url('https://fonts.googleapis.com/css2?family=Frank+Ruhl+Libre:wght@300;400;700;900&family=Noto+Serif+Hebrew:wght@300;400;700&display=swap');

.fmf-app {
  --fmf-bg:           #F1F6F4;
  --fmf-surface:      #FFFFFF;
  --fmf-surface2:     #BFD9CF;
  --fmf-gold:         #027E7F;
  --fmf-gold-light:   #4EAAAB;
  --fmf-gold-dim:     #014B4C;
  --fmf-green:        #027E7F;
  --fmf-green-light:  #4EAAAB;
  --fmf-red:          #D81757;
  --fmf-red-light:    #E45D89;
  --fmf-text:         #11221C;
  --fmf-text-dim:     #88908D;
  --fmf-text-muted:   #ABB1AF;


  box-sizing: border-box;
  color: var(--fmf-text);
  background: var(--fmf-bg);
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 12px;
  overflow: hidden;
  position: relative;
}

.fmf-app *, .fmf-app *::before, .fmf-app *::after {
  box-sizing: border-box;
}

/* background glow */
.fmf-app::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(139,92,42,.06) 0%, transparent 55%),
    radial-gradient(ellipse 50% 70% at 85% 90%, rgba(90,122,74,.05) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.fmf-app > * { position: relative; z-index: 1; }

/* ── Header ── */
.fmf-header {
  width: 100%; text-align: center;
  padding: 12px 0 6px; flex-shrink: 0;
}
.fmf-title-zh { font-size: 10px; letter-spacing: 6px; color: var(--fmf-gold-dim); margin-bottom: 2px; }
.fmf-title    { font-size: 20px; font-weight: 900; color: var(--fmf-gold-light); margin: 0; }

/* ── Category select ── */
.fmf-cat-select-wrap {
  width: 100%; flex-shrink: 0;
  padding: 4px 0 6px; position: relative;
}
.fmf-cat-select {
  width: 100%;
  background: var(--fmf-surface);
  border: 1px solid var(--fmf-surface2);
  color: var(--fmf-gold);
  font-family: inherit; font-size: 13px;
  padding: 9px 14px 9px 36px;
  border-radius: 10px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  outline: none; direction: rtl;
  transition: border-color .2s;
}
.fmf-cat-select:focus { border-color: var(--fmf-gold-dim); }
.fmf-cat-select option { background: #e8ddd0; color: var(--fmf-text); }
.fmf-cat-arrow {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--fmf-gold-dim); font-size: 12px;
}

/* ── Progress ── */
.fmf-progress-wrap { width: 100%; margin: 4px 0; flex-shrink: 0; }
.fmf-progress-track {
  height: 3px; background: var(--fmf-surface2); border-radius: 2px;
  overflow: hidden; margin-bottom: 8px;
}
.fmf-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--fmf-gold-dim), var(--fmf-gold));
  border-radius: 2px; transition: width .4s ease; width: 0%;
}
.fmf-progress-info {
  display: flex; justify-content: space-between; align-items: center;
}
.fmf-badge {
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.fmf-badge-known   { background: rgba(90,122,74,.18);  color: var(--fmf-green); }
.fmf-badge-unknown { background: rgba(139,58,42,.18);  color: var(--fmf-red); }
.fmf-badge-left    { background: rgba(139,92,42,.12);  color: var(--fmf-gold); }

/* ── Round badge ── */
.fmf-round-badge {
  font-size: 11px; color: var(--fmf-text-muted);
  text-align: center; flex-shrink: 0;
  letter-spacing: 1px; min-height: 16px;
}

/* ── Stack area ── */
.fmf-stack-area {
  position: relative; flex: 1; width: 100%;
  display: flex; align-items: stretch; justify-content: center;
  min-height: 0; padding: 10px 0 6px;
}

.fmf-stack-shadow {
  position: absolute; left: 50%;
  width: calc(100% - 32px); max-width: 420px;
  border-radius: 18px; pointer-events: none;
}
.fmf-stack-shadow-1 {
  top: 16px; bottom: 2px;
  transform: translateX(-50%) scale(.96);
  background: var(--fmf-surface2); opacity: .5;
  border: 1px solid rgba(255,255,255,.03);
}
.fmf-stack-shadow-2 {
  top: 24px; bottom: -4px;
  transform: translateX(-50%) scale(.91);
  background: var(--fmf-surface); opacity: .3;
  border: 1px solid rgba(255,255,255,.02);
}

/* ── Card container ── */
.fmf-card-container {
  position: relative;
  width: calc(100% - 32px); max-width: 420px;
  cursor: grab; touch-action: none; z-index: 10;
  display: flex; flex-direction: column;
}
.fmf-card-container:active { cursor: grabbing; }

/* ── Card ── */
.fmf-card {
  width: 100%; flex: 1; min-height: 0;
  background: var(--fmf-surface);
  border: 1px solid var(--fmf-surface2);
  border-radius: 18px; padding: 24px 24px 36px;
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  box-shadow: 0 4px 24px rgba(139,92,42,.10), 0 1px 0 rgba(255,255,255,.8) inset;
  user-select: none;
}
.fmf-card::before {
  content: '';
  position: absolute; top: 0; left: 10%; right: 10%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(76,168,201,.3), transparent);
}

/* Swipe overlays */
.fmf-overlay-know, .fmf-overlay-unknown {
  position: absolute; inset: 0; border-radius: 18px;
  opacity: 0; pointer-events: none; transition: opacity .1s;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px; font-weight: 900; letter-spacing: 2px;
}
.fmf-overlay-know    { background: rgba(90,122,74,.15);  color: var(--fmf-green); border: 2px solid var(--fmf-green); }
.fmf-overlay-unknown { background: rgba(139,58,42,.15);  color: var(--fmf-red);   border: 2px solid var(--fmf-red); }

/* Card content */
.fmf-card-category {
  font-size: 10px; letter-spacing: 3px; color: var(--fmf-gold-dim);
  margin-bottom: 10px; flex-shrink: 0;
}
.fmf-card-name {
  font-size: clamp(20px, 4.5vw, 30px); font-weight: 700;
  color: var(--fmf-gold-light); font-style: italic;
  margin-bottom: 14px; line-height: 1.2; flex-shrink: 0;
}
.fmf-card-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--fmf-surface2), transparent);
  margin-bottom: 14px; flex-shrink: 0;
}
.fmf-card-props-label {
  font-size: 10px; letter-spacing: 3px; color: var(--fmf-text-muted);
  margin-bottom: 8px; flex-shrink: 0;
}
.fmf-card-props {
  font-size: 13px; line-height: 1.7; color: var(--fmf-text);
  font-weight: 300; flex: 1; min-height: 0; overflow-y: auto;
}
.fmf-card-props::-webkit-scrollbar { width: 3px; }
.fmf-card-props::-webkit-scrollbar-thumb { background: var(--fmf-surface2); border-radius: 2px; }
.fmf-card-number {
  position: absolute; bottom: 10px; left: 16px;
  font-size: 10px; color: var(--fmf-text-muted);
}

/* Swipe hints */
.fmf-swipe-hints {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 100%; left: 0;
  display: flex; justify-content: space-between;
  pointer-events: none; z-index: 5; padding: 0 4px;
}
.fmf-hint { font-size: 20px; opacity: .18; padding: 8px; }
.fmf-hint-know    { color: var(--fmf-green-light); }
.fmf-hint-unknown { color: var(--fmf-red-light); }

/* ── Buttons ── */
.fmf-btn-row {
  display: flex; gap: 14px; justify-content: center;
  flex-shrink: 0; padding-top: 10px; width: 100%;
}
.fmf-btn {
  flex: 1; max-width: 150px; padding: 11px 10px;
  border-radius: 14px; font-family: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; border: none;
  transition: transform .15s;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.fmf-btn:active { transform: scale(.94); }
.fmf-btn-unknown { background: rgba(139,58,42,.12); color: var(--fmf-red);   border: 1px solid var(--fmf-red); }
.fmf-btn-know    { background: rgba(90,122,74,.12);  color: var(--fmf-green); border: 1px solid var(--fmf-green); }
.fmf-btn-unknown:hover { background: rgba(139,58,42,.22); }
.fmf-btn-know:hover    { background: rgba(90,122,74,.22); }
.fmf-btn-icon  { font-size: 22px; line-height: 1; }
.fmf-btn-label { font-size: 12px; letter-spacing: 1px; opacity: .8; }

/* ── Done screen ── */
.fmf-done-screen {
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px 20px;
  flex: 1; width: 100%;
}
.fmf-done-screen.show { display: flex; animation: hbfFadeUp .6s ease; }
@keyframes hbfFadeUp { from { opacity:0; transform:translateY(24px); } to { opacity:1; transform:translateY(0); } }
.fmf-done-zh    { font-size: 40px; color: var(--fmf-gold-dim); margin-bottom: 8px; }
.fmf-done-title { font-size: 32px; font-weight: 900; color: var(--fmf-gold-light); margin-bottom: 6px; }
.fmf-done-sub   { font-size: 14px; color: var(--fmf-text-dim); margin-bottom: 24px; line-height: 1.7; }
.fmf-done-sub span { color: var(--fmf-gold); }
.fmf-done-btn-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.fmf-done-btn {
  padding: 12px 24px; border-radius: 12px;
  font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; border: none; transition: transform .15s;
}
.fmf-done-btn:active { transform: scale(.94); }
.fmf-done-btn-repeat  { background: rgba(139,58,42,.12); color: var(--fmf-red);  border: 1px solid var(--fmf-red); }
.fmf-done-btn-restart { background: rgba(139,92,42,.12);  color: var(--fmf-gold); border: 1px solid var(--fmf-gold-dim); }
