/* ============================================================================
   Firefly Media — "Modern minimal" theme
   Dark, airy, soft glass, warm amber accent. Presentational only: every
   selector the JS/HTML relies on is preserved.
   ========================================================================== */

:root {
  --bg: #100f0f;            /* warm near-black */
  --bg-2: #161413;          /* slightly raised */
  --bg-elev: #1c1a18;       /* cards / surfaces */
  --glass: rgba(255, 255, 255, 0.045);
  --glass-2: rgba(255, 255, 255, 0.07);
  --hairline: rgba(255, 255, 255, 0.09);
  --hairline-2: rgba(255, 255, 255, 0.14);

  --text: #f4f1ec;
  --text-muted: #a8a29a;
  --text-dim: #6f6a64;

  --accent: #f0a93a;        /* firefly amber */
  --accent-hi: #ffc04d;
  --accent-soft: rgba(240, 169, 58, 0.16);
  --ink: #1a1207;           /* text on amber */
  --danger: #d9534f;

  --r-lg: 22px;
  --r: 16px;
  --r-sm: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.4);

  --nav-h: 62px;
  --content-max: 1400px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  /* Kill the blue/grey tap-highlight flash on mobile (folders, buttons, tiles). */
  -webkit-tap-highlight-color: transparent;
}
html { -webkit-tap-highlight-color: transparent; }

/* Belt-and-suspenders for everything tappable: no highlight flash, no callout, no
   double-tap-zoom delay (which also helps prevent the tap "passing through"). */
.main-category, .sub-category, .file, .recently-watched-file,
.profile-tile, .profile-avatar, .tile-del, .tile-edit, .ff-action,
#back-button, #randomize-button, #logout-button, #share-button,
#profile-button, #sharing-toggle, #next-btn, #prev-btn,
.ff-btn, #login-form button {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* Paint the root dark so phone overscroll never flashes a white bar behind the
   fixed bottom nav. */
html {
  background: var(--bg);
  overscroll-behavior-y: none;
}

body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 50% -10%, #1a1715 0%, var(--bg) 55%) fixed;
  background-color: var(--bg);
  color: var(--text);
  user-select: none;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-y: scroll;
}

/* Scrollbars */
body::-webkit-scrollbar { width: 12px; }
body::-webkit-scrollbar-track { background: transparent; }
body::-webkit-scrollbar-thumb {
  background-color: #3a3633;
  border-radius: 20px;
  border: 3px solid var(--bg);
}
body::-webkit-scrollbar-thumb:hover { background-color: #4c4742; }

h1, h2, h3 { letter-spacing: -0.01em; }

/* ============================================================================
   Navigation bar
   ========================================================================== */
nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--nav-h);
  padding: 0 clamp(14px, 4vw, 40px);
  background: rgba(18, 16, 15, 0.72);
  -webkit-backdrop-filter: saturate(140%) blur(18px);
  backdrop-filter: saturate(140%) blur(18px);
  border-bottom: 1px solid var(--hairline);
}

/* Brand wordmark (desktop only) */
.brand {
  order: 0;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}
.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px 1px rgba(240, 169, 58, 0.8),
              0 0 22px 3px rgba(240, 169, 58, 0.45);
}

/* Icon buttons in the nav (img + the profile div) */
#back-button, #randomize-button, #logout-button, #share-button,
#next-btn, #prev-btn {
  display: none;                 /* shown by JS */
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
  object-fit: contain;
  transition: background 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
#back-button { order: -1; }       /* far left, before brand */
#back-button:hover, #randomize-button:hover, #logout-button:hover,
#share-button:hover, #next-btn:hover, #prev-btn:hover {
  background: var(--glass-2);
}
#back-button:active, #randomize-button:active, #logout-button:active,
#share-button:active { transform: scale(0.92); }

/* Profile avatar button */
#profile-button {
  display: none;                 /* shown (flex) by JS */
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent-hi), var(--accent));
  color: var(--ink);
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(240, 169, 58, 0.35);
  transition: transform 0.12s ease;
}
#profile-button:active { transform: scale(0.92); }

/* End-of-video countdown pill */
#countdown-next {
  display: none;
  order: 5;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Sharing on/off switch */
#sharing-toggle {
  display: none;                 /* shown (flex) by JS */
  align-items: center;
  gap: 9px;
  cursor: pointer;
  padding: 6px 10px 6px 8px;
  border-radius: 999px;
  transition: background 0.15s ease;
}
#sharing-toggle:hover { background: var(--glass-2); }
#sharing-toggle .sw-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}
#sharing-toggle.on .sw-label { color: var(--accent-hi); }
#sharing-toggle .sw-track {
  width: 42px; height: 24px; border-radius: 12px;
  background: #4a4540; position: relative; transition: background 0.2s;
}
#sharing-toggle .sw-knob {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
#sharing-toggle.on .sw-track {
  background: linear-gradient(145deg, var(--accent-hi), var(--accent));
}
#sharing-toggle.on .sw-knob { left: 21px; }

