:root {
  --ink: #18140f;
  --muted: #6f685e;
  --paper: #f7f2e9;
  --panel: #fffaf0;
  --line: #ded2c0;
  --forest: #285c47;
  --blue: #2f75b8;
  --copper: #b7632d;
  --shadow: 0 18px 45px rgba(55, 42, 29, .12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(40, 92, 71, .08) 0 1px, transparent 1px 100%),
    linear-gradient(0deg, rgba(40, 92, 71, .06) 0 1px, transparent 1px 100%),
    var(--paper);
  background-size: 42px 42px;
  font-family: "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.lesson-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 28px 22px;
  background: #123a30;
  color: #fff8ec;
  border-right: 1px solid rgba(255, 255, 255, .16);
}

.brand-block {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--copper);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.lesson-rail .eyebrow {
  color: #f1b37c;
}

h1,
h2 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  font-size: 32px;
}

h2 {
  font-size: 42px;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.lesson-button {
  min-height: 54px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 8px;
  color: #fff8ec;
  background: rgba(255, 255, 255, .08);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.lesson-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, .14);
}

.lesson-button.is-active {
  background: #f6d39d;
  color: #16392f;
  border-color: #f6d39d;
  font-weight: 900;
}

.workspace {
  min-width: 0;
  max-width: 100%;
  padding: 30px clamp(18px, 4vw, 48px) 56px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.mobile-select {
  display: none;
}

.resource-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.resource-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, .78);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.resource-pill.active {
  color: #16392f;
  border-color: rgba(40, 92, 71, .35);
  background: #eef6ed;
}

.resource-pill:hover {
  border-color: rgba(183, 99, 45, .55);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.vocab-viewer {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.thumbs {
  position: sticky;
  top: 26px;
  display: grid;
  gap: 12px;
}

.thumb-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 6px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(55, 42, 29, .07);
  transition: transform .18s ease, border-color .18s ease;
}

.thumb-button:hover {
  transform: translateY(-1px);
  border-color: rgba(183, 99, 45, .55);
}

.thumb-button img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-radius: 5px;
}

.thumb-button span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pages {
  display: grid;
  min-width: 0;
  gap: 24px;
}

.page-card {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.page-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 800;
}

.page-card img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  background: #fff;
}

.open-image {
  color: var(--forest);
  text-decoration: none;
  font-size: 14px;
}

.open-image:hover {
  color: var(--copper);
}

.resource-panel {
  display: grid;
  gap: 18px;
}

.asset-card,
.upload-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.asset-card header,
.upload-card {
  padding: 18px;
}

.asset-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.asset-card h3,
.upload-card h3 {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.25;
}

.asset-card p,
.upload-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.primary-button,
.ghost-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button {
  border: 1px solid var(--forest);
  background: var(--forest);
  color: #fffaf0;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fffaf0;
  color: var(--forest);
}

.primary-button:hover,
.ghost-button:hover {
  border-color: var(--copper);
}

.audio-player {
  width: calc(100% - 36px);
  margin: 18px;
}

.pdf-frame {
  width: 100%;
  height: min(76vh, 760px);
  border: 0;
  display: block;
  background: #fff;
}

.pdf-placeholder {
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: #123a30;
  background:
    linear-gradient(135deg, rgba(40, 92, 71, .08), rgba(183, 99, 45, .08)),
    #fffaf0;
}

.pdf-placeholder strong {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fffaf0;
  background: var(--forest);
  font-size: 28px;
  letter-spacing: 0;
}

.pdf-placeholder span {
  color: var(--muted);
  font-weight: 800;
}

.file-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fffaf0;
  background: #123a30;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.manager-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 12;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid #f6d39d;
  border-radius: 999px;
  color: #123a30;
  background: #f6d39d;
  box-shadow: 0 18px 40px rgba(18, 58, 48, .22);
  font-weight: 900;
  cursor: pointer;
}

.manager-fab:hover {
  transform: translateY(-1px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 20, 16, .46);
}

.manager-modal {
  width: min(1080px, 100%);
  max-height: min(840px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 28px 70px rgba(18, 20, 16, .34);
}

.manager-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.manager-header h2 {
  font-size: 30px;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--forest);
  background: #fffaf0;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.manager-login {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.manager-login label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.manager-login input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.manager-login p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.manager-content {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.manager-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 800;
}

.manager-table-wrap {
  min-height: 0;
  overflow: auto;
}

.manager-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.manager-table th,
.manager-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.manager-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--forest);
  background: #fff4df;
  font-size: 13px;
}

.manager-course {
  font-weight: 900;
  color: var(--forest);
  white-space: nowrap;
}

.asset-cell {
  display: grid;
  gap: 8px;
}

.asset-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.mini-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mini-button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--forest);
  background: #fffaf0;
  font-weight: 800;
  cursor: pointer;
}

.mini-button.danger {
  color: #8f2e1f;
}

.mini-button:hover {
  border-color: var(--copper);
}

@media (max-width: 880px) {
  .app-shell {
    display: block;
  }

  .lesson-rail {
    display: none;
  }

  .workspace {
    padding: 18px 12px 34px;
    overflow: hidden;
  }

  .topbar,
  .resource-strip,
  .vocab-viewer,
  .thumbs,
  .pages,
  .page-card {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 3;
    align-items: center;
    padding: 12px 0;
    background: linear-gradient(180deg, var(--paper) 72%, rgba(247, 242, 233, 0));
  }

  h2 {
    font-size: 30px;
  }

  .mobile-select {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .mobile-select select {
    min-width: 106px;
    min-height: 40px;
    padding: 0 34px 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: var(--panel);
  }

  .resource-strip {
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .resource-pill {
    flex: 0 0 auto;
    min-height: 34px;
    font-size: 13px;
  }

  .vocab-viewer {
    display: block;
  }

  .thumbs {
    position: sticky;
    top: 74px;
    z-index: 2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 0 12px;
    margin-bottom: 8px;
    background: linear-gradient(180deg, var(--paper) 84%, rgba(247, 242, 233, 0));
  }

  .thumb-button {
    padding: 4px;
  }

  .thumb-button span {
    font-size: 11px;
  }

  .pages {
    gap: 16px;
  }

  .page-card header {
    padding: 10px 12px;
    font-size: 13px;
    gap: 10px;
  }

  .open-image {
    flex: 0 0 auto;
  }

  .asset-card header {
    align-items: flex-start;
    flex-direction: column;
  }

  .asset-card h3,
  .upload-card h3 {
    font-size: 18px;
  }

  .pdf-frame {
    height: 58vh;
  }

  .pdf-placeholder {
    min-height: 220px;
  }

  .manager-fab {
    right: 12px;
    bottom: 12px;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .manager-modal {
    max-height: calc(100vh - 20px);
  }

  .manager-header {
    padding: 16px;
  }

  .manager-header h2 {
    font-size: 24px;
  }

  .manager-login,
  .manager-toolbar {
    padding-left: 16px;
    padding-right: 16px;
  }
}
