/**
 * Waple Jelly / Liquid Glass Release 40 — CSS-only
 * Ref: Desktop/40/index.html · без JS, без blur на кнопках
 */

/* ===== R40 canvas (#e3e6eb + ambient orbs) ===== */
.waple-r40-canvas,
body.liquid-glass-mode {
  background-color: #e3e6eb;
  background-image:
    radial-gradient(circle at 8% 12%, rgba(94, 202, 255, 0.36), transparent 42%),
    radial-gradient(circle at 92% 8%, rgba(255, 106, 171, 0.32), transparent 40%),
    radial-gradient(circle at 28% 88%, rgba(132, 255, 96, 0.26), transparent 38%),
    radial-gradient(circle at 82% 85%, rgba(166, 108, 255, 0.3), transparent 40%);
}

/* ===== R40-lite volumetric pill ===== */
.waple-jelly-btn {
  --jelly-glow: 0, 195, 255;
  --jelly-liquid: radial-gradient(
    ellipse 96% 80% at 50% 128%,
    rgba(120, 235, 255, 1) 0%,
    rgba(0, 185, 255, 0.88) 22%,
    rgba(0, 145, 230, 0.38) 46%,
    transparent 58%
  );
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  overflow: hidden;
  isolation: isolate;
  padding: 15px 26px;
  min-height: 52px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: rgba(255, 255, 255, 0.52);
  border-bottom-color: rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.96);
  font: inherit;
  font-weight: 650;
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.03) 16%, transparent 30%),
    radial-gradient(ellipse 88% 105% at 50% 42%, rgba(8, 12, 20, 0.58) 0%, rgba(8, 12, 20, 0.42) 32%, rgba(8, 12, 20, 0.16) 68%, rgba(8, 12, 20, 0.06) 100%);
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.72),
    inset 0 -2px 1px rgba(255, 255, 255, 0.42),
    inset 0 -4px 12px rgba(0, 0, 0, 0.26),
    0 16px 40px rgba(var(--jelly-glow), 0.42),
    0 8px 22px rgba(var(--jelly-glow), 0.28),
    0 12px 28px rgba(0, 0, 0, 0.12);
  transition: filter 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.waple-jelly-btn::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 6%;
  right: 6%;
  height: 42%;
  border-radius: 50% 50% 44% 44% / 70% 70% 30% 30%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0.18) 48%, transparent 100%);
  opacity: 0.88;
  pointer-events: none;
  z-index: 1;
}

.waple-jelly-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--jelly-liquid);
  mix-blend-mode: screen;
  -webkit-mask-image: linear-gradient(180deg, transparent 8%, rgba(0, 0, 0, 0.25) 34%, #000 62%);
  mask-image: linear-gradient(180deg, transparent 8%, rgba(0, 0, 0, 0.25) 34%, #000 62%);
  pointer-events: none;
  z-index: 0;
}

.waple-jelly-btn > * {
  position: relative;
  z-index: 2;
}

.waple-jelly-btn:hover {
  filter: brightness(1.08);
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.78),
    inset 0 -2px 1px rgba(255, 255, 255, 0.48),
    inset 0 -4px 12px rgba(0, 0, 0, 0.26),
    0 20px 48px rgba(var(--jelly-glow), 0.52),
    0 10px 28px rgba(var(--jelly-glow), 0.34),
    0 14px 32px rgba(0, 0, 0, 0.14);
}

.waple-jelly-btn:active {
  filter: brightness(0.94);
  box-shadow:
    inset 0 6px 14px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 10px 24px rgba(var(--jelly-glow), 0.32),
    0 6px 16px rgba(0, 0, 0, 0.14);
}

.waple-jelly-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

.waple-jelly-btn--block {
  width: 100%;
}

/* R40 color variants */
.waple-jelly-btn--blue {
  --jelly-glow: 0, 195, 255;
  --jelly-liquid: radial-gradient(ellipse 96% 80% at 50% 128%, rgba(120, 235, 255, 1) 0%, rgba(0, 185, 255, 0.88) 22%, rgba(0, 145, 230, 0.38) 46%, transparent 58%);
}

.waple-jelly-btn--cyan {
  --jelly-glow: 0, 225, 195;
  --jelly-liquid: radial-gradient(ellipse 96% 80% at 50% 128%, rgba(70, 255, 235, 1) 0%, rgba(0, 200, 175, 0.82) 22%, rgba(0, 160, 150, 0.35) 46%, transparent 58%);
}

