/* ── Super Sentences overlay styles ── */
/* Adapted from atomic-english study panel */

/* ── Variables ── */

:root {
  --ss-ink: #171819;
  --ss-muted: #6f737a;
  --ss-pencil: rgba(60, 65, 72, 0.18);
  --ss-pencil-dark: rgba(40, 45, 52, 0.72);
  --ss-red: rgba(231, 76, 60, 0.25);
}

/* ── Overlay ── */

.ss-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 760px at 50% 34%, rgba(255, 255, 255, 0.72), transparent 70%),
    linear-gradient(165deg, #f7f3ee 0%, #f1edf6 52%, #ecf1f3 100%);
  pointer-events: none;
  opacity: 0;
}

.ss-overlay.is-active {
  pointer-events: auto;
  opacity: 1;
}

.ss-overlay.is-leaving {
  pointer-events: none;
  opacity: 0;
  transition: opacity 360ms ease;
}

body.ss-open .container,
body.ss-open .promo-pill {
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

/* ── Card (full-bleed: the paper IS the frame) ── */

.ss-card {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Close button ── */

.ss-close {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 110;
  width: 40px;
  height: 40px;
  border: 1.5px solid rgba(8, 0, 138, 0.15);
  background: #fdfaf6;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  color: #6f737a;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 150ms ease, border-color 150ms ease, opacity 200ms ease;
  box-shadow: 0 2px 8px rgba(8, 0, 138, 0.1);
}

.ss-close:hover {
  background: #fff;
  border-color: rgba(8, 0, 138, 0.3);
}

body.ss-panel-open .ss-close {
  opacity: 0;
  pointer-events: none;
}

/* ── Rail (progress bar only, no dots) ── */

.ss-rail {
  position: relative;
  padding: 48px 0 0;
  flex-shrink: 0;
  z-index: 5;
}

.ss-rail-progress {
  width: 100%;
  height: 1px;
  position: relative;
  background: rgba(0, 0, 0, 0.04);
}

.ss-rail-progress-fill {
  position: absolute;
  top: -7px;
  left: 0;
  width: 0%;
  height: 16px;
  background: var(--ss-red);
  filter: blur(10px);
  transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.ss-rail-inner {
  display: none;
}

/* ── Panel body ── */

.ss-panel-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ss-study-section {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr;
  place-items: center;
}

.ss-study-content {
  position: relative;
  z-index: 2;
  width: min(440px, 100%);
  height: 100%;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto auto;
  align-items: center;
  padding: clamp(20px, 4vw, 44px);
}

/* ── Sentence ── */

.ss-sentence-wrap {
  position: relative;
  width: min(860px, 100%);
  margin: 0 auto;
}

.ss-sentence {
  max-width: 100%;
  min-height: 0;
  margin: 0 auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 5vw, 28px);
  line-height: 1.4;
  text-align: center;
}

.ss-sentence.is-wrong {
  animation: ssNudge 230ms ease both;
}

/* ── Sentence words ── */

.ss-sentence-word,
.ss-gap {
  color: rgba(23, 24, 25, 0.32);
  transition: color 180ms ease, background 220ms ease, transform 220ms ease, opacity 220ms ease;
}

.ss-sentence-word.has-spoken,
.ss-sentence-word.is-speaking {
  color: rgba(33, 29, 24, 0.95);
}

.ss-sentence-word.is-speaking {
  color: rgba(33, 29, 24, 0.95);
  text-shadow: none;
}

/* ── Gap ── */

.ss-gap {
  display: inline-block;
  min-width: 2.65em;
  height: 1em;
  border: 0;
  border-bottom: 2px solid rgba(23, 24, 25, 0.16);
  border-radius: 0;
  text-align: center;
  vertical-align: baseline;
}

.ss-gap.is-filled {
  display: inline;
  min-width: auto;
  height: auto;
  border-bottom: none;
  padding-bottom: 0;
  color: #05007b;
  animation: ssFillPop 340ms ease both;
}

/* ── Target word highlight: ink + fine baseline rule ── */

.ss-gap.is-filled .ss-sentence-word,
.ss-word-hl {
  color: #05007A;
  text-decoration: underline;
  text-decoration-skip-ink: none;
  text-decoration-thickness: max(1.3px, 0.028em);
  text-underline-offset: 0.18em;
  text-decoration-color: rgba(5, 0, 122, 0.32);
  transition: text-decoration-color 200ms ease, color 180ms ease, text-decoration-thickness 200ms ease;
}

.ss-gap.is-filled .ss-sentence-word.has-spoken {
  text-decoration-color: rgba(5, 0, 122, 0.75);
}

.ss-gap.is-filled .ss-sentence-word.is-speaking {
  color: #05007A;
  text-decoration-color: #05007A;
  text-decoration-thickness: max(1.6px, 0.04em);
}

.ss-word-hl {
  font-weight: 500;
}

/* ── Controls (globe, replay) — in-flow above the choice row ── */

.ss-controls {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 8px;
  min-height: 30px;
  margin: 14px 0 2px;
  animation: ssControlsFade 260ms ease both;
}

.ss-controls[hidden] {
  visibility: hidden;
  display: flex;
}

.ss-controls button:not(.ss-lang-chip) {
  display: grid;
  place-items: center;
  width: clamp(32px, 5vw, 40px);
  height: clamp(32px, 5vw, 40px);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(23, 24, 25, 0.58);
  box-shadow: 0 6px 18px rgba(23, 24, 25, 0.06);
  cursor: pointer;
  transition: color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.ss-controls button:not(.ss-lang-chip)[hidden] {
  display: none;
}

.ss-controls button:not(.ss-lang-chip):hover {
  color: rgba(23, 24, 25, 0.94);
  transform: translateY(-1px);
}

.ss-controls svg {
  width: clamp(15px, 2.5vw, 19px);
  height: clamp(15px, 2.5vw, 19px);
  stroke-width: 1.85;
}

.ss-controls .ph {
  font-size: clamp(15px, 2.5vw, 19px);
  line-height: 1;
}

#ss-globe-btn.is-active {
  color: #05007A;
  background-color: rgba(5, 0, 122, 0.07);
}

/* ── Language chips (first globe tap) — floats over the player ── */

.ss-lang-chips {
  position: absolute;
  z-index: 8;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 13px 14px;
  background-color: rgba(255, 253, 247, 0.98);
  background-image: repeating-linear-gradient(
    0deg,
    rgba(23, 24, 25, 0.018) 0 1px,
    transparent 1px 3px
  );
  border: 1px solid rgba(5, 0, 122, 0.14);
  border-radius: 16px;
  box-shadow:
    0 2px 6px rgba(8, 0, 138, 0.08),
    0 18px 40px rgba(8, 0, 138, 0.16);
  animation: ssControlsFade 220ms ease both;
}

.ss-lang-chips[hidden] {
  display: none;
}

.ss-lang-chip {
  font: 500 13px/1 'DM Sans', sans-serif;
  padding: 9px 15px;
  border: 1px solid rgba(5, 0, 122, 0.16);
  border-radius: 999px;
  background-color: #fffdf9;
  color: #1f2226;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background-color 140ms ease,
    color 140ms ease;
}

.ss-lang-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(5, 0, 122, 0.4);
  background-color: #ffffff;
  color: #05007A;
}

/* ── Translation loading: the poster soft-blurs until it arrives ── */

.ss-def-question,
.ss-def-title {
  transition: filter 220ms ease;
}

.ss-def-question.is-trans-loading,
.ss-def-title.is-trans-loading,
.ss-title-slot.is-trans-loading {
  filter: blur(6px);
}

/* ── Choice area ── */

.ss-choice-area {
  position: relative;
  width: 100%;
  padding-bottom: 24px;
}

/* ── Choices ── */

.ss-choice-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  margin-top: clamp(30px, 6vh, 64px);
  align-self: start;
}

