:root {
  --bg: #fffaf0;
  --card: #ffffff;
  --yellow: #ffd86b;
  --yellow-strong: #ffc93f;
  --yellow-light: #fff8dc;
  --yellow-dark: #a87300;
  --text: #2f2a1f;
  --muted: #7b725f;
  --line: #f1dfaa;
  --blue-light: #eef8ff;
  --blue: #4c91c7;
  --shadow: 0 18px 45px rgba(130, 96, 20, 0.09);
  --soft-shadow: 0 14px 34px rgba(130, 96, 20, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

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

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus,
a:focus,
input:focus {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(255, 201, 63, 0.8);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.login-app {
  width: min(1280px, 92%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 10px 0 12px;
}

.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 900;
}

.logo-icon {
  width: 42px;
  height: 42px;
  display: block;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(255, 185, 36, 0.25);
}

.top-status {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.login-layout {
  min-height: calc(100vh - 78px);
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(400px, 1fr);
  border: 1px solid rgba(241, 223, 170, 0.95);
  border-radius: 38px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  animation: screenIn 0.35s ease;
}

.welcome-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 3.5vw, 44px);
  overflow: hidden;
  background: var(--yellow-light);
}

.welcome-panel::before,
.welcome-panel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

.welcome-panel::before {
  width: 270px;
  height: 270px;
  top: -100px;
  right: -90px;
}

.welcome-panel::after {
  width: 180px;
  height: 180px;
  bottom: -80px;
  left: -55px;
}

.tag {
  position: relative;
  z-index: 1;
  width: fit-content;
  margin-bottom: 22px;
  padding: 8px 14px;
  border: 1px solid rgba(168, 115, 0, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: #82651d;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.welcome-panel h1 {
  position: relative;
  z-index: 1;
  margin-bottom: 0;
  font-size: clamp(40px, 4.3vw, 64px);
  line-height: 1.12;
  letter-spacing: -1.5px;
}

.hero-balance-scene {
  position: relative;
  z-index: 1;
  width: min(116%, 590px);
  height: clamp(200px, 20vw, 250px);
  align-self: center;
  margin-top: 18px;
  overflow: visible;
}

.balance-2d {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.balance-ground-shadow {
  fill: rgba(126, 91, 15, 0.13);
}

.balance-trajectory {
  fill: none;
  stroke: #eda20d;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 10 13;
  opacity: 0;
}

.balance-block {
  filter: url(#blockShadow);
  transform-box: fill-box;
  transform-origin: center;
}

.login-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(20px, 2.6vw, 34px);
  background: var(--card);
}

.login-heading {
  width: min(100%, 520px);
  margin-right: auto;
  margin-bottom: 18px;
  margin-left: auto;
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--yellow-dark);
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 0.14em;
}

.login-heading h2 {
  margin-bottom: 8px;
  font-size: clamp(30px, 3vw, 42px);
  letter-spacing: -0.8px;
}

.login-heading p,
.login-note {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.login-error {
  width: fit-content;
  margin-top: 14px;
  padding: 10px 13px;
  border: 1px solid #efb6a9;
  border-radius: 13px;
  background: #fff1ed;
  color: #a83e28;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.role-switch {
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 auto 16px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 248, 220, 0.72);
}

.role-tab {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 1000;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.role-tab:hover {
  color: var(--text);
}

.role-tab span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 15px;
}

.teacher-tab.active {
  border-color: rgba(255, 201, 63, 0.72);
  background: #ffffff;
  color: #6d4b00;
  box-shadow: 0 8px 18px rgba(130, 96, 20, 0.1);
}

.teacher-tab.active span {
  background: var(--yellow);
}

.student-tab.active {
  border-color: #cce3f1;
  background: #ffffff;
  color: #266891;
  box-shadow: 0 8px 18px rgba(76, 145, 199, 0.1);
}

.student-tab.active span {
  background: #dff1ff;
}

.login-options {
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: 1fr;
  margin: 0 auto;
}

.login-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--soft-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: panelIn 0.22s ease;
}

.login-card::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  top: -58px;
  right: -48px;
  border-radius: 50%;
  background: rgba(255, 216, 107, 0.2);
  pointer-events: none;
}

.student-card { background: var(--blue-light); }

.student-card::after {
  background: rgba(76, 145, 199, 0.12);
}

.login-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 42px rgba(130, 96, 20, 0.12);
}

