:root {
  color-scheme: light;
  --paper: #fffaf1;
  --paper-deep: #f8efdf;
  --forest: #24462d;
  --ink: #51341f;
  --muted: #8c6c52;
  --orange: #f47c08;
  --orange-light: #ffad2e;
  --gold: #ebb45e;
  --wood: #9b4b16;
  --shadow: 0 28px 70px rgba(44, 13, 1, .28);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }

html, body { min-width: 320px; min-height: 100%; margin: 0; }
body { color: var(--ink); background: #7b3308; }

.student-shell {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  background:
    linear-gradient(rgba(64, 20, 2, .05), rgba(64, 20, 2, .13)),
    url('/assets/course/desk-background.jpg') center / cover no-repeat fixed,
    #7b3308;
  isolation: isolate;
}

.student-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 85% 8%, rgba(255, 210, 120, .17), transparent 28%), linear-gradient(90deg, rgba(31, 9, 1, .15), transparent 36%);
  pointer-events: none;
}

.student-topbar {
  position: fixed;
  z-index: 20;
  top: clamp(22px, 3.2vh, 42px);
  right: clamp(34px, 5.2vw, 88px);
  left: clamp(34px, 5.2vw, 88px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff8e8;
  text-shadow: 0 3px 12px rgba(47, 13, 1, .28);
}

.student-brand { display: inline-flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.student-brand b { font-size: clamp(23px, 2vw, 33px); letter-spacing: .05em; }
.student-brand-mark { position: relative; display: grid; place-items: center; width: 48px; height: 43px; border: 2px solid currentColor; border-radius: 6px 6px 13px 13px; }
.student-brand-mark::before, .student-brand-mark::after { content: ""; position: absolute; top: 7px; bottom: 6px; width: 44%; border-top: 2px solid currentColor; }
.student-brand-mark::before { left: 4px; border-left: 2px solid currentColor; transform: skewY(12deg); }
.student-brand-mark::after { right: 4px; border-right: 2px solid currentColor; transform: skewY(-12deg); }
.student-brand-mark i { position: relative; z-index: 1; width: 9px; height: 9px; border-radius: 50%; background: #ffd277; box-shadow: 0 0 13px #ffd277; }

.student-account { display: flex; align-items: center; gap: 12px; }
.student-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #98520f; background: #fff3d2; font-weight: 900; text-shadow: none; }
.student-name { color: inherit; font-size: 16px; font-weight: 700; text-shadow: inherit; }
.account-menu { position: relative; display: inline-flex; align-items: center; }
.account-caret { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid rgba(255, 248, 232, .35); border-radius: 50%; color: #fff8e8; background: rgba(52, 22, 4, .28); transition: background .18s ease, border-color .18s ease; }
.account-caret i { width: 0; height: 0; border-right: 5px solid transparent; border-bottom: 7px solid currentColor; border-left: 5px solid transparent; transform: translateY(-1px); transition: transform .18s ease; }
.account-caret:hover, .account-caret[aria-expanded="true"] { border-color: rgba(255, 216, 137, .6); background: rgba(52, 22, 4, .42); }
.account-caret[aria-expanded="true"] i { transform: rotate(180deg) translateY(1px); }
.account-dropdown { position: absolute; z-index: 30; top: calc(100% + 10px); right: 0; min-width: 168px; padding: 8px; display: grid; gap: 2px; border: 1px solid rgba(157, 91, 34, .18); border-radius: 16px; background: #fffaf1; box-shadow: 0 18px 34px rgba(44, 13, 1, .24); }
.account-menu-item { display: block; width: 100%; min-height: 40px; padding: 10px 14px; border: 0; border-radius: 11px; color: #5d3a1c; background: none; font-size: 14px; font-weight: 700; text-align: left; transition: background .15s ease, color .15s ease; }
.account-menu-item:hover, .account-menu-item:focus-visible { color: #9c5310; background: #f8ecd6; outline: none; }

.student-view { min-height: 100svh; padding: clamp(90px, 12vh, 132px) clamp(26px, 5vw, 86px) clamp(26px, 4vh, 48px); }
.student-paper {
  position: relative;
  width: min(1500px, 100%);
  min-height: calc(100svh - clamp(128px, 16vh, 172px));
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 227, 179, .92);
  border-radius: clamp(28px, 3vw, 50px);
  background: radial-gradient(circle at 42% 15%, rgba(255,255,255,.96), transparent 35%), linear-gradient(115deg, #fffdf8, #f8efdf);
  box-shadow: inset 0 0 0 9px rgba(255, 255, 255, .28), var(--shadow);
  animation: paper-arrive .55s cubic-bezier(.2,.76,.2,1) both;
}
.student-paper::after { content: ""; position: absolute; inset: 14px; border: 1px solid rgba(177, 104, 37, .14); border-radius: inherit; pointer-events: none; }

.login-paper {
  display: grid;
  grid-template-columns: minmax(420px, .95fr) minmax(500px, 1.05fr);
  align-items: center;
  gap: clamp(36px, 5vw, 86px);
  padding: clamp(52px, 7vh, 88px) clamp(58px, 7vw, 116px);
  border-color: rgba(214, 165, 116, .55);
  background:
    url('/assets/student/login-paper-background.jpg') center / cover no-repeat,
    linear-gradient(115deg, #fffdf8, #f8efdf);
}

.login-illustration { min-height: 520px; pointer-events: none; }

.student-login-form { position: relative; z-index: 2; align-self: center; }
.student-login-form header { margin-bottom: 20px; }
.student-login-form h1, .shelf-heading h1 { margin: 0; color: var(--forest); font: 800 clamp(43px, 4vw, 66px)/1.15 "Songti SC", "STSong", serif; letter-spacing: -.045em; }
.student-login-form header p, .shelf-heading p { margin: 14px 0 0; color: #85512c; font: 600 clamp(18px, 1.55vw, 25px) "Songti SC", serif; }
.form-divider { display: flex; align-items: center; gap: 13px; margin: 26px 0 30px; color: #e6af52; }
.form-divider::before, .form-divider::after { content: ""; flex: 1; height: 1px; background: rgba(126, 76, 31, .18); }
.student-login-form label, .password-card label { display: grid; gap: 10px; margin-top: 22px; color: #744722; font-size: 15px; font-weight: 800; }
.input-wrap { position: relative; display: block; }
.input-wrap input, .password-card input { width: 100%; min-height: 66px; padding: 0 22px 0 62px; border: 1px solid rgba(129, 79, 34, .18); border-radius: 17px; outline: 0; color: #3d332a; background: rgba(255, 253, 248, .78); box-shadow: inset 0 2px 4px rgba(109, 68, 31, .03), 0 9px 22px rgba(98, 50, 13, .05); font-size: 17px; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.input-wrap input[type="password"], .input-wrap input[type="text"]#student-login-password { padding-right: 66px; }
.input-wrap input:focus, .password-card input:focus { border-color: #e6a23e; box-shadow: 0 0 0 4px rgba(233, 164, 62, .13), 0 12px 24px rgba(98, 50, 13, .08); transform: translateY(-1px); }
.input-wrap > i { position: absolute; z-index: 1; top: 50%; left: 22px; width: 20px; height: 20px; transform: translateY(-50%); color: #b59a7e; }
.user-icon::before { content: ""; position: absolute; top: 0; left: 5px; width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50%; }
.user-icon::after { content: ""; position: absolute; bottom: 0; left: 1px; width: 16px; height: 8px; border: 2px solid currentColor; border-radius: 10px 10px 3px 3px; }
.lock-icon { border: 2px solid currentColor; border-radius: 4px; transform: translateY(-26%) !important; }
.lock-icon::before { content: ""; position: absolute; top: -10px; left: 3px; width: 10px; height: 11px; border: 2px solid currentColor; border-bottom: 0; border-radius: 8px 8px 0 0; }
.password-visibility { position: absolute; z-index: 2; top: 50%; right: 10px; display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 12px; color: #ad9278; background: transparent; transform: translateY(-50%); }
.password-visibility:hover, .password-visibility:focus-visible { color: #8a5b30; background: rgba(178, 121, 62, .08); outline: none; }
.password-visibility span { position: relative; width: 22px; height: 14px; border: 2px solid currentColor; border-radius: 50% / 62%; }
.password-visibility span::before { content: ""; position: absolute; top: 50%; left: 50%; width: 5px; height: 5px; border-radius: 50%; background: currentColor; transform: translate(-50%, -50%); }
.password-visibility[aria-pressed="false"] span::after { content: ""; position: absolute; top: 5px; left: -3px; width: 26px; height: 2px; border-radius: 2px; background: currentColor; box-shadow: 0 0 0 2px rgba(255, 253, 248, .75); transform: rotate(-38deg); }

.student-primary { display: flex; align-items: center; justify-content: center; gap: 25px; width: 100%; min-height: 76px; margin-top: 30px; border: 4px solid #fff0c9; border-radius: 24px; outline: 2px solid #ee991f; outline-offset: 1px; color: #fff; background: linear-gradient(180deg, var(--orange-light), var(--orange)); box-shadow: inset 0 2px 0 rgba(255,255,255,.34), 0 13px 25px rgba(180, 75, 0, .25); font-size: clamp(22px, 2vw, 31px); font-weight: 900; letter-spacing: .05em; text-shadow: 0 2px 2px rgba(120, 45, 0, .16); transition: transform .18s ease, filter .18s ease, box-shadow .18s ease; }
.student-primary:hover:not(:disabled), .student-primary:focus-visible { transform: translateY(-3px); filter: saturate(1.08); box-shadow: inset 0 2px 0 rgba(255,255,255,.34), 0 18px 30px rgba(180, 75, 0, .3); }
.student-primary:disabled { cursor: default; outline-color: #c6ad8b; color: rgba(255,255,255,.75); background: linear-gradient(#cdbb9e, #ad977a); box-shadow: none; }
.student-primary i { color: #ffd27b; font-style: normal; font-size: .75em; }
.student-primary.compact { min-height: 58px; border-width: 3px; border-radius: 17px; font-size: 18px; }
.login-quote { margin: 28px 0 0; color: #9b7658; text-align: center; font: 500 16px "Songti SC", serif; }
.form-error { margin: 14px 0 -8px; padding: 11px 14px; border-radius: 12px; color: #a5412e; background: #f9e8df; font-size: 14px; }

.shelf-paper { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; padding: clamp(42px, 5.5vh, 68px) clamp(52px, 5.5vw, 90px) clamp(42px, 5.5vh, 64px); }
.shelf-heading { position: relative; z-index: 2; margin: 0 0 clamp(24px, 3.5vh, 38px) 20px; }
.shelf-heading h1 { font-size: clamp(50px, 5vw, 76px); }
.bookcase { position: relative; z-index: 2; align-self: end; width: 100%; min-width: 0; min-height: 0; padding: 18px 42px 42px; border-radius: 28px 28px 4px 4px; background: linear-gradient(90deg, rgba(69, 29, 8, .17), transparent 8% 92%, rgba(69, 29, 8, .17)), repeating-linear-gradient(101deg, rgba(255,255,255,.025) 0 2px, transparent 2px 23px), linear-gradient(180deg, #b96f3b, #965125); box-shadow: inset 0 0 0 8px rgba(106, 48, 15, .09), inset 0 20px 35px rgba(70, 29, 7, .15), 0 14px 34px rgba(72, 32, 7, .16); }
.bookcase::after { content: ""; position: absolute; z-index: 3; right: -18px; bottom: -3px; left: -18px; height: 42px; border-radius: 9px; background: linear-gradient(180deg, #a75c2b, #713514); box-shadow: inset 0 4px rgba(255,255,255,.12), inset 0 -3px rgba(48,18,4,.15), 0 17px 23px rgba(63, 27, 8, .24); }
.shelf-track { position: relative; z-index: 1; display: flex; align-items: flex-end; gap: 34px; width: 100%; max-width: 100%; min-width: 0; height: 100%; min-height: 430px; padding: 0 18px 22px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; }
.shelf-track::-webkit-scrollbar { display: none; }
.assigned-course, .no-course { flex: 0 0 auto; scroll-snap-align: start; }
.assigned-course { display: grid; grid-template-columns: 292px 204px; align-items: end; width: 484px; min-height: 424px; overflow: visible; border: 0; border-radius: 24px; background: transparent; transition: transform .22s ease; }
.assigned-course:hover { transform: translateY(-5px); }
.course-cover-wrap { position: relative; z-index: 2; display: grid; place-items: end center; width: 292px; height: 424px; min-width: 0; margin: 0; background: transparent; }
.course-cover-wrap img { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; min-width: 0; min-height: 0; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 18px 14px rgba(48, 20, 5, .28)); }
.assigned-course-copy { position: relative; z-index: 1; align-self: center; display: flex; flex-direction: column; justify-content: center; width: 216px; min-width: 0; min-height: 350px; margin-left: -12px; padding: 22px 14px 18px 24px; border: 1px solid rgba(157, 91, 34, .16); border-radius: 3px 14px 14px 3px; background: linear-gradient(180deg, #fffdf6, #fdf4e2); box-shadow: 0 12px 22px rgba(54, 24, 6, .18); }
.assigned-course-copy::before { content: ""; position: absolute; top: 10px; bottom: 10px; left: 6px; width: 2px; border-radius: 2px; background: linear-gradient(180deg, transparent, #e2b976 24% 76%, transparent); }
.assigned-course-copy h2 { min-height: 2.7em; margin: 0; color: var(--forest); font: 800 clamp(17px, 1.35vw, 21px)/1.35 "Songti SC", serif; }
.course-author { margin: 7px 0 11px; color: #80502d; font: 600 13px "Songti SC", serif; }
.course-rule { display: block; height: 1px; background: rgba(128, 79, 38, .22); }
.course-station { display: flex; align-items: center; gap: 8px; margin: 12px 0 5px; color: #33513a; font: 700 15px "Songti SC", serif; }
.course-station i { flex: 0 0 auto; width: 16px; height: 19px; border: 3px solid #eab048; border-radius: 50% 50% 50% 3px; transform: rotate(-45deg); }
.course-station i::after { content: ""; display: block; width: 4px; height: 4px; margin: 3px; border-radius: 50%; background: #eab048; }
.course-progress { margin: 0 0 10px 28px; color: #785038; font-size: 13px; }
.course-progress strong { color: #e36c09; }
.learning-state { display: inline-flex; min-height: 27px; align-items: center; align-self: flex-start; padding: 0 11px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.learning-state.active { color: #426b3a; background: #e5eed8; }
.learning-state.unavailable { color: #816b53; background: #eee5d8; }
.course-enter { min-height: 46px; margin-top: 12px; gap: 10px; border-width: 3px; border-radius: 12px; font-size: 16px; }
.course-enter b { font-size: 22px; font-weight: 400; line-height: .6; }

.empty-book { position: relative; width: 88px; height: 72px; border: 5px solid #cdb08a; border-top: 0; border-radius: 0 0 18px 18px; }
.empty-book::before { content: ""; position: absolute; left: 50%; top: -18px; bottom: 2px; width: 4px; background: #cdb08a; transform: translateX(-50%); }
.empty-book::after { content: ""; position: absolute; top: -17px; left: 4px; width: 35px; height: 49px; border: 5px solid #cdb08a; border-right: 0; border-bottom: 0; border-radius: 18px 0 0; transform: skewY(8deg); }
.no-course { display: grid; place-items: center; align-content: center; width: 100%; color: #84674f; text-align: center; }
.no-course h2 { margin: 22px 0 6px; color: var(--forest); font: 700 29px "Songti SC", serif; }
.no-course p { margin: 0; }
.shelf-loading { display: grid; place-items: center; align-content: center; gap: 14px; width: 100%; color: #fff2d8; }
.shelf-loading i { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.28); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.shelf-arrow { position: absolute; z-index: 5; top: 50%; display: grid; place-items: center; width: 58px; height: 58px; padding: 0 0 6px; border: 2px solid #e9a943; border-radius: 50%; color: #c87718; background: #fffaf0; box-shadow: 0 9px 18px rgba(69, 29, 5, .22); font: 300 49px/1 serif; transform: translateY(-50%); transition: transform .18s ease, background .18s ease; }
.shelf-arrow:hover { color: #fff; background: #e98a20; transform: translateY(-50%) scale(1.06); }
.shelf-arrow.previous { left: -29px; }
.shelf-arrow.next { right: -29px; }

.password-dialog { width: min(470px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 28px; color: var(--ink); background: transparent; box-shadow: var(--shadow); }
.password-dialog::backdrop { background: rgba(36, 16, 5, .64); backdrop-filter: blur(7px); }
.password-card { position: relative; padding: 36px; border: 1px solid #ead2ae; border-radius: 28px; background: #fffaf1; }
.password-card h2 { margin: 4px 0 22px; color: var(--forest); font: 700 34px "Songti SC", serif; }
.password-card input { min-height: 56px; padding: 0 16px; }
.password-card small { color: var(--muted); font-size: 12px; font-weight: 500; }
.dialog-eyebrow { margin: 0; color: #bb762f; font-size: 11px; font-weight: 900; letter-spacing: .15em; }
.dialog-close { position: absolute; top: 18px; right: 18px; width: 38px; height: 38px; border: 0; border-radius: 50%; color: #84664d; background: #f1e9dd; font-size: 25px; }
.student-toast { position: fixed; z-index: 80; bottom: 28px; left: 50%; max-width: min(520px, calc(100vw - 36px)); padding: 13px 18px; border-radius: 14px; color: #fffaf0; background: rgba(28, 64, 51, .96); box-shadow: 0 14px 30px rgba(37, 15, 3, .25); transform: translateX(-50%); }

@keyframes paper-arrive { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .login-paper { grid-template-columns: .8fr 1.2fr; padding-right: 55px; padding-left: 55px; }
  .login-illustration { min-height: 440px; }
  .shelf-paper { padding-right: 52px; padding-left: 52px; }
  .assigned-course { grid-template-columns: 272px 204px; width: 464px; }
  .course-cover-wrap { width: 272px; }
}

@media (max-width: 820px), (orientation: portrait) {
  .student-shell { overflow: auto; }
  .student-topbar { position: absolute; top: 22px; right: 22px; left: 22px; }
  .student-brand-mark { width: 40px; height: 37px; }
  .student-brand b { font-size: 23px; }
  .student-account { gap: 8px; }
  .student-name { font-size: 14px; }
  .account-caret { width: 26px; height: 26px; }
  .account-dropdown { min-width: 150px; }
  .student-view { padding: 84px 14px 18px; }
  .student-paper { min-height: calc(100svh - 102px); border-radius: 28px; }
  .login-paper {
    display: block;
    padding: 34px 26px 30px;
    background:
      linear-gradient(rgba(255, 250, 238, .82), rgba(255, 250, 238, .92)),
      url('/assets/student/login-paper-background.jpg') left top / cover no-repeat,
      linear-gradient(115deg, #fffdf8, #f8efdf);
  }
  .login-illustration { min-height: 200px; }
  .student-login-form h1 { font-size: clamp(35px, 9vw, 47px); }
  .input-wrap input { min-height: 58px; }
  .student-primary { min-height: 64px; }
  .shelf-paper { padding: 38px 22px 26px; }
  .shelf-heading { margin: 8px 8px 24px; }
  .shelf-heading h1 { font-size: 46px; }
  .bookcase { padding: 14px 20px 38px; }
  .shelf-track { min-height: 480px; padding-right: 12px; padding-left: 12px; }
  .assigned-course { grid-template-columns: 260px 204px; width: min(452px, calc(100vw - 98px)); min-height: 430px; }
  .course-cover-wrap { width: 260px; }
  .assigned-course-copy { width: 216px; margin-left: -12px; padding: 18px 14px 18px 24px; }
  .shelf-arrow { width: 48px; height: 48px; font-size: 40px; }
  .shelf-arrow.previous { left: -18px; }
  .shelf-arrow.next { right: -18px; }
}

@media (max-width: 580px) {
  .login-illustration { min-height: 160px; }
  .student-login-form header p { font-size: 16px; }
  .login-quote { font-size: 13px; }
  .assigned-course { grid-template-columns: 1fr; width: calc(100vw - 94px); min-height: 650px; }
  .course-cover-wrap { width: 100%; height: 360px; }
  .assigned-course-copy { align-self: end; width: auto; min-height: 0; margin: -22px 18px 0; padding-left: 18px; border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
