:root {
  --ink: #17201c;
  --muted: #63736c;
  --line: #dfe7e2;
  --paper: #f4f6f3;
  --soft: #e8f4ef;
  --green: #0f766e;
  --green-dark: #103c35;
  --gold: #c58b2c;
  --white: #ffffff;
  --shadow: 0 18px 42px rgba(15, 35, 31, 0.1);
}

body[data-template="sakura"] {
  --ink: #261923;
  --muted: #7d6873;
  --line: #efd5de;
  --paper: #fff8fa;
  --soft: #fdebf1;
  --green: #b44b73;
  --green-dark: #7e294e;
  --gold: #b77a42;
  --shadow: 0 18px 46px rgba(126, 41, 78, 0.14);
}

body[data-template="indigo"] {
  --ink: #101827;
  --muted: #5c6678;
  --line: #d8dfef;
  --paper: #f7f9fe;
  --soft: #eaf0fb;
  --green: #2c5aa0;
  --green-dark: #12284c;
  --gold: #c89b3c;
  --shadow: 0 18px 48px rgba(18, 40, 76, 0.16);
}

body[data-template="graphite"] {
  --ink: #202124;
  --muted: #62666d;
  --line: #dddddd;
  --paper: #fafafa;
  --soft: #eeeeee;
  --green: #4d5156;
  --green-dark: #202124;
  --gold: #d2a94f;
  --shadow: 0 18px 44px rgba(32, 33, 36, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(47, 124, 108, 0.2);
  outline-offset: 2px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--green-dark);
  color: var(--white);
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary-btn {
  border: 1px solid var(--green-dark);
  background: var(--green-dark);
  box-shadow: 0 14px 28px rgba(16, 60, 53, 0.16);
  color: #ffffff;
}

.primary-btn:hover {
  background: #0c332d;
  box-shadow: 0 18px 36px rgba(16, 60, 53, 0.2);
  transform: translateY(-1px);
}

.secondary-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: none;
  color: var(--green-dark);
}

.secondary-btn:hover {
  border-color: rgba(15, 118, 110, 0.32);
  background: var(--soft);
  color: var(--green-dark);
  transform: translateY(-1px);
}

.primary-btn:disabled,
.secondary-btn:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.wide-btn {
  width: 100%;
}

.login-page,
.auth-login-page {
  min-width: 0;
  min-height: 100vh;
  background: #edf1ef;
  color: #17231f;
}

.login-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  padding: 12px max(24px, calc((100vw - 1480px) / 2 + 24px));
  border-bottom: 1px solid rgba(15, 80, 66, 0.12);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 30px rgba(16, 60, 53, 0.08);
  backdrop-filter: blur(10px);
}

.login-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.login-topbar-brand strong,
.login-topbar-brand small {
  display: block;
}

.login-topbar-brand strong {
  font-size: 18px;
  line-height: 1.25;
}

.login-topbar-brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.login-home-link {
  display: inline-flex;
  min-width: 76px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--green-dark);
  font-weight: 800;
}

.login-home-link:hover {
  border-color: rgba(15, 118, 110, 0.32);
  background: var(--soft);
}

.auth-login-shell {
  display: grid;
  min-height: calc(100vh - 48px);
  place-items: center;
  padding: 106px 24px 32px;
}

.auth-login-card {
  --auth-panel: #173f38;
  --auth-accent: #d7a94c;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.98fr);
  width: min(100%, 980px);
  min-height: 540px;
  overflow: visible;
  border: 1px solid #d9e1dd;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 54px rgba(29, 48, 41, 0.14);
}

.auth-login-card--student {
  --auth-panel: #1f5664;
  --auth-accent: #76c6b7;
}

.auth-login-card--teacher {
  --auth-panel: #354d45;
  --auth-accent: #e5b85b;
}

.auth-login-card--parent {
  --auth-panel: #6f5329;
  --auth-accent: #f0c46a;
}

.auth-login-context {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 44px;
  border-radius: 7px 0 0 7px;
  background: var(--auth-panel);
  color: #ffffff;
}

.auth-login-role-brand {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 12px;
  color: #ffffff;
}

