* { box-sizing: border-box; }
html { color-scheme: light; }

body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #163b31;
  background: radial-gradient(ellipse at top, #21946f 0, #075846 48%, #034236 100%);
}

.shell {
  width: min(100%, 440px);
  margin: auto;
  padding: 24px 18px;
  display: grid;
  gap: 16px;
}

header { text-align: center; color: white; }

.logo {
  display: block;
  width: 100px;
  height: 100px;
  object-fit: contain;
  margin: 12px auto 4px;
}

h1 { margin: 0; font-size: 34px; line-height: 1.15; letter-spacing: .04em; }
h2 { text-align: center; font-size: 24px; line-height: 1.2; margin: 12px 0 6px; }

.card {
  background: #fff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 16px 40px #002b2b40;
}

footer { text-align: center; color: #c5e6d9; font-size: 12px; }
.result { margin-top: 16px; text-align: center; }
.result p { color: #50665d; }
.result a { color: #08774e; font-weight: 650; }

@media (max-width: 350px) {
  .shell { padding: 16px 12px; }
  .card { padding: 17px; }
  h1 { font-size: 30px; }
  .logo { width: 82px; height: 82px; }
}

.portal {
  background: radial-gradient(ellipse at 50% 6%, #1b805f 0, #0b594a 50%, #063e35 100%);
}

.login-shell, .result-shell {
  --section-gap: clamp(16px, 2.6svh, 24px);
  --card-padding: clamp(16px, 5vw, 28px);
  width: min(100%, 468px);
  min-height: 100vh;
  min-height: 100svh;
  padding: max(8px, env(safe-area-inset-top)) clamp(14px, 4vw, 20px) max(18px, env(safe-area-inset-bottom));
  gap: 16px;
  gap: var(--section-gap);
  align-content: start;
}

.login-shell {
  width: min(100%, 448px);
  padding-block: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-bottom));
  align-content: space-between;
}

.school {
  margin: 0;
  font-size: clamp(1.15rem, 6.25vw, 1.25rem);
  font-weight: 750;
  line-height: 1.25;
}

.school span {
  display: block;
  margin-top: 3px;
  color: #dbf3e8;
  font-size: .875rem;
  letter-spacing: .09em;
}

.brand { margin-top: 16px; }

.brand .logo {
  width: 88px;
  width: clamp(74px, 10.5svh, 96px);
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto 8px;
}

.brand h1 { font-size: clamp(2rem, 9vw, 2.5rem); }
.tag { margin: 5px 0 0; color: #dbf3e8; font-size: .875rem; }

.portal .card {
  padding: var(--card-padding);
  border: 1px solid #e2efe8;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.wifi {
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  height: 46px;
  border-radius: 14px;
  background: #e6f4ed;
  color: #08724d;
}

.card-heading h2 { margin: 0; text-align: start; font-size: 1.5rem; }

.account-help {
  margin: 14px 0 0;
  color: #435f54;
  font-size: .875rem;
  line-height: 1.45;
  text-align: center;
}

.wifi-reminder {
  margin: 0;
  color: #dbf3e8;
  font-size: .875rem;
  line-height: 1.5;
  text-align: center;
}

.wifi-reminder span { display: block; }

.notice {
  margin: 0 0 14px;
  padding: 9px 11px;
  border-radius: 9px;
  background: #fff3dc;
  color: #784b0a;
  font-size: .8125rem;
  line-height: 1.4;
}

.field + .field { margin-top: 12px; }

.field label {
  display: block;
  margin-bottom: 5px;
  font-size: .875rem;
  font-weight: 650;
  line-height: 1.3;
}

.field input {
  display: block;
  width: 100%;
  min-height: 48px;
  border: 1px solid #c9d9d1;
  border-radius: 11px;
  background: #f7faf8;
  padding: 10px 12px 10px 40px;
  font: inherit;
  font-size: 1rem;
  color: #163b31;
}

.field input:focus { outline: 2px solid #1c936a; outline-offset: 1px; }
.input-wrap { position: relative; }

.field-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: #3c7260;
  pointer-events: none;
}

.password input { padding-right: 84px; }

.toggle {
  position: absolute;
  inset: 0 1px 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 76px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #08724d;
  font-weight: 700;
  cursor: pointer;
}

.toggle::before {
  content: "";
  width: 16px;
  height: 16px;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2308724d' stroke-width='1.8'%3E%3Cpath d='M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6-10-6-10-6Z'/%3E%3Ccircle cx='12' cy='12' r='2.5'/%3E%3C/svg%3E");
}

.toggle[aria-pressed="true"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2308724d' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M3 3l18 18M10.6 6.1C17.9 5.4 22 12 22 12a15 15 0 0 1-3.1 3.3M6.2 7.8C3.5 9.5 2 12 2 12s3.5 6 10 6c1.4 0 2.7-.3 3.8-.7'/%3E%3C/svg%3E");
}

.primary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 11px;
  background: #08724d;
  color: white;
  font: 700 .875rem system-ui, sans-serif;
  letter-spacing: .035em;
  cursor: pointer;
  transition: background-color .16s ease;
}

.primary:disabled { background: #dce8e2; color: #4f665a; cursor: not-allowed; }
.primary:not(:disabled):hover { background: #065f40; }

form[aria-busy="true"] .primary::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid #ffffff70;
  border-top-color: white;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(1turn); } }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.portal footer { display: grid; gap: 3px; font-size: .8125rem; }
.portal footer a { color: #e4f8ef; text-underline-offset: .2em; }

.portal :is(a, button):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.portal .primary:focus-visible { outline-color: #08724d; }

.result-shell { width: min(100%, 500px); }
.result-shell .result { margin: 0; }
.result h2 { margin-top: 14px; }
.result p { margin: 8px 0 0; }

.result-icon {
  display: grid;
  width: 56px;
  height: 56px;
  margin: 0 auto;
  place-items: center;
  border-radius: 16px;
  background: #e6f4ed;
  color: #08724d;
}

.result-fail .result-icon { background: #fff3dc; color: #784b0a; }
.result .primary { max-width: 240px; color: #fff; text-decoration: none; }

@media (max-height: 860px) {
  .login-shell, .result-shell {
    --section-gap: 12px;
    --card-padding: clamp(16px, 4vw, 21px);
    padding-bottom: 14px;
  }

  .brand { margin-top: 10px; }
  .brand .logo { width: 72px; margin-bottom: 6px; }
  .portal .card { padding-block: 14px; }
  .card-heading, .notice { margin-bottom: 12px; }
  .notice { padding-inline: 9px; }
  .field + .field { margin-top: 10px; }
  .primary { margin-top: 14px; }
}

@media (max-height: 740px) {
  .login-shell, .result-shell {
    --section-gap: 9px;
    --card-padding: 16px;
    padding-bottom: 10px;
  }

  .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 9px;
    text-align: start;
  }

  .brand .logo { width: 60px; margin: 0; }
  .brand h1 { font-size: 1.85rem; }
  .tag { margin-top: 2px; }
  .portal .card { padding-block: 12px; }
  .card-heading { gap: 10px; margin-bottom: 10px; }
  .card-heading h2 { font-size: 1.375rem; }
  .notice { margin-bottom: 10px; padding-block: 6px; }
  .field input, .primary { min-height: 44px; }
  .field input { padding-block: 8px; }
  .primary { margin-top: 12px; }
  .portal footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 8px; font-size: .75rem; }
}

@media (max-height: 670px) {
  .login-shell { padding-top: 10px; }
  .account-help, .wifi-reminder { font-size: .8125rem; line-height: 1.3; }
  .account-help { margin-top: 8px; }
}

@media (max-height: 600px) {
  .login-shell, .result-shell { --section-gap: 8px; --card-padding: 12px; padding: 5px 12px 8px; }
  .brand .logo { width: 48px; }
  .brand { margin-top: 6px; }
  .brand h1 { font-size: 1.625rem; }
  .tag { font-size: .8125rem; line-height: 1.3; }
  .portal .card { padding-block: 10px; }
  .wifi { flex-basis: 32px; height: 32px; border-radius: 10px; }
  .card-heading, .notice { margin-bottom: 8px; }
  .notice { font-size: .75rem; }
  .field label { margin-bottom: 4px; }
  .field + .field, .primary { margin-top: 8px; }
  .portal footer { line-height: 1.2; }
}

@media (min-height: 741px) {
  .login-shell .brand .logo { width: clamp(82px, 10.4svh, 96px); }
  .login-shell .card { padding-block: clamp(22px, 3svh, 28px); }
  .login-shell .field input, .login-shell .primary { min-height: 52px; }
}

@media (max-width: 350px) {
  .login-shell header, .result-shell header { margin-inline: -7px; }
  .school { letter-spacing: -.02em; }
}

@media (prefers-reduced-motion: reduce) {
  .primary { transition: none; }
  form[aria-busy="true"] .primary::before { animation: none; }
}
