/* style.css — Fruit Fusion UI component system
   Skin-driven via CSS custom properties set by skins.js applySkinToDOM() */

/* ── Custom Properties (defaults, overridden by skin) ────── */

:root {
  --skin-accent: #F6C564;
  --skin-accent-alt: #E8B84C;
  --skin-bg: #0A0D15;
  --skin-font-display: 'Nunito Sans', sans-serif;
  --skin-font-mono: 'IBM Plex Mono', monospace;
  --skin-panel-bg: rgba(255,255,255,0.02);
  --skin-panel-border: rgba(255,255,255,0.04);
  --theme-text: #ffffff;
  --theme-text-secondary: rgba(255,255,255,0.6);
}

/* ── Reset & Base ───────────────────────────────────────── */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  font-family: var(--skin-font-display);
  background: var(--skin-bg);
  color: var(--theme-text);
}
/* Canvas fills viewport minus action bar; --action-bar-h set dynamically by showActionBar() */
#game-canvas { display: block; width: 100%; height: calc(100% - var(--action-bar-h, 0px)); touch-action: none; }
#screen-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  background: var(--skin-bg);
  transition: opacity 80ms ease-out;
}
#screen-overlay.hidden { display: none; }
/* In-game overlay: transparent so game renders behind */
#screen-overlay.ff-overlay-transparent {
  background: rgba(0,0,0,0.6);
}
/* Settings preview: floating sheet overlapping game area */
#screen-overlay.ff-overlay-settings-preview {
  background: transparent;
  align-items: flex-start;
  justify-content: center;
  pointer-events: none;
  /* Position sheet starting near the danger line area (~20% from top) */
  padding-top: 18vh;
  padding-bottom: 80px;
}
#screen-overlay.ff-overlay-settings-preview .ff-screen {
  height: auto;
  max-height: calc(82vh - 80px); /* Fill from top padding to action bar */
  width: calc(100% - 16px);
  max-width: 480px;
  margin: 0 8px;
  background: var(--skin-bg, #0A0D15);
  border: 1px solid var(--skin-accent, #F6C564);
  border-radius: 16px;
  padding: 8px 16px 12px;
  overflow-y: auto;
  pointer-events: auto;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
/* Tighter spacing in preview mode */
#screen-overlay.ff-overlay-settings-preview .ff-screen__header { display: none; }
#screen-overlay.ff-overlay-settings-preview .ff-settings-group { margin-bottom: 4px; }
#screen-overlay.ff-overlay-settings-preview .ff-danger-btn { display: none; }
#screen-overlay.ff-overlay-settings-preview .ff-screen__body { padding-top: 4px; }
.ff-settings-done {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  background: var(--skin-accent, #F6C564);
  color: var(--skin-bg, #0A0D15);
  font-weight: 700;
}

/* ── Screen Layout ──────────────────────────────────────── */

.ff-screen {
  width: 100%;
  max-width: 480px;
  height: 100%;
  margin: 0 auto;
  padding: env(safe-area-inset-top, 16px) 24px env(safe-area-inset-bottom, 16px);
  display: flex;
  flex-direction: column;
  animation: ff-fade-in 180ms ease-out;
}
.ff-screen__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  flex-shrink: 0;
}
.ff-screen__title {
  font-family: var(--skin-font-display);
  font-size: clamp(16px, 4vw, 20px);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--theme-text);
}
.ff-screen__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
}
.ff-screen__footer {
  flex-shrink: 0;
  padding: 12px 0 16px;
}

/* ── Button ─────────────────────────────────────────────── */

.ff-btn {
  font-family: var(--skin-font-display);
  font-weight: 700;
  font-size: clamp(14px, 3.5vw, 18px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  min-height: 48px;
  padding: 12px 24px;
  width: 100%;
  transition: transform 80ms ease, opacity 80ms ease;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ff-btn:active {
  transform: scale(0.96);
  opacity: 0.9;
}
.ff-btn--primary {
  background: var(--skin-accent);
  color: #000;
}
.ff-btn--primary:active {
  background: var(--skin-accent-alt);
}
.ff-btn--secondary {
  background: transparent;
  border: 2px solid var(--skin-accent);
  color: var(--skin-accent);
}
.ff-btn--ghost {
  background: transparent;
  color: var(--skin-accent);
  opacity: 0.7;
  min-height: 40px;
  font-size: clamp(12px, 3vw, 14px);
  letter-spacing: 0.04em;
}
.ff-btn--danger {
  color: #E74C3C;
  opacity: 0.6;
}
.ff-btn--danger:active { opacity: 1; }
.ff-btn--icon {
  width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 50%;
  font-size: 20px;
  background: var(--skin-panel-bg);
  color: var(--skin-accent);
  border: 1px solid var(--skin-panel-border);
  flex-shrink: 0;
}
/* Stack spacing only for non-grid button lists */
.ff-btn + .ff-btn { margin-top: 8px; }
.ff-menu__grid .ff-btn + .ff-btn { margin-top: 0; }
.ff-menu__grid .ff-btn { min-height: 44px; font-size: clamp(12px, 3vw, 14px); }

/* ── Panel ──────────────────────────────────────────────── */

.ff-panel {
  background: var(--skin-panel-bg);
  border: 1px solid var(--skin-panel-border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}
.ff-panel__title {
  font-family: var(--skin-font-display);
  font-size: clamp(11px, 2.5vw, 13px);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--theme-text-secondary);
  margin-bottom: 12px;
}

/* ── Mode Card ──────────────────────────────────────────── */

.ff-mode-card {
  background: var(--skin-panel-bg);
  border: 1px solid var(--skin-panel-border);
  border-left: 4px solid transparent;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 80ms ease;
}
.ff-mode-card:active {
  transform: scale(0.98);
  background: rgba(255,255,255,0.04);
}
.ff-mode-card.is-selected {
  border-left-color: var(--skin-accent);
  background: rgba(255,255,255,0.03);
}
.ff-mode-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ff-mode-card__name {
  font-family: var(--skin-font-display);
  font-weight: 700;
  font-size: clamp(15px, 3.5vw, 17px);
  color: var(--theme-text);
}
.ff-mode-card__icon {
  font-size: 20px;
  opacity: 0.6;
}
.ff-mode-card__desc {
  font-size: clamp(12px, 2.8vw, 14px);
  color: var(--theme-text-secondary);
  margin-top: 4px;
}
.ff-mode-card__score {
  font-family: var(--skin-font-mono);
  font-size: clamp(11px, 2.5vw, 13px);
  color: var(--skin-accent);
  margin-top: 8px;
  opacity: 0.7;
}
.ff-mode-card__score::before {
  content: '★ ';
  opacity: 0.8;
}

/* ── Mode Group (collapsible) ──────────────────────────── */

.ff-mode-group {
  background: var(--skin-panel-bg);
  border: 1px solid var(--skin-panel-border);
  border-radius: 12px;
  margin-bottom: 8px;
  overflow: hidden;
}
.ff-mode-group__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
}
.ff-mode-group__icon { font-size: 18px; opacity: 0.6; }
.ff-mode-group__label {
  font-family: var(--skin-font-display);
  font-weight: 700;
  font-size: clamp(14px, 3.2vw, 16px);
  color: var(--theme-text-secondary);
  flex: 1;
}
.ff-mode-group__arrow {
  font-size: 14px;
  color: var(--theme-text-secondary);
  transition: transform 150ms ease;
}
.ff-mode-group__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 200ms ease;
  padding: 0 8px;
}
.ff-mode-group.is-expanded .ff-mode-group__body {
  max-height: 400px;
  padding: 0 8px 8px;
}
.ff-mode-group.is-expanded .ff-mode-group__arrow {
  transform: rotate(0deg);
}
.ff-mode-group__body .ff-mode-card {
  border: none;
  border-left: 4px solid transparent;
  background: rgba(255,255,255,0.02);
  margin-bottom: 4px;
}
.ff-mode-group__body .ff-mode-card.is-selected {
  border-left-color: var(--skin-accent);
  background: rgba(255,255,255,0.04);
}

/* ── Skin Card ──────────────────────────────────────────── */

.ff-skin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ff-skin-card {
  background: var(--skin-panel-bg);
  border: 2px solid var(--skin-panel-border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, transform 80ms ease;
}
.ff-skin-card:active { transform: scale(0.96); }
.ff-skin-card.is-active { border-color: var(--skin-accent); }
.ff-skin-card.is-locked { opacity: 0.5; pointer-events: none; }
.ff-skin-card__preview { font-size: 24px; letter-spacing: 2px; margin-bottom: 8px; }
.ff-skin-card__name { font-weight: 700; font-size: 14px; }
.ff-skin-card__badge {
  font-size: 11px; color: var(--skin-accent); margin-top: 4px;
  text-transform: uppercase; letter-spacing: 0.08em;
}

/* ── Stat Row ───────────────────────────────────────────── */

.ff-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.ff-stat-row:last-child { border-bottom: none; }
.ff-stat-row__label { font-size: clamp(13px, 3vw, 15px); color: var(--theme-text-secondary); }
.ff-stat-row__value {
  font-family: var(--skin-font-mono);
  font-size: clamp(14px, 3.2vw, 16px);
  font-weight: 700; color: var(--theme-text);
}

/* ── Score Display ──────────────────────────────────────── */

.ff-score { text-align: center; padding: 24px 0; }
.ff-score__value {
  font-family: var(--skin-font-mono);
  font-size: clamp(40px, 10vw, 56px);
  font-weight: 700; color: var(--skin-accent); line-height: 1;
}
.ff-score__label {
  font-size: 12px; color: var(--theme-text-secondary);
  text-transform: uppercase; letter-spacing: 0.1em; margin-top: 4px;
}
.ff-score.is-new-best .ff-score__value {
  animation: ff-glow-pulse 1.5s ease-in-out infinite;
}

/* ── Slider ─────────────────────────────────────────────── */

.ff-slider { margin-bottom: 16px; }
.ff-slider__label { font-size: 14px; color: var(--theme-text-secondary); }
.ff-slider__input {
  -webkit-appearance: none; width: 100%; height: 6px;
  border-radius: 3px; background: var(--skin-panel-border);
  outline: none; margin-top: 8px;
}
.ff-slider__input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px;
  border-radius: 50%; background: var(--skin-accent); cursor: pointer;
}

/* ── Toggle ─────────────────────────────────────────────── */

.ff-toggle {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; cursor: pointer; min-height: 48px;
}
.ff-toggle__label { font-size: 14px; color: var(--theme-text-secondary); }
.ff-toggle__switch {
  width: 44px; height: 24px; border-radius: 12px;
  background: var(--skin-panel-border); position: relative;
  transition: background 150ms ease; flex-shrink: 0;
}
.ff-toggle__switch.is-on { background: var(--skin-accent); }
.ff-toggle__dot {
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  position: absolute; top: 2px; left: 2px; transition: left 150ms ease;
}
.ff-toggle__switch.is-on .ff-toggle__dot { left: 22px; }

/* ── Pill Buttons ───────────────────────────────────────── */

.ff-pills { display: flex; gap: 6px; margin-top: 8px; }
.ff-pill {
  font-family: var(--skin-font-mono); font-size: 12px; font-weight: 700;
  padding: 4px 12px; border-radius: 20px;
  border: 1px solid var(--skin-panel-border);
  background: transparent; color: var(--theme-text-secondary);
  cursor: pointer; transition: all 150ms ease;
}
.ff-pill.is-active {
  background: var(--skin-accent); border-color: var(--skin-accent); color: #000;
}

/* ── Menu-Specific ──────────────────────────────────────── */

.ff-menu { justify-content: center; text-align: center; position: relative; overflow: hidden; }
.ff-menu::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 20%, var(--skin-accent) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, var(--skin-accent) 0%, transparent 50%);
  opacity: 0.03;
  pointer-events: none;
}
.ff-menu__hero {
  margin-bottom: 8px;
  opacity: 0.9;
}
.ff-menu__fruits {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  margin-bottom: 8px;
  max-width: 340px;
}
.ff-menu__fruit {
  display: inline-block;
  image-rendering: auto;
}
/* Fallback for emoji if draw function unavailable */
.ff-menu__emoji {
  display: inline-block; font-size: 32px; margin: 0 4px;
}
.ff-menu__emoji:nth-child(1) { animation: ff-bob 3s ease-in-out infinite; }
.ff-menu__emoji:nth-child(2) { animation: ff-bob 3s ease-in-out 0.4s infinite; }
.ff-menu__emoji:nth-child(3) { animation: ff-bob 3s ease-in-out 0.8s infinite; }
.ff-menu__emoji:nth-child(4) { animation: ff-bob 3s ease-in-out 1.2s infinite; }
.ff-menu__emoji:nth-child(5) { animation: ff-bob 3s ease-in-out 1.6s infinite; }
.ff-menu__wordmark {
  display: flex; flex-direction: column; align-items: center;
  margin: 16px 0 4px;
}
.ff-wm-top {
  font-family: 'Caveat', cursive;
  font-size: clamp(2.75rem, 8vw, 4.5rem); font-weight: 700;
  color: #ffffff; line-height: 1;
}
.ff-wm-bottom {
  font-family: 'Permanent Marker', cursive;
  font-size: clamp(1.125rem, 3.5vw, 1.75rem);
  letter-spacing: 0.04em; margin-top: 0.375rem;
}
.ff-wm-with, .ff-wm-you { color: var(--skin-accent, #F6C564); }
.ff-menu__subtitle {
  font-size: 14px; color: var(--theme-text-secondary);
  margin-bottom: 32px; margin-top: 8px;
}
.ff-menu__actions {
  width: 100%; max-width: 280px;
  display: flex; flex-direction: column; gap: 8px;
}
.ff-menu__actions .ff-btn + .ff-btn { margin-top: 0; }
.ff-menu__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* ── Version Pill (persistent chrome) ────────────────────── */

.ff-version-pill {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 8px);
  left: 12px;
  z-index: 11;
  font: 11px var(--skin-font-mono);
  color: var(--theme-text-secondary);
  opacity: 0.4;
  cursor: pointer;
  transition: opacity 0.15s;
  user-select: none;
}
.ff-version-pill:hover,
.ff-version-pill.is-expanded { opacity: 1; }
.ff-version-pill.is-gameplay { display: none; }
.ff-version-pill__panel {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--skin-panel-bg);
  border: 1px solid var(--skin-panel-border);
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.6;
  max-width: 260px;
  backdrop-filter: blur(8px);
}
.ff-version-pill.is-expanded .ff-version-pill__panel { display: block; }
.ff-version-pill__row { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ff-version-pill__errors-list {
  max-height: 80px; overflow-y: auto; font-size: 10px; opacity: 0.7;
  white-space: pre-wrap; word-break: break-all;
}
.ff-version-pill__btn {
  margin-top: 8px; padding: 4px 10px;
  font: 11px var(--skin-font-mono);
  background: var(--skin-accent); color: #000;
  border: none; border-radius: 4px; cursor: pointer;
}
.ff-version-pill__btn--send {
  background: transparent; color: var(--theme-text-secondary);
  border: 1px solid var(--skin-panel-border);
}

/* ── Diagnostic Toast ────────────────────────────────────── */

.ff-diagnostic-toast {
  position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%);
  padding: 8px 16px; border-radius: 8px;
  background: var(--skin-accent); color: #000;
  font: 12px var(--skin-font-mono);
  opacity: 0; transition: opacity 0.2s;
  z-index: 12; pointer-events: none;
}
.ff-diagnostic-toast.is-visible { opacity: 1; }

