:root {
  --sp-ink: #101d38;
  --sp-muted: #5c6b84;
  --sp-line: #dbe4f1;
  --sp-blue: #2563eb;
  --sp-blue-deep: #1747b7;
  --sp-cyan: #04a6c2;
  --sp-green: #0d8a72;
  --sp-orange: #f28b28;
  --sp-purple: #7654d8;
  --sp-surface: rgba(255, 255, 255, 0.94);
}

body.ielts-speaking-page {
  color: var(--sp-ink);
  background:
    radial-gradient(circle at 82% 8%, rgba(37, 99, 235, 0.16), transparent 27rem),
    radial-gradient(circle at 22% 76%, rgba(13, 138, 114, 0.12), transparent 25rem),
    #eef3fa;
}

body.ielts-speaking-page .main {
  padding: 28px;
}

body.ielts-speaking-page .content-section.active.speaking-shell {
  display: block;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.speaking-label {
  margin: 0 0 12px;
  color: #1c73e8;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.speaking-parts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 22px;
}

.speaking-part-tab {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  min-height: 86px;
  padding: 16px;
  text-align: left;
  color: var(--sp-ink);
  border: 1px solid var(--sp-line);
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.78);
}

.speaking-part-tab:not(:disabled) {
  cursor: pointer;
}

.speaking-part-tab.is-available:not(.is-active) {
  border-color: #b8d1fb;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(235, 244, 255, 0.94));
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.1);
}

.speaking-part-tab.is-available:not(.is-active) > span {
  color: #1f5dc5;
  background: #e5efff;
}

.speaking-part-tab.is-available:not(.is-active) small {
  color: #2475d8;
}

.speaking-part-tab > span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #71809a;
  font-size: 0.78rem;
  font-weight: 900;
  border-radius: 14px;
  background: #edf2f9;
}

.speaking-part-tab strong {
  font-size: 1rem;
}

.speaking-part-tab small {
  color: #8995aa;
  font-weight: 700;
}

.speaking-part-tab.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #2563eb, #0b8cab);
  box-shadow: 0 16px 35px rgba(37, 99, 235, 0.2);
}

.speaking-part-tab.is-active > span {
  color: #19499f;
  background: #fff;
}

.speaking-part-tab.is-active small {
  color: #aef4e7;
}

.speaking-part1-panel[hidden] {
  display: none;
}

.speaking-part1-panel:not([hidden]) {
  animation: speaking-panel-in 0.28s ease both;
}

@keyframes speaking-panel-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.speaking-workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(0, 1.2fr);
  gap: 22px;
}

.spin-card,
.question-studio,
.topic-library {
  border: 1px solid rgba(179, 194, 218, 0.65);
  background: var(--sp-surface);
  box-shadow: 0 22px 55px rgba(28, 50, 88, 0.1);
}

.spin-card,
.question-studio {
  min-height: 570px;
  padding: 28px;
  border-radius: 28px;
}

.speaking-card-heading,
.question-studio-top,
.topic-library-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.speaking-card-heading h2,
.question-studio-top h2,
.topic-library-heading h2 {
  margin: 0;
  color: var(--sp-ink);
  font-size: clamp(1.35rem, 2.1vw, 2rem);
  letter-spacing: -0.035em;
}

.speaking-card-tools {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.speaking-free-badge,
.question-position {
  flex: 0 0 auto;
  padding: 9px 12px;
  color: #08715e;
  font-size: 0.72rem;
  font-weight: 900;
  border: 1px solid #b9eadf;
  border-radius: 999px;
  background: #e6f9f3;
}

.question-position {
  color: #245dbf;
  border-color: #cbdafa;
  background: #edf4ff;
}

.speaking-sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 35px;
  padding: 7px 11px;
  color: #31547f;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 850;
  border: 1px solid #d2dfef;
  border-radius: 999px;
  background: #f8fbff;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.speaking-sound-toggle:hover,
.speaking-sound-toggle:focus-visible {
  color: #174fa9;
  border-color: #9fc0f3;
  background: #edf5ff;
  transform: translateY(-1px);
}

.speaking-sound-toggle[aria-pressed="false"] {
  color: #6c788b;
  background: #f3f5f8;
}

.speaking-sound-toggle > span:first-child {
  font-size: 0.9rem;
}

.spin-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 330px;
  margin: 12px 0 4px;
}