.waple-jelly-btn--violet {
  --jelly-glow: 165, 90, 255;
  --jelly-liquid: radial-gradient(ellipse 96% 80% at 50% 128%, rgba(200, 120, 255, 1) 0%, rgba(110, 160, 255, 0.82) 22%, rgba(130, 60, 255, 0.35) 46%, transparent 58%);
}

.waple-jelly-btn--pink {
  --jelly-glow: 255, 85, 140;
  --jelly-liquid: radial-gradient(ellipse 96% 80% at 50% 128%, rgba(255, 110, 185, 1) 0%, rgba(255, 130, 70, 0.82) 22%, rgba(255, 60, 140, 0.35) 46%, transparent 58%);
}

.waple-jelly-btn--green {
  --jelly-glow: 120, 255, 75;
  --jelly-liquid: radial-gradient(ellipse 96% 80% at 50% 128%, rgba(170, 255, 100, 1) 0%, rgba(90, 220, 50, 0.82) 22%, rgba(60, 180, 40, 0.35) 46%, transparent 58%);
}

.waple-jelly-btn--ghost {
  --jelly-glow: 255, 200, 120;
  --jelly-liquid: none;
  color: rgba(255, 214, 147, 0.96);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 214, 147, 0.4);
  border-top-color: rgba(255, 255, 255, 0.22);
  font-weight: 600;
  font-size: clamp(13px, 3.6vw, 15px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 4px 14px rgba(0, 0, 0, 0.12);
}

.waple-jelly-btn--ghost::after {
  display: none;
}

.waple-jelly-btn--ghost::before {
  opacity: 0.35;
}

.waple-jelly-btn--ghost:hover {
  color: #ffe5bc;
  background: rgba(255, 255, 255, 0.1);
}

.waple-jelly-btn--compact {
  padding: 9px 16px;
  min-height: 38px;
  font-size: 0.8rem;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.65),
    inset 0 -3px 8px rgba(0, 0, 0, 0.2),
    0 8px 22px rgba(var(--jelly-glow), 0.34),
    0 6px 14px rgba(0, 0, 0, 0.1);
}

.waple-jelly-btn--banner {
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 16px;
  justify-content: flex-start;
  text-align: left;
}

.waple-jelly-btn--banner::before {
  border-radius: 16px 16px 40% 40% / 16px 16px 30% 30%;
}

/* Login tabs — R40 toggle track */
.waple-jelly-tabs {
  display: flex;
  gap: 4px;
  padding: 5px;
  margin-bottom: 30px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.waple-jelly-tabs .tab {
  flex: 1;
  min-width: 0;
  padding: 12px min(14px, 3vw);
  text-align: center;
  cursor: pointer;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  font: inherit;
  font-weight: 500;
  font-size: clamp(13px, 3.8vw, 16px);
  line-height: 1.25;
  transition: background 0.15s ease, color 0.15s ease;
}

.waple-jelly-tabs .tab.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

/* R40 card panel (login) — один blur */
.waple-jelly-panel {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.14) 0%, transparent 32%),
    radial-gradient(ellipse 92% 88% at 50% 45%, rgba(8, 12, 20, 0.62) 0%, rgba(8, 12, 20, 0.38) 35%, rgba(8, 12, 20, 0.14) 72%, rgba(8, 12, 20, 0.06) 100%);
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: rgba(255, 255, 255, 0.48);
  border-bottom-color: rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -4px 12px rgba(0, 0, 0, 0.22),
    0 24px 50px rgba(0, 195, 255, 0.12),
    0 16px 36px rgba(165, 90, 255, 0.08);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}

.waple-jelly-field {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-top-color: rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.07);
  color: #f7fbff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.waple-jelly-field:focus {
  outline: none;
  border-color: rgba(0, 195, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 195, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.waple-jelly-field::placeholder {
  color: rgba(230, 238, 255, 0.5);
}

.waple-jelly-btn--gold {
  --jelly-glow: 245, 158, 11;
  --jelly-liquid: radial-gradient(ellipse 96% 80% at 50% 128%, rgba(255, 210, 100, 1) 0%, rgba(245, 158, 11, 0.88) 22%, rgba(217, 119, 6, 0.38) 46%, transparent 58%);
}

/* Dock (mobile) */
.waple-jelly-btn--dock {
  flex-direction: column;
  gap: 3px;
  width: 100%;
  min-height: 54px;
  padding: 8px 4px 10px;
  border-radius: 14px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.05;
}

.waple-jelly-btn--dock::before {
  height: 36%;
  opacity: 0.75;
}

.waple-jelly-btn--dock .dock-icon {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.waple-jelly-btn--dock .dock-icon svg {
  width: 22px;
  height: 22px;
}

.waple-jelly-btn--dock > span:last-child {
  position: relative;
  z-index: 2;
}

#wapleMobileDock .waple-jelly-btn.waple-dock-active {
  --jelly-glow: 0, 225, 195;
  --jelly-liquid: radial-gradient(ellipse 96% 80% at 50% 128%, rgba(70, 255, 235, 1) 0%, rgba(0, 200, 175, 0.82) 22%, rgba(0, 160, 150, 0.35) 46%, transparent 58%);
}

#wapleMobileDock .waple-jelly-btn.waple-dock-active .dock-icon {
  color: #fff;
}