/* ── Traveler Level Badge ─────────────────────────────────── */

.ff-traveler-badge {
  display: flex; align-items: center; gap: 8px;
  margin-top: 16px; padding: 6px 14px;
  background: var(--theme-panel, rgba(255,255,255,0.06));
  border-radius: 20px; border: 1px solid var(--theme-border, rgba(255,255,255,0.1));
}
.ff-traveler-badge__level {
  font-family: var(--skin-font-display, 'Nunito Sans', sans-serif);
  font-weight: 800; font-size: 14px;
  color: var(--skin-accent, #F6C564);
  white-space: nowrap;
}
.ff-traveler-badge__bar {
  width: 80px; height: 6px;
  background: var(--theme-border, rgba(255,255,255,0.1));
  border-radius: 3px; overflow: hidden;
}
.ff-traveler-badge__fill {
  height: 100%;
  background: var(--skin-accent, #F6C564);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.ff-traveler-badge__xp {
  font-size: 11px; color: var(--theme-text-secondary, #aaa);
  white-space: nowrap;
}

/* ── Top Bar (in-game) ──────────────────────────────────── */

.ff-top-bar {
  position: fixed;
  top: env(safe-area-inset-top, 4px);
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 12px;
}
.ff-top-bar.hidden { display: none; }

.ff-pause-btn {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--theme-text-secondary);
  font-size: 18px;
  letter-spacing: 1px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 150ms ease;
}
.ff-pause-btn:active { opacity: 0.8; }


/* ── Action Bar (S10B-01: DOM action buttons) ──────────── */

/* ── Tier Progression Meter ────────────────────────────── */

.ff-tier-meter {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 2px 8px 4px;
  pointer-events: none;
  min-height: 32px;
}
.ff-tier-meter__star {
  color: #FFD700;
  font-size: 14px;
  font-weight: bold;
  margin-right: 2px;
  align-self: center;
}
.ff-tier-meter__icon {
  transition: opacity 0.3s ease;
  display: block;
}

.ff-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 12px calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: var(--skin-bg, #0f172a);
}
.ff-action-bar.hidden { display: none; }

.ff-action-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ff-action-charges {
  display: flex;
  gap: 5px;
  justify-content: center;
  padding-bottom: 4px;
}
.ff-charge-pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--skin-panel-border);
  border: 1px solid var(--skin-panel-border);
  transition: background 200ms ease, border-color 200ms ease;
}
.ff-charge-pip.filled {
  background: var(--skin-accent);
  border-color: var(--skin-accent-alt);
}
.ff-charge-pip.just-earned {
  animation: ff-pip-earn 400ms ease-out;
}
@keyframes ff-pip-earn {
  0% { transform: scale(1); }
  40% { transform: scale(1.8); }
  100% { transform: scale(1); }
}

