:root {
  --paper3-navy: #0b2339;
  --paper3-navy-mid: #143a53;
  --paper3-navy-soft: #1b4a65;
  --paper3-ivory: #f6f0e3;
  --paper3-ivory-soft: #fbf8f0;
  --paper3-cyan: #43b7c8;
  --paper3-cyan-dark: #176c7d;
  --paper3-cyan-pale: #dcf2f3;
  --paper3-gold: #d3a34e;
  --paper3-gold-dark: #8a6320;
  --paper3-ink: #14293b;
  --paper3-muted: #60707c;
  --paper3-line: rgba(20, 58, 83, 0.16);
  --paper3-success: #176b4e;
  --paper3-danger: #9a3737;
  --paper3-shadow: 0 22px 62px rgba(12, 35, 57, 0.13);
  --paper3-shadow-small: 0 10px 28px rgba(12, 35, 57, 0.1);
  --paper3-radius-xl: 28px;
  --paper3-radius-lg: 20px;
  --paper3-radius-md: 14px;
  --shared-header-height: 76px;
  --local-toolbar-height: 92px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--paper3-ivory);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--paper3-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background:
    linear-gradient(rgba(67, 183, 200, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(67, 183, 200, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 8% 4%, rgba(67, 183, 200, 0.13), transparent 25rem),
    radial-gradient(circle at 92% 30%, rgba(211, 163, 78, 0.12), transparent 28rem),
    var(--paper3-ivory);
  background-size: 38px 38px, 38px 38px, auto, auto, auto;
}

button,
input,
select {
  font: inherit;
}

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

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 11px 15px;
  border-radius: 10px;
  color: #fff;
  background: var(--paper3-navy);
  transform: translateY(-160%);
  transition: transform 0.16s ease;
}

.skip-link:focus {
  transform: none;
}

.paper3-site-header {
  width: 100%;
  margin-left: 0;
  color: var(--paper3-ink);
}

.paper3-header-inner {
  width: min(1480px, calc(100% - 32px));
}

.paper3-header-actions {
  font-size: 0.82rem;
}

.connection-pill,
.user-pill,
.header-button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--paper3-line);
  border-radius: 999px;
  color: var(--paper3-navy-mid);
  background: rgba(255, 255, 255, 0.8);
  font-weight: 750;
  white-space: nowrap;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.connection-pill::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--paper3-gold);
  box-shadow: 0 0 0 4px rgba(211, 163, 78, 0.14);
  content: "";
}

.connection-pill[data-state="online"] {
  color: var(--paper3-success);
  border-color: rgba(23, 107, 78, 0.22);
  background: #eef8f2;
}

.connection-pill[data-state="online"]::before {
  background: #2a9a70;
  box-shadow: 0 0 0 4px rgba(42, 154, 112, 0.13);
}

.connection-pill[data-state="error"] {
  color: var(--paper3-danger);
  border-color: rgba(154, 55, 55, 0.2);
  background: #fff1ef;
}

.connection-pill[data-state="error"]::before {
  background: var(--paper3-danger);
  box-shadow: 0 0 0 4px rgba(154, 55, 55, 0.12);
}

.header-button {
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.header-button:hover,
.header-button:focus-visible {
  color: #fff;
  border-color: var(--paper3-navy-mid);
  background: var(--paper3-navy-mid);
}

.paper3-app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 80px;
}

.paper3-view {
  animation: paper3-view-in 0.24s ease both;
}

@keyframes paper3-view-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

.paper-panel {
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: var(--paper3-radius-xl);
  background: rgba(251, 248, 240, 0.96);
  box-shadow: var(--paper3-shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--paper3-cyan-dark);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.25;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow-light {
  color: #8de2e9;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.7fr);
  gap: 22px;
  min-height: min(720px, calc(100vh - 142px));
}

.login-hero,
.login-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(34px, 5vw, 74px);
}

.login-hero {
  display: flex;
  align-items: flex-end;
  color: #fffaf0;
  border-color: rgba(114, 212, 223, 0.22);
  background:
    linear-gradient(136deg, rgba(8, 30, 49, 0.98), rgba(20, 58, 83, 0.96) 68%, rgba(27, 74, 101, 0.94));
}

.login-hero::before {
  position: absolute;
  top: 0;
  right: clamp(24px, 5vw, 72px);
  width: 1px;
  height: 100%;
  background: linear-gradient(transparent, rgba(67, 183, 200, 0.7), transparent);
  content: "";
}

