:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #181a1f;
  --panel-2: #20232a;
  --line: #343842;
  --text: #f5f2ea;
  --muted: #b9b3a8;
  --accent: #e0b84f;
  --accent-2: #60c0a4;
  --bad: #e56b6f;
  --good: #74c69d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(224, 184, 79, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(96, 192, 164, 0.11), transparent 38%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

button,
select {
  font: inherit;
}

.app {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.kicker {
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  font-size: 17px;
}

.stats {
  display: flex;
  gap: 10px;
  color: var(--muted);
}

.stats span {
  border: 1px solid var(--line);
  background: rgba(24, 26, 31, 0.8);
  padding: 8px 10px;
  border-radius: 6px;
  min-width: 82px;
  text-align: center;
}

.stage {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  align-items: stretch;
}

.role-panel,
.word-card,
.review {
  border: 1px solid var(--line);
  background: rgba(24, 26, 31, 0.92);
  border-radius: 8px;
}

.role-panel {
  min-height: 520px;
  padding: 18px;
}

.role-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px;
  border-radius: 6px;
}

.role-name {
  margin-top: 18px;
  font-size: 24px;
  font-weight: 750;
}

.role-brief {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.feedback {
  margin-top: 20px;
  min-height: 148px;
  border-left: 3px solid var(--accent);
  background: rgba(224, 184, 79, 0.08);
  padding: 14px;
  border-radius: 0 6px 6px 0;
  line-height: 1.7;
  font-size: 18px;
}

.feedback.good {
  border-color: var(--good);
  background: rgba(116, 198, 157, 0.1);
}

.feedback.bad {
  border-color: var(--bad);
  background: rgba(229, 107, 111, 0.1);
}

.quiz {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(300px, 1.25fr) minmax(190px, 1fr);
  grid-template-rows: 128px minmax(250px, 1fr) 128px;
  gap: 14px;
  min-height: 520px;
}

.word-card {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px;
  min-width: 0;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
}

.meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.03);
}

.word {
  font-size: 54px;
  font-weight: 800;
  line-height: 1.05;
  overflow-wrap: normal;
}

.phonetic {
  min-height: 28px;
  margin-top: 10px;
  color: var(--accent);
  font-size: 20px;
}

.example {
  min-height: 96px;
  margin-top: 20px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 17px;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.actions button,
.review-head button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  min-height: 38px;
  padding: 0 12px;
  cursor: pointer;
}

.actions button:hover,
.review-head button:hover {
  border-color: var(--accent);
}

.choice {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(32, 35, 42, 0.9);
  color: var(--text);
  border-radius: 8px;
  padding: 16px;
  min-width: 0;
  min-height: 112px;
  text-align: left;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease;
}

.choice:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.choice.correct {
  border-color: var(--good);
  background: rgba(116, 198, 157, 0.15);
}

.choice.wrong {
  border-color: var(--bad);
  background: rgba(229, 107, 111, 0.15);
}

.choice-up {
  grid-column: 2;
  grid-row: 1;
}

.choice-left {
  grid-column: 1;
  grid-row: 2;
}

.choice-right {
  grid-column: 3;
  grid-row: 2;
}

.choice-down {
  grid-column: 2;
  grid-row: 3;
}

.arrow {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--bg);
  background: var(--accent);
  font-weight: 800;
}

.choice-text {
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.review {
  margin-top: 18px;
  padding: 16px;
}

.review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.script-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  color: var(--muted);
}

.script-line {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  padding: 10px;
  line-height: 1.5;
}

.script-line strong {
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}

.editable-line {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px;
  outline: none;
}

.editable-line:hover {
  border-color: rgba(224, 184, 79, 0.35);
  background: rgba(224, 184, 79, 0.06);
}

.editable-line:focus {
  border-color: var(--accent);
  background: rgba(224, 184, 79, 0.09);
  color: var(--text);
}

@media (max-width: 900px) {
  .stage {
    grid-template-columns: 1fr;
  }

  .role-panel {
    min-height: auto;
  }

  .quiz {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto;
  }

  .word-card {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .choice-up,
  .choice-right,
  .choice-down,
  .choice-left {
    grid-column: auto;
    grid-row: auto;
  }

  .script-preview {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100vw - 20px, 1180px);
    padding-top: 16px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  h1 {
    font-size: 28px;
  }

  .word {
    font-size: 40px;
  }

  .quiz {
    grid-template-columns: 1fr;
  }
}
