: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 {
  -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(42px, 7vw, 78px);
  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;
}

.balance-structure {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin-top: 34px;
  position: relative;
  z-index: 2;
}

.structure-block {
  min-height: 142px;
  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;
  transition: 0.28s ease;
}

.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);
}

.structure-block.active strong,
.structure-block.active span {
  color: #3a2c05;
}

.balance-block {
  background: #fff8dc;
  border-color: #edc85e;
}

.balance-block strong {
  color: var(--yellow-dark);
}

.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);
  }
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 32px;
  position: relative;
  z-index: 2;
}

.word-card {
  min-height: 118px;
  border-radius: 26px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  transform: translateY(18px);
  opacity: 0;
}

.screen.active .word-card {
  animation: itemUp 0.45s ease forwards;
}

.screen.active .word-card:nth-child(1) {
  animation-delay: 0.08s;
}

.screen.active .word-card:nth-child(2) {
  animation-delay: 0.16s;
}

.screen.active .word-card:nth-child(3) {
  animation-delay: 0.24s;
}

.screen.active .word-card:nth-child(4) {
  animation-delay: 0.32s;
}

.screen.active .word-card:nth-child(5) {
  animation-delay: 0.4s;
}

.word-card strong {
  display: block;
  font-size: clamp(26px, 4vw, 42px);
  color: var(--yellow-dark);
  margin-bottom: 6px;
}

.word-card span {
  color: var(--muted);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.5;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 32px;
  position: relative;
  z-index: 2;
}

.match-grid.two {
  grid-template-columns: repeat(2, 1fr);
}

.match-card {
  min-height: 210px;
  border-radius: 30px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform: translateY(18px);
  opacity: 0;
}

.screen.active .match-card {
  animation: itemUp 0.45s ease forwards;
}

.screen.active .match-card:nth-child(1) {
  animation-delay: 0.12s;
}

.screen.active .match-card:nth-child(2) {
  animation-delay: 0.24s;
}

.screen.active .match-card:nth-child(3) {
  animation-delay: 0.36s;
}

.match-word {
  font-size: clamp(38px, 6vw, 68px);
  font-weight: 1000;
  color: var(--yellow-dark);
  line-height: 1;
}

.match-subjects {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.subject-pill {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--yellow-light);
  border: 1px solid var(--line);
  font-weight: 900;
  color: var(--text);
}

.match-example {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  margin-top: 16px;
  line-height: 1.5;
}

.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;
}

@keyframes itemUp {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.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 {
  background: var(--yellow);
  border-radius: 12px;
  padding: 3px 9px;
  color: #3a2c05;
  box-shadow: 0 8px 18px rgba(255, 199, 67, 0.22);
}

.balance-word {
  background: #ffe9a3;
  border: 2px solid var(--yellow-strong);
  border-radius: 12px;
  padding: 3px 9px;
  color: #3a2c05;
  box-shadow: 0 8px 18px rgba(255, 199, 67, 0.22);
}

.hidden-balance {
  border: 2px dashed var(--yellow-dark);
  background: #fff8dc;
  border-radius: 12px;
  padding: 3px 9px;
  color: 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;
}

.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(28px, 5vw, 48px);
  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: 680px;
  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: 760px) {
  .top-status {
    display: none;
  }

  .main-card {
    min-height: 540px;
    border-radius: 30px;
  }

  .balance-structure,
  .word-grid,
  .match-grid,
  .match-grid.two {
    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);
    }
  }

  .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: 520px) {
  .app {
    width: 94%;
    padding-top: 16px;
  }

  .topbar {
    height: 54px;
  }

  .logo {
    font-size: 19px;
  }

  .logo-icon {
    width: 34px;
    height: 34px;
  }

  .main-card {
    padding: 24px;
  }

  .floating-note {
    padding: 20px;
  }

  .primary-btn,
  .secondary-btn {
    padding: 13px 18px;
  }
}
/* Unit 2 updated components */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 32px;
  position: relative;
  z-index: 2;
}

