/**
 * Десктоп (html без data-mobile-ui): только то, чего нет в inline index.html.
 * Рамка viewport и отступы — как в dist (не трогаем padding/max-width).
 */

html:not([data-mobile-ui]) body {
  margin: 0;
  overflow-x: hidden;
}

/* Подстраницы /pages/* */
html:not([data-mobile-ui])[data-gv-subpage] main > section.mobile-page {
  display: none !important;
}

/* Десктоп: одна колонка для шапки и main на всех вкладках (главная = квесты = …) */
html:not([data-mobile-ui]) .page-hero-header > .max-w-6xl.guildhall-banner,
html:not([data-mobile-ui]) .page-hero-header > .max-w-6xl,
html:not([data-mobile-ui]) main.max-w-6xl {
  max-width: 72rem !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

html:not([data-mobile-ui]) .guildhall-banner {
  max-width: 100% !important;
  width: 100% !important;
}

html:not([data-mobile-ui]) main.max-w-6xl > section.section-scene {
  width: 100%;
  box-sizing: border-box;
}

/* Босс (ПК): дублируем theme.css — выше специфичность с html:not */
html:not([data-mobile-ui]) #section-boss.section-scene,
html:not([data-mobile-ui]) #section-boss .boss-layout,
html:not([data-mobile-ui]) #boss-panel-fight .boss-fight-card {
  overflow: visible !important;
}

html:not([data-mobile-ui]) #dragon-wrap.boss-dragon-wrap {
  padding-top: 12px;
  padding-bottom: 4px;
}

/* Смена подвкладок босса: без скачка высоты страницы */
html:not([data-mobile-ui]) #section-boss .boss-panel.boss-panel--visible,
html:not([data-mobile-ui]) #section-boss .boss-panel:not([hidden]) {
  min-height: 18rem;
}

html:not([data-mobile-ui])[data-gv-subpage] .viewport-outer {
  min-height: 0 !important;
  align-items: flex-start !important;
}

html:not([data-mobile-ui])[data-gv-subpage] #app-viewport.viewport-desktop {
  min-height: 0 !important;
}

/* ——— Вкладка «Квесты» (desktop) ——— */
html:not([data-mobile-ui]) #section-quests.section-scene {
  border-color: rgba(212, 168, 75, 0.42) !important;
  box-shadow:
    0 0 0 1px rgba(212, 168, 75, 0.18),
    0 10px 28px rgba(0, 0, 0, 0.28) !important;
}

html:not([data-mobile-ui]) #section-quests > h2,
html:not([data-mobile-ui]) #section-quests > p {
  position: relative;
  z-index: 1;
}

html:not([data-mobile-ui]) #quest-board {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 1rem !important;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none !important;
}

/* Один квест: на всю ширину кейса, без «половинки» от сетки 2×2 */
html:not([data-mobile-ui]) #quest-board:has(> .parchment-card:only-child) {
  grid-template-columns: 1fr !important;
}

html:not([data-mobile-ui]) #quest-board > .parchment-card:only-child {
  min-height: 11.5rem;
  display: flex;
  flex-direction: column;
}

html:not([data-mobile-ui]) #quest-board > .parchment-card:only-child > .flex {
  align-items: flex-start;
  gap: 0.75rem 1rem;
}

html:not([data-mobile-ui]) #quest-board > .parchment-card:only-child > p.text-sm {
  max-width: 42rem;
}

html:not([data-mobile-ui]) #quest-board > .parchment-card:only-child > .guild-quest-footer {
  margin-top: auto;
  padding-top: 0.75rem;
}

/* Подзаголовок доски — только mobile, на desktop лишний */
html:not([data-mobile-ui]) #section-quests > .quest-board-lead {
  display: none !important;
}

/* Футер квеста: прогресс слева, кнопка справа */
.guild-quest-footer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.guild-quest-footer__progress {
  flex: 1 1 10rem;
  min-width: 0;
}

