.luna-widget{
  --luna-ink:#6d4e3f;
  --luna-ink-strong:#5a3d32;
  --luna-muted:#9c7f6f;
  --luna-gold:#c89b63;
  position:fixed;
  right:22px;
  bottom:22px;
  z-index:9000;
  display:grid;
  gap:12px;
  justify-items:end;
  pointer-events:none;
}

/* Statické HTML má starý srpek měsíce a někde pulzující ::after — skrýt do hydratace (luna-widget.js nastaví data-kp-luna=v2). */
.luna-widget[data-luna-widget]:not([data-kp-luna="v2"]) .luna-head .luna-orb svg,
.luna-widget[data-luna-widget]:not([data-kp-luna="v2"]) .luna-toggle .luna-orb svg{
  visibility:hidden !important;
}

.luna-widget[data-luna-widget]:not([data-kp-luna="v2"]) .luna-toggle::after{
  content:none !important;
  animation:none !important;
  opacity:0 !important;
  border:0 !important;
}

.luna-panel{
  display:none;
  width:min(380px, calc(100vw - 28px));
  overflow:hidden;
  border:1px solid rgba(200,155,99,.22);
  border-radius:28px;
  background:linear-gradient(180deg, rgba(255,248,242,.98), rgba(247,237,227,.98));
  box-shadow:0 24px 70px rgba(80,45,20,.18);
  pointer-events:auto;
}

.luna-widget.open .luna-panel{display:block}
.luna-widget.open .luna-toggle{display:none}

.luna-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:16px 16px 14px;
  border-bottom:1px solid rgba(200,155,99,.16);
  background:
    radial-gradient(circle at 18% 0%, rgba(242,216,182,.78), transparent 38%),
    rgba(255,255,255,.26);
}

.luna-id{
  display:flex;
  align-items:center;
  gap:11px;
  min-width:0;
}

.luna-orb{
  display:grid;
  flex:0 0 42px;
  width:42px;
  height:42px;
  place-items:center;
  border-radius:50%;
  background:transparent;
  color:#7a4f35;
  box-shadow:none;
  border:0;
}

.luna-orb svg{
  width:34px;
  height:34px;
  display:block;
}

/* hard reset for unified Luna icon across legacy pages */
.luna-widget[data-kp-luna="v2"] .luna-orb{
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
  outline:0 !important;
}
.luna-widget[data-kp-luna="v2"] .luna-toggle{
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
}
.luna-widget[data-kp-luna="v2"] .luna-toggle::after{
  content:none !important;
  display:none !important;
}
.luna-widget[data-kp-luna="v2"] .luna-toggle .luna-orb{
  width:62px !important;
  height:62px !important;
  flex-basis:62px !important;
}
.luna-widget[data-kp-luna="v2"] .luna-head .luna-orb{
  width:42px !important;
  height:42px !important;
  flex-basis:42px !important;
}
.luna-widget[data-kp-luna="v2"] .luna-orb svg{
  display:block !important;
  width:100% !important;
  height:100% !important;
  max-width:none !important;
  max-height:none !important;
}

.luna-widget[data-kp-luna="v2"] .luna-orb::before,
.luna-widget[data-kp-luna="v2"] .luna-orb::after,
.luna-widget[data-kp-luna="v2"] .luna-toggle .luna-orb::before,
.luna-widget[data-kp-luna="v2"] .luna-toggle .luna-orb::after{
  content:none !important;
  display:none !important;
}

.luna-widget[data-kp-luna="v2"] .luna-toggle .luna-orb{
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
}

.luna-widget[data-kp-luna="v2"] .luna-orb svg{
  filter:none !important;
  opacity:1 !important;
}

.luna-id strong{
  display:block;
  color:var(--luna-ink-strong);
  font-family:Georgia,"Times New Roman",serif;
  font-size:22px;
  line-height:1;
  letter-spacing:-.04em;
}

.luna-id span{
  display:block;
  margin-top:3px;
  color:var(--luna-muted);
  font-size:12px;
  line-height:1.35;
}

.luna-close{
  display:grid;
  width:34px;
  height:34px;
  place-items:center;
  border:1px solid rgba(200,155,99,.18);
  border-radius:50%;
  background:rgba(255,255,255,.48);
  color:var(--luna-ink);
  cursor:pointer;
  font:inherit;
  font-size:20px;
}

.luna-messages{
  display:flex;
  flex-direction:column;
  gap:10px;
  max-height:330px;
  min-height:250px;
  overflow:auto;
  padding:16px;
  scroll-behavior:smooth;
}

