/* ---------- Flash banners ---------- */

.ff-flash-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 30;
}

.ff-flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 14px;
  line-height: 1.4;
  animation: ff-flash-in .25s ease both;
}

.ff-flash__icon { flex: none; margin-top: 1px; font-size: 16px; }
.ff-flash__text { flex: 1; }

.ff-flash__close {
  flex: none;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: .55;
  padding: 0 2px;
  line-height: 1;
  font-size: 18px;
}
.ff-flash__close:hover { opacity: 1; }

.ff-flash--success {
  background: var(--ff-mint);
  border-color: var(--ff-mint-border);
  color: var(--ff-brand-dark);
}

.ff-flash--danger, .ff-flash--error {
  background: var(--ff-danger-bg);
  border-color: var(--ff-danger-border);
  color: var(--ff-danger-text);
}

.ff-flash--warning {
  background: var(--ff-warning-bg);
  border-color: var(--ff-warning-border);
  color: var(--ff-warning-text);
}

.ff-flash--info {
  background: var(--ff-info-bg);
  border-color: var(--ff-info-border);
  color: var(--ff-info-text);
}

/* ---------- Bootstrap modal → v2 sheet / dialog ---------- */

.ff-modal .modal-dialog {
  margin: 0;
  max-width: none;
  width: 100%;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  min-height: auto;
  pointer-events: none;
}

.ff-modal.show .modal-dialog { pointer-events: auto; }

.ff-modal .modal-content {
  width: 100%;
  border: 0;
  border-radius: var(--ff-radius-xl) var(--ff-radius-xl) 0 0;
  background: var(--ff-bg-page);
  box-shadow: 0 -12px 40px -8px rgba(9, 26, 18, .28);
  overflow: hidden;
  pointer-events: auto;
}

.ff-modal__handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: #d3ddd0;
  margin: 10px auto 0;
}

.ff-modal__header { padding: 14px 20px 0; }

.ff-modal__header--dark {
  position: relative;
  overflow: hidden;
  padding: 20px 20px 18px;
  background: var(--ff-gradient-card);
  color: #f4f8f1;
}

.ff-modal__header--dark .eyebrow { color: #9fd4b0; opacity: 1; }

.ff-modal__title {
  font-family: var(--ff-font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -.02em;
  margin: 6px 0 0;
  line-height: 1.15;
}

.ff-modal__title--sm { font-size: 18px; margin-top: 0; }

.ff-modal__sub {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--ff-muted);
  line-height: 1.45;
}

.ff-modal__header--dark .ff-modal__sub { color: rgba(244, 248, 241, .82); }

.ff-modal__meta {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: rgba(244, 248, 241, .65);
}

.ff-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.ff-modal__body { padding: 16px 20px; }

.ff-modal__footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 20px calc(16px + env(safe-area-inset-bottom));
}

.ff-modal__footer--row { flex-direction: row; gap: 10px; }
.ff-modal__footer--row .btn { flex: 1; }

.ff-modal--center .modal-dialog {
  position: relative;
  bottom: auto;
  left: auto;
  right: auto;
  margin: 1.75rem auto;
  max-width: min(calc(100% - 28px), 420px);
  align-items: center;
}

.ff-modal--center .modal-content {
  border-radius: var(--ff-radius-lg);
  border: 1px solid var(--ff-border);
}

.ff-modal--center .modal-header,
.ff-modal--center .modal-body,
.ff-modal--center .modal-footer {
  border: 0;
  background: transparent;
  padding-left: 20px;
  padding-right: 20px;
}

.ff-modal--center .modal-header { padding-top: 20px; padding-bottom: 0; }

.ff-modal--center .modal-title {
  font-family: var(--ff-font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -.01em;
}

.ff-modal--center .modal-body {
  padding-top: 12px;
  padding-bottom: 8px;
  color: var(--ff-text-soft);
  font-size: 14px;
}

.ff-modal--center .modal-footer {
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  gap: 8px;
}

.ff-modal--center .modal-footer .btn { border-radius: 12px; }
.ff-modal--danger .modal-title { color: #b42318; }

.ff-modal-backdrop.show {
  background: var(--ff-overlay);
  backdrop-filter: blur(2px);
}

@media (min-width: 576px) {
  .ff-modal:not(.ff-modal--center) .modal-dialog {
    position: relative;
    bottom: auto;
    margin: auto;
    max-width: min(calc(100% - 28px), 440px);
    align-items: center;
    min-height: calc(100% - 3.5rem);
  }

  .ff-modal:not(.ff-modal--center) .modal-content {
    border-radius: var(--ff-radius-xl);
    border: 1px solid var(--ff-border);
  }

  .ff-modal__handle { display: none; }
}

.ff-round-score {
  background: var(--ff-surface);
  border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius-md);
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 14px;
  align-items: center;
}

.ff-round-score__main { text-align: center; }

.ff-round-score__val {
  font-family: var(--ff-font-display);
  font-weight: 700;
  font-size: 42px;
  line-height: 1;
  color: var(--ff-brand);
  letter-spacing: -.03em;
}

.ff-round-score__lbl {
  font-family: var(--ff-font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ff-muted-light);
  margin-top: 4px;
}

.ff-round-score__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ff-round-score__item span { display: block; font-size: 11px; color: #8a968c; }
.ff-round-score__item strong { font-size: 16px; color: var(--ff-text); }

.ff-round-score__note {
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--ff-muted-light);
}

/* ---------- FF dialog (alert / confirm / prompt) ---------- */

#ffDialogRoot {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: var(--ff-pad-x);
}

#ffDialogRoot.is-open { display: flex; }

.ff-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: var(--ff-overlay);
  backdrop-filter: blur(2px);
  animation: fade-in .2s ease both;
}

.ff-dialog-card {
  position: relative;
  z-index: 1;
  width: min(100%, 400px);
  background: var(--ff-bg-page);
  border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius-lg);
  padding: 20px;
  box-shadow: var(--ff-shadow-sheet);
  animation: drop-in .28s cubic-bezier(.2, .8, .2, 1) both;
}

.ff-dialog-card__title {
  font-family: var(--ff-font-display);
  font-weight: 700;
  font-size: 18px;
  margin: 0 0 8px;
  color: var(--ff-text);
}

.ff-dialog-card__msg {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ff-text-soft);
}

.ff-dialog-card__input {
  width: 100%;
  margin-bottom: 14px;
  border-radius: 12px;
  border: 1px solid var(--ff-border);
  padding: 12px 14px;
  font-size: 15px;
  background: var(--ff-surface);
}

.ff-dialog-card__actions { display: flex; gap: 8px; }
.ff-dialog-card__actions .btn { flex: 1; border-radius: 12px; }

@media (min-width: 576px) {
  #ffDialogRoot { align-items: center; }
}

/* ---------- Toasts ---------- */

.ff-toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1900;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(calc(100% - 28px), 420px);
  pointer-events: none;
}

.ff-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--ff-brand-dark);
  color: #f4f8f1;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 14px 34px -10px rgba(9, 26, 18, .45);
  animation: ff-toast-in .28s cubic-bezier(.2, .8, .2, 1) both;
}

.ff-toast.is-leaving { animation: ff-toast-out .2s ease both; }
.ff-toast__icon { font-size: 16px; color: var(--ff-accent); flex: none; }

@media (min-width: 992px) {
  .ff-toast-stack { bottom: 24px; }
}

body.ff-body--overlay-open { overflow: hidden; }