.ss-choice-row button,
.ss-next-btn {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #1f2226;
  box-shadow: none;
  cursor: pointer;
  font: 600 clamp(18px, 2vw, 23px)/1.1 Georgia, "Times New Roman", serif;
  padding: 8px 10px;
  text-decoration: underline;
  text-decoration-color: rgba(23, 24, 25, 0.18);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.28em;
  transition: color 160ms ease, opacity 160ms ease, text-decoration-color 160ms ease;
}

.ss-choice-row button:disabled {
  cursor: default;
}

.ss-choice-row button.is-correct {
  color: #171819;
  text-decoration-color: transparent;
}

.ss-choice-row button.is-wrong {
  opacity: 0.44;
  text-decoration-color: rgba(23, 24, 25, 0.06);
}

/* ── Next button ── */

.ss-next-btn {
  min-width: 120px;
  font-family: Georgia, "Times New Roman", serif !important;
  font-weight: 600 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #1f2226 !important;
  text-decoration: underline !important;
  text-decoration-color: rgba(23, 24, 25, 0.18) !important;
  text-decoration-thickness: 1px !important;
  text-underline-offset: 0.28em !important;
  box-shadow: none !important;
  backdrop-filter: none;
}

/* ── Completion view ── */

.ss-complete-view {
  display: none;
  text-align: center;
  padding: 0 20px;
  place-self: center;
}