.luna-message{
  width:fit-content;
  max-width:88%;
  padding:11px 13px;
  border-radius:18px;
  color:var(--luna-ink);
  font-size:14px;
  line-height:1.5;
  overflow-wrap:anywhere;
  word-break:normal;
}

.luna-message.bot{
  border-top-left-radius:7px;
  background:rgba(255,255,255,.58);
  border:1px solid rgba(200,155,99,.15);
}

.luna-message.user{
  align-self:flex-end;
  border-top-right-radius:7px;
  background:linear-gradient(180deg, rgba(229,201,163,.34), rgba(200,155,99,.2));
  color:#6c452d;
}

.luna-message a,
.luna-course-link{
  color:#8c5f33;
  font-weight:850;
  text-decoration:underline;
  text-decoration-thickness:1px;
  text-underline-offset:3px;
  overflow-wrap:anywhere;
}

.luna-gate{
  display:none;
  margin:0 16px 16px;
  padding:15px;
  border-radius:20px;
  background:rgba(255,255,255,.6);
  border:1px solid rgba(200,155,99,.18);
  color:var(--luna-muted);
  font-size:13px;
  line-height:1.55;
}

.luna-gate.show{display:block}

.luna-account-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:100%;
  min-height:44px;
  margin-top:12px;
  padding:12px 18px;
  border:0;
  border-radius:999px;
  background:linear-gradient(135deg, #e5c9a3, #c89b63);
  color:#fffaf2;
  font-size:13px;
  font-weight:800;
  letter-spacing:.02em;
  text-decoration:none;
  box-shadow:0 12px 28px rgba(200,155,99,.22);
  transition:transform .25s ease, box-shadow .25s ease;
}

.luna-account-btn:hover{
  transform:translateY(-1px);
  box-shadow:0 16px 34px rgba(200,155,99,.28);
}

.luna-gate button.luna-account-btn,
.luna-gate button.btn{
  font-family:inherit;
  cursor:pointer;
}

.luna-subscription-modal{
  position:fixed;
  inset:0;
  z-index:2147483005;
  display:none;
  place-items:center;
  padding:22px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,248,239,.34), transparent 34%),
    rgba(54,34,24,.46);
  -webkit-backdrop-filter:blur(10px);
  backdrop-filter:blur(10px);
}

.luna-subscription-modal.show{display:grid}

body.luna-subscription-open{overflow:hidden}

.luna-subscription-card{
  position:relative;
  width:min(560px, 100%);
  max-height:min(88vh, 720px);
  overflow:auto;
  padding:30px;
  border:1px solid rgba(200,155,99,.24);
  border-radius:30px;
  background:
    radial-gradient(circle at 88% 8%, rgba(229,201,163,.32), transparent 28%),
    linear-gradient(180deg, rgba(255,250,244,.98), rgba(247,237,227,.98));
  box-shadow:0 32px 90px rgba(45,28,19,.32);
  color:var(--luna-ink);
}

.luna-subscription-close{
  position:absolute;
  top:16px;
  right:16px;
  display:grid;
  place-items:center;
  width:38px;
  height:38px;
  border:1px solid rgba(200,155,99,.2);
  border-radius:50%;
  background:rgba(255,255,255,.64);
  color:var(--luna-ink-strong);
  font-size:25px;
  line-height:1;
  cursor:pointer;
}

.luna-subscription-kicker{
  display:block;
  margin:0 auto 12px;
  color:#a87946;
  font-size:12px;
  font-weight:850;
  letter-spacing:.14em;
  text-align:center;
  text-transform:uppercase;
}

.luna-subscription-card h2{
  margin:0 auto 14px;
  color:var(--luna-ink-strong);
  font-family:Georgia,"Times New Roman",serif;
  font-size:clamp(32px, 6vw, 48px);
  line-height:1;
  letter-spacing:-.045em;
  text-align:center;
}

.luna-subscription-lead,
.luna-subscription-note{
  margin:0;
  color:var(--luna-muted);
  font-size:15px;
  line-height:1.75;
}

.luna-subscription-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:10px;
  margin:22px 0;
}

.luna-subscription-grid span{
  position:relative;
  min-height:54px;
  padding:14px 14px 14px 39px;
  border:1px solid rgba(200,155,99,.16);
  border-radius:18px;
  background:rgba(255,255,255,.58);
  color:var(--luna-ink-strong);
  font-size:13px;
  font-weight:800;
  line-height:1.35;
}

.luna-subscription-grid span::before{
  content:"";
  position:absolute;
  left:14px;
  top:17px;
  width:14px;
  height:14px;
  border-radius:50%;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 2px, transparent 3px),
    linear-gradient(135deg, #e5c9a3, #c89b63);
  box-shadow:0 8px 18px rgba(200,155,99,.18);
}

