/* DanjiQ Shared Winter Theme Engine UI (Strict CSP, zero external fonts/CDN) */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, -apple-system, sans-serif;
  background: #0d1118;
  color: #f8fafc;
}

.dq-stage {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: #10131a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 16px 76px;
}

.dq-bg-img {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  pointer-events: none;
  user-select: none;
}

.dq-fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Frosted / crystal glass primary action button with independent fill opacity */
.dq-glass-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: transparent;
  border: var(--btn-border, 1.5px solid rgba(255, 255, 255, 0.88));
  color: var(--btn-fg, #ffffff);
  text-shadow: var(--btn-txt-glow, 0 1px 8px rgba(4, 8, 18, 0.96));
  box-shadow: var(--btn-box-shadow, inset 0 1px 0 rgba(255, 255, 255, 0.38), 0 4px 16px rgba(4, 8, 18, 0.32));
  backdrop-filter: blur(var(--btn-blur, 0px));
  -webkit-backdrop-filter: blur(var(--btn-blur, 0px));
  transition: transform 0.16s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.dq-glass-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--btn-grad, linear-gradient(125deg, #7d1f2d 0%, #b2414f 54%, #e0ba86 100%));
  opacity: var(--btn-fill-alpha, 0);
  transition: opacity 0.2s ease;
}

.dq-glass-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.30) 50%, transparent 70%);
  transform: translateX(-125%);
  animation: dqSheen 5.4s ease-in-out infinite;
}

@keyframes dqSheen {
  0%, 60% { transform: translateX(-125%); }
  86%, 100% { transform: translateX(130%); }
}

.dq-glass-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.dq-glass-btn:hover:not(:disabled)::before {
  opacity: var(--btn-fill-hover, 0.18);
}

.dq-glass-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

/* Bottom floating control bar */
.dq-control-bar {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.24);
  max-width: calc(100vw - 16px);
  overflow-x: auto;
  scrollbar-width: none;
}

.dq-control-bar::-webkit-scrollbar {
  display: none;
}

.dq-cb-btn {
  border: none;
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 700;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: background 0.14s ease, color 0.14s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.dq-cb-btn:hover { background: rgba(15, 23, 42, 0.14); }
.dq-cb-btn.on { background: #1e293b; color: #ffffff; }
.dq-cb-btn.snow.on { background: #0369a1; color: #ffffff; }
.dq-cb-btn.fire.on { background: #b45309; color: #ffffff; }
.dq-cb-ico { width: 22px; padding: 0; font-size: 11px; }
.dq-cb-name {
  font-size: 10.5px;
  font-weight: 800;
  color: #1e293b;
  padding: 0 3px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.dq-cb-sep {
  width: 1px;
  height: 14px;
  background: rgba(15, 23, 42, 0.15);
  margin: 0 1px;
  flex-shrink: 0;
}
.dq-cb-lbl {
  font-size: 9.8px;
  font-weight: 800;
  color: #64748b;
  padding: 0 1px;
  white-space: nowrap;
  flex-shrink: 0;
}
.dq-op-val {
  min-width: 36px;
  font-variant-numeric: tabular-nums;
  background: #1e293b;
  color: #ffffff;
}
.dq-op-val:hover { background: #0f172a; }

/* Dual-row opacity popover (All vs Controls-only) */
.dq-op-pop {
  position: fixed;
  left: 50%;
  bottom: 50px;
  transform: translateX(-50%);
  z-index: 36;
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.99);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.26);
  display: none;
  flex-direction: column;
  gap: 7px;
  max-width: calc(100vw - 20px);
  overflow-x: auto;
}
.dq-op-pop.open { display: flex; }
.dq-op-row { display: flex; align-items: center; gap: 3px; flex-wrap: nowrap; }
.dq-op-row-lbl {
  font-size: 10px;
  font-weight: 800;
  color: #334155;
  min-width: 82px;
  white-space: nowrap;
}

/* 4x3 Theme Gallery Drawer */
.dq-drawer {
  position: fixed;
  left: 50%;
  bottom: 50px;
  transform: translateX(-50%);
  z-index: 35;
  width: 700px;
  max-width: calc(100vw - 20px);
  padding: 11px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.99);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28);
  display: none;
}
.dq-drawer.open { display: block; }
.dq-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.dq-drawer-title { font-size: 11.5px; font-weight: 800; color: #0f172a; }
.dq-thumb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.dq-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
  position: relative;
}
.dq-thumb img { display: block; width: 100%; height: 56px; object-fit: cover; }
.dq-thumb span {
  display: block;
  padding: 3px 3px;
  font-size: 9.4px;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.dq-thumb.active {
  border-color: #9f1239;
  box-shadow: 0 0 0 2px rgba(159, 18, 57, 0.22);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .dq-thumb-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .dq-glass-btn::after { animation: none; }
}