.ff-action-btns {
  display: flex;
  gap: 8px;
}
.ff-action-btn {
  width: 76px;
  height: 76px;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: var(--theme-text);
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, opacity 150ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow: hidden; /* For bomb progress ring */
}
.ff-action-icon {
  width: 48px;
  height: 48px;
  pointer-events: none;
}
.ff-action-btn:disabled {
  opacity: 0.25;
  cursor: default;
}
.ff-action-btn:not(:disabled):active {
  background: var(--skin-panel-border);
  transform: scale(0.92);
}
/* Action armed: pulsing glow to indicate targeting mode */
.ff-action-btn.pending {
  background: var(--skin-accent);
  border-color: var(--skin-accent);
  color: var(--skin-bg);
  animation: ff-armed-pulse 1s ease-in-out infinite;
}
@keyframes ff-armed-pulse {
  0%, 100% { box-shadow: 0 0 6px var(--skin-accent); }
  50% { box-shadow: 0 0 16px var(--skin-accent); }
}
.ff-action-cost {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 13px;
  font-family: var(--skin-font-mono);
  font-weight: 700;
  color: var(--skin-accent);
  opacity: 0.7;
}
.ff-action-btn:disabled .ff-action-cost { opacity: 0.3; }

.ff-action-btn.activated {
  animation: ff-action-flash 300ms ease-out;
}
@keyframes ff-action-flash {
  0% { background: var(--skin-accent); transform: scale(0.9); }
  50% { background: var(--skin-accent); }
  100% { background: var(--skin-panel-bg); transform: scale(1); }
}

