.sensei-float-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15000;
  overflow: hidden;
}

.sensei-celebration-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 17000;
}

.sensei-win-burst {
  position: absolute;
  width: 0;
  height: 0;
  transform: translate3d(0, 0, 0);
}

.sensei-win-particle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--sensei-win-size, 9px);
  height: calc(var(--sensei-win-size, 9px) * 0.58);
  border-radius: 1.5px;
  background: var(--sensei-win-color, #0ea5e9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28) inset;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
  opacity: 0;
  will-change: transform, opacity;
  animation: senseiWinParticleFlight var(--sensei-win-duration, 980ms) cubic-bezier(0.12, 0.82, 0.24, 1) var(--sensei-win-delay, 0ms) forwards;
}

@keyframes senseiWinParticleFlight {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) scale(0.45);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  72% {
    opacity: 0.95;
  }
  100% {
    transform:
      translate(
        calc(-50% + var(--sensei-win-dx, 70px)),
        calc(-50% + var(--sensei-win-dy, -70px))
      )
      rotate(var(--sensei-win-rot, 0deg))
      scale(0.76);
    opacity: 0;
  }
}

.sensei-float-badge {
  position: absolute;
  left: var(--sensei-origin-x, 0px);
  top: var(--sensei-origin-y, 0px);
  max-width: min(76vw, 340px);
  padding: 12px 17px 13px;
  border-radius: 6px;
  border: 1px solid #7f2638;
  background:
    linear-gradient(rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 38%),
    #fff9e9;
  color: #38251d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.42;
  letter-spacing: 0;
  box-shadow:
    0 12px 26px rgba(48, 31, 23, 0.22),
    0 0 0 3px #f4dfaa inset,
    0 0 0 4px rgba(127, 38, 56, 0.16) inset;
  opacity: 0;
  transform: translate(0, 0);
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  animation: none;
}

.sensei-float-body {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: 0;
}

.sensei-float-label {
  display: inline-block;
}

.sensei-float-badge.is-text {
  will-change: auto;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
  text-rendering: auto;
  -webkit-font-smoothing: auto;
  margin-left: 0;
  margin-top: 0;
  animation: senseiTextFloatUp 6000ms cubic-bezier(.2, .9, .2, 1) forwards;
}

@keyframes senseiTextFloatUp {
  0% {
    opacity: 0;
    transform: translate(0, 0);
    margin-left: 0;
    margin-top: 0;
  }
  15% {
    opacity: 1;
    transform: translate(0, 0);
    margin-left: 0;
    margin-top: 0;
  }
  77.9% {
    opacity: 1;
    transform: translate(var(--sensei-float-dx, 0px), var(--sensei-float-dy, -12px));
    margin-left: 0;
    margin-top: 0;
  }
  78%,
  100% {
    opacity: 1;
    transform: none;
    margin-left: var(--sensei-float-dx, 0px);
    margin-top: var(--sensei-float-dy, -12px);
  }
}

.sensei-float-badge.is-visual {
  max-width: min(52vw, 220px);
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #f8fafc;
}

.sensei-float-badge.is-visual .sensei-float-body {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.sensei-float-badge.is-visual .sensei-float-label {
  display: block;
  box-sizing: border-box;
  max-width: min(58vw, 210px);
  padding: 7px 10px;
  border-radius: 6px;
  background: #0f172a;
  text-align: center;
  overflow-wrap: anywhere;
  color: #f8fafc;
  text-shadow: none;
}

.sensei-float-image {
  display: block;
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(122, 80, 4, 0.22));
}

.sensei-float-badge.is-visual .sensei-float-image {
  width: clamp(98px, 13vw, 156px);
  height: clamp(98px, 13vw, 156px);
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.24));
}

.sensei-float-badge::after {
  content: "";
  position: absolute;
  left: var(--sensei-float-tail-left, 18px);
  bottom: -7px;
  width: 12px;
  height: 12px;
  border-right: 1px solid #7f2638;
  border-bottom: 1px solid #7f2638;
  background: #fff9e9;
  transform: rotate(45deg);
  box-shadow: 2px 2px 3px rgba(48, 31, 23, 0.08);
}

.sensei-float-badge.is-grumpy {
  border-color: #772033;
  color: #541c28;
  background:
    linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 38%),
    #f9e8e3;
  box-shadow:
    0 12px 26px rgba(65, 20, 30, 0.22),
    0 0 0 3px #e8c0b2 inset,
    0 0 0 4px rgba(119, 32, 51, 0.16) inset;
}

.sensei-float-badge.is-grumpy::after {
  border-color: #772033;
  background: #f9e8e3;
}

.sensei-float-badge.is-grumpy .sensei-float-mood-arrow {
  border-color: rgba(133, 32, 54, 0.28);
  color: rgba(101, 20, 34, 0.9);
  background: rgba(255, 244, 246, 0.64);
}

