:root {
  --ink: #243044;
  --muted: #617087;
  --paper: #fffaf0;
  --panel: #ffffff;
  --line: #dfe7ef;
  --blue: #42a5f5;
  --green: #56c271;
  --yellow: #ffd45a;
  --red: #ff7a7a;
  --orange: #ffad4f;
  --teal: #38c6bd;
  --shadow: 0 18px 50px rgba(36, 48, 68, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(90deg, rgba(66, 165, 245, 0.1) 1px, transparent 1px),
    linear-gradient(rgba(86, 194, 113, 0.11) 1px, transparent 1px),
    linear-gradient(135deg, #fff6d8 0%, #e4fbff 48%, #fff0f0 100%);
  background-size: 34px 34px, 34px 34px, auto;
}

button,
a {
  font: inherit;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0;
}

.tagline-track {
  width: 100%;
  margin-bottom: 18px;
  overflow: hidden;
  border: 2px solid rgba(36, 48, 68, 0.08);
  border-radius: 8px;
  background: linear-gradient(90deg, #ffffff, #fff3bf, #e2fbff);
  box-shadow: 0 10px 26px rgba(36, 48, 68, 0.1);
}

.tagline-train {
  display: flex;
  width: max-content;
  animation: taglineTrain 16s linear infinite;
}

.tagline-train span {
  flex: 0 0 auto;
  padding: 10px 34px;
  color: #137c74;
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

@keyframes taglineTrain {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  gap: 28px;
  align-items: center;
  min-height: 320px;
}

.hero-copy {
  padding: 10px 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: #137c74;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(2.35rem, 6vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.lede {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.65;
}

.hero-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 22px;
  border: 3px solid rgba(36, 48, 68, 0.08);
  border-radius: 8px;
  background:
    radial-gradient(circle at 24px 24px, rgba(255, 212, 90, 0.52) 0 7px, transparent 8px),
    linear-gradient(145deg, #ffffff, #eafffb);
  box-shadow: var(--shadow);
}

.hero-visual img {
  width: min(260px, 82%);
  height: auto;
  display: block;
  filter: drop-shadow(0 18px 20px rgba(36, 48, 68, 0.2));
}

.year-section {
  margin-top: 24px;
  padding: 26px;
  border: 1px solid rgba(36, 48, 68, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
}

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

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.4rem);
  letter-spacing: 0;
}

.member-button {
  flex: 0 0 auto;
  padding: 11px 16px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: #137c74;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(19, 124, 116, 0.22);
}

.member-button:hover,
.member-button:focus-visible {
  outline: 3px solid rgba(19, 124, 116, 0.22);
  outline-offset: 3px;
}

.member-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.year-card {
  position: relative;
  min-height: 170px;
  padding: 18px 14px;
  border: 0;
  border-radius: 8px;
  color: #172235;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 10px 22px rgba(36, 48, 68, 0.12);
  transition: transform 160ms ease, box-shadow 160ms ease, outline-color 160ms ease;
}

.lock-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(36, 48, 68, 0.86);
  font-size: 0.72rem;
  font-weight: 900;
}

.year-card:hover,
.year-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 16px 30px rgba(36, 48, 68, 0.18);
  outline: 3px solid rgba(36, 48, 68, 0.18);
  outline-offset: 3px;
}

.year-card.is-selected {
  outline: 4px solid #243044;
  outline-offset: 3px;
}

.year-label,
.card-note {
  display: block;
  font-weight: 800;
}

.year-label {
  font-size: 0.86rem;
  text-transform: uppercase;
}

.year-card strong {
  display: block;
  margin: 8px 0 12px;
  font-size: 4rem;
  line-height: 0.9;
}

.card-note {
  width: fit-content;
  max-width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.86rem;
}

.card-red {
  background: linear-gradient(160deg, #ff9f9f, #ffd3d3);
}

.card-yellow {
  background: linear-gradient(160deg, #ffd75f, #fff0a6);
}

.card-green {
  background: linear-gradient(160deg, #63d984, #c9f4d5);
}

.card-blue {
  background: linear-gradient(160deg, #62b8ff, #d7efff);
}

.card-orange {
  background: linear-gradient(160deg, #ffb35b, #ffe1b4);
}

.card-teal {
  background: linear-gradient(160deg, #45d2c9, #c6f7f2);
}

.selection-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding: 18px;
  border: 2px dashed rgba(36, 48, 68, 0.18);
  border-radius: 8px;
  background: #ffffff;
}

.selection-kicker {
  color: #137c74;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.selection-panel h3 {
  margin: 4px 0 4px;
  font-size: 1.45rem;
}

.selection-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.next-link {
  flex: 0 0 auto;
  min-width: 132px;
  padding: 12px 16px;
  border-radius: 8px;
  color: #ffffff;
  background: #243044;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.login-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(36, 48, 68, 0.5);
}

.login-modal.is-open {
  display: grid;
}

.login-box {
  position: relative;
  width: min(440px, 100%);
  padding: 26px;
  border: 4px solid #ffd45a;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(36, 48, 68, 0.3);
}

.login-box h2 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.15;
}

.login-note {
  margin: 12px 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.close-login {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  color: #243044;
  background: #fff3bf;
  font-weight: 900;
  cursor: pointer;
}

.login-form {
  display: grid;
  gap: 9px;
}

.login-form label {
  color: #243044;
  font-size: 0.88rem;
  font-weight: 900;
}

.login-form input {
  width: 100%;
  padding: 12px 13px;
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
}

.login-form input:focus {
  border-color: #38c6bd;
  outline: 3px solid rgba(56, 198, 189, 0.2);
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.password-field button {
  height: 100%;
  min-width: 86px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #243044;
  background: #fff3bf;
  font-weight: 900;
  cursor: pointer;
}

.auth-message {
  min-height: 22px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.4;
}

.auth-message[data-type="error"] {
  color: #c93838;
}

.auth-message[data-type="success"] {
  color: #137c74;
}

.auth-message[data-type="info"] {
  color: #2f6fb3;
}

.login-form button {
  margin-top: 8px;
  padding: 13px 16px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: #243044;
  font-weight: 900;
  cursor: pointer;
}

.login-form button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.login-form .secondary-login {
  margin-top: 0;
  color: #243044;
  background: #fff3bf;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.home-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #243044;
  background: #ffffff;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(36, 48, 68, 0.1);
}

.subject-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.subject-hero h1 {
  font-size: clamp(2rem, 5vw, 4rem);
}

.year-bubble {
  display: grid;
  place-items: center;
  width: 132px;
  aspect-ratio: 1;
  border-radius: 8px;
  color: #ffffff;
  background: #137c74;
  font-size: 4.4rem;
  font-weight: 900;
  box-shadow: 0 16px 32px rgba(19, 124, 116, 0.24);
}

.subject-section,
.gate-panel {
  margin-top: 24px;
  padding: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

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

.subject-card {
  min-height: 170px;
  padding: 18px;
  border-radius: 8px;
  color: #172235;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(36, 48, 68, 0.12);
  transition: transform 160ms ease, box-shadow 160ms ease, outline-color 160ms ease;
}

.subject-card:hover,
.subject-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 16px 30px rgba(36, 48, 68, 0.18);
  outline: 3px solid rgba(36, 48, 68, 0.18);
  outline-offset: 3px;
}

.subject-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 1.7rem;
  font-weight: 900;
}

.subject-card strong,
.subject-card span {
  display: block;
}

.subject-card strong {
  font-size: 1.2rem;
  line-height: 1.18;
}

.subject-card span:last-child {
  margin-top: 8px;
  font-size: 0.88rem;
  font-weight: 800;
}

.subject-malay {
  background: linear-gradient(160deg, #ff9f9f, #ffd3d3);
}

.subject-english {
  background: linear-gradient(160deg, #62b8ff, #d7efff);
}

.subject-science {
  background: linear-gradient(160deg, #63d984, #c9f4d5);
}

.subject-math {
  background: linear-gradient(160deg, #ffd75f, #fff0a6);
}

.subject-islam {
  background: linear-gradient(160deg, #45d2c9, #c6f7f2);
}

.gate-panel {
  border: 3px dashed rgba(36, 48, 68, 0.18);
}

.gate-panel h2 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.gate-panel p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 420px) {
  .password-field {
    grid-template-columns: 1fr;
  }

  .password-field button {
    min-height: 42px;
  }
}

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

  .hero-visual {
    min-height: 220px;
  }

  .year-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .subject-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: min(100% - 22px, 1120px);
    padding: 18px 0;
  }

  .tagline-track {
    margin-bottom: 14px;
  }

  .tagline-train {
    animation-duration: 12s;
  }

  .tagline-train span {
    padding: 9px 24px;
    font-size: 0.88rem;
  }

  .hero {
    gap: 18px;
    min-height: unset;
    position: relative;
    overflow: hidden;
    padding: 24px;
    border: 3px solid rgba(36, 48, 68, 0.08);
    border-radius: 8px;
    background:
      linear-gradient(90deg, rgba(255, 250, 240, 0.92), rgba(255, 250, 240, 0.48)),
      url("../images/murid-seronok-belajar.png");
    background-position: center;
    background-size: cover;
    box-shadow: var(--shadow);
  }

  h1 {
    font-size: 2.6rem;
  }

  .lede {
    font-size: 1rem;
  }

  .hero-visual {
    display: none;
  }

  .year-section {
    padding: 18px;
  }

  .section-heading {
    display: block;
  }

  .member-button {
    width: 100%;
    margin-top: 14px;
  }

  .year-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .year-card {
    min-height: 145px;
  }

  .year-card strong {
    font-size: 3.2rem;
  }

  .selection-panel {
    display: block;
  }

  .next-link {
    display: block;
    width: 100%;
    margin-top: 14px;
  }

  .top-nav,
  .subject-hero {
    display: block;
  }

  .home-link {
    width: 100%;
    justify-content: center;
    margin-top: 12px;
  }

  .subject-hero {
    padding: 22px;
  }

  .year-bubble {
    width: 96px;
    margin-top: 18px;
    font-size: 3.2rem;
  }

  .subject-section,
  .gate-panel {
    padding: 18px;
  }

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

  .subject-card {
    min-height: 148px;
  }
}

@media (max-width: 380px) {
  .year-grid,
  .subject-grid {
    grid-template-columns: 1fr;
  }
}