/* ── Action Callout (S10B-09) ──────────────────────────── */

.ff-action-callout {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--skin-accent);
  color: var(--skin-bg);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}
.ff-action-callout--show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* ── Achievement List (S9-03) ──────────────────────────── */

.ff-achievement {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ff-achievement:last-child { border-bottom: none; }
.ff-achievement--locked { opacity: 0.35; }
.ff-achievement__icon { font-size: 24px; flex-shrink: 0; }
.ff-achievement__info { flex: 1; min-width: 0; }
.ff-achievement__title {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
}
.ff-achievement__desc {
  font-size: 11px;
  color: var(--theme-text-secondary);
  margin-top: 2px;
}
.ff-achievement__date {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
}

/* ── Achievement Toast (S9-04) ─────────────────────────── */

.ff-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 100;
  background: rgba(0,0,0,0.85);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 300ms ease, transform 300ms ease;
  pointer-events: none;
}
.ff-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.ff-toast__icon { font-size: 24px; }
.ff-toast__text {
  font-family: var(--skin-font, 'Nunito Sans', sans-serif);
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
}

/* ── Multiplayer Screens (S11-11) ───────────────────────── */

.ff-room-code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--skin-accent, #F6C564);
  text-align: center;
  padding: 16px 24px;
  background: rgba(255,255,255,0.04);
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 12px;
  user-select: all;
}
.ff-room-code--small {
  font-size: 20px;
  letter-spacing: 4px;
  padding: 8px 16px;
}