.auth-login-role-brand .brand-mark {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.auth-login-role-brand strong,
.auth-login-role-brand small {
  display: block;
}

.auth-login-role-brand strong {
  font-size: 18px;
}

.auth-login-role-brand small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.auth-login-context-copy {
  margin: auto 0 38px;
}

.auth-login-context .eyebrow {
  margin: 0 0 12px;
  color: var(--auth-accent);
}

.auth-login-context h1 {
  max-width: 420px;
  margin: 0;
  color: #ffffff;
  font-size: 38px;
  line-height: 1.22;
}

.auth-login-context-copy > p:last-child {
  max-width: 420px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 15px;
  line-height: 1.7;
}

.auth-login-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.auth-login-facts div {
  min-width: 0;
  padding: 0 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.auth-login-facts div:first-child {
  padding-left: 0;
}

.auth-login-facts div:last-child {
  padding-right: 0;
  border-right: 0;
}

.auth-login-facts dt {
  color: rgba(255, 255, 255, 0.56);
  font-size: 12px;
}

.auth-login-facts dd {
  margin: 7px 0 0;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.auth-login-action {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 32px 40px;
  border-radius: 0 7px 7px 0;
  background: #ffffff;
}

.auth-login-action header .eyebrow {
  margin: 0 0 10px;
  color: #8f6b25;
}

.auth-login-action h2 {
  margin: 0;
  color: #17231f;
  font-size: 30px;
  line-height: 1.2;
}

.auth-login-action header > p:last-child {
  margin: 10px 0 0;
  color: #687770;
  font-size: 14px;
}

.auth-login-method-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid #d8e1dd;
  border-radius: 8px;
  background: #f3f6f4;
}

.auth-login-method-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #61716a;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.auth-login-method-tabs button[aria-selected="true"] {
  background: #ffffff;
  color: #174e43;
  box-shadow: 0 1px 4px rgba(23, 78, 67, 0.12);
}

.auth-login-method-panel {
  min-width: 0;
}

.auth-password-login-panel {
  display: grid;
  gap: 18px;
}

.auth-wechat-login-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px 18px;
  border: 1px solid #d7e4df;
  border-radius: 8px;
  background: linear-gradient(180deg, #f6fbf8, #ffffff);
  text-align: center;
}

.auth-wechat-login-heading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.auth-wechat-login-heading > div {
  min-width: 0;
  text-align: left;
}

.auth-wechat-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  font-size: 26px;
}

.auth-wechat-login-panel strong {
  color: #17231f;
  font-size: 18px;
}

.auth-wechat-login-panel p {
  margin: 7px 0 0;
  color: #687770;
  font-size: 13px;
  line-height: 1.65;
}

.auth-wechat-qr-frame {
  display: grid;
  width: 242px;
  height: 302px;
  overflow: hidden;
  place-items: start;
  border: 1px solid #d8e3de;
  border-radius: 8px;
  background: #ffffff;
}

.auth-wechat-qr-frame iframe {
  display: block;
  width: 320px !important;
  height: 400px !important;
  border: 0;
  transform: scale(0.75);
  transform-origin: top left;
}

.auth-wechat-qr-placeholder {
  display: grid;
  width: 100%;
  min-height: 300px;
  place-items: center;
  padding: 24px;
  color: #65766f;
  font-size: 14px;
  line-height: 1.65;
}

.auth-wechat-qr-placeholder.is-expired {
  background: #fff9ec;
  color: #8b6424;
}

.auth-wechat-qr-placeholder.is-error {
  background: #fff4f1;
  color: #9a382d;
}

.auth-wechat-mobile-notice {
  display: grid;
  width: min(100%, 340px);
  gap: 6px;
  padding: 22px;
  border: 1px solid #d8e3de;
  border-radius: 8px;
  background: #ffffff;
}

.auth-wechat-mobile-notice p {
  margin: 0;
}

.auth-wechat-refresh-button,
.auth-wechat-password-fallback {
  min-width: 180px;
  min-height: 38px;
  margin: 0;
}

.auth-login-fields {
  display: grid;
  gap: 18px;
}

.auth-login-fields label,
.field-label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: #31433c;
  font-size: 14px;
  font-weight: 800;
}

.auth-login-fields input {
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 0 14px;
  border: 1px solid #cdd8d3;
  border-radius: 6px;
  background: #ffffff;
  color: #17231f;
  outline: none;
}

.auth-login-fields input:focus {
  border-color: #2f7c6c;
  box-shadow: 0 0 0 3px rgba(47, 124, 108, 0.12);
}

.auth-password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  min-width: 0;
}

.auth-password-field input {
  border-radius: 6px 0 0 6px;
}

.auth-password-field button {
  min-width: 0;
  border: 1px solid #cdd8d3;
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: #f4f7f5;
  color: #235b50;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.auth-login-submit {
  min-height: 52px;
  margin: 0;
  border-radius: 6px;
}