.sensei-float-badge.is-bonus {
  border-color: #8a6417;
  color: #49370c;
  background:
    linear-gradient(rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 38%),
    #fff3c9;
  box-shadow:
    0 12px 26px rgba(72, 51, 8, 0.22),
    0 0 0 3px #e8c96e inset,
    0 0 0 4px rgba(138, 100, 23, 0.16) inset;
}

.sensei-float-badge.is-bonus::before {
  content: "\2726";
  margin-right: 6px;
  opacity: 0.92;
}

.sensei-float-badge.is-bonus.is-visual {
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  color: #f8fafc;
}

.sensei-float-badge.is-bonus.is-visual::before {
  content: none;
}

.sensei-float-badge.is-bonus::after {
  border-color: #8a6417;
  background: #fff3c9;
}

.sensei-float-badge.is-visual::after {
  content: none;
}

.sensei-float-badge.is-bonus .sensei-float-mood-arrow {
  border-color: rgba(182, 124, 23, 0.32);
  color: rgba(97, 63, 0, 0.92);
  background: rgba(255, 250, 230, 0.62);
}

.sensei-float-badge.is-duel-decline {
  max-width: min(80vw, 420px);
  border: 1px solid #25cfc9;
  border-radius: 6px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 38%),
    #fff9e9;
  color: #38251d;
  box-shadow:
    0 0 0 1px rgba(37, 207, 201, 0.42),
    0 0 10px rgba(34, 211, 238, 0.42),
    0 0 22px rgba(16, 185, 129, 0.18),
    0 12px 28px rgba(48, 31, 23, 0.24),
    0 0 0 3px #f4dfaa inset,
    0 0 0 4px rgba(37, 207, 201, 0.16) inset;
}

.sensei-float-badge.is-duel-decline .sensei-float-body {
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: 0;
}

.sensei-float-badge.is-duel-decline::after {
  border-color: #25cfc9;
  background: #fff9e9;
  box-shadow:
    2px 2px 3px rgba(48, 31, 23, 0.08),
    3px 3px 8px rgba(34, 211, 238, 0.34);
}

/* Dark Mode Support for Visual/Emoji Badges */
body[data-mode="dark"] .sensei-float-badge.is-visual .sensei-float-label {
  color: #f1f5f9;
  font-weight: 800;
}

body[data-mode="dark"] .sensei-float-badge.is-visual .sensei-float-image {
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55));
}

body[data-mode="dark"] .sensei-float-badge.is-bonus.is-visual .sensei-float-label {
  color: #fef3c7;
  font-weight: 800;
}

@media (max-width: 640px) {
  .sensei-float-badge {
    max-width: min(84vw, 280px);
    padding: 9px 12px;
  }

  .sensei-float-body {
    font-size: 0.92rem;
  }

  .sensei-float-mood-arrow {
    font-size: 0.6rem;
  }

  .sensei-float-badge.is-visual {
    max-width: min(72vw, 210px);
    padding: 0;
  }

  .sensei-float-badge.is-visual .sensei-float-label {
    max-width: min(70vw, 200px);
    font-size: 0.76rem;
  }

  .sensei-float-badge.is-duel-decline {
    max-width: min(90vw, 340px);
    padding: 10px 12px;
  }
}

/* QUESTION MODAL */
.sensei-question-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: auto;
  z-index: 16000;
}

.sensei-question-modal * {
  pointer-events: auto;
}

.sensei-question-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background:
    radial-gradient(circle at 14% 18%, rgba(30, 64, 175, 0.24) 0%, rgba(30, 64, 175, 0) 40%),
    radial-gradient(circle at 86% 80%, rgba(14, 165, 233, 0.2) 0%, rgba(14, 165, 233, 0) 38%),
    rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(2px) saturate(0.88);
  -webkit-backdrop-filter: blur(2px) saturate(0.88);
  opacity: 0;
  animation: senseiQuestionOverlayIn 220ms ease-out forwards;
}

.sensei-question-card {
  position: fixed;
  background:
    linear-gradient(162deg, rgba(255, 255, 255, 0.98) 0%, rgba(243, 248, 255, 0.98) 100%),
    #ffffff;
  border: 1px solid rgba(30, 64, 175, 0.22);
  border-radius: 14px;
  padding: 20px;
  max-width: 360px;
  width: 90vw;
  box-shadow:
    0 24px 64px rgba(2, 6, 23, 0.55),
    0 8px 20px rgba(30, 64, 175, 0.24),
    0 0 0 1px rgba(9, 30, 66, 0.08);
  animation: senseiQuestionFadeIn 220ms ease-out;
  transition:
    left 260ms ease,
    top 260ms ease,
    right 260ms ease,
    width 260ms ease,
    max-height 260ms ease;
  z-index: 16001;
}

