/* Nova support widget — partials/support-widget.ejs + js/nova/nova-support.js.
   Layout follows PolyBet's widget (Home with greeting + help, Messages thread, bottom tabs),
   drawn with nova tokens: green brand hero, ink surfaces, the skin's panel/line greys. */
.nsw { position: fixed; right: 24px; bottom: 24px; z-index: 70; font-family: var(--font); color: var(--bone); }
.nsw *, .nsw *::before, .nsw *::after { box-sizing: border-box; }
.nsw svg { display: block; flex: none; }
/* The widget sits outside .nova-shell, so the shell's link reset doesn't reach it. */
:where(.nsw a) { color: inherit; text-decoration: none; }
.nsw a:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 4px; }
.nsw-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Launcher */
.nsw-fab {
  position: relative; display: grid; place-items: center; width: 48px; height: 48px; margin-left: auto;
  border: 0; border-radius: 50%; background: #fff; color: #141414; cursor: pointer;
  transition: background .15s, transform .15s;
}
.nsw-fab:hover { background: #e9e9e9; }
.nsw-fab:active { transform: scale(.95); }
.nsw-fab:focus-visible { outline: 2px solid var(--bone); outline-offset: 3px; }
.nsw-fab__i { grid-area: 1 / 1; display: grid; place-items: center; transition: opacity .18s, transform .22s; }
.nsw-fab__i svg { width: 22px; height: 22px; }
.nsw-fab__i--close { opacity: 0; transform: rotate(-60deg) scale(.6); }
.nsw.is-open .nsw-fab__i--open { opacity: 0; transform: rotate(60deg) scale(.6); }
.nsw.is-open .nsw-fab__i--close { opacity: 1; transform: none; }
.nsw.is-open .nsw-fab { display: none; }
.nsw-fab__badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: 11px; background: var(--down); border: 2px solid var(--ink); color: #fff; font-size: 12px; font-weight: 600; line-height: 1; }
.nsw-fab__badge[hidden] { display: none; }

/* Panel */
.nsw-panel {
  position: absolute; right: 0; bottom: 0; display: flex; flex-direction: column;
  width: min(384px, calc(100vw - 32px)); height: min(640px, calc(100dvh - 48px)); overflow: hidden;
  background: var(--ink); border: 1px solid rgba(255,255,255,.08); border-radius: 14px;
  transform-origin: 100% 100%; animation: nsw-in .2s cubic-bezier(.2,.8,.2,1);
}
.nsw-panel[hidden] { display: none; }
@keyframes nsw-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.nsw-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.nsw-view[hidden] { display: none; }

.nsw-icon-btn { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; transition: background .15s; }
.nsw-icon-btn:hover { background: rgba(255,255,255,.08); }
.nsw-icon-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }

/* Home */
.nsw-view--home { overflow-y: auto; overscroll-behavior: contain; }
.nsw-hero { flex: none; padding: 16px 16px 58px 22px; background: var(--signal); color: var(--signal-ink); }
.nsw-hero .nsw-icon-btn:hover { background: rgba(0,0,0,.1); }
.nsw-hero__bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.nsw-brand { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.nsw-brand strong { font-weight: 600; }
.nsw-brand img { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; }
.nsw-brand__mark { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--signal-ink); color: var(--signal); font-size: 12px; font-weight: 600; }
.nsw-hero h2 { margin: 0; font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.nsw-hero__sub { margin: 4px 0 0; font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; opacity: .62; }

.nsw-home { display: flex; flex-direction: column; gap: 10px; margin-top: -40px; padding: 0 14px 18px; }

/* Start-a-chat card: operator stack | live status + hint | arrow. */
.nsw-start {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; text-align: left;
  background: var(--ink); border: 1px solid rgba(255,255,255,.1); border-radius: 12px; color: var(--bone);
  font: inherit; cursor: pointer; transition: border-color .18s;
}
.nsw-start:hover { border-color: rgba(2,192,118,.55); }
.nsw-start:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.nsw-team { flex: none; display: flex; }
.nsw-team img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; outline: 2px solid var(--ink); transition: transform .2s; }
.nsw-team img + img { margin-left: -12px; }
.nsw-start:hover .nsw-team img:nth-child(1) { transform: translateX(-3px); }
.nsw-start:hover .nsw-team img:nth-child(3) { transform: translateX(3px); }
.nsw-start__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.nsw-start__status { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.nsw-start__hint { color: var(--stone); font-size: 12px; }
.nsw-live { position: relative; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.nsw-live::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok); opacity: 0; animation: nsw-live 2.2s ease-out infinite; }
@keyframes nsw-live { 0% { transform: scale(.5); opacity: .7; } 80%, 100% { transform: scale(1.3); opacity: 0; } }
.nsw-start__arrow { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--stone); transition: color .18s, background .18s, transform .18s; }
.nsw-start:hover .nsw-start__arrow { color: var(--signal-ink); background: var(--signal); transform: translateX(2px); }