.ff-code-input {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 6px;
  text-align: center;
  text-transform: uppercase;
  width: 220px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  color: #fff;
  outline: none;
  transition: border-color 150ms ease;
}
.ff-code-input:focus {
  border-color: var(--skin-accent, #F6C564);
}
.ff-code-input::placeholder {
  color: rgba(255,255,255,0.2);
}

.ff-connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--theme-text-secondary);
}

.ff-connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
}
.ff-connection-dot--waiting {
  background: #f39c12;
  animation: ff-pulse-dot 1.5s ease-in-out infinite;
}
.ff-connection-dot--connected {
  background: #2ecc71;
}
@keyframes ff-pulse-dot {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.ff-error-msg {
  color: #e74c3c;
  font-size: 13px;
  text-align: center;
  max-width: 240px;
}

.ff-lobby-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  font-size: 14px;
  color: var(--theme-text);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ff-lobby-player:last-child { border-bottom: none; }

.ff-lobby-modes {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.ff-lobby-mode-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}
.ff-lobby-mode-label {
  color: var(--skin-accent, #F6C564);
  font-weight: 700;
  font-size: 18px;
  font-family: var(--skin-font-display, 'Nunito Sans', sans-serif);
}

.ff-reconnect-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--skin-accent, #F6C564);
  border-radius: 50%;
  animation: ff-spin 0.8s linear infinite;
}
@keyframes ff-spin {
  to { transform: rotate(360deg); }
}

.ff-btn--small {
  font-size: 12px;
  padding: 6px 16px;
  border-radius: 6px;
}
.ff-btn--active {
  background: var(--skin-accent, #F6C564) !important;
  color: #1a1a2e !important;
}

.ff-disconnect-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 100;
  background: rgba(231,76,60,0.9);
  border-radius: 8px;
  padding: 10px 20px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 300ms ease, transform 300ms ease;
  pointer-events: none;
}
.ff-disconnect-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Resync prompt - non-intrusive button on right side during gameplay */
.ff-resync-prompt {
  position: fixed;
  right: 8px;
  top: 50%;
  transform: translateY(-50%) translateX(20px);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 300ms ease, transform 300ms ease;
  pointer-events: none;
}
.ff-resync-prompt--show {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
  pointer-events: auto;
}
.ff-resync-prompt span {
  font-size: 11px;
  color: var(--skin-text, #fff);
  text-align: center;
  max-width: 80px;
  line-height: 1.2;
}
.ff-resync-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid var(--skin-accent, #F6C564);
  color: var(--skin-accent, #F6C564);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 200ms;
}
.ff-resync-btn:active {
  background: rgba(255,255,255,0.3);
}
.ff-resync-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── S12-04: Versus Result ──────────────────────────────── */

.ff-versus-result__title {
  font-size: 36px;
  font-weight: 700;
  font-family: var(--ff-font-display, 'Nunito Sans', sans-serif);
  margin-bottom: 16px;
}

.ff-versus-win {
  color: var(--ff-accent, #F6C564);
}

.ff-versus-lose {
  color: #EF4444;
}

.ff-versus-scores {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.ff-versus-score-col {
  text-align: center;
}

.ff-versus-score-label {
  font-size: 12px;
  color: var(--theme-text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ff-versus-score-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--ff-font-mono, 'IBM Plex Mono', monospace);
  color: var(--ff-accent, #F6C564);
}

.ff-versus-score-divider {
  font-size: 14px;
  color: rgba(255,255,255,0.3);
}

.ff-versus-stats {
  text-align: center;
  font-size: 13px;
  color: var(--theme-text-secondary);
  line-height: 1.6;
}

/* ── Settings Groups (collapsible) ─────────────────────── */

.ff-settings-group {
  background: var(--skin-panel-bg);
  border: 1px solid var(--skin-panel-border);
  border-radius: 16px;
  margin-bottom: 12px;
  overflow: hidden;
}
.ff-settings-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ff-settings-group__label {
  font-family: var(--skin-font-display);
  font-size: clamp(11px, 2.5vw, 13px);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--theme-text-secondary);
}
.ff-settings-group__arrow {
  font-size: 14px;
  color: var(--theme-text-secondary);
  transition: transform 150ms ease;
}
.ff-settings-group__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 200ms ease;
  padding: 0 16px;
}
.ff-settings-group.is-expanded .ff-settings-group__body {
  max-height: 400px;
  padding: 0 16px 16px;
}

/* ── Theme Chips ───────────────────────────────────────── */

.ff-theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.ff-theme-chip {
  font-family: var(--skin-font-display);
  font-size: clamp(12px, 3vw, 14px);
  font-weight: 600;
  padding: 10px 8px;
  border-radius: 10px;
  border: 2px solid var(--skin-panel-border);
  background: var(--skin-panel-bg);
  color: var(--theme-text-secondary);
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
  -webkit-tap-highlight-color: transparent;
}
.ff-theme-chip.is-active {
  border-color: var(--skin-accent);
  color: var(--skin-accent);
  background: rgba(255,255,255,0.04);
}
.ff-theme-chip:active { opacity: 0.8; }

/* ── Pause Overlay ──────────────────────────────────────── */

.ff-pause-overlay {
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  animation: ff-fade-in 150ms ease-out;
}
.ff-pause-panel {
  background: var(--skin-panel-bg);
  border: 1px solid var(--skin-panel-border);
  border-radius: 20px; padding: 28px 20px;
  max-width: 360px; width: 90%; text-align: center;
}
.ff-pause-panel .ff-btn {
  margin-top: 8px;
}
.ff-pause-panel .ff-btn:first-child { margin-top: 0; }
.ff-pause-panel__title {
  font-size: 28px; font-weight: 700; color: var(--skin-accent);
  margin-bottom: 20px;
}
.ff-pause-panel__row {
  display: flex; gap: 8px; margin-top: 8px;
}
.ff-pause-panel__row .ff-btn {
  flex: 1; min-width: 0; margin-top: 0;
  padding: 10px 8px;
  font-size: clamp(12px, 3vw, 14px);
  letter-spacing: 0.02em;
}

/* ── Animations ─────────────────────────────────────────── */

@keyframes ff-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ff-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes ff-glow-pulse {
  0%, 100% { text-shadow: 0 0 8px var(--skin-accent); }
  50%      { text-shadow: 0 0 20px var(--skin-accent); }
}

/* ── Responsive ─────────────────────────────────────────── */

@media (min-width: 480px) {
  .ff-screen { padding-left: 32px; padding-right: 32px; }

}
@media (min-width: 768px) {
  .ff-screen { padding-left: 48px; padding-right: 48px; }
}

/* ── First-Drop Hint ───────────────────────────────────── */

.ff-first-drop-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 48px;
  z-index: 20;
  pointer-events: none;
  animation: ff-hint-pulse 1.2s ease-in-out infinite;
}
.ff-first-drop-hint span {
  display: block;
  font-size: 14px;
  color: var(--theme-text-secondary);
  margin-top: 8px;
  font-family: var(--skin-font-display);
}
@keyframes ff-hint-pulse {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.9); }
  50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.1); }
}