.spin-wheel {
  position: relative;
  width: min(290px, 72vw);
  aspect-ratio: 1;
  border: 12px solid #fff;
  border-radius: 50%;
  background: conic-gradient(
    #2563eb 0 10%, #0b8cab 10% 20%, #11a87f 20% 30%, #76b63e 30% 40%,
    #f0b429 40% 50%, #f28b28 50% 60%, #e34a62 60% 70%, #a84fbb 70% 80%,
    #7654d8 80% 90%, #3f68c9 90% 100%
  );
  box-shadow: 0 18px 45px rgba(29, 63, 124, 0.24), inset 0 0 0 2px rgba(255, 255, 255, 0.6);
  transition: transform 2.9s cubic-bezier(0.15, 0.78, 0.18, 1);
}

.spin-wheel::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 2px dashed rgba(255, 255, 255, 0.58);
  border-radius: 50%;
}

.spin-wheel-core {
  position: absolute;
  inset: 50% auto auto 50%;
  display: grid;
  place-items: center;
  width: 95px;
  height: 95px;
  transform: translate(-50%, -50%);
  color: var(--sp-ink);
  border: 8px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 24px rgba(11, 33, 73, 0.22);
}

.spin-wheel-core strong {
  align-self: end;
  font-size: 1.55rem;
  line-height: 1;
}

.spin-wheel-core span {
  align-self: start;
  color: #6b7890;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.spin-pointer {
  position: absolute;
  z-index: 2;
  top: 9px;
  width: 0;
  height: 0;
  border-left: 17px solid transparent;
  border-right: 17px solid transparent;
  border-top: 30px solid #101d38;
  filter: drop-shadow(0 5px 5px rgba(7, 20, 45, 0.25));
}

.spin-primary,
.question-primary,
.question-secondary {
  min-height: 50px;
  padding: 0 20px;
  font: inherit;
  font-weight: 900;
  border-radius: 15px;
  cursor: pointer;
}

.spin-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  color: #fff;
  border: 0;
  background: linear-gradient(135deg, #2563eb, #0b8cab);
  box-shadow: 0 12px 25px rgba(37, 99, 235, 0.23);
}

.spin-primary span {
  font-size: 1.3rem;
}

.spin-primary:disabled {
  cursor: wait;
  opacity: 0.75;
}

.spin-hint,
.record-status {
  min-height: 24px;
  margin: 13px 0 0;
  color: var(--sp-muted);
  text-align: center;
  font-size: 0.84rem;
  line-height: 1.5;
}

.speaking-progress-mini {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #dfe7f3;
  border-radius: 16px;
  background: #f7f9fd;
}

.speaking-progress-mini > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  color: var(--sp-muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.speaking-progress-mini strong {
  color: var(--sp-ink);
}

.speaking-progress-track {
  height: 7px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebf4;
}

.speaking-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0d8a72, #35c4ad);
  transition: width 0.3s ease;
}

.question-studio {
  display: flex;
  flex-direction: column;
}

