:root {
  --bg: #f4efe7;
  --bg-strong: #10212c;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #f9f7f1;
  --surface-dark: rgba(16, 33, 44, 0.92);
  --text: #11212f;
  --text-soft: rgba(17, 33, 47, 0.68);
  --line: rgba(17, 33, 47, 0.12);
  --accent: #ef6c3d;
  --accent-strong: #c44717;
  --accent-soft: rgba(239, 108, 61, 0.12);
  --success: #1d8c63;
  --danger: #b43d2a;
  --shadow: 0 24px 80px rgba(16, 33, 44, 0.16);
  --font-ui: "Avenir Next", "PingFang SC", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.teacher-body {
  background:
    radial-gradient(circle at top left, rgba(239, 108, 61, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(17, 33, 47, 0.08), transparent 20%),
    linear-gradient(180deg, #f7f0e6 0%, #efe8dc 100%);
}

.teacher-shell {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.teacher-header,
.teacher-access,
.gallery-section,
.upload-shell,
.detail-modal {
  backdrop-filter: blur(12px);
}

.teacher-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.teacher-sidebar {
  position: sticky;
  top: 24px;
}

.teacher-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.teacher-heading h1,
.upload-hero h1,
.section-heading h2,
.access-copy h2,
.modal-copy h3 {
  margin: 0;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.teacher-heading h1 {
  font-size: clamp(2.8rem, 4vw, 4.8rem);
}

.eyebrow,
.section-label {
  margin: 0 0 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-soft);
}

.teacher-subtitle,
.hint-text,
.gallery-count,
.modal-time,
.file-tip {
  color: var(--text-soft);
}

.teacher-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill,
.ghost-button,
.upload-link,
.feedback-panel,
.field,
.teacher-access,
.gallery-section,
.upload-form,
.preview-card,
.qr-panel,
.detail-modal {
  border: 1px solid var(--line);
}

.status-pill,
.ghost-button {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #c6a27b;
  transition: background-color 180ms ease;
}

.status-dot.is-live {
  background: var(--success);
}

.status-dot.is-pending {
  background: #d5a43a;
}

.status-dot.is-error {
  background: var(--danger);
}

.ghost-button {
  padding: 10px 16px;
  color: var(--text);
}

.teacher-access {
  display: grid;
  gap: 22px;
  padding: 24px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
}

.upload-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 16px;
  margin: 18px 0 10px;
  word-break: break-all;
  background: rgba(255, 255, 255, 0.86);
}

.qr-panel {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 18px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.88);
}

.gallery-section {
  padding: 24px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed rgba(17, 33, 47, 0.2);
  border-radius: 24px;
  text-align: center;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.56);
}

.gallery-card {
  opacity: 0;
  transform: translateY(12px);
  animation: rise-in 240ms ease forwards;
}

.gallery-figure {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 30px rgba(16, 33, 44, 0.12);
}

.gallery-open {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.gallery-delete {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  background: rgba(180, 61, 42, 0.96);
  opacity: 0;
  transform: translateY(-4px) scale(0.92);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    background-color 160ms ease;
}

.gallery-delete:hover,
.gallery-delete:focus-visible {
  background: #962a19;
}

.gallery-card:hover .gallery-delete,
.gallery-card:focus-within .gallery-delete {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.gallery-card.is-deleting {
  opacity: 0.58;
}

.gallery-thumb {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
  background: #ddd6cc;
}

.gallery-copy {
  padding: 14px 14px 16px;
}

.gallery-copy h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.gallery-copy p {
  margin: 0;
  line-height: 1.45;
  color: var(--text-soft);
}

.gallery-note {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.detail-modal {
  width: min(960px, calc(100% - 24px));
  padding: 0;
  border-radius: 28px;
  background: rgba(248, 245, 240, 0.96);
  box-shadow: 0 32px 100px rgba(16, 33, 44, 0.24);
}

.detail-modal::backdrop {
  background: rgba(10, 17, 23, 0.68);
  backdrop-filter: blur(6px);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(16, 33, 44, 0.88);
  color: #fff;
  font-size: 1.6rem;
}

.modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 0;
}

.modal-image {
  width: 100%;
  height: 100%;
  max-height: 76vh;
  object-fit: contain;
  background: #ddd6cc;
}

.modal-copy {
  padding: 36px 28px 28px;
}

.modal-note {
  line-height: 1.65;
  white-space: pre-wrap;
}

.modal-actions {
  margin-top: 24px;
}

.modal-delete {
  padding: 10px 14px;
  border: 1px solid rgba(180, 61, 42, 0.2);
  border-radius: 999px;
  color: var(--danger);
  background: rgba(180, 61, 42, 0.06);
}

.modal-delete:disabled,
.gallery-delete:disabled,
.gallery-open:disabled {
  cursor: wait;
}

.upload-body {
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at top left, rgba(239, 108, 61, 0.18), transparent 30%),
    linear-gradient(180deg, #11212f 0%, #182c3a 48%, #f4efe7 48%, #f4efe7 100%);
}

.upload-shell {
  width: min(560px, 100%);
  padding: 28px;
  border-radius: 32px;
  background: rgba(249, 247, 241, 0.92);
  box-shadow: 0 28px 90px rgba(9, 15, 20, 0.28);
}

.upload-hero {
  margin-bottom: 22px;
}

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

.upload-form {
  display: grid;
  gap: 16px;
  padding: 0;
  border: 0;
}

.field {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
}

.field span:first-child {
  font-size: 0.92rem;
}

.field input,
.field textarea {
  width: 100%;
  border: 0;
  outline: 0;
  resize: vertical;
  color: var(--text);
  background: transparent;
}

.field input::file-selector-button {
  margin-right: 14px;
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--bg-strong);
}

.preview-card {
  overflow: hidden;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.8);
}

.preview-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.primary-button {
  min-height: 58px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
  box-shadow: 0 18px 34px rgba(196, 71, 23, 0.24);
}

.primary-button:hover,
.primary-button:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible,
.gallery-open:hover,
.gallery-open:focus-visible {
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: 0.68;
  cursor: wait;
}

.feedback-panel {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.84);
}

.feedback-panel.is-success {
  border-color: rgba(29, 140, 99, 0.28);
  background: rgba(29, 140, 99, 0.08);
}

.feedback-panel.is-error {
  border-color: rgba(180, 61, 42, 0.28);
  background: rgba(180, 61, 42, 0.08);
}

.field-file input {
  min-height: 44px;
}

.is-hidden {
  display: none !important;
}

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .teacher-layout,
  .modal-layout {
    grid-template-columns: 1fr;
  }

  .teacher-sidebar {
    position: static;
  }

  .teacher-header,
  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .qr-panel {
    max-width: 280px;
  }
}

@media (max-width: 640px) {
  .teacher-shell {
    width: min(100% - 20px, 1320px);
    padding: 20px 0 28px;
  }

  .teacher-access,
  .gallery-section,
  .upload-shell {
    padding: 18px;
    border-radius: 24px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .modal-copy {
    padding: 20px 18px 18px;
  }
}

@media (hover: none) {
  .gallery-delete {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
