:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #66737d;
  --line: #d9e0e5;
  --accent: #0c7c73;
  --accent-dark: #075f58;
  --soft: #eef7f5;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(23, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(12, 124, 115, 0.08), rgba(47, 88, 135, 0.08)),
    var(--bg);
  color: var(--text);
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.lookup-panel {
  width: min(100%, 760px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.brand {
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 10px;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.intro {
  margin: 12px 0 28px;
  color: var(--muted);
  line-height: 1.6;
}

.lookup-form {
  display: grid;
  gap: 16px;
}

.lookup-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #fff;
  color: var(--text);
  font-size: 17px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(12, 124, 115, 0.16);
}

button {
  height: 48px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status {
  min-height: 24px;
  margin-top: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.status.error {
  color: var(--danger);
}

.result {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.result-eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.result h2 {
  margin: 0 0 14px;
  font-size: 24px;
}

.student-number {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-dark);
  padding: 7px 11px;
  font-size: 14px;
  font-weight: 800;
}

.total-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  margin-bottom: 16px;
}

.total-card div {
  background: #fff;
  padding: 14px;
}

.total-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.total-card strong {
  font-size: 24px;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.subject-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: #fff;
}

.subject-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.subject-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.subject-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.subject-card dt {
  color: var(--muted);
  font-weight: 700;
}

.subject-card dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.grade-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.grade-table th,
.grade-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.grade-table th {
  width: 38%;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 520px) {
  .lookup-panel {
    padding: 24px;
  }

  h1 {
    font-size: 24px;
  }

  button {
    width: 100%;
  }

  .result-header {
    display: block;
  }

  .student-number {
    display: inline-block;
    margin-top: 2px;
  }

  .total-card,
  .subject-grid {
    grid-template-columns: 1fr;
  }
}