.luna-subscription-cta{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:52px;
  margin-top:24px;
  padding:14px 18px;
  border-radius:999px;
  background:linear-gradient(135deg, #e5c9a3, #c89b63);
  color:#fffaf2;
  font-size:clamp(12px, 2.9vw, 15px);
  font-weight:900;
  text-decoration:none;
  white-space:nowrap;
  box-shadow:0 18px 38px rgba(200,155,99,.32);
  transition:transform .22s ease, box-shadow .22s ease;
}

.luna-subscription-cta:hover{
  transform:translateY(-1px);
  box-shadow:0 22px 48px rgba(200,155,99,.38);
}

.luna-subscription-secondary{
  display:block;
  width:100%;
  margin-top:11px;
  border:0;
  background:transparent;
  color:var(--luna-muted);
  font:inherit;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
}

.luna-form{
  display:flex;
  gap:9px;
  padding:0 16px 16px;
}

.luna-form input{
  width:100%;
  min-height:46px;
  border:1px solid rgba(200,155,99,.22);
  border-radius:999px;
  background:rgba(255,255,255,.62);
  color:var(--luna-ink-strong);
  font:inherit;
  font-size:14px;
  outline:none;
  padding:0 15px;
}

.luna-form input:focus{
  border-color:rgba(200,155,99,.48);
  box-shadow:0 0 0 4px rgba(200,155,99,.08);
}

.luna-form button{
  display:grid;
  flex:0 0 46px;
  width:46px;
  height:46px;
  place-items:center;
  border:0;
  border-radius:50%;
  background:linear-gradient(180deg, #e5c9a3 0%, #c89b63 100%);
  color:#fff8f2;
  cursor:pointer;
  box-shadow:0 12px 24px rgba(140,88,48,.18);
}

.luna-form button:disabled{cursor:not-allowed;opacity:.58}

.luna-toggle{
  position:relative;
  display:grid;
  width:62px;
  height:62px;
  place-items:center;
  padding:0;
  border:0;
  border-radius:50%;
  background:transparent;
  color:var(--luna-ink-strong);
  cursor:pointer;
  font:inherit;
  box-shadow:none;
  pointer-events:auto;
  animation:luna-float 3.4s ease-in-out infinite;
}

.luna-toggle::after{
  content:none;
}

.luna-toggle .luna-orb{width:62px;height:62px;flex-basis:62px}
.luna-toggle .luna-orb svg{width:62px;height:62px}

.luna-toggle-text{
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip:rect(0 0 0 0);
  white-space:nowrap;
}

.luna-nudge{
  position:absolute;
  right:0;
  bottom:74px;
  width:max-content;
  max-width:min(280px, calc(100vw - 34px));
  padding:13px 15px;
  border:1px solid rgba(200,155,99,.2);
  border-radius:18px 18px 6px 18px;
  background:rgba(255,248,242,.96);
  color:var(--luna-ink);
  font-size:13px;
  line-height:1.45;
  box-shadow:0 18px 42px rgba(80,45,20,.14);
  opacity:0;
  transform:translateY(8px);
  pointer-events:none;
  transition:opacity .24s ease, transform .24s ease;
}

.luna-spark{
  width:15px;
  height:15px;
  display:inline-block;
  margin-left:3px;
  color:var(--luna-gold);
  vertical-align:-2px;
}

.luna-widget.nudge .luna-nudge{opacity:1;transform:translateY(0)}
.luna-widget.open .luna-nudge{display:none}
.luna-widget.open .luna-toggle{animation:none}

.luna-nudge::after{
  content:"";
  position:absolute;
  right:22px;
  bottom:-7px;
  width:14px;
  height:14px;
  background:rgba(255,248,242,.96);
  border-right:1px solid rgba(200,155,99,.2);
  border-bottom:1px solid rgba(200,155,99,.2);
  transform:rotate(45deg);
}

@keyframes luna-float{
  0%,100%{transform:translateY(0)}
  50%{transform:translateY(-5px)}
}

@keyframes luna-pulse{
  0%{transform:scale(.9);opacity:.42}
  70%{transform:scale(1.22);opacity:0}
  100%{transform:scale(1.22);opacity:0}
}

@media(max-width:720px){
  .luna-widget{right:14px;bottom:14px}
  .luna-panel{width:calc(100vw - 28px);border-radius:24px}
  .luna-messages{max-height:300px}
  .luna-subscription-card{padding:26px 20px;border-radius:24px}
  .luna-subscription-grid{grid-template-columns:1fr}
}