/* Override flat dock styles (index.html uses !important) */
#wapleMobileDock button.waple-jelly-btn {
  padding: 8px 4px 10px !important;
  font-size: 0.62rem !important;
  font-weight: 700 !important;
  border-radius: 14px !important;
  color: rgba(255, 255, 255, 0.96) !important;
  border: 2px solid rgba(255, 255, 255, 0.22) !important;
  border-top-color: rgba(255, 255, 255, 0.52) !important;
  border-bottom-color: rgba(255, 255, 255, 0.28) !important;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.03) 16%, transparent 30%),
    radial-gradient(ellipse 88% 105% at 50% 42%, rgba(8, 12, 20, 0.58) 0%, rgba(8, 12, 20, 0.42) 32%, rgba(8, 12, 20, 0.16) 68%, rgba(8, 12, 20, 0.06) 100%) !important;
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.72),
    inset 0 -2px 1px rgba(255, 255, 255, 0.42),
    inset 0 -4px 12px rgba(0, 0, 0, 0.26),
    0 16px 40px rgba(var(--jelly-glow), 0.42),
    0 8px 22px rgba(var(--jelly-glow), 0.28),
    0 12px 28px rgba(0, 0, 0, 0.12) !important;
}

#wapleMobileDock button.waple-jelly-btn.waple-dock-active {
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
  border-top-color: rgba(255, 255, 255, 0.55) !important;
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.78),
    inset 0 -2px 1px rgba(255, 255, 255, 0.48),
    0 20px 48px rgba(var(--jelly-glow), 0.52),
    0 10px 28px rgba(var(--jelly-glow), 0.34) !important;
}

body.dark-mode #wapleMobileDock button.waple-jelly-btn {
  color: rgba(255, 255, 255, 0.96) !important;
}

body.dark-mode #wapleMobileDock button.waple-jelly-btn.waple-dock-active {
  color: #fff !important;
}

/* Pomodoro presets */
.waple-jelly-btn--mini {
  min-height: 36px;
  padding: 8px 14px;
  font-size: 0.82rem;
}

.preset-btn.waple-jelly-btn.active,
.waple-jelly-btn--seg.active {
  --jelly-glow: 165, 90, 255;
  --jelly-liquid: radial-gradient(ellipse 96% 80% at 50% 128%, rgba(200, 120, 255, 1) 0%, rgba(110, 160, 255, 0.82) 22%, rgba(130, 60, 255, 0.35) 46%, transparent 58%);
}

/* Settings modal — R40 panel */
body.liquid-glass-mode #settingsModal {
  border-radius: 22px !important;
  border: 2px solid rgba(255, 255, 255, 0.22) !important;
  border-top-color: rgba(255, 255, 255, 0.42) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 24px 50px rgba(0, 195, 255, 0.1),
    0 16px 36px rgba(165, 90, 255, 0.08) !important;
}

body.liquid-glass-mode #pomodoroModal .pomodoro-container {
  border-radius: 22px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 24px 50px rgba(255, 90, 130, 0.12);
}

body.liquid-glass-mode #wapleMobileDock {
  background: rgba(227, 230, 235, 0.9) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.65) !important;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.08) !important;
  padding: 6px 4px max(6px, env(safe-area-inset-bottom)) !important;
}

body.liquid-glass-mode.dark-mode #wapleMobileDock {
  background: rgba(10, 12, 18, 0.92) !important;
  border-top-color: rgba(255, 255, 255, 0.08) !important;
}

body.liquid-glass-mode #chatSendBtn.waple-jelly-btn {
  min-height: 40px;
  padding: 10px 16px;
}

body.liquid-glass-mode .danger.waple-jelly-btn {
  --jelly-glow: 255, 85, 140;
  --jelly-liquid: radial-gradient(ellipse 96% 80% at 50% 128%, rgba(255, 110, 185, 1) 0%, rgba(255, 60, 140, 0.82) 22%, rgba(255, 60, 100, 0.35) 46%, transparent 58%);
}