.guild-quest-claim {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border-style: solid !important;
  border-width: 1px;
  border-color: var(--gv-border-gold-35, rgba(212, 168, 75, 0.35));
  color: var(--gv-gold, #d4a84b);
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  box-shadow: none;
  transition:
    opacity 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease,
    filter 0.15s ease;
}

.guild-quest-claim--ready:not(:disabled) {
  background: linear-gradient(180deg, #e2b85a 0%, #c4922e 100%);
  border-color: #efd08a !important;
  color: #1a140c !important;
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 210, 0.45),
    0 4px 14px rgba(212, 168, 75, 0.28);
}

.guild-quest-claim--ready:not(:disabled):hover {
  background: linear-gradient(180deg, #ebc56a 0%, #d4a84b 100%);
  filter: brightness(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 210, 0.55),
    0 6px 18px rgba(212, 168, 75, 0.36);
}

.guild-quest-claim--ready:not(:disabled):active {
  background: linear-gradient(180deg, #c4922e 0%, #a87a24 100%);
  filter: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
}

.guild-quest-claim--locked,
.guild-quest-claim:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  pointer-events: none;
  background: transparent !important;
  color: var(--gv-gold, #d4a84b) !important;
  border-color: var(--gv-border-gold-35, rgba(212, 168, 75, 0.35)) !important;
  box-shadow: none !important;
  font-weight: 500;
  filter: none;
}

html[data-palette="guild-milk"] .guild-quest-claim--ready:not(:disabled) {
  background: #3aa0ad;
  border-color: #6bc0cb !important;
  color: #fff !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 4px 12px color-mix(in srgb, #3aa0ad 22%, transparent);
}

html[data-palette="guild-milk"] .guild-quest-claim--ready:not(:disabled):hover {
  filter: brightness(1.06);
}

html[data-palette="guild-dust"] .guild-quest-claim--ready:not(:disabled),
html[data-palette="guild-forest"] .guild-quest-claim--ready:not(:disabled) {
  background: var(--gv-gold);
  border-color: var(--gv-border-gold-35) !important;
  color: #fff !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 4px 12px color-mix(in srgb, var(--gv-gold) 22%, transparent);
}

html[data-palette="guild-dust"] .guild-quest-claim--ready:not(:disabled):hover,
html[data-palette="guild-forest"] .guild-quest-claim--ready:not(:disabled):hover {
  filter: brightness(1.08);
}

html[data-palette="guild-milk"] .guild-quest-claim--locked,
html[data-palette="guild-milk"] .guild-quest-claim:disabled,
html[data-palette="guild-dust"] .guild-quest-claim--locked,
html[data-palette="guild-dust"] .guild-quest-claim:disabled,
html[data-palette="guild-forest"] .guild-quest-claim--locked,
html[data-palette="guild-forest"] .guild-quest-claim:disabled {
  color: var(--gv-gold) !important;
  border-color: var(--gv-border-gold-30) !important;
}

html:not([data-mobile-ui]) #quest-board .parchment-card {
  position: relative;
  z-index: 1;
  isolation: isolate;
  margin: 0 !important;
  padding: 1.25rem !important;
  border-radius: 0.75rem !important;
  border: 2px solid var(--gv-parchment-border, rgba(212, 168, 75, 0.35)) !important;
  border-left-width: 4px !important;
  background: linear-gradient(
    145deg,
    var(--gv-parchment-from, rgba(58, 48, 36, 0.95)) 0%,
    var(--gv-parchment-to, rgba(42, 34, 24, 0.98)) 100%
  ) !important;
  box-shadow:
    inset 0 1px 0 var(--gv-parchment-inset, rgba(255, 235, 200, 0.08)),
    0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

html:not([data-mobile-ui]) #quest-board article[class*="border-purple"],
html:not([data-mobile-ui]) #quest-board article[data-quest-difficulty="epic"] {
  border-left-width: 5px !important;
  border-left-color: #a855f7 !important;
  box-shadow:
    inset 0 1px 0 var(--gv-parchment-inset, rgba(255, 235, 200, 0.08)),
    0 0 0 1px rgba(168, 85, 247, 0.28),
    0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

html:not([data-mobile-ui]) #quest-board article[class*="border-blue"],
html:not([data-mobile-ui]) #quest-board article[data-quest-difficulty="rare"] {
  border-left-width: 5px !important;
  border-left-color: #3b82f6 !important;
  box-shadow:
    inset 0 1px 0 var(--gv-parchment-inset, rgba(255, 235, 200, 0.08)),
    0 0 0 1px rgba(59, 130, 246, 0.28),
    0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

html:not([data-mobile-ui]) #quest-board article[class*="border-amber"],
html:not([data-mobile-ui]) #quest-board article[data-quest-difficulty="legendary"] {
  border-left-width: 5px !important;
  border-left-color: #f59e0b !important;
  box-shadow:
    inset 0 1px 0 var(--gv-parchment-inset, rgba(255, 235, 200, 0.08)),
    0 0 0 1px rgba(245, 158, 11, 0.32),
    0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

html:not([data-mobile-ui]) #quest-board article[class*="border-green"],
html:not([data-mobile-ui]) #quest-board article[data-quest-difficulty="uncommon"] {
  border-left-width: 5px !important;
  border-left-color: #16a34a !important;
  box-shadow:
    inset 0 1px 0 var(--gv-parchment-inset, rgba(255, 235, 200, 0.08)),
    0 0 0 1px rgba(22, 163, 74, 0.28),
    0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="light"]:not([data-mobile-ui]) #quest-board article[class*="border-purple"],
html[data-theme="light"]:not([data-mobile-ui]) #quest-board article[data-quest-difficulty="epic"] {
  border-left-color: #7e22ce !important;
}

html[data-theme="light"]:not([data-mobile-ui]) #quest-board article[class*="border-blue"],
html[data-theme="light"]:not([data-mobile-ui]) #quest-board article[data-quest-difficulty="rare"] {
  border-left-color: #1d4ed8 !important;
}

html[data-theme="light"]:not([data-mobile-ui]) #quest-board article[class*="border-amber"],
html[data-theme="light"]:not([data-mobile-ui]) #quest-board article[data-quest-difficulty="legendary"] {
  border-left-color: #b45309 !important;
}

html[data-theme="light"]:not([data-mobile-ui]) #quest-board article[class*="border-green"],
html[data-theme="light"]:not([data-mobile-ui]) #quest-board article[data-quest-difficulty="uncommon"] {
  border-left-color: #15803d !important;
}

@media (max-width: 720px) {
  html:not([data-mobile-ui]) #quest-board {
    grid-template-columns: 1fr !important;
  }
}