.role-heading {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 22px;
}

.role-icon {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: var(--yellow);
  color: #4a3500;
  font-size: 21px;
  font-weight: 1000;
  box-shadow: 0 9px 20px rgba(255, 199, 67, 0.25);
}

.student-card .role-icon {
  background: #dff1ff;
  color: #266891;
  box-shadow: 0 9px 20px rgba(76, 145, 199, 0.18);
}

.role-label {
  color: var(--yellow-dark);
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.14em;
}

.student-card .role-label {
  color: var(--blue);
}

.role-heading h3 {
  margin-top: 2px;
  font-size: 23px;
}

.login-form {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 15px;
}

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

.login-form label > span {
  color: #5f5748;
  font-size: 13px;
  font-weight: 900;
}

.login-form input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #ead9a9;
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.64);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.student-card .login-form input {
  border-color: #d2e4ef;
  background: rgba(255, 255, 255, 0.78);
}

.login-form input::placeholder {
  color: #aaa18f;
}

.login-form input:focus {
  border-color: var(--yellow-strong);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(255, 201, 63, 0.14);
}

.student-card .login-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(76, 145, 199, 0.12);
}

.login-btn {
  min-height: 48px;
  margin-top: 3px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 999px;
  background: var(--yellow);
  color: #3a2c05;
  font-weight: 1000;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(255, 199, 67, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.student-card .login-btn {
  background: #dff1ff;
  color: #205b80;
  box-shadow: 0 12px 26px rgba(76, 145, 199, 0.18);
}

.login-btn:hover {
  transform: translateY(-2px);
}

.login-btn span {
  font-size: 18px;
}

.login-note {
  width: min(100%, 520px);
  margin-top: 20px;
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .login-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .welcome-panel {
    padding: 38px;
  }

  .welcome-panel h1 br {
    display: none;
  }
}

@media (min-width: 761px) and (max-height: 800px) {
  .login-app {
    padding-top: 10px;
    padding-bottom: 12px;
  }

  .topbar {
    height: 48px;
    margin-bottom: 8px;
  }

  .login-layout {
    min-height: calc(100vh - 78px);
    border-radius: 30px;
  }

  .welcome-panel {
    padding: clamp(24px, 3vw, 40px);
  }

  .tag {
    margin-bottom: 12px;
    padding: 6px 11px;
  }

  .welcome-panel h1 {
    font-size: clamp(34px, 3.8vw, 52px);
  }

  .hero-balance-scene {
    height: clamp(180px, 20vw, 230px);
    margin-top: 4px;
  }

  .login-section {
    padding: clamp(18px, 2.5vw, 34px);
  }

  .login-heading {
    margin-bottom: 12px;
  }

  .login-heading h2 {
    margin-bottom: 4px;
    font-size: clamp(27px, 2.5vw, 35px);
  }

  .role-switch {
    margin-bottom: 10px;
    padding: 4px;
  }

  .role-tab {
    min-height: 44px;
  }

  .login-card {
    padding: 17px 19px;
    border-radius: 22px;
  }

  .role-heading {
    margin-bottom: 13px;
  }

  .role-icon {
    width: 43px;
    height: 43px;
    border-radius: 14px;
  }

  .role-heading h3 {
    font-size: 20px;
  }

  .login-form {
    gap: 10px;
  }

  .login-form label {
    gap: 4px;
  }

  .login-form input {
    height: 42px;
  }

  .login-btn {
    min-height: 43px;
  }

  .login-note {
    margin-top: 11px;
  }
}

@media (max-width: 720px) {
  .login-app {
    width: calc(100% - 20px);
    padding-top: 8px;
    padding-bottom: 12px;
  }

  .topbar {
    height: 48px;
    margin-bottom: 8px;
  }

  .top-status {
    display: none;
  }

  .login-layout {
    min-height: auto;
    border-radius: 26px;
  }

  .welcome-panel,
  .login-section {
    padding: 20px 18px;
  }

  .welcome-panel h1 {
    font-size: 35px;
  }

  .hero-balance-scene {
    width: min(102%, 460px);
    height: 195px;
    margin-top: 4px;
  }

  .login-card {
    padding: 21px;
    border-radius: 24px;
  }
}

@media (max-width: 380px) {
  .logo {
    font-size: 19px;
  }

  .logo-icon {
    width: 35px;
    height: 35px;
  }

  .welcome-panel h1 {
    font-size: 30px;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