.sensei-question-card.is-centered {
  inset: 16px;
  height: fit-content;
  margin: auto;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.sensei-question-card.is-awaiting-accept .sensei-question-reveal {
  filter: blur(8px);
  opacity: 0.78;
  user-select: none;
  pointer-events: none;
}

.sensei-question-card.is-duel-accepted .sensei-question-reveal {
  filter: none;
  opacity: 1;
  pointer-events: auto;
}

.sensei-question-gate {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(30, 64, 175, 0.16);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.54) 0%, rgba(239, 246, 255, 0.9) 100%);
}

.sensei-question-gate-copy {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  color: #0f172a;
}

.sensei-question-gate-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sensei-question-gate-button {
  min-width: 108px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 140ms ease-out, box-shadow 140ms ease-out, background 140ms ease-out, border-color 140ms ease-out, color 140ms ease-out;
}

.sensei-question-gate-button.is-accept {
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(22, 163, 74, 0.22);
}

.sensei-question-gate-button.is-accept:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(22, 163, 74, 0.28);
}

.sensei-question-gate-button.is-decline {
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
  border-color: rgba(148, 163, 184, 0.48);
  color: #334155;
}

.sensei-question-gate-button.is-decline:hover {
  transform: translateY(-1px);
  border-color: rgba(100, 116, 139, 0.72);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
}

.sensei-question-gate-button:active {
  transform: translateY(0) scale(0.98);
}

.sensei-question-gate-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22);
}

/* Sensei byline header */
.sensei-question-byline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(30, 64, 175, 0.2);
}

.sensei-question-byline-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(30, 64, 175, 0.3);
  box-shadow: 0 0 0 3px rgba(219, 234, 254, 0.8);
  flex-shrink: 0;
}

.sensei-question-byline-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sensei-question-byline-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.sensei-question-byline-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(30, 64, 175, 0.95);
}

.sensei-question-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #c9d7eb;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
  color: #334155;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(30, 64, 123, 0.12);
  transition: transform 140ms ease-out, background 140ms ease-out, box-shadow 140ms ease-out, color 140ms ease-out;
}

.sensei-question-close:hover {
  background: linear-gradient(180deg, #fff5f5 0%, #ffe8e8 100%);
  border-color: #f1b7b7;
  color: #9f1239;
  box-shadow: 0 4px 10px rgba(159, 18, 57, 0.2);
  transform: translateY(-1px);
}

.sensei-question-close:active {
  transform: translateY(0) scale(0.97);
}

.sensei-question-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.24), 0 2px 6px rgba(30, 64, 123, 0.12);
}

.sensei-question-close.is-give-up {
  width: auto;
  min-width: 88px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sensei-question-rules {
  margin-bottom: 10px;
}

.sensei-question-rules-title {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #64748b;
  margin-bottom: 5px;
}

.sensei-question-rule-line {
  display: block;
  width: 100%;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.sensei-question-rule-line + .sensei-question-rule-line {
  margin-top: 4px;
}

.sensei-question-rule-line.is-win {
  color: #15803d;
}

.sensei-question-rule-line.is-lose {
  color: #b91c1c;
}

.sensei-question-text {
  margin: 0 0 20px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.4;
}

.sensei-question-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sensei-question-option {
  padding: 12px 16px;
  border: 1.5px solid rgba(66, 104, 161, 0.3);
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 140ms ease-out;
}

.sensei-question-option:hover:not(:disabled) {
  background: #e8f0fc;
  border-color: rgba(66, 104, 161, 0.5);
  transform: translateX(3px);
}

.sensei-question-modal.is-locked .sensei-question-option:not(.is-correct):not(.is-wrong):hover,
.sensei-question-option.is-locked:not(.is-correct):not(.is-wrong):hover {
  background: #f8fafc;
  border-color: rgba(66, 104, 161, 0.3);
  transform: none;
}

.sensei-question-option:active:not(:disabled) {
  transform: translateX(1px) scale(0.98);
}

.sensei-question-option:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sensei-question-option.is-correct {
  background: #dcfce7;
  border-color: #22c55e;
  color: #15803d;
  animation: senseiQuestionCorrect 600ms ease-out;
}

.sensei-question-option.is-wrong {
  background: #fee2e2;
  border-color: #ef4444;
  animation: senseiQuestionWrong 400ms ease-out;
}

@keyframes senseiQuestionFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes senseiQuestionOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes senseiQuestionCorrect {
  0% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.04) rotate(1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes senseiQuestionWrong {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

@media (max-width: 600px) {
  .sensei-question-card {
    padding: 16px 14px;
    max-width: 85vw;
  }

  .sensei-question-text {
    font-size: 0.95rem;
    margin-bottom: 12px;
  }

  .sensei-question-option {
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .sensei-question-rules {
    margin-bottom: 8px;
  }

  .sensei-question-rule-line {
    font-size: 0.76rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sensei-float-badge.is-text,
  .sensei-question-overlay,
  .sensei-question-card,
  .sensei-question-option.is-correct,
  .sensei-question-option.is-wrong,
  .sensei-win-particle {
    animation: none;
  }

  .sensei-float-badge.is-text {
    opacity: 1;
  }

  .sensei-win-particle {
    opacity: 0;
  }
}
