.quests-page {
  padding: var(--pages-frame-pad-top, clamp(12px, 2vw, 32px))
    var(--pages-frame-pad-x, clamp(10px, 2.5vw, 44px))
    var(--pages-frame-pad-bottom, clamp(14px, 2vw, 28px));
  direction: rtl;
}

.quests-header {
  margin-bottom: 10px;
}

.quests-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.quests-tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 6px 8px 28px;
  border: 0;
  font-family: inherit;
  font-size: 0;
  cursor: pointer;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  opacity: 0.72;
  filter: saturate(0.85);
  transition: opacity 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.quests-tab[data-period="daily"] {
  background-image: url("/quests/quests-daily.png");
}

.quests-tab[data-period="weekly"] {
  background-image: url("/quests/quests-weekly.png");
}

.quests-tab[data-period="monthly"] {
  background-image: url("/quests/quests-monthly.png");
}

.quests-tab[data-period="once"] {
  background-image: url("/quests/quests-once.png");
}

.quests-tab.is-active {
  opacity: 1;
  filter: none;
  box-shadow: 0 0 14px rgba(224, 184, 58, 0.35);
  background-color: rgba(224, 184, 58, 0.12);
}

.quests-tab-label {
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  color: rgba(235, 235, 235, 0.82);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
  pointer-events: none;
}

.quests-tab.is-active .quests-tab-label {
  color: var(--p-gold-light, #f0c15a);
}

.quests-tab-dot {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e53935;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.quests-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 70px;
}

.quests-loading,
.quests-empty,
.quests-error {
  text-align: center;
  opacity: 0.8;
  padding: 24px 8px;
}

.quest-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  grid-template-areas:
    ". header header"
    "icon desc claim"
    ". meta meta";
  gap: 4px 8px;
  align-items: center;
  padding: 8px 8px;
  border: 0;
  background: url("/quests/quests-items-bg.webp") center / 100% 100% no-repeat;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}

.quest-card.is-claimed {
  opacity: 0.62;
}

.quest-title {
  grid-area: header;
  width: 100%;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  color: #d4a13f;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.quest-icon {
  grid-area: icon;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
}

.quest-desc {
  grid-area: desc;
  margin: 0;
  min-width: 0;
  font-size: 10px;
  color: rgba(237, 237, 237, 0.82);
  line-height: 1.4;
}

.quest-actions {
  grid-area: claim;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

.quest-meta {
  grid-area: meta;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.quest-reward {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--p-gold-light, #f0c15a);
}

.quest-progress-block {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quest-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.quest-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9e2d2d, #e0b83a);
  box-shadow: 0 0 10px rgba(224, 184, 58, 0.45);
  transition: width 0.25s ease;
}

.quest-reward img {
  width: 14px;
  height: 14px;
}

.quest-progress {
  font-size: 11px;
  opacity: 0.9;
  color: rgba(237, 237, 237, 0.88);
}

.quest-claim-btn {
  border: 0;
  padding: 0;
  min-width: 118px;
  min-height: 38px;
  font-family: inherit;
  font-size: 0;
  line-height: 0;
  color: transparent;
  cursor: pointer;
  background: url("/quests/quests-claim.webp") center / 100% 100% no-repeat;
  box-shadow: none;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.quest-claim-btn:hover:not(:disabled):not(.is-busy) {
  filter: brightness(1.08);
}

.quest-claim-btn:disabled,
.quest-claim-btn.is-busy {
  cursor: default;
  filter: grayscale(1) opacity(0.55);
}

.quest-status-label {
  font-size: 11px;
  text-align: center;
  opacity: 0.75;
}

@media (max-width: 360px) {
  .quests-tabs {
    gap: 4px;
  }

  .quests-tab {
    min-height: 36px;
    padding: 6px 4px 6px 22px;
  }

  .quests-tab-label {
    font-size: 10px;
  }

  .quest-card {
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-areas:
      ". header"
      "icon desc"
      "claim claim"
      "meta meta";
  }

  .quest-icon {
    width: 48px;
    height: 48px;
  }

  .quest-actions {
    justify-content: stretch;
    width: 100%;
  }

  .quest-claim-btn {
    width: 100%;
    min-width: 0;
    max-width: 150px;
  }
}
