/*
 * 白变黑，黑变白
 * From Uiverse.io by doniaskima - https://uiverse.io/doniaskima/nervous-wombat-2
 * MIT License, Copyright (c) doniaskima (doniaskima)
 *
 * From Uiverse.io by Praashoo7 - https://uiverse.io/Praashoo7/black-lizard-62
 * MIT License, Copyright (c) Praashoo7 (Prashant)
 *
 * From Uiverse.io by mrhyddenn - https://uiverse.io/mrhyddenn/fluffy-bird-66
 * MIT License, Copyright (c) mrhyddenn
 *
 * From Uiverse.io by gharsh11032000 - https://uiverse.io/gharsh11032000/bitter-cow-59
 * MIT License, Copyright (c) gharsh11032000 (Harsh Gupta)
 *
 * From Uiverse.io by Mohammad-Rahme-576 - https://uiverse.io/Mohammad-Rahme-576/hard-starfish-64
 * MIT License, Copyright (c) Mohammad-Rahme-576
 *
 * From Uiverse.io by PriyanshuGupta28 - https://uiverse.io/PriyanshuGupta28/spicy-starfish-71
 * MIT License, Copyright (c) PriyanshuGupta28 (Priyanshu Gupta)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

:is(
  .button.primary,
  .action-form > button:not(:where(.secondary, .text-button, .buttons *, .vote-row *, .friend-section *, .more-actions *, .account *)),
  .filters button,
  #quiz .buttons button:last-child:not(.secondary),
  .assistant #ask button
) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-color: #fff;
  background: #fff;
  color: #fff;
  -webkit-tap-highlight-color: transparent;

  & > span {
    position: relative;
    z-index: 1;
    mix-blend-mode: difference;
    overflow-wrap: anywhere;
  }
  &::before, &::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #000 25%, transparent 25% 50%, #000 50% 75%, transparent 75%);
    transform: translateY(calc(100% + 1px));
    transition: transform .2s ease;
    pointer-events: none;
  }
  &::after {
    background: linear-gradient(90deg, transparent 25%, #000 25% 50%, transparent 50% 75%, #000 75%);
    transform: translateY(calc(-100% - 1px));
  }
  &:not(:disabled):is(:focus-visible, :active)::before,
  &:not(:disabled):is(:focus-visible, :active)::after { transform: translateY(0); }
  @media (hover: hover) {
    &:hover:not(:disabled)::before, &:hover:not(:disabled)::after { transform: translateY(0); }
  }
  @media (forced-colors: active) {
    & > span { mix-blend-mode: normal; }
    &::before, &::after { display: none; }
  }
}
.stage-actions .button.sqtp-invert {
  border-width: 2px;
  border-radius: 99rem;
}
.stage-actions .sqtp-invert > span {
  display: inline-flex;
  align-items: center;
  gap: .42rem;
}

main .demo-stack .sqtp-demo-flip {
  position: relative;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  perspective: 1000px;
  pointer-events: auto;
}
.demo-play .sqtp-demo-flip:not(.demo-visible) { pointer-events: none; }
.sqtp-demo-inner {
  display: grid;
  min-width: 0;
  transition: transform .8s;
  transform-style: preserve-3d;
}
.sqtp-demo-face {
  grid-area: 1 / 1;
  min-width: 0;
  padding: .8rem .9rem;
  border: 1px solid #ae93c75c;
  border-radius: .75rem;
  background: #1b1629e8;
  box-shadow: 0 8px 14px #0003;
  backface-visibility: hidden;
  transition: visibility 0s linear .4s;
}
.sqtp-demo-back {
  transform: rotateY(180deg);
  background: #20192f;
  visibility: hidden;
}
.sqtp-demo-flip[data-flipped="true"] .sqtp-demo-inner { transform: rotateY(180deg); }
.sqtp-demo-flip[data-flipped="true"] .sqtp-demo-face { visibility: hidden; }
.sqtp-demo-flip[data-flipped="true"] .sqtp-demo-back { visibility: visible; }
@media (hover: hover) {
  .sqtp-demo-flip:hover:not([data-flipped]) .sqtp-demo-inner { transform: rotateY(180deg); }
  .sqtp-demo-flip:hover:not([data-flipped]) .sqtp-demo-face { visibility: hidden; }
  .sqtp-demo-flip:hover:not([data-flipped]) .sqtp-demo-back { visibility: visible; }
}
.sqtp-demo-flip > .sqtp-demo-toggle {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: .75rem;
  background: transparent;
}

.sqtp-floating-field { position: relative; width: min(100%, 22rem); padding-top: 1.25rem; }
.form-workspace .editor-panel .sqtp-floating-field input[name="title"] {
  width: 100%;
  margin: 0;
}
.sqtp-floating-field input::placeholder { color: transparent; }
.editor-panel .sqtp-floating-field label:not(.check) {
  position: absolute;
  top: 0;
  left: 0;
  color: #b8b0c2;
  pointer-events: none;
  transition: top .2s, color .2s, font-size .2s;
}
.editor-panel .sqtp-floating-field input:placeholder-shown:not(:focus) + label {
  top: 1.95rem;
  left: .75rem;
  color: var(--text-muted);
  font-size: .94rem;
}
.editor-panel .sqtp-floating-field input:focus + label { color: #e8a9df; }

.auth.sqtp-auth { max-width: 400px; }
.sqtp-auth .sqtp-auth-panel {
  width: 100%;
  padding: clamp(1rem, 4vw, 2rem) clamp(.9rem, 3vw, 1.5rem);
  background: linear-gradient(#212121, #212121) padding-box,
    linear-gradient(145deg, transparent 35%, #e81cff, #40c9ff) border-box;
  border: 2px solid transparent;
  border-radius: 16px;
  font-size: .875rem;
  color: #fff;
}
.sqtp-auth-panel .action-form { display: flex; flex-direction: column; gap: 1.25rem; margin-top: 0; }
.sqtp-auth-panel .sqtp-auth-field label:not(.check) { margin: 0 0 .32rem; color: #aeaeae; font-size: .8125rem; }
.sqtp-auth-panel .sqtp-auth-field input {
  margin: 0;
  padding: .65rem .75rem;
}
.sqtp-auth-panel .action-form > button {
  align-self: flex-start;
  margin-top: .5rem;
  padding: 12px 16px;
}
.sqtp-auth-panel .action-form > button:active { scale: .95; }
.sqtp-auth-panel > p:last-child { margin: 1.25rem 0 0; }

/* Editable controls and the shared border of the assistant composer. */
:is(.site-shell, .assistant-embedded) :is(
  input:not([type], [readonly], :disabled),
  input:is([type="text"], [type="password"], [type="search"], [type="email"], [type="tel"], [type="url"],
    [type="number"], [type="date"], [type="datetime-local"], [type="time"], [type="week"], [type="month"]):not([readonly], :disabled),
  textarea:not([readonly], :disabled, .assistant #ask textarea),
  select:not(:disabled),
  .assistant #ask
) {
  --sqtp-field-pink: #e745bc;
  --sqtp-field-blue: #7768f0;
  --sqtp-field-depth: #30243c;
  --sqtp-field-border: linear-gradient(155deg, var(--sqtp-field-pink), var(--sqtp-field-depth) 38% 62%, var(--sqtp-field-blue)) border-box;
  border: 1px solid transparent;
  border-radius: .625rem;
  color-scheme: dark;
  color: #f4f1f7;
  background:
    radial-gradient(ellipse at top left, #261025, transparent 42%) padding-box,
    radial-gradient(ellipse at bottom right, #19132c, transparent 40%) padding-box,
    linear-gradient(#08070b, #08070b) padding-box,
    var(--sqtp-field-motion, var(--sqtp-field-border));
  box-shadow: -2px -2px 7px #e745bc39, 2px 2px 7px #7768f046;
  transition: box-shadow .2s ease;

  &:focus-within {
    --sqtp-field-pink: #ff8ddd;
    --sqtp-field-blue: #ada1ff;
    --sqtp-field-depth: #624273;
    box-shadow: -3px -3px 12px #e745bc59, 3px 3px 12px #7768f067;
  }
  @media (forced-colors: active) {
    border-color: FieldText;
    &:focus-within { border-color: Highlight; }
  }
}

@property --sqtp-field-highlight-x {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 12%;
}

:is(.site-shell, .assistant-embedded) :is(
  input:is(:not([type]), [type="text"], [type="password"], [type="search"], [type="email"], [type="tel"], [type="url"]):not([readonly], :disabled),
  textarea:not([readonly], :disabled, .assistant #ask textarea),
  .assistant #ask:has(textarea:not([readonly], :disabled))
) {
  --sqtp-field-motion:
    radial-gradient(ellipse 3.75rem .55rem at var(--sqtp-field-highlight-x, 12%) 0%, var(--sqtp-field-pink) 15%, transparent 100%) border-box,
    radial-gradient(ellipse 3.75rem .55rem at calc(100% - var(--sqtp-field-highlight-x, 12%)) 100%, var(--sqtp-field-blue) 15%, transparent 100%) border-box,
    linear-gradient(var(--sqtp-field-depth), var(--sqtp-field-depth)) border-box;
  transition: --sqtp-field-highlight-x .42s ease, box-shadow .2s ease;

  &:is(input:focus, textarea:focus, #ask:has(textarea:focus:not([readonly], :disabled))) {
    --sqtp-field-highlight-x: 50%;
  }
  @media (hover: hover) {
    &:is(input:hover, textarea:hover, #ask:has(textarea:hover:not([readonly], :disabled))) {
      --sqtp-field-highlight-x: 50%;
    }
  }
  @media (prefers-reduced-motion: reduce) {
    transition: none;
  }
}
.assistant #ask textarea { color: inherit; }

#assistant-anchor {
  position: fixed;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
}
#assistant-anchor[data-positioned] { right: auto; bottom: auto; }
#assistant-anchor #mascot {
  position: relative;
  inset: auto;
  isolation: isolate;
  border-color: #8a79d7;
  background: linear-gradient(135deg, #6e8efb, #a777e3);
  box-shadow: 0 8px 15px #0003;
  animation: sqtp-assistant-pulse 3s infinite;
  transition: transform .3s ease, box-shadow .4s ease;
}
#assistant-anchor #mascot:hover { transform: translateY(-4px) scale(1.03); }
#assistant-anchor #mascot:active { transform: translateY(-2px) scale(.98); }
#assistant-anchor #mascot::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: #ffffff4d;
  opacity: 0;
}
#assistant-anchor #mascot:active::before { animation: sqtp-assistant-ripple .6s linear; }
#assistant-anchor #mascot .assistant-mark { color: #fff; text-shadow: 0 1px 5px #2521518a; }
#assistant-tooltip {
  position: absolute;
  left: calc(50% + var(--sqtp-tooltip-shift, 0px));
  bottom: calc(100% + 10px);
  width: max-content;
  max-width: 11rem;
  padding: .65rem .88rem;
  border-radius: 15px;
  background: #fffffff0;
  box-shadow: 0 15px 30px #0004;
  color: #222;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) scale(.8);
  transition: opacity .5s cubic-bezier(.68,-.55,.265,1.55), transform .5s cubic-bezier(.68,-.55,.265,1.55), visibility .5s ease;
  pointer-events: none;
  backdrop-filter: blur(10px);
}
#assistant-tooltip::before {
  content: "";
  position: absolute;
  top: 100%;
  left: calc(50% - var(--sqtp-tooltip-shift, 0px));
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #fffffff0;
}
#assistant-tooltip span { display: block; font-size: .78rem; }
#assistant-anchor[data-tooltip-below] #assistant-tooltip { bottom: auto; top: calc(100% + 10px); }
#assistant-anchor[data-tooltip-below] #assistant-tooltip::before {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: #fffffff0;
}
#mascot[aria-expanded="false"]:focus-visible + #assistant-tooltip {
  opacity: 1; visibility: visible; transform: translateX(-50%) scale(1);
}
@media (hover: hover) {
  #mascot[aria-expanded="false"]:hover:not(:active) + #assistant-tooltip {
    opacity: 1; visibility: visible; transform: translateX(-50%) scale(1);
  }
}
@keyframes sqtp-assistant-pulse {
  0% { box-shadow: 0 0 0 0 #6e8efb66; }
  70% { box-shadow: 0 0 0 20px #6e8efb00; }
  100% { box-shadow: 0 0 0 0 #6e8efb00; }
}
@keyframes sqtp-assistant-ripple {
  from { transform: scale(0); opacity: 1; }
  to { transform: scale(4); opacity: 0; }
}

.sqtp-gradient-check { position: relative; gap: .55rem; cursor: pointer; }
.filters .sqtp-gradient-check { align-items: center; }
.sqtp-gradient-check > input[type="checkbox"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}
.sqtp-gradient-check:has(> input:disabled) { cursor: not-allowed; opacity: .55; }
.sqtp-check-disc {
  --sqtp-check-size: 1.6rem;
  position: relative;
  width: var(--sqtp-check-size);
  height: var(--sqtp-check-size);
  flex: none;
  border-radius: 50%;
  background: linear-gradient(43deg, #4158d0, #c850c0 46%, #ffcc70);
  box-shadow: 0 2px 3px #ffbeb8a0;
  transition: transform .2s ease, box-shadow .2s ease;
  pointer-events: none;
}
.sqtp-check-disc::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 70%;
  height: 70%;
  translate: -50% -50%;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 2px 3px #ffbeb8;
  transition: width .2s ease, height .2s ease;
}
@media (hover: hover) {
  .sqtp-gradient-check:hover input:not(:checked, :disabled) + .sqtp-check-disc::before { width: 55%; height: 55%; }
}
.sqtp-gradient-check input:active:not(:disabled) + .sqtp-check-disc { transform: scale(.9); }
.sqtp-gradient-check input:focus-visible + .sqtp-check-disc { outline: 2px solid #c2aeff; outline-offset: 3px; }
.sqtp-gradient-check input:checked + .sqtp-check-disc { box-shadow: 0 5px 9px #0008; }
.sqtp-gradient-check input:checked + .sqtp-check-disc::before { width: 0; height: 0; }
.sqtp-check-disc i {
  position: absolute;
  inset: 15% auto auto 22%;
  width: 60%;
  height: 53%;
  transform: rotateZ(-40deg);
}
.sqtp-check-disc i::before, .sqtp-check-disc i::after {
  content: "";
  position: absolute;
  inset: auto auto 0 0;
  border-radius: 2px;
  background: #fff;
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}
.sqtp-check-disc i::before { width: 18%; height: 65%; transform: translateY(-125%); }
.sqtp-check-disc i::after { width: 100%; height: 19%; transform: translateX(125%); }
.sqtp-gradient-check input:checked + .sqtp-check-disc i::before,
.sqtp-gradient-check input:checked + .sqtp-check-disc i::after { transform: none; opacity: 1; }

@media (forced-colors: active) {
  .sqtp-gradient-check > input[type="checkbox"] { position: static; width: 1.075rem; height: 1.075rem; opacity: 1; }
  .sqtp-gradient-check .sqtp-check-disc { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sqtp-demo-face { transition-delay: 0s; }
  #assistant-anchor #mascot, #assistant-anchor #mascot:active::before { animation: none; }
}
@media print { #assistant-anchor { display: none; } }