/* ============================================================================
   Content shell
   ========================================================================== */
#media-select { min-width: 100%; }

#section-title {
  max-width: var(--content-max);
  margin: clamp(18px, 4vw, 36px) auto 2px;
  padding: 0 clamp(16px, 4vw, 40px);
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  font-weight: 800;
}

#breadcrumb {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 4px clamp(16px, 4vw, 40px) 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  word-break: break-word;
}

.section-label {
  max-width: var(--content-max);
  margin: clamp(18px, 3vw, 28px) auto 0;
  padding: 0 clamp(16px, 4vw, 40px);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Video title while playing */
#media-select > h3 {
  max-width: var(--content-max);
  margin: clamp(16px, 3vw, 26px) auto 0;
  padding: 0 clamp(16px, 4vw, 40px);
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  font-weight: 700;
  text-align: left;
}

/* ============================================================================
   Tile grid
   ========================================================================== */
.main-categories,
.sub-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: clamp(14px, 1.8vw, 24px);
  max-width: var(--content-max);
  margin: 14px auto 48px;
  padding: 6px clamp(16px, 4vw, 40px) 0;
}

.main-category,
.sub-category,
.file {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  padding: 10px 10px 0;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease, opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Admin delete button (top-right of a tile) */
.tile-del {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  padding: 7px;
  border-radius: 50%;
  background: rgba(16, 14, 12, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0.55;
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.tile-del:hover {
  opacity: 1;
  background: var(--danger);
}
.tile-del:active { transform: scale(0.88); }
.has-del:hover .tile-del { opacity: 0.95; }

/* Edit (rename) button — mirror of the delete button, top-left */
.tile-edit {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 30px;
  height: 30px;
  padding: 7px;
  border-radius: 50%;
  background: rgba(16, 14, 12, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0.55;
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.tile-edit:hover { opacity: 1; background: var(--accent); }
.tile-edit:active { transform: scale(0.88); }

/* Admin action bar ("+ New folder" / "Upload video") */
#admin-actions {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 6px clamp(16px, 4vw, 40px) 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.ff-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--hairline-2);
  background: var(--glass);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ff-action:hover { background: var(--glass-2); border-color: rgba(240, 169, 58, 0.5); }
.ff-action img { width: 18px; height: 18px; }

/* Upload progress bar (in the modal) */
.ff-progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin: 0.6rem 0 0.2rem;
}
.ff-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  transition: width 0.2s ease;
}

/* Modal textarea (description editor) */
.ff-textarea {
  width: 100%;
  padding: 0.7rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline-2);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  resize: vertical;
  box-sizing: border-box;
}
.ff-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Quality selector under the player title */
#quality-menu {
  max-width: var(--content-max);
  margin: 0.3rem auto 0;
  padding: 0 clamp(16px, 4vw, 40px);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
#quality-menu .q-gear { width: 18px; height: 18px; opacity: 0.85; }
#quality-menu select {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font: inherit;
  cursor: pointer;
}

/* Description block under the player title */
#video-desc {
  max-width: var(--content-max);
  margin: 0.4rem auto 0;
  padding: 0 clamp(16px, 4vw, 40px);
}
#video-desc .desc-text {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 0.6rem;
}
#video-desc .desc-edit { font-size: 0.85rem; padding: 0.45rem 0.9rem; }

/* Fade + shrink a tile out as it's deleted */
.main-category.removing,
.sub-category.removing,
.file.removing {
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
}
.main-category:hover,
.sub-category:hover,
.file:hover {
  transform: translateY(-4px);
  border-color: rgba(240, 169, 58, 0.45);
  background: var(--glass-2);
  box-shadow: var(--shadow);
}
.main-category:active,
.sub-category:active,
.file:active { transform: translateY(-1px) scale(0.995); }

/* Media area: a 16:9 frame that holds either cover art or a centered icon */
.tile-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-sm);
  overflow: hidden;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.02) 0 10px, rgba(255,255,255,.035) 10px 20px);
}
.tile-media img {
  display: block;
  width: 100%;
  height: 100%;
}
.tile-media img.tile-cover { object-fit: cover; }
.tile-media img.tile-icon {
  object-fit: contain;
  padding: clamp(16px, 22%, 40px);
  opacity: 0.92;
}

/* Hover play glyph on video tiles only */
.file .tile-media::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background:
    rgba(20, 16, 12, 0.55) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23ffffff'><polygon points='8 5 19 12 8 19 8 5'/></svg>") no-repeat center / 22px 22px;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}