.nsw-arts { padding: 14px 6px 6px; background: var(--ink); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; }
.nsw-arts h3 { margin: 0 10px 6px; color: var(--faint); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.nsw-arts ul { list-style: none; margin: 0; padding: 0; }
.nsw-arts li a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; border-radius: 7px; color: var(--bone); font-size: 14px; line-height: 1.35; }
.nsw-arts li a svg { color: var(--faint); transition: transform .15s, color .15s; }
.nsw-arts li a:hover { background: rgba(255,255,255,.04); }
.nsw-arts li a:hover svg { color: var(--signal); transform: translateX(2px); }
.nsw-arts__all { display: block; margin: 4px 10px 6px; padding-top: 6px; color: var(--signal); font-size: 14px; font-weight: 600; }
.nsw-arts__all:hover { color: var(--signal-2); }

/* Chat — values taken from PolyBet's widget (layout-form.css .sw__header / .sw__list / .sw__msg /
   .sw__footer), recoloured: PolyBet blue (#26A3FD / header gradient) -> nova green, #15191D -> ink. */
.nsw-head { flex: none; display: flex; align-items: center; min-height: 56px; padding: 14px 14px 14px 16px; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.12); background: var(--signal); color: var(--signal-ink); }
.nsw-head .nsw-icon-btn { color: rgba(41,40,42,.82); }
.nsw-head .nsw-icon-btn:hover { background: rgba(0,0,0,.1); border-color: transparent; color: var(--signal-ink); }
.nsw-back { margin-left: -6px; }
.nsw-head__ava { flex: none; width: 36px; height: 36px; border-radius: 12px; object-fit: cover; }
.nsw-head__txt { flex: 1; min-width: 0; }
.nsw-head__title { margin: 0; overflow: hidden; font-size: 16px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; }
.nsw-view--chat .nsw-icon-btn { width: 30px; height: 30px; border-radius: 10px; border: 1px solid transparent; }

.nsw-feed {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px 8px 12px 14px;
  background: var(--ink); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) rgba(255,255,255,.04);
}
.nsw-feed::-webkit-scrollbar { width: 5px; }
.nsw-feed::-webkit-scrollbar-track { margin: 8px 0; background: rgba(255,255,255,.04); border-radius: 999px; }
.nsw-feed::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 999px; border: 1px solid transparent; background-clip: padding-box; }
.nsw-feed::-webkit-scrollbar-thumb:hover { background: rgba(2,192,118,.55); background-clip: padding-box; }
.nsw-welcome { width: 100%; margin: 4px 0 2px; }
.nsw-welcome p { margin: 0; color: rgba(255,255,255,.5); font-size: 12px; line-height: 1.45; }
.nsw-welcome b { color: var(--bone); font-weight: 600; }
.nsw-day { flex: none; display: flex; align-items: center; justify-content: center; width: 100%; margin: 10px 0 6px; padding: 0 8px; }
.nsw-day span { color: rgba(255,255,255,.78); font-size: 12px; font-weight: 600; letter-spacing: .02em; line-height: 1.2; white-space: nowrap; }