.login-hero::after {
  position: absolute;
  right: clamp(46px, 7vw, 110px);
  bottom: clamp(52px, 8vw, 116px);
  width: clamp(160px, 23vw, 340px);
  aspect-ratio: 1;
  border: 1px solid rgba(121, 219, 229, 0.2);
  border-radius: 50%;
  box-shadow:
    0 0 0 28px rgba(67, 183, 200, 0.035),
    0 0 0 72px rgba(211, 163, 78, 0.025);
  content: "";
}

.hero-grid {
  position: absolute;
  inset: 28px 28px auto auto;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 6px;
  color: rgba(255, 255, 255, 0.32);
  font-size: 0.61rem;
  font-weight: 850;
  letter-spacing: 0.14em;
}

.hero-grid span {
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 780px;
}

.student-label {
  margin: 0 0 14px;
  color: #ecc66f;
  font-size: 1rem;
  font-weight: 800;
}

.hero-copy h1 {
  margin: 0;
  max-width: 800px;
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: clamp(3rem, 6.4vw, 7.2rem);
  font-weight: 700;
  line-height: 0.94;
  letter-spacing: -0.055em;
}

.hero-copy h1 span {
  color: var(--paper3-gold);
}

.hero-copy > p:last-child {
  max-width: 670px;
  margin: 28px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: clamp(0.98rem, 1.4vw, 1.18rem);
  line-height: 1.8;
}