.category-card {
  min-height: 230px;
  border-radius: 30px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform: translateY(18px);
  opacity: 0;
}

.screen.active .category-card {
  animation: itemUp 0.45s ease forwards;
}

.screen.active .category-card:nth-child(1) { animation-delay: 0.1s; }
.screen.active .category-card:nth-child(2) { animation-delay: 0.2s; }
.screen.active .category-card:nth-child(3) { animation-delay: 0.3s; }
.screen.active .category-card:nth-child(4) { animation-delay: 0.4s; }

.category-title {
  font-size: clamp(24px, 3.2vw, 38px);
  font-weight: 1000;
  color: var(--yellow-dark);
  line-height: 1.15;
  margin-bottom: 14px;
}

.category-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.word-chip {
  display: inline-flex;
  padding: 9px 13px;
  border-radius: 999px;
  background: var(--yellow-light);
  border: 1px solid var(--line);
  color: #4a3500;
  font-weight: 1000;
}

.category-desc {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.55;
}

.rule-box {
  margin-top: 32px;
  border-radius: 30px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  padding: 28px;
  position: relative;
  z-index: 2;
}

.rule-title {
  color: var(--yellow-dark);
  font-size: 20px;
  font-weight: 1000;
  margin-bottom: 14px;
}

.rule-line {
  font-size: clamp(21px, 3vw, 34px);
  line-height: 1.45;
  font-weight: 1000;
  color: var(--text);
}

.rule-line + .rule-line {
  margin-top: 12px;
}

.mini-table {
  display: grid;
  gap: 12px;
  margin-top: 28px;
  position: relative;
  z-index: 2;
}

.table-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.4fr;
  gap: 12px;
  align-items: stretch;
}

.table-cell {
  border-radius: 18px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  padding: 16px 18px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.45;
}

.table-cell.head {
  background: var(--yellow);
  color: #3a2c05;
  font-weight: 1000;
}

.table-cell.soft {
  background: var(--yellow-light);
  color: var(--yellow-dark);
}

.priority-stack {
  display: grid;
  gap: 16px;
  margin-top: 32px;
  position: relative;
  z-index: 2;
}

.priority-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--soft-shadow);
  padding: 18px 22px;
  transform: translateY(18px);
  opacity: 0;
}

.screen.active .priority-item {
  animation: itemUp 0.45s ease forwards;
}

.screen.active .priority-item:nth-child(1) { animation-delay: 0.1s; }
.screen.active .priority-item:nth-child(2) { animation-delay: 0.2s; }
.screen.active .priority-item:nth-child(3) { animation-delay: 0.3s; }

.priority-number {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: var(--yellow);
  display: grid;
  place-items: center;
  color: #3a2c05;
  font-size: 24px;
  font-weight: 1000;
}

.priority-text strong {
  display: block;
  font-size: 22px;
  color: var(--text);
  margin-bottom: 4px;
}

.priority-text span {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
}

.priority-tag {
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--yellow-light);
  border: 1px solid var(--line);
  color: var(--yellow-dark);
  font-weight: 1000;
  white-space: nowrap;
}

.content-word {
  background: #f7f0dc;
  border: 2px dashed #d5bd79;
  border-radius: 12px;
  padding: 3px 9px;
  color: #6a5722;
}

.complete-word {
  background: #fff2b8;
  border: 2px solid var(--yellow-dark);
  border-radius: 12px;
  padding: 3px 9px;
  color: var(--yellow-dark);
  box-shadow: 0 8px 18px rgba(255, 199, 67, 0.22);
}

@media (max-width: 760px) {
  .category-grid {
    grid-template-columns: 1fr;
  }

  .table-row {
    grid-template-columns: 1fr;
  }

  .priority-item {
    grid-template-columns: 1fr;
  }

  .priority-tag {
    width: fit-content;
  }
}
