.ssb,
.ssb * {
  box-sizing: border-box;
}
.ssb {
  font-family: var(--font);
  color: var(--ink);
  --tint: #f6f4ff;
}
.ssb button {
  font: inherit;
  cursor: pointer;
}
.ssb-launch {
  position: fixed;
  right: 1.25rem;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1.25rem);
  z-index: 1005;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 58px;
  padding: 0 1.25rem 0 1rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #8b5cff, #5e31d8);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 8px 24px rgba(94, 49, 216, 0.4);
  animation: ssbpop 0.5s 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.ssb-launch::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}
.ssb-launch.nudge::before {
  animation: ssbring 1.8s ease-out 4;
}
.ssb-launch.wig {
  animation: ssbwig 0.7s ease 1;
}
.ssb-launch:hover {
  filter: brightness(1.08);
}
.ssb-launch svg {
  width: 24px;
  height: 24px;
}
.ssb-dot {
  position: absolute;
  top: -4px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #f5b93a;
  color: #1e123e;
  border: 2px solid #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.ssb-dot[hidden] {
  display: none;
}
@keyframes ssbpop {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes ssbring {
  0% {
    box-shadow: 0 0 0 0 rgba(139, 92, 255, 0.55);
  }
  100% {
    box-shadow: 0 0 0 22px rgba(139, 92, 255, 0);
  }
}
@keyframes ssbwig {
  0%,
  100% {
    transform: none;
  }
  20% {
    transform: rotate(-6deg) scale(1.06);
  }
  40% {
    transform: rotate(6deg) scale(1.06);
  }
  60% {
    transform: rotate(-4deg);
  }
  80% {
    transform: rotate(4deg);
  }
}
@keyframes ssbin {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.ssb-tease {
  position: fixed;
  right: 1.25rem;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 5.9rem);
  z-index: 1005;
  width: 290px;
  max-width: calc(100vw - 2.5rem);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px 18px 4px 18px;
  padding: 1rem 1rem 0.9rem;
  box-shadow: 0 12px 36px rgba(30, 18, 62, 0.25);
  font-size: 0.9375rem;
  line-height: 1.45;
  cursor: pointer;
  animation: ssbin 0.4s ease both;
}
.ssb-tease b {
  display: block;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.15rem;
  padding-right: 1.5rem;
}
.ssb-tease p {
  margin: 0 0 0.7rem;
  color: var(--muted);
}
.ssb-tease .x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}
.ssb-tease .x:hover {
  background: var(--soft);
}
.ssb-tease .st {
  width: 100%;
}
.ssb-panel {
  position: fixed;
  right: 1.25rem;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1.25rem);
  z-index: 1010;
  width: 410px;
  max-width: calc(100vw - 2rem);
  height: min(660px, calc(100vh - 2.5rem));
  display: flex;
  flex-direction: column;
  background: var(--tint);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(30, 18, 62, 0.35);
  overflow: hidden;
  animation: ssbin 0.3s ease both;
}
.ssb-panel[hidden],
.ssb-tease[hidden],
.ssb-launch[hidden] {
  display: none;
}
.ssb-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, #1e123e, #3f2a8c);
  color: #fff;
}
.ssb-av {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  color: #5e31d8;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex: none;
}
.ssb-av:after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #3ddc97;
  border: 2px solid #2a1b66;
}
.ssb-head b {
  display: block;
  font-weight: 600;
  line-height: 1.2;
}
.ssb-head small {
  color: #cfc5f5;
  font-size: 0.8125rem;
}
.ssb-head .sp {
  flex: 1;
}
.ssb-ib {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 16px;
}
.ssb-ib:hover {
  background: rgba(255, 255, 255, 0.22);
}
.ssb-bar {
  height: 4px;
  background: #e3dcfa;
}
.ssb-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #8b5cff, #f5b93a);
  transition: width 0.5s;
}
.ssb-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}
.ssb-body > * {
  flex-shrink: 0;
}
.ssb-m {
  max-width: 86%;
  padding: 0.65rem 0.9rem;
  border-radius: 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
  white-space: pre-wrap;
  animation: ssbin 0.25s ease both;
}
.ssb-b {
  background: #fff;
  border: 1px solid #e6e0f7;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 2px rgba(30, 18, 62, 0.05);
}
.ssb-u {
  background: linear-gradient(135deg, #7748f9, #5e31d8);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.ssb-ty {
  display: flex;
  gap: 4px;
  padding: 0.9rem;
}
.ssb-ty span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a99bd6;
  animation: ssbt 1s infinite;
}
.ssb-ty span:nth-child(2) {
  animation-delay: 0.15s;
}
.ssb-ty span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes ssbt {
  50% {
    opacity: 0.25;
    transform: translateY(-2px);
  }
}
.ssb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  animation: ssbin 0.25s ease both;
}
.ssb-chip {
  min-height: 42px;
  padding: 0.45rem 0.95rem;
  border: 1.5px solid #c9b8ff;
  border-radius: 999px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}