.question-stage {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 230px;
  margin-top: 28px;
  padding: 36px;
  overflow: hidden;
  border: 1px solid #cbdafa;
  border-radius: 24px;
  background: linear-gradient(135deg, #f6f9ff, #edf5ff 58%, #eefcf9);
}

.question-stage::after {
  content: "?“";
  position: absolute;
  right: 20px;
  bottom: -46px;
  color: rgba(37, 99, 235, 0.075);
  font-size: 10rem;
  font-weight: 900;
  line-height: 1;
}

.question-stage p {
  position: relative;
  z-index: 1;
  max-width: 770px;
  margin: 0;
  color: var(--sp-ink);
  font-size: clamp(1.55rem, 2.8vw, 2.45rem);
  font-weight: 850;
  line-height: 1.28;
  letter-spacing: -0.035em;
}

.question-dots {
  display: flex;
  justify-content: center;
  gap: 9px;
  min-height: 36px;
  margin: 18px 0;
}

.question-dots button {
  width: 34px;
  height: 34px;
  color: #6f7d94;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  border: 1px solid #d6dfec;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.question-dots button.is-active {
  color: #fff;
  border-color: var(--sp-blue);
  background: var(--sp-blue);
}

.question-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.question-primary {
  color: #fff;
  border: 1px solid transparent;
  background: var(--sp-blue);
}

.question-secondary {
  color: #214a8f;
  border: 1px solid #c7d6ee;
  background: #fff;
}

.question-primary:disabled,
.question-secondary:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.answer-shape {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 18px;
  border: 1px solid #dce6f2;
  border-radius: 18px;
  background: #f8fafc;
}

.answer-shape span {
  flex-basis: 100%;
  color: #708099;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.answer-shape strong {
  padding: 8px 11px;
  color: #1f4f99;
  font-size: 0.78rem;
  border-radius: 9px;
  background: #eaf2ff;
}

.answer-shape i {
  color: #8b98aa;
  font-style: normal;
}

.topic-library {
  margin-top: 22px;
  padding: 30px;
  border-radius: 28px;
}

.topic-library-heading {
  align-items: end;
  margin-bottom: 22px;
}

.topic-library-heading > p {
  max-width: 340px;
  margin: 0;
  color: var(--sp-muted);
  text-align: right;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 13px;
}

.topic-card {
  position: relative;
  min-height: 155px;
  padding: 19px;
  overflow: hidden;
  text-align: left;
  color: var(--sp-ink);
  font: inherit;
  border: 1px solid #dce4ef;
  border-radius: 19px;
  background: #fff;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.topic-card::after {
  content: "";
  position: absolute;
  right: -27px;
  bottom: -33px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--topic-tint, #e8f0ff);
}

.topic-card:hover,
.topic-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--topic-accent, #2563eb);
  box-shadow: 0 14px 28px rgba(35, 61, 105, 0.12);
}

.topic-card.is-active {
  border-color: var(--topic-accent, #2563eb);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--topic-accent, #2563eb) 14%, transparent);
}

.topic-card-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.topic-card-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  font-size: 1.15rem;
  border-radius: 12px;
  background: var(--topic-tint, #e8f0ff);
}

.topic-card-number {
  color: var(--topic-accent, #2563eb);
  font-size: 0.74rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.topic-card strong {
  position: relative;
  z-index: 1;
  display: block;
  font-size: 0.94rem;
  line-height: 1.28;
}

.topic-card small {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 7px;
  color: #79869b;
  font-weight: 700;
}

.speaking-standard-note {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  padding: 18px 22px;
  color: #4f5f78;
  line-height: 1.55;
  border: 1px solid #d7e1ef;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.speaking-standard-note strong {
  flex: 0 0 auto;
  color: var(--sp-ink);
}

@media (max-width: 1180px) {
  .speaking-workspace { grid-template-columns: 1fr; }
  .spin-card { min-height: auto; }
  .topic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body.ielts-speaking-page .main { padding: 14px; }
  .speaking-parts { grid-template-columns: 1fr 1fr; }
  .speaking-part-tab { min-height: 74px; padding: 12px; }
  .spin-card, .question-studio, .topic-library { padding: 20px; border-radius: 22px; }
  .speaking-card-heading, .question-studio-top, .topic-library-heading { align-items: flex-start; }
  .speaking-free-badge { display: none; }
  .speaking-card-tools { align-items: flex-end; }
  .speaking-sound-toggle span:last-child { display: none; }
  .speaking-sound-toggle { width: 38px; padding: 7px; justify-content: center; }
  .question-stage { min-height: 210px; padding: 26px; }
  .question-actions { grid-template-columns: 1fr; }
  .topic-library-heading { display: block; }
  .topic-library-heading > p { margin-top: 10px; text-align: left; }
  .topic-grid { grid-template-columns: 1fr 1fr; }
  .speaking-standard-note { display: block; }
  .speaking-standard-note span { display: block; margin-top: 6px; }
}

@media (max-width: 480px) {
  .speaking-parts { grid-template-columns: 1fr; }
  .topic-grid { grid-template-columns: 1fr; }
  .topic-card { min-height: 125px; }
  .answer-shape i { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .spin-wheel,
  .topic-card { transition-duration: 0.01ms !important; }
}