.ss-complete-view.show {
  display: block;
}

.ss-complete-view h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 7vw, 56px);
  font-weight: 500;
  margin: 0 0 16px;
}

.ss-complete-view p {
  color: var(--ss-muted);
  font-size: 1.1rem;
  margin: 0 0 24px;
}

/* ── Meaning panel (bottom sheet) ── */

.ss-meaning-panel {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 120;
  display: grid;
  gap: 18px;
  width: min(760px, calc(100vw - 20px));
  max-height: min(72vh, 540px);
  overflow: auto;
  border: 1px solid rgba(29, 31, 36, 0.12);
  border-radius: 24px;
  background: rgba(250, 250, 249, 0.96);
  padding: 14px 26px 26px;
  color: #43464d;
  font-size: 17px;
  line-height: 1.45;
  box-shadow: 0 24px 80px rgba(22, 24, 29, 0.18);
  backdrop-filter: blur(20px) saturate(1.04);
  transform: translateX(-50%);
  animation: ssSheetIn 220ms ease both;
}

.ss-meaning-panel[hidden] {
  display: none;
}

.ss-meaning-panel p {
  margin: 0;
}

.ss-meaning-handle {
  width: 44px;
  height: 4px;
  margin: 2px auto 0;
  border-radius: 999px;
  background: rgba(22, 24, 29, 0.14);
}

.ss-meaning-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
}

.ss-meaning-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ss-muted);
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 160ms ease;
}

.ss-meaning-close:hover {
  background: rgba(0, 0, 0, 0.05);
}

.ss-study-help {
  color: rgba(23, 24, 25, 0.86);
  max-width: calc(100% - 72px);
  padding-top: 8px;
}

.ss-study-help strong {
  color: transparent;
  background:
    radial-gradient(ellipse 145% 86% at 56% 54%, rgba(175, 124, 214, 0.98), rgba(138, 91, 181, 0.94) 54%, rgba(88, 65, 110, 0.9) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  font-weight: 650;
}

.ss-translation-content {
  border-top: 1px solid rgba(22, 24, 29, 0.08);
  padding-top: 2px;
}

.ss-translation {
  color: rgba(23, 24, 25, 0.68);
  font-weight: 520;
}

/* ── Language lockup: hairline globe + underlined select ── */

.ss-lang-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  gap: 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
  line-height: 1;
}

.ss-lang-globe {
  font-size: 14px;
  line-height: 1;
  color: rgba(5, 0, 122, 0.55);
}

.ss-lang-select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 0;
  max-width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(5, 0, 122, 0.25);
  border-radius: 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2305007A' stroke-opacity='0.55' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
  background-size: 9px 6px;
  color: rgba(5, 0, 122, 0.78);
  font: 500 11.5px/1.5 'DM Sans', sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 16px 2px 0;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}

.ss-lang-select:hover {
  border-bottom-color: rgba(5, 0, 122, 0.6);
  color: #05007A;
}

.ss-lang-select:focus-visible {
  outline: none;
  border-bottom-color: #05007A;
  color: #05007A;
}

/* ── Animations ── */