.ff-hint-text {
  color: var(--theme-text-secondary);
  font-size: 13px;
  font-family: var(--skin-font-display);
}

/* ── Loading Screen (S9-19) ────────────────────────────── */

#loading-screen {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--skin-bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 100;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#loading-screen.ff-loader--done {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}
.ff-loader__logo {
  font-size: 36px;
  letter-spacing: 4px;
  animation: ff-loader-bounce 1.8s ease-in-out infinite;
}
.ff-loader__title {
  font-family: var(--skin-font-display);
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 700;
  color: var(--skin-accent);
  letter-spacing: 0.12em;
  margin: 16px 0 24px;
}
.ff-loader__wordmark {
  display: flex; flex-direction: column; align-items: center;
  margin: 16px 0 20px;
}
.ff-loader__fruits {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 20px;
}
.ff-loader__fruit {
  border-radius: 50%;
}
.ff-loader__bar-track {
  width: min(200px, 60vw);
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.ff-loader__bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--skin-accent);
  transition: width 0.15s ease-out;
}

@keyframes ff-loader-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* ── Developer Mode Panel ──────────────────────────────── */

.ff-dev-panel {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid #444;
  border-radius: 8px;
  padding: 8px;
  font-family: monospace;
  font-size: 11px;
  color: #ccc;
  max-width: 280px;
  pointer-events: auto;
}
.ff-dev-panel__header {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: bold; color: #F6C564; font-size: 12px;
  margin-bottom: 6px; padding-bottom: 4px;
  border-bottom: 1px solid #333;
}
.ff-dev-close {
  cursor: pointer; color: #888; font-size: 14px;
  padding: 0 4px;
}
.ff-dev-close:hover { color: #fff; }
.ff-dev-section { margin-bottom: 6px; }
.ff-dev-label { color: #888; font-size: 10px; margin-bottom: 3px; }
.ff-dev-tiers {
  display: flex; flex-wrap: wrap; gap: 2px;
}
.ff-dev-tier {
  background: #222; border: 1px solid #444; color: #aaa;
  border-radius: 4px; padding: 2px 6px; cursor: pointer;
  font-family: monospace; font-size: 11px;
}
.ff-dev-tier:hover { background: #333; }
.ff-dev-tier.is-active {
  background: #F6C564; color: #000; border-color: #F6C564; font-weight: bold;
}
.ff-dev-btn {
  background: #222; border: 1px solid #444; color: #aaa;
  border-radius: 4px; padding: 3px 8px; cursor: pointer;
  font-family: monospace; font-size: 11px; margin-right: 4px;
}
.ff-dev-btn:hover { background: #333; color: #fff; }
.ff-dev-danger {
  font-size: 11px; padding: 2px 0;
}

/* ── Reduced Motion ─────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