.nsw-msg { display: flex; flex-direction: column; max-width: 88%; gap: 4px; }
.nsw-msg--out { align-self: flex-end; align-items: flex-end; }
.nsw-msg--in { align-self: flex-start; align-items: flex-start; }
.nsw-bubble { padding: 9px 12px; border: 1px solid transparent; border-radius: 12px; font-size: 14px; line-height: 1.45; letter-spacing: -.01em; }
.nsw-msg--in .nsw-bubble { background: var(--panel-2); border-color: rgba(255,255,255,.06); color: var(--bone); }
.nsw-msg--out .nsw-bubble { background: var(--signal); color: var(--signal-ink); font-weight: 500; }
.nsw-body { margin: 0; word-break: break-word; }
.nsw-body a { color: var(--signal); text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.nsw-msg--out .nsw-body a { color: var(--signal-ink); }
.nsw-time { display: inline-flex; align-items: center; gap: 3px; padding: 0 2px; color: var(--faint); font-size: 12px; letter-spacing: -.01em; }
.nsw-tick { display: inline-flex; color: var(--faint); font-style: normal; transition: color .25s; }
.nsw-tick.is-read { color: var(--signal); }
.nsw-msg--out .nsw-time { text-align: right; }

.nsw-img-wrap { display: block; margin-top: 8px; max-width: min(240px, 72vw); padding: 0; border: 0; background: transparent; cursor: zoom-in; font: inherit; color: inherit; }
.nsw-img-wrap:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 10px; }
.nsw-img { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); pointer-events: none; }
.nsw-msg--media .nsw-bubble { padding: 0; background: transparent !important; border-color: transparent !important; color: var(--bone); font-weight: 500; }
.nsw-msg--media-only .nsw-img-wrap { margin-top: 0; }
.nsw-caption { display: block; padding: 9px 12px; border-radius: 12px; line-height: 1.45; word-break: break-word; }
.nsw-msg--out .nsw-caption { background: var(--signal); color: var(--signal-ink); font-weight: 500; }
.nsw-msg--in .nsw-caption { background: var(--panel-2); border: 1px solid rgba(255,255,255,.06); color: var(--bone); }

.nsw-foot { flex: none; padding: 12px 14px 14px; background: var(--ink); }
.nsw-err { margin: 0 2px 8px; color: var(--bad); font-size: 12px; }
.nsw-err[hidden] { display: none; }
.nsw-compose { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; }
.nsw-file { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); border: 0; opacity: 0; }
.nsw-attach { flex: 0 0 32px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--faint); cursor: pointer; transition: background .12s, color .12s; }
.nsw-attach:hover { color: var(--bone); background: rgba(255,255,255,.06); }
.nsw-box { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 4px 12px; background: var(--ink); border: 1px solid rgba(255,255,255,.12); border-radius: 18px; transition: border-color .15s; }
.nsw-box:focus-within { border-color: rgba(255,255,255,.2); }
.nsw .nsw-input, .nsw .nsw-input:focus {
  flex: 1 1 auto; width: 100%; min-width: 0; max-height: 128px; margin: 0; padding: 7px 4px; resize: none;
  background: transparent !important; border: 0 !important; border-radius: 0; box-shadow: none; outline: none;
  color: var(--bone); font-family: inherit; font-size: 14px; line-height: 1.45;
}
.nsw-input::placeholder { color: var(--faint); }
.nsw-send { flex: 0 0 38px; display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; margin: 0; border: 0; border-radius: 50%; background: var(--btn); color: var(--btn-ink); cursor: pointer; transition: background .14s, transform .1s, opacity .14s; }
.nsw-send svg { margin-left: 2px; }
.nsw-send:hover:not(:disabled) { background: var(--btn-hover); }
.nsw-send:active:not(:disabled) { transform: scale(.92); }
.nsw-send:disabled { opacity: .5; cursor: default; }
.nsw-preview { position: relative; align-self: stretch; max-width: 100%; margin: 6px 0 0; }
.nsw-preview[hidden] { display: none; }
.nsw-preview img { display: block; width: 100%; max-height: 160px; object-fit: cover; border-radius: 10px; border: 1px solid rgba(255,255,255,.12); }
.nsw-preview__clear { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: rgba(27,26,28,.88); color: var(--faint); cursor: pointer; backdrop-filter: blur(6px); transition: color .12s, border-color .12s; }
.nsw-preview__clear:hover { color: var(--bone); border-color: rgba(255,255,255,.2); }