@keyframes ssNudge {
  0% { transform: translateX(0); }
  24% { transform: translateX(-8px); }
  48% { transform: translateX(7px); }
  72% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

@keyframes ssFillPop {
  0% { opacity: 0.18; transform: scale(0.96); filter: blur(2px); }
  58% { opacity: 1; transform: scale(1.028); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

@keyframes ssRailArrive {
  0% { opacity: 0; transform: scale(0.86); }
  64% { opacity: 1; transform: scale(1.055); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes ssControlsFade {
  0% { opacity: 0; transform: translateY(2px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes ssSheetIn {
  0% { opacity: 0; transform: translate(-50%, 18px); }
  100% { opacity: 1; transform: translate(-50%, 0); }
}

/* ── Help card: ivory paper object above the sentence ── */

.ss-explain-text {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-width: 620px;
  margin: 0 auto 26px;
  background-color: rgba(252, 250, 246, 0.97);
  background-image: repeating-linear-gradient(
    0deg,
    rgba(23, 24, 25, 0.025) 0 1px,
    transparent 1px 3px
  );
  border: 1px solid rgba(5, 0, 122, 0.12);
  border-top: 2.5px solid #05007A;
  border-radius: 6px;
  box-shadow:
    0 1px 2px rgba(8, 0, 138, 0.05),
    0 14px 34px rgba(8, 0, 138, 0.10);
  padding: 18px 22px 16px;
  font-family: 'Newsreader', Georgia, serif;
  font-size: clamp(15.5px, 2vw, 17.5px);
  line-height: 1.48;
  color: rgba(23, 24, 25, 0.82);
  text-align: left;
  max-height: min(44vh, 320px);
  overflow: auto;
  transform: rotate(-0.6deg);
  animation: ssNoteIn 300ms ease both;
}

.ss-explain-text[hidden] {
  display: none;
}

@keyframes ssNoteIn {
  0% { opacity: 0; transform: translateY(-10px) rotate(-2.4deg); }
  100% { opacity: 1; transform: translateY(0) rotate(-0.6deg); }
}

.ss-note-def {
  margin: 0;
}

.ss-note-divider {
  border: 0;
  border-top: 1px solid rgba(5, 0, 122, 0.10);
  margin: 14px 0 12px;
}

.ss-lang-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.ss-trans-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 14.5px;
  line-height: 1.45;
  color: rgba(23, 24, 25, 0.58);
  font-weight: 400;
}

.ss-trans-word {
  display: block;
  font-family: 'Newsreader', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 19px;
  color: #05007A;
  margin-bottom: 1px;
}

.ss-trans-def {
  display: block;
  color: rgba(23, 24, 25, 0.58);
}

.ss-trans-text.is-loading {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(23, 24, 25, 0.45);
}

.ss-trans-text.is-error {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(150, 62, 52, 0.85);
  cursor: pointer;
  border-bottom: 1px solid rgba(150, 62, 52, 0.4);
  padding-bottom: 1px;
  width: fit-content;
}

.ss-ok-btn {
  animation: ssControlsFade 260ms ease both;
}

/* ── Definition poster (presentation mode) ── */

/* The answer word — floats above the definition, lands there after correct. */
.ss-def-title {
  position: absolute;
  bottom: 100%;
  left: 0;
  display: inline-block;
  margin-bottom: 14px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(44px, 7.5vw, 68px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  text-align: start;
  color: #05007A;
  pointer-events: none;
  will-change: transform, opacity;
}

.ss-def-title[hidden] {
  display: none;
}

/* Mid-flight the title wears a paper scrap: word on a cut-out with a soft
   shadow. Layout-free (box-shadow spread only), so the FLIP math stays true. */
.ss-def-title.is-flying {
  background-color: #fffdf9;
  border-radius: 10px;
  box-shadow:
    0 0 0 7px #fffdf9,
    0 0 0 8px rgba(5, 0, 122, 0.16),
    0 10px 24px rgba(8, 0, 138, 0.18);
}

/* ── Empty title slot — the home waiting for its sticker ── */

.ss-title-slot {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: min(300px, 72%);
  min-height: clamp(54px, 8vw, 70px);
  margin-bottom: 14px;
  border: 2px dashed rgba(5, 0, 122, 0.3);
  border-radius: 14px;
  background-color: rgba(5, 0, 122, 0.035);
  box-shadow: inset 0 2px 6px rgba(8, 0, 138, 0.05);
  transition: opacity 240ms ease 280ms;
}

.ss-title-slot[hidden] {
  display: none;
}

.ss-title-slot.is-landed {
  opacity: 0;
}

.ss-def-question {
  max-width: 100%;
  margin: 0 auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 6vw, 30px);
  line-height: 1.36;
  text-align: start;
  color: rgba(23, 24, 25, 0.92);
}

/* Short definitions get the bigger poster step. */
.ss-def-question.is-short {
  font-size: clamp(28px, 7vw, 38px);
  line-height: 1.3;
}

.ss-def-question.is-wrong {
  animation: ssNudge 230ms ease both;
}

.ss-def-word {
  color: rgba(23, 24, 25, 0.92);
}

/* ── Example: a papery panel that rises over the definition ── */

.ss-sentence.is-example {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: 100%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 5vw, 34px);
  line-height: 1.34;
  padding: 24px 28px 46px;
  text-align: center;
  background-color: rgba(255, 253, 247, 0.98);
  background-image: repeating-linear-gradient(
    0deg,
    rgba(23, 24, 25, 0.018) 0 1px,
    transparent 1px 3px
  );
  border: 1px solid rgba(5, 0, 122, 0.12);
  border-radius: 14px;
  box-shadow:
    0 2px 6px rgba(8, 0, 138, 0.06),
    0 16px 34px rgba(8, 0, 138, 0.10);
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 600ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 300ms ease;
}

/* Up: slow, deliberate slide — the reading beat starts once it lands. */
.ss-sentence.is-example.is-up {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  transition:
    transform 800ms cubic-bezier(0.33, 0, 0.15, 1),
    opacity 250ms ease;
}

.ss-sentence.is-example.is-parked {
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
}

/* Single flex child — keeps the words inline while the panel centers them. */
.ss-example-body {
  max-width: 100%;
}

/* ── Panel tabs: paper drawer handles ── */

.ss-panel-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(5, 0, 122, 0.16);
  background-color: #fffdf9;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(23, 24, 25, 0.018) 0 1px,
    transparent 1px 3px
  );
  color: #05007A;
  border-radius: 9px;
  padding: 6px 12px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(8, 0, 138, 0.14);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.ss-panel-tab:hover {
  transform: translateY(-1px);
  background-color: #ffffff;
  box-shadow: 0 4px 10px rgba(8, 0, 138, 0.18);
}

.ss-panel-tab[hidden] {
  display: none;
}

.ss-panel-tab .ph {
  font-size: 1.15em;
}

/* Drop tab: rides the panel's bottom edge while it is up. */
.ss-panel-tab-down {
  position: absolute;
  right: 14px;
  bottom: 9px;
  padding: 5px 9px;
}

/* Raise tab: peeks under the definition while the panel is parked. */
.ss-panel-tab-up {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
}

/* ── Clustered option cards (definition mode) — full-width stacked ── */

.ss-choice-row.is-def {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.ss-choice-row.is-def button {
  width: 100%;
  border: 1px solid rgba(5, 0, 122, 0.14);
  border-radius: 12px;
  background-color: #fffdf9;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(23, 24, 25, 0.02) 0 1px,
    transparent 1px 3px
  );
  box-shadow:
    0 1px 2px rgba(8, 0, 138, 0.05),
    0 10px 24px rgba(8, 0, 138, 0.07);
  padding: 15px 22px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: clamp(24px, 5vw, 30px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: #1f2226;
  text-decoration: none;
  transition:
    transform 200ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    opacity 160ms ease,
    color 160ms ease;
}

/* Paper cut-outs scattered at rest — each scrap has its own tilt. */
.ss-choice-row.is-def button:nth-child(1) { transform: rotate(-1.3deg); }
.ss-choice-row.is-def button:nth-child(2) { transform: rotate(1.2deg); }

.ss-choice-row.is-def button:hover:not(:disabled) {
  transform: rotate(0deg) translateY(-3px);
  border-color: rgba(5, 0, 122, 0.34);
  background-color: #ffffff;
  box-shadow:
    0 2px 4px rgba(8, 0, 138, 0.06),
    0 14px 30px rgba(8, 0, 138, 0.1);
}

.ss-choice-row.is-def button.is-correct {
  transform: rotate(0deg) translateY(-4px);
  color: #05007A;
  border-color: rgba(5, 0, 122, 0.55);
  background-color: #ffffff;
}

.ss-choice-row.is-def button.is-wrong {
  opacity: 0.4;
  text-decoration: line-through;
  text-decoration-color: rgba(23, 24, 25, 0.32);
}

/* All cards leave after a correct choice — the poster is the final product. */
.ss-choice-row.is-def button.is-leaving {
  opacity: 0;
  transform: scale(0.95) translateY(6px);
  pointer-events: none;
}

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
  .ss-overlay,
  .ss-panel,
  .ss-sentence,
  .ss-def-question,
  .ss-def-title,
  .ss-title-slot,
  .ss-explain-text,
  .ss-ok-btn,
  .ss-lang-chips,
  .ss-choice-row.is-def button,
  .ss-panel-tab,
  .ss-study-content {
    transition: none !important;
    animation: none !important;
  }
}

/* ── Mobile ── */

@media (max-width: 640px) {
  .ss-rail {
    padding: 36px 0 0;
  }

  .ss-sentence.is-example {
    padding: 18px 18px 44px;
  }

  .ss-choice-row.is-def {
    gap: 9px;
  }

  .ss-choice-row.is-def button {
    padding: 14px 18px;
    font-size: 24px;
    border-radius: 10px;
  }

  .ss-choice-row {
    margin-top: clamp(20px, 4vh, 40px);
  }

  .ss-meaning-panel {
    width: calc(100vw - 16px);
    left: 8px;
    transform: none;
    border-radius: 20px 20px 0 0;
  }

  .ss-explain-text {
    padding: 15px 16px 14px;
    font-size: 15.5px;
    max-height: min(40vh, 280px);
    margin-bottom: 18px;
  }

  .ss-trans-word {
    font-size: 17px;
  }
}

audio { display: none; }
