:root {
  --bg: #fffaf0;
  --card: #ffffff;
  --yellow: #ffd86b;
  --yellow-strong: #ffc93f;
  --yellow-light: #fff8dc;
  --yellow-dark: #a87300;
  --text: #2f2a1f;
  --muted: #7b725f;
  --line: #f1dfaa;
  --green: #2f8f46;
  --red: #c2472d;
  --shadow: 0 18px 45px rgba(130, 96, 20, 0.09);
  --soft-shadow: 0 14px 34px rgba(130, 96, 20, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

button,
a,
.option,
.dot,
.primary-btn,
.secondary-btn,
.small-next-btn,
.drag-block,
.drop-cell,
.reset-btn,
.check-btn,
.grid-next-btn {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button:focus,
a:focus {
  outline: none;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(255, 201, 63, 0.8);
  outline-offset: 4px;
}

body {
  min-height: 100vh;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    Arial,
    sans-serif;
  background:
    radial-gradient(circle at top left, #fff0b8 0, transparent 34%),
    radial-gradient(circle at bottom right, #ffe9a3 0, transparent 30%),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

button {
  font-family: inherit;
}

.app {
  width: min(1080px, 92%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 42px;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 22px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffd15c, #fff0ae);
  display: grid;
  place-items: center;
  color: #4a3500;
  box-shadow: 0 10px 24px rgba(255, 185, 36, 0.25);
}

.top-status {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.progress-bar {
  flex: 1;
  height: 10px;
  background: #f6e9bd;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--yellow), var(--yellow-strong));
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress-text {
  min-width: 62px;
  text-align: right;
  color: var(--muted);
  font-weight: 900;
  font-size: 14px;
}

.screen-area {
  flex: 1;
  display: grid;
  place-items: center;
}

.screen {
  display: none;
  width: 100%;
  animation: screenIn 0.32s ease;
}

.screen.active {
  display: block;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.main-card {
  min-height: 560px;
  border-radius: 38px;
  background: linear-gradient(135deg, #ffffff 0%, #fff8dc 100%);
  border: 1px solid rgba(241, 223, 170, 0.95);
  box-shadow: var(--shadow);
  padding: clamp(28px, 5vw, 56px);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.main-card::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -90px;
  top: -90px;
  border-radius: 50%;
  background: rgba(255, 216, 107, 0.28);
  pointer-events: none;
}

.tag {
  display: inline-flex;
  width: fit-content;
  padding: 8px 14px;
  background: var(--yellow-light);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #82651d;
  font-size: 14px;
  font-weight: 900;
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
}

h1 {
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1.04;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
}

h2 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.12;
  letter-spacing: -1px;
  margin-bottom: 16px;
  position: relative;
  z-index: 2;
}

p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.85;
  position: relative;
  z-index: 2;
}

.big-word {
  display: inline-block;
  width: fit-content;
  margin-top: 26px;
  padding: 14px 26px;
  border-radius: 24px;
  background: var(--yellow);
  color: #3a2c05;
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 1000;
  box-shadow: 0 16px 34px rgba(255, 199, 67, 0.3);
  position: relative;
  z-index: 2;
  animation: gentleFloat 2.6s ease-in-out infinite;
}

@keyframes gentleFloat {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.floating-note {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 22px 24px;
  box-shadow: var(--soft-shadow);
  position: relative;
  z-index: 3;
  transform: translateY(28px);
  opacity: 0;
}

.screen.active .floating-note {
  animation: noteUp 0.5s ease forwards;
  animation-delay: 0.18s;
}

@keyframes noteUp {
  from {
    transform: translateY(32px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.floating-note::before {
  content: "";
  position: absolute;
  left: 38px;
  top: -11px;
  width: 20px;
  height: 20px;
  background: white;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}

.note-title {
  font-size: 16px;
  font-weight: 1000;
  color: var(--yellow-dark);
  margin-bottom: 8px;
}

.note-text {
  color: var(--text);
  font-size: clamp(18px, 2.4vw, 24px);
  line-height: 1.7;
  font-weight: 800;
}

.highlight {
  background: linear-gradient(180deg, transparent 52%, var(--yellow) 52%);
  padding: 0 4px;
  font-weight: 1000;
}

.structure-line {
  margin-top: 30px;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 2;
}

.structure-block {
  min-height: 130px;
  border-radius: 28px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
}

.structure-block strong {
  display: block;
  font-size: clamp(24px, 3.2vw, 38px);
  color: var(--text);
  margin-bottom: 8px;
}

.structure-block span {
  display: block;
  font-size: 15px;
  color: var(--muted);
  font-weight: 800;
}

.structure-block.active {
  background: var(--yellow);
  border-color: #edc85e;
  transform: translateY(-8px);
  box-shadow: 0 18px 36px rgba(255, 199, 67, 0.32);
}

.arrow {
  color: var(--yellow-dark);
  font-size: 30px;
  font-weight: 1000;
  animation: arrowPulse 1.5s ease-in-out infinite;
}

@keyframes arrowPulse {
  0%,
  100% {
    opacity: 0.45;
    transform: translateX(0);
  }

  50% {
    opacity: 1;
    transform: translateX(4px);
  }
}

.question-word-grid,
.swap-grid {
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  position: relative;
  z-index: 2;
}

.qw-card,
.swap-card {
  min-height: 132px;
  border-radius: 26px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  padding: 20px;
  transform: translateY(18px);
  opacity: 0;
}

.screen.active .qw-card,
.screen.active .swap-card {
  animation: itemUp 0.45s ease forwards;
}

.screen.active .qw-card:nth-child(1),
.screen.active .swap-card:nth-child(1) {
  animation-delay: 0.08s;
}

.screen.active .qw-card:nth-child(2),
.screen.active .swap-card:nth-child(2) {
  animation-delay: 0.16s;
}

.screen.active .qw-card:nth-child(3),
.screen.active .swap-card:nth-child(3) {
  animation-delay: 0.24s;
}

.screen.active .qw-card:nth-child(4) {
  animation-delay: 0.32s;
}

.screen.active .qw-card:nth-child(5) {
  animation-delay: 0.4s;
}

.screen.active .qw-card:nth-child(6) {
  animation-delay: 0.48s;
}

.screen.active .qw-card:nth-child(7) {
  animation-delay: 0.56s;
}

.screen.active .qw-card:nth-child(8) {
  animation-delay: 0.64s;
}

@keyframes itemUp {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.qw-card strong {
  display: block;
  color: var(--yellow-dark);
  font-size: 34px;
  font-weight: 1000;
  margin-bottom: 8px;
}

.qw-card span {
  display: block;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.55;
}

.swap-card {
  text-align: center;
  display: grid;
  gap: 8px;
  place-items: center;
}

.swap-from,
.swap-to {
  font-size: 36px;
  font-weight: 1000;
  color: var(--yellow-dark);
}

.swap-arrow {
  font-size: 28px;
  font-weight: 1000;
  color: var(--text);
}

.swap-card p {
  font-size: 15px;
  line-height: 1.5;
  font-weight: 800;
}

.example-list {
  display: grid;
  gap: 18px;
  margin-top: 30px;
  position: relative;
  z-index: 2;
}

.example-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  box-shadow: var(--soft-shadow);
  transform: translateY(18px);
  opacity: 0;
}

.screen.active .example-item {
  animation: itemUp 0.45s ease forwards;
}

.screen.active .example-item:nth-child(1) {
  animation-delay: 0.12s;
}

.screen.active .example-item:nth-child(2) {
  animation-delay: 0.24s;
}

.screen.active .example-item:nth-child(3) {
  animation-delay: 0.36s;
}

.sentence-wrap {
  display: grid;
  gap: 6px;
}

.sentence {
  color: var(--text);
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 900;
  line-height: 1.4;
}

.translation {
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}

.subject,
.balance-word,
.target-word {
  border-radius: 12px;
  padding: 3px 9px;
  color: #3a2c05;
  box-shadow: 0 8px 18px rgba(255, 199, 67, 0.22);
}

.subject {
  background: var(--yellow);
}

.balance-word {
  background: #ffe9a3;
  border: 2px solid var(--yellow-strong);
}

.target-word {
  background: #fff1a8;
  border: 2px dashed var(--yellow-dark);
}

.label {
  white-space: nowrap;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--yellow-light);
  border: 1px solid var(--line);
  color: var(--yellow-dark);
  font-weight: 900;
  font-size: 14px;
}

.grid-scroll {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 8px;
  position: relative;
  z-index: 2;
}

.grid-scroll::-webkit-scrollbar {
  height: 8px;
}

.grid-scroll::-webkit-scrollbar-track {
  background: #f6e9bd;
  border-radius: 999px;
}

.grid-scroll::-webkit-scrollbar-thumb {
  background: #d9b24c;
  border-radius: 999px;
}

.nine-grid-wrap {
  margin-top: 28px;
  position: relative;
  z-index: 2;
  display: grid;
  gap: 16px;
}

.nine-grid {
  min-width: 680px;
  display: grid;
  grid-template-columns: 150px repeat(3, 1fr);
  gap: 10px;
  align-items: stretch;
}

.grid-label,
.grid-cell {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: white;
  min-height: 72px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12px;
  box-shadow: var(--soft-shadow);
  font-weight: 900;
  line-height: 1.45;
}

.grid-label {
  background: var(--yellow-light);
  color: var(--yellow-dark);
}

.grid-cell strong {
  font-size: 18px;
}

.grid-cell span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.grid-head {
  background: #fffaf0;
  color: var(--muted);
  font-size: 14px;
}

.exercise-board {
  margin-top: 26px;
  position: relative;
  z-index: 2;
  display: grid;
  gap: 18px;
}

.exercise-title-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px 20px;
  box-shadow: var(--soft-shadow);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.exercise-title-card strong {
  display: block;
  color: var(--yellow-dark);
  font-size: 17px;
  margin-bottom: 6px;
}

.exercise-title-card span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
}

.round-badge {
  white-space: nowrap;
  background: var(--yellow-light);
  border: 1px solid var(--line);
  color: var(--yellow-dark);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 1000;
  font-size: 13px;
}

.drop-grid {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 150px repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-right: 22px;
}

.drop-row-label {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--yellow-light);
  color: var(--yellow-dark);
  min-height: 76px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12px;
  font-weight: 1000;
  box-shadow: var(--soft-shadow);
  line-height: 1.45;
}

.drop-cell {
  min-height: 76px;
  border-radius: 18px;
  border: 2px dashed #e8c96b;
  background: rgba(255, 255, 255, 0.82);
  display: grid;
  place-items: center;
  padding: 8px;
  transition: 0.2s;
}

.drop-cell:hover,
.drop-cell.over {
  background: #fff8dc;
  border-color: var(--yellow-dark);
  transform: none;
}

.drop-cell.correct {
  border-style: solid;
  border-color: #9ed88f;
  background: #e9f9e5;
}

.drop-cell.wrong {
  border-style: solid;
  border-color: #f2ad9c;
  background: #ffe9e2;
}

.block-bank {
  border-radius: 26px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  padding: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 84px;
  transition: 0.2s;
}

.block-bank.over {
  background: #fff8dc;
  border-color: var(--yellow-dark);
}

.drag-block {
  border: 1px solid #e7c760;
  background: var(--yellow);
  color: #3a2c05;
  padding: 13px 18px;
  border-radius: 999px;
  font-weight: 1000;
  cursor: grab;
  box-shadow: 0 10px 20px rgba(255, 199, 67, 0.26);
  transition: 0.18s;
  text-align: center;
  font-size: 15px;
}

.drag-block:active {
  cursor: grabbing;
}

.drag-block.selected {
  transform: translateY(-4px) scale(1.04);
  outline: 3px solid rgba(255, 201, 63, 0.55);
}

.grid-help {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px 16px;
}

.exercise-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.check-btn,
.reset-btn,
.grid-next-btn {
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  font-weight: 1000;
  cursor: pointer;
  transition: 0.2s;
}

.check-btn,
.grid-next-btn {
  background: var(--yellow);
  color: #3a2c05;
  box-shadow: 0 12px 26px rgba(255, 199, 67, 0.28);
}

.reset-btn {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

.check-btn:hover,
.reset-btn:hover,
.grid-next-btn:hover {
  transform: translateY(-2px);
}

.grid-next-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.quiz-box {
  margin-top: 32px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 30px;
  position: relative;
  z-index: 2;
  box-shadow: var(--soft-shadow);
}

.quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.quiz-count {
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--yellow-light);
  border: 1px solid var(--line);
  color: var(--yellow-dark);
  font-weight: 1000;
  font-size: 14px;
}

.quiz-type {
  color: var(--muted);
  font-weight: 900;
  font-size: 14px;
}

.quiz-sentence {
  color: var(--text);
  font-size: clamp(26px, 5vw, 46px);
  line-height: 1.3;
  font-weight: 1000;
  margin-bottom: 8px;
  min-height: 62px;
}

.quiz-translation {
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 24px;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.option {
  border: 1px solid var(--line);
  background: #fffaf0;
  color: var(--text);
  padding: 14px 22px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  transition: 0.2s;
}

.option:hover {
  transform: translateY(-2px);
  background: var(--yellow-light);
}

.option.correct {
  background: #dff7d9;
  border-color: #9ed88f;
  color: var(--green);
}

.option.wrong {
  background: #ffe5dd;
  border-color: #f2ad9c;
  color: var(--red);
}

.option:disabled {
  cursor: not-allowed;
}

.feedback {
  margin-top: 18px;
  font-weight: 900;
  font-size: 17px;
  min-height: 26px;
}

.feedback.good {
  color: var(--green);
}

.feedback.bad {
  color: var(--red);
}

.quiz-actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
}

.small-next-btn {
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  background: var(--yellow);
  color: #3a2c05;
  font-weight: 1000;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(255, 199, 67, 0.28);
  transition: 0.2s;
}

.small-next-btn:hover {
  transform: translateY(-2px);
}

.small-next-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.finish-card {
  text-align: center;
  display: grid;
  place-items: center;
}

.finish-icon {
  width: 92px;
  height: 92px;
  border-radius: 32px;
  background: var(--yellow);
  display: grid;
  place-items: center;
  font-size: 42px;
  margin: 0 auto 24px;
  box-shadow: 0 16px 34px rgba(255, 199, 67, 0.3);
  animation: pop 0.5s ease;
}

@keyframes pop {
  0% {
    transform: scale(0.75);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.summary-box {
  margin: 28px auto 0;
  max-width: 720px;
  display: grid;
  gap: 12px;
  position: relative;
  z-index: 2;
}

.summary-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 20px;
  color: var(--text);
  font-weight: 800;
  text-align: left;
}

.summary-item::before {
  content: "✓";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--yellow);
  color: #4a3500;
  font-size: 13px;
  font-weight: 1000;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 26px;
}

.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 999px;
  padding: 15px 24px;
  font-size: 16px;
  font-weight: 1000;
  cursor: pointer;
  transition: 0.2s;
}

.primary-btn {
  background: var(--yellow);
  color: #3a2c05;
  box-shadow: 0 12px 26px rgba(255, 199, 67, 0.35);
}

.secondary-btn {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-2px);
}

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.step-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #ead6a1;
  transition: 0.25s;
  cursor: pointer;
}

.dot.active {
  width: 24px;
  background: var(--yellow-dark);
}

@media (max-width: 860px) {
  .top-status {
    display: none;
  }

  .structure-line {
    grid-template-columns: 1fr;
  }

  .arrow {
    transform: rotate(90deg);
    text-align: center;
  }

  @keyframes arrowPulse {
    0%,
    100% {
      opacity: 0.45;
      transform: translateY(0) rotate(90deg);
    }

    50% {
      opacity: 1;
      transform: translateY(4px) rotate(90deg);
    }
  }

  .question-word-grid,
  .swap-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .example-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .controls {
    flex-wrap: wrap;
  }

  .step-dots {
    order: -1;
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .app {
    width: 94%;
    padding-top: 16px;
  }

  .topbar {
    height: 54px;
  }

  .logo {
    font-size: 19px;
  }

  .logo-icon {
    width: 34px;
    height: 34px;
  }

  .main-card {
    padding: 24px;
    border-radius: 30px;
  }

  .floating-note {
    padding: 20px;
  }

  .question-word-grid,
  .swap-grid {
    grid-template-columns: 1fr;
  }

  .nine-grid {
  min-width: 520px;
  grid-template-columns: 96px repeat(3, 1fr);
  gap: 8px;
}

.drop-grid {
  width: 100%;
  min-width: 0;
  grid-template-columns: 82px repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding-right: 18px;
}

  .grid-label,
  .grid-cell,
  .drop-row-label,
  .drop-cell {
    border-radius: 15px;
    min-height: 68px;
    padding: 8px;
  }

  .grid-cell strong {
    font-size: 15px;
  }

  .grid-cell span {
    font-size: 11px;
  }

  .drop-row-label {
    font-size: 13px;
  }

  .drag-block {
    font-size: 14px;
    padding: 12px 15px;
  }

  .exercise-title-card {
    flex-direction: column;
  }

  .primary-btn,
  .secondary-btn {
    padding: 13px 18px;
  }
}


/* Unit 4 updated: balance-category boards */
.category-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 30px;
  position: relative;
  z-index: 2;
}

.category-card {
  min-height: 260px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transform: translateY(18px);
  opacity: 0;
}

.category-card::after {
  content: "";
  position: absolute;
  width: 128px;
  height: 128px;
  right: -48px;
  top: -48px;
  border-radius: 50%;
  background: rgba(255, 216, 107, 0.24);
  pointer-events: none;
}

.screen.active .category-card {
  animation: itemUp 0.45s ease forwards;
}

.screen.active .category-card:nth-child(1) {
  animation-delay: 0.08s;
}

.screen.active .category-card:nth-child(2) {
  animation-delay: 0.18s;
}

.screen.active .category-card:nth-child(3) {
  animation-delay: 0.28s;
}

.category-icon {
  width: 58px;
  height: 58px;
  border-radius: 22px;
  background: var(--yellow);
  display: grid;
  place-items: center;
  color: #3a2c05;
  font-size: 26px;
  font-weight: 1000;
  box-shadow: 0 14px 28px rgba(255, 199, 67, 0.28);
  position: relative;
  z-index: 2;
  margin-bottom: 16px;
}

.category-title {
  font-size: clamp(22px, 3vw, 31px);
  font-weight: 1000;
  color: var(--text);
  line-height: 1.15;
  position: relative;
  z-index: 2;
}

.category-words {
  margin-top: 10px;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff3be;
  border: 1px solid #efd37b;
  color: #5b4100;
  font-weight: 1000;
  font-size: 15px;
  position: relative;
  z-index: 2;
}

.category-card p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 800;
  position: relative;
  z-index: 2;
}

.category-example {
  margin-top: auto;
  padding-top: 18px;
  color: var(--yellow-dark);
  font-size: 16px;
  line-height: 1.4;
  font-weight: 1000;
  position: relative;
  z-index: 2;
}

/* Method cards for static / dynamic / condition pages */
.method-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
  position: relative;
  z-index: 2;
}

.method-card {
  border-radius: 26px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  padding: 20px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: translateY(18px);
  opacity: 0;
}

.screen.active .method-card {
  animation: itemUp 0.45s ease forwards;
}

.screen.active .method-card:nth-child(1) {
  animation-delay: 0.08s;
}

.screen.active .method-card:nth-child(2) {
  animation-delay: 0.18s;
}

.screen.active .method-card:nth-child(3) {
  animation-delay: 0.28s;
}

.method-card.active {
  background: var(--yellow);
  border-color: var(--yellow-strong);
  box-shadow: 0 18px 36px rgba(255, 199, 67, 0.3);
}

.method-label {
  color: var(--yellow-dark);
  font-weight: 1000;
  font-size: 14px;
}

.method-card.active .method-label,
.method-card.active strong,
.method-card.active span {
  color: #3a2c05;
}

.method-card strong {
  color: var(--text);
  font-size: clamp(19px, 2.5vw, 28px);
  line-height: 1.25;
  font-weight: 1000;
}

.method-card span {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.55;
  font-size: 15px;
}

/* Condition explanation board */
.condition-note-board {
  margin-top: 26px;
  display: grid;
  grid-template-columns: 1fr auto 1fr 1fr;
  gap: 14px;
  align-items: stretch;
  position: relative;
  z-index: 2;
}

.condition-mini-card {
  min-height: 108px;
  border-radius: 24px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  padding: 18px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.condition-mini-card.active {
  background: var(--yellow);
  border-color: var(--yellow-strong);
  color: #3a2c05;
}

.condition-mini-card strong {
  font-size: 14px;
  color: var(--yellow-dark);
  font-weight: 1000;
}

.condition-mini-card.active strong {
  color: #3a2c05;
}

.condition-mini-card span {
  font-size: clamp(17px, 2.2vw, 24px);
  font-weight: 1000;
  line-height: 1.25;
}

.condition-arrow {
  display: grid;
  place-items: center;
  color: var(--yellow-dark);
  font-size: 30px;
  font-weight: 1000;
}

/* Completion board */
.completion-board {
  margin-top: 26px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  position: relative;
  z-index: 2;
}

.completion-card {
  min-height: 130px;
  border-radius: 28px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  padding: 22px;
  text-align: center;
}

.completion-word {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 18px;
  background: var(--yellow);
  color: #3a2c05;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1;
  font-weight: 1000;
  box-shadow: 0 14px 28px rgba(255, 199, 67, 0.28);
}

.completion-card p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 800;
}

.completion-plus {
  color: var(--yellow-dark);
  font-size: 34px;
  font-weight: 1000;
}

/* Overall rule cards */
.rule-stack {
  margin-top: 30px;
  display: grid;
  gap: 16px;
  position: relative;
  z-index: 2;
}

.rule-card {
  border-radius: 28px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  transform: translateY(18px);
  opacity: 0;
}

.screen.active .rule-card {
  animation: itemUp 0.45s ease forwards;
}

.screen.active .rule-card:nth-child(1) {
  animation-delay: 0.08s;
}

.screen.active .rule-card:nth-child(2) {
  animation-delay: 0.18s;
}

.screen.active .rule-card:nth-child(3) {
  animation-delay: 0.28s;
}

.rule-card.active {
  background: var(--yellow);
  border-color: var(--yellow-strong);
}

.rule-number {
  width: 54px;
  height: 54px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--yellow-light);
  border: 1px solid var(--line);
  color: var(--yellow-dark);
  font-size: 24px;
  font-weight: 1000;
}

.rule-card.active .rule-number {
  background: white;
  color: #3a2c05;
}

.rule-card strong {
  display: block;
  color: var(--text);
  font-size: clamp(20px, 2.8vw, 30px);
  line-height: 1.2;
  font-weight: 1000;
}

.rule-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 800;
}

.rule-card.active strong,
.rule-card.active span {
  color: #3a2c05;
}

/* Denser question-card layout */
.compact-qw .qw-card strong {
  font-size: 30px;
}

@media (max-width: 900px) {
  .category-board,
  .method-board {
    grid-template-columns: 1fr;
  }

  .category-card,
  .method-card {
    min-height: auto;
  }

  .condition-note-board {
    grid-template-columns: 1fr;
  }

  .condition-arrow {
    transform: rotate(90deg);
    min-height: 20px;
  }

  .completion-board {
    grid-template-columns: 1fr;
  }

  .completion-plus {
    text-align: center;
  }
}

@media (max-width: 560px) {
  .category-board,
  .method-board {
    display: flex;
    overflow-x: auto;
    gap: 14px;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
  }

  .category-card,
  .method-card {
    min-width: 270px;
    scroll-snap-align: start;
  }

  .category-board::-webkit-scrollbar,
  .method-board::-webkit-scrollbar {
    display: none;
  }

  .rule-card {
    align-items: flex-start;
    flex-direction: column;
  }
}


/* Unit 4 九宫格练习：原句单独放大 */
.exercise-title-main {
  flex: 1;
  display: grid;
  gap: 12px;
}

.original-sentence-card {
  width: fit-content;
  max-width: 100%;
  padding: 14px 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, #fff8dc 0%, #ffffff 100%);
  border: 1px solid var(--line);
  box-shadow: 0 12px 26px rgba(130, 96, 20, 0.08);
}

.original-label {
  display: inline-flex;
  margin-bottom: 6px;
  color: var(--yellow-dark);
  font-size: 13px;
  font-weight: 1000;
}

.original-sentence {
  color: var(--text);
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.2;
  font-weight: 1000;
  letter-spacing: -0.4px;
}

.grid-exercise-info {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 800;
}

/* 修复拖动时浏览器默认拖拽影子太乱的问题 */
.drag-ghost {
  position: fixed;
  left: -9999px;
  top: -9999px;
  z-index: 9999;
  border: 1px solid #e7c760;
  background: var(--yellow);
  color: #3a2c05;
  padding: 13px 18px;
  border-radius: 999px;
  font-weight: 1000;
  box-shadow: 0 14px 28px rgba(255, 199, 67, 0.32);
  font-size: 15px;
  white-space: nowrap;
  pointer-events: none;
}

.drag-block.dragging {
  cursor: grabbing;
}

.drag-block.drag-hidden {
  opacity: 0.12;
}

/* 防止拖动时选中网页文字，减少残影 */
.exercise-board,
.drop-grid,
.block-bank {
  user-select: none;
}

/* 九宫格练习：标点放在框外 */
.drop-slot {
  position: relative;
  min-height: 76px;
  display: grid;
  align-items: stretch;
}

.drop-slot .drop-cell {
  width: 100%;
  height: 100%;
}

.drop-punctuation {
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text);
  font-size: 26px;
  font-weight: 1000;
  line-height: 1;
  pointer-events: none;
  z-index: 3;
}

/* 如果没有标点，就不要占视觉 */
.drop-punctuation:empty {
  display: none;
}

/* 手机端标点稍微小一点，避免挤 */
@media (max-width: 560px) {
  .drop-punctuation {
    right: -10px;
    font-size: 20px;
  }
}


.skip-grid-btn {
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  font-weight: 1000;
  cursor: pointer;
  transition: 0.2s;
  background: white;
  color: var(--yellow-dark);
  border: 1px solid var(--line);
}

.skip-grid-btn:hover {
  transform: translateY(-2px);
  background: var(--yellow-light);
}
