:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --ink: #172033;
  --muted: #647086;
  --line: #d8dee9;
  --panel: #ffffff;
  --accent: #0f8f7a;
  --accent-dark: #086c5c;
  --accent-soft: #e0f6f2;
  --warning: #b25a1b;
  --blue: #2f67c8;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(15, 143, 122, 0.16), transparent 34rem),
    linear-gradient(135deg, #f7faf9 0%, var(--bg) 52%, #edf3ff 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(17rem, 24rem) minmax(0, 1fr);
  gap: 1.25rem;
  width: min(72rem, calc(100% - 2rem));
  min-height: calc(100vh - 2rem);
  margin: 1rem auto;
  align-items: stretch;
}

.control-panel,
.results-panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(216, 222, 233, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  border-radius: 8px;
}

.results-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: 4.1rem;
  max-width: 8ch;
}

h2 {
  font-size: 2rem;
}

.hardness-control p,
.copy-status {
  color: var(--muted);
  line-height: 1.55;
}

.hardness-control {
  display: grid;
  gap: 0.7rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.hardness-control label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  color: var(--ink);
  font-weight: 750;
}

.hardness-control strong {
  display: inline-grid;
  place-items: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.hardness-control input {
  width: 100%;
  accent-color: var(--accent);
}

.hardness-control p {
  margin: 0;
  font-size: 0.9rem;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin-top: auto;
}

button {
  min-height: 2.85rem;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(47, 103, 200, 0.35);
  outline-offset: 3px;
}

.primary-action {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 24px rgba(15, 143, 122, 0.2);
}

.primary-action:hover {
  background: var(--accent-dark);
}

.secondary-action {
  background: #eef3fb;
  color: var(--blue);
}

.secondary-action:hover {
  background: #e1eaf7;
}

.copy-status {
  min-height: 1.5rem;
  margin: 0;
  font-size: 0.92rem;
}

.results-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.average-pill {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: #fff2e8;
  color: var(--warning);
  font-weight: 800;
  white-space: nowrap;
}

.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
}

.student-card {
  display: grid;
  gap: 0.7rem;
  min-height: 9.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.student-emoji {
  min-height: 2.45rem;
  font-size: 2rem;
  line-height: 1;
}

.score-line {
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
  flex-wrap: wrap;
}

.grade {
  font-size: 2rem;
  font-weight: 850;
  line-height: 1;
}

.extra {
  color: var(--accent-dark);
  font-size: 1.05rem;
  font-weight: 850;
}

.range {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: min(100% - 1rem, 42rem);
    margin: 0.5rem auto;
  }

  .control-panel,
  .results-panel {
    padding: 1rem;
  }

  h1 {
    max-width: none;
    font-size: 2.6rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .results-header {
    align-items: stretch;
    flex-direction: column;
  }

  .average-pill {
    width: fit-content;
  }
}