.nsw-gate { flex: none; padding: 18px 18px 16px; border-top: 1px solid var(--line); text-align: center; }
.nsw-gate__ico { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 10px; border-radius: 50%; border: 1px solid var(--line-2); color: var(--bone); }
.nsw-gate strong { display: block; font-size: 14px; font-weight: 600; }
.nsw-gate p { margin: 6px auto 14px; max-width: 30ch; color: var(--stone); font-size: 12px; line-height: 1.5; }
.nsw-gate__act { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nsw-gate__act .nova-btn { width: 100%; }

/* Bottom tabs */
.nsw-tabs { flex: none; display: grid; grid-template-columns: 1fr 1fr; background: var(--ink); }
.nsw-tabs button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0 11px; border: 0; background: none; color: var(--faint); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: color .15s; }
.nsw-tabs button:hover { color: var(--stone); }
.nsw-tabs button.is-on { color: var(--bone); }
.nsw-tabs button.is-on svg { color: var(--bone); }
.nsw-tabs button:focus-visible { outline: 2px solid var(--signal); outline-offset: -4px; border-radius: 8px; }
.nsw-tabs__dot { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; display: grid; place-items: center; border-radius: 9px; background: var(--down); color: #fff; font-size: 12px; font-weight: 600; font-style: normal; line-height: 1; }
.nsw-tabs__dot[hidden] { display: none; }
.nsw-panel.is-chat .nsw-tabs { display: none; }

.nsw-lightbox { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.88); cursor: zoom-out; }
.nsw-lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.nsw-lightbox button { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-size: 20px; cursor: pointer; }

/* Phone: full screen sheet */
@media (max-width: 560px) {
  .nsw { right: 16px; bottom: 16px; }
  .nsw-panel { position: fixed; inset: 0; width: auto; height: 100dvh; border: 0; border-radius: 0; animation-name: nsw-up; }
  .nsw-hero h2, .nsw-hero__sub { font-size: 28px; }
  .nsw-tabs { padding-bottom: env(safe-area-inset-bottom); }
  .nsw-head { padding: 12px 14px; }
  .nsw-head__ava { width: 40px; height: 40px; }
  .nsw-head__title { font-size: 16px; }
  .nsw-view--chat .nsw-icon-btn { width: 36px; height: 36px; }
  .nsw-feed { padding: 12px 12px 10px 14px; }
  .nsw-foot { padding: 10px 12px max(12px, env(safe-area-inset-bottom)); }
  .nsw .nsw-input { font-size: 16px; min-height: 40px; }
  .nsw-send { flex-basis: 42px; width: 42px; height: 42px; }
  .nsw-attach { flex-basis: 40px; width: 40px; height: 40px; }
}
@keyframes nsw-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
html.nsw-lock, html.nsw-lock body { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .nsw-panel { animation: none; }
  .nsw-fab, .nsw-fab__i, .nsw-arts li a svg, .nsw-send, .nsw-team img, .nsw-start__arrow { transition: none; }
  .nsw-live::after { animation: none; }
}