.auth-login-footnote {
  margin: -8px 0 0;
  color: #74827c;
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.login-guard-message {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(154, 52, 18, 0.18);
  border-radius: 8px;
  background: #fff7ed;
  color: #7c2d12;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
}

.auth-login-action .login-guard-message {
  margin: -4px 0 0;
}

.auth-miniprogram-entry {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-top: 28px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 28px rgba(7, 26, 22, 0.16);
}

.auth-miniprogram-entry img {
  display: block;
  width: 112px;
  height: 112px;
  border: 1px solid #e0e7e3;
  border-radius: 6px;
  background: #ffffff;
  object-fit: contain;
}

.auth-miniprogram-entry-copy {
  min-width: 0;
}

.auth-miniprogram-entry-copy strong {
  display: block;
  color: #ffffff;
  font-size: 16px;
  line-height: 1.45;
}

.auth-miniprogram-entry-copy p {
  margin: 7px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  line-height: 1.65;
}

.toast {
  position: fixed;
  top: 88px;
  right: 18px;
  z-index: 3000;
  max-width: min(360px, calc(100vw - 36px));
  padding: 13px 16px;
  border-radius: 8px;
  background: #0d4c40;
  color: var(--white);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 16px;
  padding: 7px clamp(16px, 3vw, 48px);
  border-top: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.site-footer > span {
  grid-column: 2;
  justify-self: center;
  text-align: center;
  white-space: nowrap;
}

.site-footer a {
  grid-column: 3;
  justify-self: end;
  color: var(--green-dark);
  font-weight: 700;
  white-space: nowrap;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (min-width: 761px) {
  .auth-login-context {
    position: sticky;
    top: 88px;
    align-self: start;
    min-height: 540px;
  }
}

@media (min-width: 761px) and (max-height: 820px) {
  .auth-login-shell {
    padding: 78px 18px 20px;
  }

  .auth-login-card {
    min-height: 0;
  }

  .auth-login-context,
  .auth-login-action {
    padding: 26px 34px;
  }

  .auth-login-context-copy {
    margin-bottom: 26px;
  }

  .auth-login-context h1 {
    font-size: 32px;
  }

  .auth-login-action {
    gap: 12px;
  }

  .auth-login-action header .eyebrow {
    display: none;
  }

  .auth-login-action h2 {
    font-size: 24px;
  }

  .auth-login-action header > p:last-child {
    margin-top: 6px;
    font-size: 13px;
  }

  .auth-wechat-login-panel {
    gap: 8px;
    padding: 10px 14px;
  }

  .auth-wechat-qr-frame {
    width: 210px;
    height: 262px;
  }

  .auth-wechat-qr-frame iframe {
    transform: scale(0.65);
  }

  .auth-wechat-qr-placeholder {
    min-height: 260px;
  }

  .auth-wechat-refresh-button,
  .auth-wechat-password-fallback {
    min-height: 34px;
  }

  .auth-login-footnote {
    margin-top: 0;
    font-size: 11px;
  }

  .auth-miniprogram-entry {
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 12px;
    margin-top: 18px;
    padding: 10px;
  }

  .auth-miniprogram-entry img {
    width: 86px;
    height: 86px;
  }

  .auth-miniprogram-entry-copy strong {
    font-size: 14px;
  }

  .auth-miniprogram-entry-copy p {
    margin-top: 4px;
    font-size: 12px;
  }
}

@media (max-width: 760px) {
  .login-topbar {
    min-height: 68px;
    padding: 10px 14px;
  }

  .login-topbar-brand {
    gap: 9px;
  }

  .login-topbar-brand .brand-mark {
    width: 38px;
    height: 38px;
  }

  .login-topbar-brand strong {
    font-size: 16px;
  }

  .login-topbar-brand small {
    max-width: 150px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .login-home-link {
    min-width: 58px;
    min-height: 38px;
    padding: 7px 10px;
    font-size: 13px;
  }

  .auth-login-shell {
    align-items: start;
    padding: 86px 12px 20px;
  }

  .auth-login-card {
    grid-template-columns: 1fr;
    min-height: 0;
    overflow: hidden;
  }

  .auth-login-context,
  .auth-login-action {
    padding: 24px;
    border-radius: 0;
  }

  .auth-login-context-copy {
    margin: 46px 0 28px;
  }

  .auth-login-context h1 {
    font-size: 30px;
  }

  .auth-login-facts {
    padding-top: 18px;
  }

  .auth-login-facts div {
    padding: 0 9px;
  }

  .auth-login-action {
    gap: 20px;
  }

  .auth-wechat-login-panel {
    gap: 14px;
    padding: 20px 16px;
  }

  .auth-wechat-login-heading {
    display: flex;
  }

  .auth-wechat-login-heading > div {
    text-align: center;
  }

  .auth-miniprogram-entry {
    margin-top: 24px;
  }

  .site-footer {
    grid-template-columns: 1fr;
    min-height: 44px;
    gap: 2px;
    padding: 8px 12px 10px;
    font-size: 11px;
  }

  .site-footer > span,
  .site-footer a {
    grid-column: 1;
    justify-self: center;
    font-size: 11px;
    text-align: center;
    white-space: normal;
  }
}

@media (max-width: 430px) {
  .auth-login-context,
  .auth-login-action {
    padding: 20px;
  }

  .auth-login-context-copy {
    margin-top: 36px;
  }

  .auth-login-context h1 {
    font-size: 27px;
  }

  .auth-login-facts {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .auth-login-facts div,
  .auth-login-facts div:first-child,
  .auth-login-facts div:last-child {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    align-items: baseline;
    padding: 0;
    border-right: 0;
  }

  .auth-login-facts dd {
    margin: 0;
  }

  .auth-miniprogram-entry {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .auth-miniprogram-entry img {
    width: 96px;
    height: 96px;
  }

  .auth-miniprogram-entry-copy strong {
    font-size: 14px;
  }

  .auth-miniprogram-entry-copy p {
    font-size: 12px;
  }
}