.file:hover .tile-media::after { opacity: 1; transform: scale(1); }

.tile-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 11px 4px 13px;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--text);
  text-align: center;
  word-break: break-word;
}

/* ============================================================================
   Continue-watching rail
   ========================================================================== */
#watch-history {
  display: none;                 /* shown (flex) by JS */
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 14px;
  max-width: var(--content-max);
  margin: 10px auto 6px;
  padding: 6px clamp(16px, 4vw, 40px) 14px;
}
#watch-history::-webkit-scrollbar { height: 10px; }
#watch-history::-webkit-scrollbar-track { background: transparent; }
#watch-history::-webkit-scrollbar-thumb {
  background-color: #3a3633; border-radius: 20px; border: 3px solid var(--bg);
}

.recently-watched-file {
  flex: 0 0 auto;
  width: clamp(190px, 24vw, 260px);
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  padding: 8px 8px 0;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.recently-watched-file:hover {
  transform: translateY(-4px);
  border-color: rgba(240, 169, 58, 0.45);
  background: var(--glass-2);
  box-shadow: var(--shadow);
}
.recently-watched-file .tile-media::after {
  content: "";
  position: absolute; inset: 0; margin: auto;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(20,16,12,.55) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23ffffff'><polygon points='8 5 19 12 8 19 8 5'/></svg>") no-repeat center / 20px 20px;
  opacity: 0; transform: scale(.8); transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.recently-watched-file:hover .tile-media::after { opacity: 1; transform: scale(1); }
.recently-watched-file > p {
  margin: 0;
  padding: 10px 4px 12px;
  font-size: 0.9rem;
  line-height: 1.3;
  white-space: normal;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================================
   Video player
   ========================================================================== */
#video-player {
  display: block;
  width: min(100%, 1100px);
  max-height: 78vh;
  margin: 16px auto 40px;
  padding: 0 clamp(0px, 2vw, 24px);
  border-radius: var(--r);
  background: #000;
  box-shadow: var(--shadow);
}

/* ============================================================================
   Login gate
   ========================================================================== */
#login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  background: radial-gradient(900px 500px at 50% 0%, #1a1715 0%, var(--bg) 60%);
  z-index: 100;
}
#login-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.9rem;
  width: min(92%, 360px);
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 2rem 1.6rem;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
#login-form h2 {
  margin: 0 0 0.4rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
}
#login-form h2::before {
  content: "";
  display: inline-block;
  width: 12px; height: 12px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px 2px rgba(240,169,58,.7);
  vertical-align: middle;
}
#login-form input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline-2);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
}
#login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#login-form button {
  width: 100%;
  padding: 0.85rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--r-sm);
  border: none;
  background: linear-gradient(145deg, var(--accent-hi), var(--accent));
  color: var(--ink);
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.12s ease;
}
#login-form button:hover { filter: brightness(1.06); }
#login-form button:active { transform: scale(0.98); }
#login-form button:disabled { opacity: 0.6; cursor: default; }
#login-error {
  margin: 0;
  min-height: 1.2rem;
  color: #ff8a86;
  text-align: center;
  font-size: 0.9rem;
}

/* ============================================================================
   Profile picker — "Who's watching?"
   ========================================================================== */
#profile-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: radial-gradient(900px 500px at 50% 0%, #1a1715 0%, var(--bg) 60%);
  padding: 1.5rem;
  z-index: 100;
}
#profile-overlay h2 {
  margin: 0 0 2rem;
  font-size: 1.8rem;
  font-weight: 800;
}
#profile-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  justify-content: center;
  max-width: 640px;
}
.profile-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  width: 120px;
  cursor: pointer;
}
.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 22px;
  background: linear-gradient(150deg, var(--accent-hi), var(--accent));
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.profile-tile:hover .profile-avatar {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 10px 28px rgba(240, 169, 58, 0.35);
}
.profile-add .profile-avatar {
  background: transparent;
  border: 2px dashed var(--text-dim);
  color: var(--text-dim);
  font-weight: 400;
}
.profile-name {
  text-align: center;
  word-break: break-word;
  color: var(--text-muted);
}
.profile-tools { display: flex; gap: 0.4rem; }
.profile-tools button {
  background: var(--glass);
  border: 1px solid var(--hairline-2);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 0.7rem;
  padding: 3px 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.profile-tools button:hover { background: var(--glass-2); color: var(--text); }

/* ============================================================================
   Share banner
   ========================================================================== */
#share-banner {
  background: var(--accent-soft);
  color: var(--accent-hi);
  text-align: center;
  padding: 0.55rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(240, 169, 58, 0.25);
  word-break: break-word;
}

/* ============================================================================
   Modals (share + confirmations) + spinner
   ========================================================================== */
