:root {
  --ff-dl-bar-bg: #111;
  --ff-dl-filename: #f0f0f0;
  --ff-dl-meta: #aaa;
  --ff-dl-border: rgba(255, 255, 255, 0.08);
  --ff-dl-price-bg: rgba(255, 255, 255, 0.06);
  --ff-dl-price-border: rgba(255, 255, 255, 0.1);
  --ff-dl-price-text: #e2e5e9;
  --ff-dl-free: #6ee7a8;
  --ff-dl-btn-bg: #388e3c;
  --ff-dl-btn-hover: #43a047;
  --ff-dl-progress-track: rgba(255, 255, 255, 0.12);
  --ff-dl-progress-fill: #43a047;
  --ff-dl-cancel-bg: rgba(255, 255, 255, 0.06);
  --ff-dl-cancel-border: rgba(255, 255, 255, 0.14);
  --ff-dl-cancel-text: #c8ccd0;
}

body.fabuba {
  --ff-dl-bar-bg: var(--fb-vt-post-plc-bg, #212121);
  --ff-dl-filename: var(--fb-text, #e2e5e9);
  --ff-dl-meta: var(--fb-muted, #63676e);
  --ff-dl-border: var(--fb-border, #333738);
  --ff-dl-price-bg: var(--fb-surface-h, #303436);
  --ff-dl-price-border: var(--fb-border, #333738);
  --ff-dl-price-text: var(--fb-text, #e2e5e9);
  --ff-dl-free: #6ee7a8;
  --ff-dl-progress-track: rgba(255, 255, 255, 0.1);
  --ff-dl-cancel-bg: var(--fb-input, #2c2f30);
  --ff-dl-cancel-border: var(--fb-border, #333738);
  --ff-dl-cancel-text: var(--fb-text, #e2e5e9);
}

.fabuba-file-block__cover {
  width: 100%;
  line-height: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--ff-dl-border);
}

.fabuba-file-block__cover-img {
  display: block;
  width: 100%;
  max-height: 420px;
  height: auto;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.25);
}

.fabuba-file-block {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
  max-width: 1000px;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--ff-dl-bar-bg);
  border: 1px solid var(--ff-dl-border);
  border-radius: 6px;
}

.fabuba-file-block--error {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.25);
  padding: 10px 14px;
  font-size: 14px;
}

.fabuba-file-block__row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.fabuba-file-block__info {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.fabuba-file-block__icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
}

.fabuba-file-block__icon img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
}

.fabuba-file-block__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.fabuba-file-block__name {
  font-size: 16px;
  font-weight: 600;
  color: var(--ff-dl-filename);
  margin: 0 0 6px;
  word-break: break-all;
  line-height: 1.4;
  width: 100%;
}

.fabuba-file-block__size {
  font-size: 13px;
  color: var(--ff-dl-meta);
  line-height: 1.35;
  width: 100%;
}

.fabuba-file-block__actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

.fabuba-file-block__price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  background: var(--ff-dl-price-bg);
  border: 1px solid var(--ff-dl-price-border);
  color: var(--ff-dl-price-text);
  white-space: nowrap;
}

.fabuba-file-block__price-emoji {
  font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
  font-size: 1.1em;
  line-height: 1;
}

.fabuba-file-block__price--free {
  color: var(--ff-dl-free);
}

.fabuba-file-dl.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ff-dl-btn-bg);
  color: #fff !important;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.2;
  text-decoration: none;
}

.fabuba-file-dl.btn:hover:not(:disabled) {
  background: var(--ff-dl-btn-hover);
}

.fabuba-file-dl.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.fabuba-file-dl__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

.fabuba-file-dl-progress-wrap {
  display: none;
  width: 100%;
  margin-top: 12px;
  box-sizing: border-box;
}

.fabuba-file-dl-progress-bar {
  height: 6px;
  background: var(--ff-dl-progress-track);
  border-radius: 3px;
  overflow: hidden;
}

.fabuba-file-dl-progress-inner {
  height: 100%;
  width: 0;
  background: var(--ff-dl-progress-fill);
  border-radius: 3px;
  transition: width 0.15s ease;
}

.fabuba-file-dl-progress-text {
  font-size: 12px;
  color: var(--ff-dl-meta);
  margin-top: 6px;
}

.fabuba-file-dl-cancel {
  display: none;
  margin-top: 8px;
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--ff-dl-cancel-border);
  background: var(--ff-dl-cancel-bg);
  border-radius: 4px;
  cursor: pointer;
  color: var(--ff-dl-cancel-text);
}

.fabuba-file-dl-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 640px) {
  .fabuba-file-block__row {
    flex-direction: column;
    align-items: stretch;
  }

  .fabuba-file-block__actions {
    margin-left: 0;
    justify-content: flex-end;
  }
}

.ff-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ff-modal {
  width: 100%;
  max-width: 430px;
  background: var(--fb-surface, #242728);
  border: 1px solid var(--fb-border, #333738);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  color: var(--fb-text, #e2e5e9);
}

.ff-modal--plain {
  border-radius: 12px;
  max-width: min(430px, 92vw);
}

.ff-modal__body {
  padding: 16px;
  color: var(--fb-text, #e2e5e9);
  line-height: 1.6;
  word-break: break-word;
}

.ff-modal__body--alert {
  padding: 24px 24px 16px;
  text-align: center;
  box-sizing: border-box;
}

.ff-modal__body--purchase {
  padding: 22px 24px 8px;
  text-align: left;
  box-sizing: border-box;
}

.ff-modal__lead {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--fb-text, #e2e5e9);
  line-height: 1.4;
}

.ff-modal__body--alert .ff-modal__lead {
  margin-bottom: 10px;
}

.ff-modal__text {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fb-muted, #b1b4b9);
}

.ff-modal__body--alert .ff-modal__lead + .ff-modal__text {
  font-size: 15px;
}

.ff-modal__row {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--fb-text, #e2e5e9);
}

.ff-modal__body--purchase > .ff-modal__row:first-child {
  margin-top: 0;
}

.ff-modal__hint {
  margin-top: 12px;
}

.ff-modal__footer {
  padding: 12px 16px;
  border-top: 1px solid var(--fb-border, #333738);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.ff-modal__footer--plain {
  padding: 16px 24px 20px;
  justify-content: center;
}

.ff-modal__body--purchase + .ff-modal__footer--plain {
  justify-content: flex-end;
}

.ff-btn {
  border: 1px solid var(--fb-border, #333738);
  background: var(--fb-input, #2c2f30);
  color: var(--fb-text, #e2e5e9);
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
}

.ff-btn--primary {
  border: none;
  background: var(--fb-cta, #5ca8ff);
  color: var(--fb-cta-text, #fcfdfd);
  padding: 10px 24px;
  font-size: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.ff-btn--primary:hover {
  filter: brightness(1.08);
}

.ff-btn--block {
  min-width: 120px;
}

.ff-btn--ghost {
  background: transparent;
  padding: 10px 20px;
  font-size: 14px;
}

.ff-ok {
  color: #6ee7a8;
}

.ff-bad {
  color: #fca5a5;
}

.ff-toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%);
  z-index: 10001;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
}