.hero-edition {
  position: absolute;
  z-index: 2;
  top: clamp(70px, 10vw, 128px);
  right: clamp(35px, 6vw, 90px);
  margin: 0;
  color: rgba(255, 255, 255, 0.22);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.3rem, 2.4vw, 2.5rem);
  letter-spacing: 0.08em;
  writing-mode: vertical-rl;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.section-number {
  color: var(--paper3-gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3.5rem;
  line-height: 0.9;
  opacity: 0.58;
}

.login-heading h2,
.library-hero h1,
.screen-heading h2,
.resource-heading h2,
.empty-state h2 {
  margin: 0;
  color: var(--paper3-navy);
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-weight: 750;
  letter-spacing: -0.035em;
}

.login-heading h2 {
  font-size: clamp(2rem, 3.4vw, 3.6rem);
  line-height: 1.03;
}

.login-heading p:last-child {
  margin: 15px 0 0;
  color: var(--paper3-muted);
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 34px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span:first-child {
  color: var(--paper3-navy-mid);
  font-size: 0.84rem;
  font-weight: 800;
}

.field input {
  width: 100%;
  min-height: 52px;
  padding: 13px 15px;
  border: 1px solid rgba(20, 58, 83, 0.2);
  border-radius: 12px;
  color: var(--paper3-ink);
  outline: none;
  background: rgba(255, 255, 255, 0.86);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.field input:focus {
  border-color: var(--paper3-cyan-dark);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(67, 183, 200, 0.14);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 76px;
}

.password-field button {
  position: absolute;
  top: 50%;
  right: 7px;
  min-height: 38px;
  padding: 6px 11px;
  border: 0;
  border-radius: 9px;
  color: var(--paper3-cyan-dark);
  background: var(--paper3-cyan-pale);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transform: translateY(-50%);
}

.form-status {
  min-height: 1.4em;
  margin: -2px 0;
  color: var(--paper3-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.form-status[data-state="error"] {
  color: var(--paper3-danger);
}

.primary-button,
.secondary-button,
.back-button,
.toolbar-button {
  min-height: 44px;
  border-radius: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.primary-button {
  padding: 13px 18px;
  border: 1px solid var(--paper3-navy);
  color: #fff;
  background: var(--paper3-navy);
  box-shadow: 0 9px 20px rgba(11, 35, 57, 0.17);
}

.primary-button:hover,
.primary-button:focus-visible {
  border-color: var(--paper3-cyan-dark);
  background: var(--paper3-cyan-dark);
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: 0.58;
  cursor: wait;
  transform: none;
}

.account-note {
  margin: 22px 0 0;
  color: var(--paper3-muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.library-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 34px;
  padding: clamp(30px, 4vw, 58px);
  color: #fff;
  border-color: rgba(67, 183, 200, 0.18);
  background:
    linear-gradient(112deg, rgba(8, 31, 50, 0.99), rgba(20, 58, 83, 0.97) 68%, rgba(31, 84, 101, 0.94));
}

.library-hero::after {
  position: absolute;
  right: -90px;
  bottom: -150px;
  width: 390px;
  aspect-ratio: 1;
  border: 1px solid rgba(93, 209, 221, 0.22);
  border-radius: 50%;
  box-shadow: 0 0 0 42px rgba(67, 183, 200, 0.035), 0 0 0 92px rgba(211, 163, 78, 0.025);
  content: "";
}

.library-hero > * {
  position: relative;
  z-index: 1;
}

.library-hero .eyebrow {
  color: #8de2e9;
}

.library-hero h1 {
  color: #fffaf0;
  font-size: clamp(2.5rem, 5vw, 5.4rem);
  line-height: 0.98;
}

.library-hero > div > p:last-child {
  margin: 19px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1rem;
  line-height: 1.65;
}

.library-facts {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(105px, 1fr));
  gap: 8px;
  margin: 0;
}

.library-facts div {
  min-height: 92px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.065);
}

.library-facts dt {
  color: rgba(255, 255, 255, 0.57);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.library-facts dd {
  margin: 10px 0 0;
  color: #f4d285;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.18rem;
  font-weight: 750;
}

.local-toolbar {
  position: sticky;
  z-index: 60;
  top: calc(var(--shared-header-height) + 8px);
  margin: 16px 0 24px;
  overflow: hidden;
  border-color: rgba(20, 58, 83, 0.12);
  border-radius: 18px;
  background: rgba(251, 248, 240, 0.94);
  box-shadow: 0 13px 32px rgba(12, 35, 57, 0.12);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
}

.toolbar-main {
  min-height: 64px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 11px;
}

.back-button,
.toolbar-button,
.secondary-button {
  padding: 9px 13px;
  border: 1px solid var(--paper3-line);
  color: var(--paper3-navy-mid);
  background: rgba(255, 255, 255, 0.72);
}

.back-button {
  flex: 0 0 auto;
}

.back-button:hover,
.back-button:focus-visible,
.toolbar-button:hover,
.toolbar-button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible {
  color: var(--paper3-cyan-dark);
  border-color: rgba(23, 108, 125, 0.45);
  background: #fff;
}

.breadcrumbs {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.breadcrumbs::-webkit-scrollbar {
  display: none;
}

.crumb-button,
.crumb-current {
  flex: 0 0 auto;
  border: 0;
  color: var(--paper3-navy-mid);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.crumb-button {
  min-height: 38px;
  padding: 6px 7px;
  border-radius: 8px;
  cursor: pointer;
}

.crumb-button:hover,
.crumb-button:focus-visible {
  color: var(--paper3-cyan-dark);
  background: var(--paper3-cyan-pale);
}

.crumb-current {
  color: var(--paper3-muted);
}

.crumb-separator {
  flex: 0 0 auto;
  color: rgba(20, 58, 83, 0.35);
  font-size: 0.78rem;
}

.toolbar-actions {
  flex: 0 0 auto;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.toolbar-button[aria-pressed="true"] {
  color: #fff;
  border-color: var(--paper3-navy-mid);
  background: var(--paper3-navy-mid);
}

.fast-navigation {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--paper3-line);
  background: rgba(220, 242, 243, 0.36);
}

.fast-navigation__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.fast-navigation__label {
  flex: 0 0 auto;
  color: var(--paper3-cyan-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fast-navigation__select {
  min-width: 0;
  min-height: 40px;
  flex: 1 1 360px;
  padding: 8px 34px 8px 11px;
  border: 1px solid rgba(20, 58, 83, 0.2);
  border-radius: 10px;
  color: var(--paper3-navy-mid);
  outline: none;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 750;
}

.fast-navigation__select:focus {
  border-color: var(--paper3-cyan-dark);
  box-shadow: 0 0 0 3px rgba(67, 183, 200, 0.13);
}

.fast-navigation__list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 1px 1px 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(20, 58, 83, 0.28) transparent;
}

.fast-jump-button {
  min-height: 36px;
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(20, 58, 83, 0.13);
  border-radius: 999px;
  color: var(--paper3-navy-mid);
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.fast-jump-button:hover,
.fast-jump-button:focus-visible {
  color: #fff;
  border-color: var(--paper3-cyan-dark);
  background: var(--paper3-cyan-dark);
}

.library-screen {
  min-height: 420px;
}

.screen-section {
  animation: paper3-view-in 0.2s ease both;
}

.screen-heading,
.resource-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 26px;
  margin: 0 0 20px;
  padding: 0 5px;
}

.screen-heading h2,
.resource-heading h2 {
  font-size: clamp(2rem, 4vw, 4.5rem);
  line-height: 1;
}

.screen-heading p:last-child,
.resource-heading p:last-child {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--paper3-muted);
  line-height: 1.68;
}

.screen-counter,
.resource-count {
  flex: 0 0 auto;
  min-width: 116px;
  padding: 16px 18px;
  border: 1px solid rgba(23, 108, 125, 0.18);
  border-radius: 14px;
  color: var(--paper3-cyan-dark);
  background: rgba(220, 242, 243, 0.62);
  text-align: center;
}

.screen-counter strong,
.resource-count strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
  line-height: 1;
}

.screen-counter span,
.resource-count span {
  display: block;
  margin-top: 6px;
  font-size: 0.7rem;
  font-weight: 800;
}

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

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

.selection-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 190px;
  padding: 22px;
  border: 1px solid rgba(20, 58, 83, 0.15);
  border-radius: var(--paper3-radius-lg);
  color: var(--paper3-ink);
  background: rgba(251, 248, 240, 0.95);
  box-shadow: var(--paper3-shadow-small);
  text-align: left;
  cursor: pointer;
  transition: transform 0.17s ease, border-color 0.17s ease, box-shadow 0.17s ease, background-color 0.17s ease;
}

.selection-card::before {
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  width: 74px;
  height: 74px;
  border-bottom: 1px solid rgba(67, 183, 200, 0.18);
  border-left: 1px solid rgba(67, 183, 200, 0.18);
  border-radius: 0 0 0 74px;
  background: rgba(67, 183, 200, 0.055);
  content: "";
}

.selection-card:hover,
.selection-card:focus-visible {
  border-color: rgba(23, 108, 125, 0.48);
  background: #fffdf8;
  box-shadow: 0 18px 42px rgba(12, 35, 57, 0.15);
  transform: translateY(-3px);
}

.selection-card.is-available {
  border-color: rgba(23, 108, 125, 0.3);
  background: linear-gradient(145deg, #fffdf8, #edf8f5);
}

.card-kicker {
  display: block;
  margin-bottom: 24px;
  color: var(--paper3-cyan-dark);
  font-size: 0.67rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.selection-card strong {
  display: block;
  color: var(--paper3-navy);
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: clamp(2.1rem, 3.4vw, 3.7rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.material-grid .selection-card strong {
  font-size: clamp(1.65rem, 3vw, 3.1rem);
}

.selection-card small {
  display: block;
  margin-top: 12px;
  color: var(--paper3-muted);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.5;
}

.card-status {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--paper3-muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.card-status::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9aa4ab;
  content: "";
}

.is-available .card-status {
  color: var(--paper3-success);
}

.is-available .card-status::before {
  background: #2a9a70;
}

.card-arrow {
  position: absolute;
  right: 18px;
  top: 18px;
  color: var(--paper3-cyan-dark);
  font-size: 1.2rem;
  font-weight: 800;
}

.empty-state {
  min-height: 420px;
  padding: clamp(34px, 7vw, 90px);
  display: grid;
  place-items: center;
  border: 1px solid rgba(20, 58, 83, 0.14);
  border-radius: var(--paper3-radius-xl);
  background: rgba(251, 248, 240, 0.95);
  box-shadow: var(--paper3-shadow-small);
  text-align: center;
}

.empty-state-inner {
  max-width: 600px;
}

.empty-mark {
  width: 68px;
  height: 68px;
  margin: 0 auto 20px;
  border: 1px solid rgba(23, 108, 125, 0.25);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--paper3-cyan-dark);
  background: var(--paper3-cyan-pale);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
}

.empty-state h2 {
  font-size: clamp(2rem, 4vw, 3.8rem);
}

.empty-state p {
  margin: 16px auto 24px;
  color: var(--paper3-muted);
  line-height: 1.72;
}

.resource-list {
  display: grid;
  gap: 13px;
}

.essay-card,
.analysis-accordion {
  overflow: clip;
  border: 1px solid rgba(20, 58, 83, 0.15);
  border-radius: var(--paper3-radius-lg);
  background: rgba(251, 248, 240, 0.97);
  box-shadow: var(--paper3-shadow-small);
}

.essay-card > summary,
.analysis-accordion > summary {
  position: relative;
  list-style: none;
  cursor: pointer;
}

.essay-card > summary::-webkit-details-marker,
.analysis-accordion > summary::-webkit-details-marker {
  display: none;
}

.essay-card > summary {
  min-height: 120px;
  padding: 22px 70px 22px 22px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.essay-card > summary::after,
.analysis-accordion > summary::after {
  position: absolute;
  top: 50%;
  right: 22px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(23, 108, 125, 0.22);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--paper3-cyan-dark);
  background: rgba(220, 242, 243, 0.64);
  content: "+";
  font-size: 1.2rem;
  line-height: 1;
  transform: translateY(-50%);
}

.essay-card[open] > summary::after,
.analysis-accordion[open] > summary::after {
  content: "−";
}

.essay-index,
.analysis-index {
  display: grid;
  place-items: center;
  color: var(--paper3-gold-dark);
  border: 1px solid rgba(211, 163, 78, 0.3);
  border-radius: 12px;
  background: rgba(246, 225, 181, 0.45);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 750;
}

.essay-index {
  width: 54px;
  height: 54px;
}

.essay-summary-copy,
.analysis-summary-copy {
  min-width: 0;
}

.essay-summary-copy small,
.analysis-summary-copy small {
  display: block;
  margin-bottom: 5px;
  color: var(--paper3-cyan-dark);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.essay-summary-copy strong,
.analysis-summary-copy strong {
  display: block;
  color: var(--paper3-navy);
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: clamp(1.18rem, 2vw, 1.65rem);
  line-height: 1.22;
}

.essay-page,
.analysis-page-count {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--paper3-muted);
  background: rgba(20, 58, 83, 0.055);
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.essay-body,
.analysis-body {
  border-top: 1px solid var(--paper3-line);
}

.essay-body {
  padding: clamp(24px, 4vw, 48px);
  background: #fffef9;
}

.essay-document {
  max-width: 880px;
  margin: 0 auto;
}

.essay-document p {
  margin: 0 0 1.05em;
  color: #263b4a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 1.35vw, 1.12rem);
  line-height: 1.82;
}

.essay-document p:first-child {
  margin-bottom: 1.35em;
  color: var(--paper3-navy);
  font-size: clamp(1.16rem, 2vw, 1.45rem);
  font-weight: 750;
}

.essay-document__task {
  margin-bottom: 0.55rem !important;
  color: var(--paper3-cyan-dark) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif !important;
  font-size: 0.75rem !important;
  font-weight: 850 !important;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.essay-document h3 {
  margin: 0 0 1.3rem;
  color: var(--paper3-navy);
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: clamp(1.55rem, 2.8vw, 2.35rem);
  line-height: 1.18;
}

.essay-document h4 {
  margin: 1.75rem 0 0.65rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(23, 108, 125, 0.2);
  color: var(--paper3-cyan-dark);
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: 1.12rem;
}

.analysis-list {
  display: grid;
  gap: 12px;
}

.essay-card,
.analysis-accordion {
  scroll-margin-top: calc(var(--shared-header-height) + var(--local-toolbar-height) + 26px);
}

.analysis-accordion > summary {
  min-height: 112px;
  padding: 20px 70px 20px 20px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 17px;
}

.analysis-accordion[open] {
  border-color: rgba(23, 108, 125, 0.28);
}

.analysis-accordion[open] > summary {
  background: linear-gradient(90deg, rgba(220, 242, 243, 0.68), rgba(251, 248, 240, 0.95));
}

.analysis-index {
  width: 48px;
  height: 48px;
}

.analysis-summary-copy p {
  margin: 7px 0 0;
  color: var(--paper3-muted);
  font-size: 0.82rem;
  line-height: 1.52;
}

.analysis-body {
  padding: clamp(20px, 3vw, 36px);
  background: #fffef9;
}

.analysis-pages {
  display: grid;
  gap: 18px;
}

.analysis-page {
  padding: clamp(19px, 3vw, 30px);
  border: 1px solid rgba(20, 58, 83, 0.12);
  border-radius: 16px;
  background: var(--paper3-ivory-soft);
}

.analysis-page header {
  margin-bottom: 18px;
  padding-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--paper3-line);
}

.analysis-page header span {
  color: var(--paper3-cyan-dark);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.analysis-page header strong {
  color: var(--paper3-gold-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
}

.page-blocks {
  display: grid;
  gap: 10px;
}

.page-block {
  margin: 0;
  color: #2c3f4c;
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: clamp(0.96rem, 1.15vw, 1.06rem);
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.page-block.is-marker {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 8px;
  color: var(--paper3-cyan-dark);
  background: var(--paper3-cyan-pale);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  font-size: 0.78rem;
  font-weight: 850;
}

.page-block.is-bullet {
  padding-left: 18px;
  color: #294656;
}

.page-block.is-heading {
  margin-top: 7px;
  color: var(--paper3-navy);
  font-size: 1.09em;
  font-weight: 750;
}

.page-block.is-quote {
  padding-left: 15px;
  border-left: 3px solid rgba(211, 163, 78, 0.65);
  color: #344d5b;
}

.toast {
  position: fixed;
  z-index: 900;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  max-width: min(390px, calc(100vw - 32px));
  padding: 13px 17px;
  border: 1px solid rgba(117, 222, 231, 0.22);
  border-radius: 13px;
  color: #fff;
  background: rgba(11, 35, 57, 0.96);
  box-shadow: 0 18px 44px rgba(9, 28, 45, 0.28);
  font-size: 0.86rem;
  font-weight: 750;
}

.noscript-message {
  width: min(720px, calc(100% - 32px));
  margin: 24px auto;
  padding: 18px;
  border-radius: 12px;
  color: #fff;
  background: var(--paper3-danger);
  text-align: center;
}

:focus-visible {
  outline: 3px solid rgba(67, 183, 200, 0.55);
  outline-offset: 3px;
}

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

  .login-hero {
    min-height: 520px;
  }

  .login-panel {
    min-height: 520px;
  }

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

  .library-hero {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 820px) {
  .paper3-app-shell,
  .paper3-header-inner {
    width: min(100% - 20px, 1480px);
  }

  .paper3-app-shell {
    padding-top: 20px;
  }

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

  .toolbar-main {
    flex-wrap: wrap;
  }

  .breadcrumbs {
    flex: 1 1 calc(100% - 100px);
  }

  .toolbar-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .library-facts {
    width: 100%;
  }

  .screen-heading,
  .resource-heading {
    align-items: start;
  }
}

@media (max-width: 620px) {
  :root {
    --paper3-radius-xl: 22px;
  }

  .paper3-app-shell {
    padding-bottom: 54px;
  }

  .login-hero,
  .login-panel {
    min-height: 0;
    padding: 32px 24px;
  }

  .login-hero {
    min-height: 470px;
  }

  .hero-copy h1 {
    font-size: clamp(2.4rem, 10vw, 4rem);
  }

  .hero-grid,
  .hero-edition {
    display: none;
  }

  .login-heading {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .section-number {
    font-size: 2.6rem;
  }

  .paper3-header-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .connection-pill,
  .user-pill,
  .header-button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 12px;
    font-size: 0.74rem;
  }

  .library-hero {
    padding: 30px 23px;
  }

  .library-facts {
    grid-template-columns: 1fr 1fr;
  }

  .library-facts div:last-child {
    grid-column: 1 / -1;
  }

  .local-toolbar {
    margin-top: 12px;
    border-radius: 15px;
  }

  .screen-heading,
  .resource-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .screen-counter,
  .resource-count {
    width: fit-content;
    min-width: 105px;
  }

  .selection-grid,
  .selection-grid.level-grid,
  .selection-grid.material-grid {
    grid-template-columns: 1fr;
  }

  .selection-card {
    min-height: 166px;
  }

  .fast-navigation__controls {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .fast-navigation__select {
    width: 100%;
    flex: 0 0 auto;
  }

  .essay-card > summary,
  .analysis-accordion > summary {
    padding: 18px 58px 18px 16px;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 13px;
  }

  .essay-card > summary::after,
  .analysis-accordion > summary::after {
    right: 14px;
    width: 30px;
    height: 30px;
  }

  .essay-page,
  .analysis-page-count {
    grid-column: 2;
    justify-self: start;
  }

  .analysis-summary-copy p {
    display: none;
  }

  .analysis-index,
  .essay-index {
    width: 44px;
    height: 44px;
  }

  .analysis-page {
    padding: 18px 16px;
  }
}

@media (max-width: 390px) {
  .toolbar-main {
    padding: 8px;
  }

  .back-button,
  .toolbar-button {
    padding-inline: 10px;
    font-size: 0.76rem;
  }

  .library-facts {
    grid-template-columns: 1fr;
  }

  .library-facts div:last-child {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  body {
    background: #fff;
  }

  .paper3-site-header,
  .library-hero,
  .local-toolbar,
  .toast {
    display: none !important;
  }

  .paper3-app-shell {
    width: 100%;
    padding: 0;
  }

  .essay-card,
  .analysis-accordion,
  .analysis-page {
    box-shadow: none;
    break-inside: avoid;
  }

  .essay-card > :not(summary),
  .analysis-accordion > :not(summary) {
    display: block !important;
  }
}