.ssb-chip:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.ssb-row {
  display: flex;
  gap: 0.5rem;
  animation: ssbin 0.25s ease both;
}
.ssb .in,
.ssb select,
.ssb textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #dad3f0;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
}
.ssb .in:focus,
.ssb select:focus,
.ssb textarea:focus {
  border-color: var(--accent);
  outline: 3px solid var(--accent-soft);
}
.ssb textarea {
  min-height: 68px;
  resize: vertical;
}
.ssb-go {
  min-height: 44px;
  padding: 0 1.1rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #7748f9, #5e31d8);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ssb-go:hover {
  filter: brightness(1.08);
}
.ssb-go.alt {
  background: #fff;
  color: var(--accent-strong);
  border: 1.5px solid var(--accent);
}
.ssb-pks {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 0 -1rem;
  padding: 0.2rem 1rem 0.6rem;
  align-self: stretch;
  scrollbar-width: thin;
}
.ssb-pk {
  flex: 0 0 82%;
  scroll-snap-align: start;
  border: 1px solid #e6e0f7;
  border-top: 4px solid var(--accent);
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
  background: #fff;
  font-size: 0.875rem;
  line-height: 1.45;
  box-shadow: 0 2px 8px rgba(30, 18, 62, 0.06);
}
.ssb-pk h4 {
  margin: 0 0 0.2rem;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}
.ssb-pk p {
  margin: 0.3rem 0;
}
.ssb-pk .m2 {
  color: var(--muted);
}
.ssb-pk .bn {
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
}
.ssb-form {
  align-self: stretch;
  display: grid;
  gap: 0.7rem;
  border: 1px solid #e6e0f7;
  border-radius: 16px;
  padding: 1rem;
  background: #fff;
  box-shadow: 0 2px 8px rgba(30, 18, 62, 0.06);
  animation: ssbin 0.3s ease both;
}
.ssb-form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
}
.ssb-form small {
  font-weight: 400;
  color: var(--muted);
}
.ssb-form .r:after {
  content: " *";
  color: #b3261e;
}
.ssb-err {
  color: #b3261e;
  font-size: 0.8125rem;
  min-height: 1em;
}
.ssb-sum {
  align-self: stretch;
  border-radius: 14px;
  padding: 0.7rem 0.9rem;
  font-size: 0.8125rem;
  background: #fff;
  border: 1px solid #d9f2e6;
  border-left: 4px solid #2fb574;
}
.ssb-sum div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 2px 0;
}
.ssb-sum span:first-child {
  color: var(--muted);
}
.ssb-sum span:last-child {
  text-align: right;
}
.ssb-foot {
  padding: 0.45rem 1rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  background: #fff;
  border-top: 1px solid #e6e0f7;
}
.ssb :focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
@media (max-width: 700px) {
  .ssb-launch {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 76px);
    right: 0.85rem;
    min-height: 54px;
    transition: bottom 0.25s ease;
  }
  body:has(.ssb-cb:not(.ssb-cb-hiding)) .ssb-launch {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 195px);
  }
  .ssb-tease {
    right: 0.85rem;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 142px);
    transition: bottom 0.25s ease;
  }
  body:has(.ssb-cb:not(.ssb-cb-hiding)) .ssb-tease {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 260px);
  }
  .ssb-panel {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    border-radius: 0;
  }
  .ssb-head {
    padding-top: calc(0.9rem + env(safe-area-inset-top, 0px));
  }
  .ssb-foot {
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom, 0px));
  }
}
@media (prefers-reduced-motion: reduce) {
  .ssb *,
  .ssb-launch,
  .ssb-launch::before {
    animation: none !important;
    transition: none !important;
  }
  .ssb-body {
    scroll-behavior: auto;
  }
}
