:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --line: #d8dde8;
  --text: #171b23;
  --muted: #667085;
  --green: #147d52;
  --red: #b42318;
  --blue: #175cd3;
  --yellow: #ad6800;
  --ink: #101828;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
}

.ghost-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 22px;
  padding: 22px;
  max-width: 1440px;
  margin: 0 auto;
}

.workspace,
.side section,
.challenge,
.result {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workspace {
  padding: 18px;
  min-width: 0;
}

.starter {
  display: grid;
  grid-template-columns: minmax(180px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.starter img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.starter-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 160px;
  padding: 18px;
  border-left: 4px solid var(--blue);
  background: #f4f7ff;
}

.starter-meta .label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.starter-meta strong {
  font-size: 34px;
  line-height: 1.08;
}

.submit-panel {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
button {
  width: 100%;
  min-height: 42px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font: inherit;
  letter-spacing: 0;
}

input,
select {
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
}

button {
  padding: 0 16px;
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  background: #2b3445;
}

.side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.side section {
  padding: 16px;
}

.side h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.challenge-list {
  display: grid;
  gap: 10px;
}

.challenge {
  padding: 12px;
}

.challenge.selected {
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.challenge-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.challenge h3 {
  font-size: 16px;
}

.challenge-head span {
  color: var(--blue);
  font-weight: 900;
}

.challenge p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

dl {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}

dl div {
  display: flex;
  gap: 5px;
  padding: 5px 7px;
  border-radius: 999px;
  background: #f2f4f7;
  font-size: 12px;
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  margin: 0;
  color: var(--text);
  font-weight: 800;
}

.result {
  margin-top: 18px;
  padding: 16px;
  min-height: 96px;
}

.result.empty,
.result.loading {
  color: var(--muted);
}

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

.result-head h2 {
  font-size: 22px;
}

.result.passed {
  border-color: #a6d8c1;
  background: #f3fbf7;
}

.result.failed {
  border-color: #f3b8b3;
  background: #fff7f6;
}

.flag {
  display: block;
  padding: 10px;
  border: 1px solid #9bd2b8;
  border-radius: 6px;
  background: #e8f7ef;
  color: var(--green);
  overflow-wrap: anywhere;
}

.note {
  margin-top: 10px;
  color: var(--yellow);
  font-weight: 700;
}

.prediction {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 14px;
}

.prediction h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.prediction ol,
.prediction ul,
.scoreboard ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 7px;
}

.prediction li,
.scoreboard li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.prediction li span,
.scoreboard li span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.prediction li.ok {
  border-color: #a6d8c1;
}

.prediction li.fail {
  border-color: #f3b8b3;
}

.prediction li.ok strong {
  color: var(--green);
}

.prediction li.fail strong {
  color: var(--red);
}

.prediction em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.scoreboard {
  color: var(--muted);
}

.scoreboard li {
  grid-template-columns: minmax(0, 1fr) auto;
}

.scoreboard strong {
  color: var(--blue);
}

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

  .submit-panel {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 18px;
  }

  .layout {
    padding: 14px;
  }

  .starter,
  .submit-panel,
  .prediction {
    grid-template-columns: 1fr;
  }

  .starter-meta strong {
    font-size: 26px;
  }
}