.ff-modal-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.ff-modal {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-lg);
  width: min(92%, 440px);
  padding: 1.6rem;
  box-shadow: var(--shadow);
}
.ff-modal h2 { margin: 0 0 0.4rem; font-size: 1.3rem; font-weight: 800; }
.ff-modal p { color: var(--text-muted); font-size: 0.95rem; margin: 0.4rem 0; line-height: 1.45; }
.ff-modal .scope { color: var(--accent-hi); font-weight: 600; word-break: break-word; }
.ff-modal label { display: block; margin: 1.1rem 0 0.35rem; font-size: 0.82rem; color: var(--text-muted); }
.ff-modal select, .ff-modal input[type=text], .ff-modal input[type=number] {
  width: 100%; padding: 0.7rem; border-radius: var(--r-sm);
  border: 1px solid var(--hairline-2);
  background: rgba(0, 0, 0, 0.25); color: var(--text); font-size: 1rem;
}
.ff-modal select:focus, .ff-modal input[type=text]:focus, .ff-modal input[type=number]:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
/* Checkbox option rows (personal / keep-on-pause) */
.ff-modal .ff-check {
  display: flex; align-items: flex-start; gap: 0.6rem;
  margin: 1rem 0 0; font-size: 0.92rem; color: var(--text); cursor: pointer;
}
.ff-modal .ff-check input[type=checkbox] {
  width: 18px; height: 18px; margin: 2px 0 0; flex: 0 0 auto;
  accent-color: var(--accent); cursor: pointer;
}
.ff-modal .ff-check span { line-height: 1.35; }
.ff-modal-actions { display: flex; gap: 0.6rem; margin-top: 1.4rem; }
.ff-btn {
  flex: 1; padding: 0.75rem; border-radius: var(--r-sm);
  border: 1px solid var(--hairline-2);
  background: var(--glass); color: var(--text);
  font-size: 0.95rem; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background 0.15s ease, filter 0.15s ease, transform 0.12s ease;
}
.ff-btn:hover { background: var(--glass-2); }
.ff-btn:active { transform: scale(0.98); }
.ff-btn.primary {
  background: linear-gradient(145deg, var(--accent-hi), var(--accent));
  border-color: transparent; color: var(--ink);
}
.ff-btn.primary:hover { filter: brightness(1.06); background: linear-gradient(145deg, var(--accent-hi), var(--accent)); }
.ff-btn.danger { background: var(--danger); border-color: transparent; color: #fff; }
.ff-btn.danger:hover { filter: brightness(1.08); background: var(--danger); }
.ff-btn:disabled { opacity: 0.6; cursor: default; }
.ff-linkrow { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.ff-linkrow .ff-btn { flex: 0 0 auto; }
.ff-copied { color: var(--accent-hi); font-size: 0.85rem; min-height: 1rem; margin-top: 0.4rem; }

.ff-spinner-overlay {
  position: fixed; inset: 0; z-index: 130;
  background: rgba(0, 0, 0, 0.62);
  display: flex; align-items: center; justify-content: center;
}
.ff-spinner {
  width: 48px; height: 48px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.18); border-top-color: var(--accent);
  animation: ff-spin 0.8s linear infinite;
}
@keyframes ff-spin { to { transform: rotate(360deg); } }
.ff-modal .ff-spinner { margin: 1.3rem auto 0.4rem; }

/* ============================================================================
   Responsive — phones: nav becomes a fixed bottom bar
   ========================================================================== */
@media (max-width: 700px) {
  nav {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    justify-content: space-evenly;
    gap: 2px;
    padding: 0 8px;
    border-bottom: none;
    border-top: 1px solid var(--hairline);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .brand { display: none; }
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0)); }

  .main-categories,
  .sub-categories {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  #video-player { max-height: 60vh; }
}

@media (max-width: 420px) {
  #sharing-toggle .sw-label { display: none; }   /* keep just the switch when tight */
  .main-categories,
  .sub-categories { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* Touch devices have no real hover, but tapping applies a :hover that STICKS — so a
   freshly-rendered tile under the finger looks "selected/lifted" after navigating.
   Neutralize hover visuals where hover isn't real; desktop keeps them. */
@media (hover: none) {
  .main-category:hover,
  .sub-category:hover,
  .file:hover,
  .recently-watched-file:hover {
    transform: none;
    border-color: var(--hairline);
    background: var(--glass);
    box-shadow: none;
  }
  .file:hover .tile-media::after,
  .recently-watched-file:hover .tile-media::after {
    opacity: 0;
    transform: scale(0.8);
  }
  .tile-del:hover { background: rgba(16, 14, 12, 0.55); opacity: 0.55; }
  .has-del:hover .tile-del { opacity: 0.55; }
  .tile-edit:hover { background: rgba(16, 14, 12, 0.55); opacity: 0.55; }
}