.pomodoro-close.waple-jelly-btn {
  min-width: 36px;
  min-height: 36px;
  padding: 0 !important;
  border-radius: 50% !important;
  font-size: 22px;
  line-height: 1;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.03) 16%, transparent 30%),
    radial-gradient(ellipse 88% 105% at 50% 42%, rgba(8, 12, 20, 0.58) 0%, rgba(8, 12, 20, 0.42) 32%, rgba(8, 12, 20, 0.16) 68%, rgba(8, 12, 20, 0.06) 100%) !important;
  border: 2px solid rgba(255, 255, 255, 0.22) !important;
}

/* ===== Subscription page ===== */
.waple-sub-page {
  background-color: #0a0c14;
  background-image:
    radial-gradient(circle at 10% 8%, rgba(165, 90, 255, 0.28), transparent 42%),
    radial-gradient(circle at 88% 12%, rgba(0, 195, 255, 0.22), transparent 40%),
    radial-gradient(circle at 50% 92%, rgba(245, 158, 11, 0.12), transparent 38%);
}

.waple-sub-page::before,
.waple-sub-page::after {
  content: none !important;
}

.waple-sub-page .plan {
  border-color: rgba(255, 255, 255, 0.12);
}

.waple-sub-page .provider-switch {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

.waple-sub-page .seg.waple-jelly-btn {
  background: transparent;
  box-shadow: none;
  border: none;
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 10px;
}

.waple-sub-page .seg.waple-jelly-btn::before,
.waple-sub-page .seg.waple-jelly-btn::after {
  display: none;
}

.waple-sub-page .seg.waple-jelly-btn.active {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #fff;
}

.waple-sub-page .logout-btn.waple-jelly-btn {
  min-height: 36px;
  padding: 8px 14px;
  font-size: 13px;
}

.waple-sub-page .cta-btn.waple-jelly-btn {
  margin-top: auto;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  width: 100%;
  border-radius: 999px;
}

.waple-sub-page .cta-btn.waple-jelly-btn:hover {
  transform: none;
}

.waple-sub-page .cta-btn.cta-primary.waple-jelly-btn,
.waple-sub-page .cta-btn.cta-gold.waple-jelly-btn,
.waple-sub-page .cta-btn.waple-jelly-btn {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.03) 16%, transparent 30%),
    radial-gradient(ellipse 88% 105% at 50% 42%, rgba(8, 12, 20, 0.58) 0%, rgba(8, 12, 20, 0.42) 32%, rgba(8, 12, 20, 0.16) 68%, rgba(8, 12, 20, 0.06) 100%);
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: rgba(255, 255, 255, 0.52);
  color: rgba(255, 255, 255, 0.96);
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.72),
    inset 0 -2px 1px rgba(255, 255, 255, 0.42),
    0 16px 40px rgba(var(--jelly-glow), 0.42),
    0 8px 22px rgba(var(--jelly-glow), 0.28);
}

.waple-sub-page .post-pay-hint button.waple-jelly-btn {
  font-size: 14px;
}

/* ===== App: active tab → violet R40 ===== */
body.liquid-glass-mode .header-right-tabs > button.waple-header-tab--active.waple-jelly-btn {
  --jelly-glow: 165, 90, 255;
  --jelly-liquid: radial-gradient(ellipse 96% 80% at 50% 128%, rgba(200, 120, 255, 1) 0%, rgba(110, 160, 255, 0.82) 22%, rgba(130, 60, 255, 0.35) 46%, transparent 58%);
}

body.liquid-glass-mode .header-right-tabs .waple-jelly-btn {
  margin: 0 2px 6px;
}

body.liquid-glass-mode .header-bar .waple-jelly-btn--compact {
  min-height: 36px;
  padding: 8px 14px;
}

body.liquid-glass-mode .header-bar {
  overflow: visible !important;
}

body.liquid-glass-mode .header-right-tabs {
  overflow: visible;
  align-items: flex-start;
  flex-wrap: wrap;
}

body.liquid-glass-mode .idea-tree-entry-btn.waple-jelly-btn {
  display: flex;
  margin-bottom: 10px;
}

body.liquid-glass-mode .idea-tree-entry-btn-mark {
  position: relative;
  z-index: 2;
}

/* Сброс конфликтующих стилей Classic */
body.liquid-glass-mode .waple-jelly-btn {
  transform: none !important;
}

body.liquid-glass-mode .waple-jelly-btn:hover {
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .waple-jelly-btn,
  body.liquid-glass-mode button {
    transition: none !important;
  }
}
