:root {
  color-scheme: light;
  font-family: Tahoma, "Microsoft YaHei", Arial, sans-serif;
  background: #008080;
  color: #000;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 16px;
  background: #008080;
  font-size: 13px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-width: 76px;
  min-height: 24px;
  padding: 2px 10px;
  color: #000;
  background: #c0c0c0;
  border: 2px outset #fff;
}

button:active {
  border-style: inset;
}

button:disabled {
  color: #777;
  text-shadow: 1px 1px #eee;
}

input,
textarea {
  width: 100%;
  padding: 3px 5px;
  background: #fff;
  border: 2px inset #d4d0c8;
  outline: none;
}

textarea {
  min-height: 78px;
  resize: vertical;
}

.hidden {
  display: none !important;
}

.vb-window {
  background: #c0c0c0;
  border: 2px outset #fff;
  box-shadow: 2px 2px 0 #000;
}

.login-window {
  width: min(440px, calc(100vw - 32px));
  margin: 12vh auto 0;
}

.app-window {
  width: min(1180px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.share-window {
  width: min(960px, calc(100vw - 32px));
  min-height: min(720px, calc(100vh - 32px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.title-bar {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(90deg, #000080, #1084d0);
}

.window-buttons {
  display: inline-flex;
  gap: 3px;
}

.window-buttons i {
  width: 16px;
  height: 16px;
  display: block;
  background: #c0c0c0;
  border: 2px outset #fff;
}

.login-body,
.toolbar,
.status-bar,
.pane,
.groupbox,
.vb-dialog form {
  border: 2px inset #fff;
}

.login-body {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  padding: 26px 40px 24px;
}

.password-login-panel {
  min-width: 0;
}

.login-divider {
  margin: 0 0 12px;
  text-align: center;
  color: #333;
}

.login-body label,
.vb-dialog label {
  display: block;
  margin-bottom: 12px;
}

.checkbox-row {
  display: flex !important;
  width: fit-content;
  align-items: center;
  gap: 6px;
}

.checkbox-row input[type="checkbox"] {
  width: auto;
}

.message {
  min-height: 18px;
  margin: 10px 0 0;
  color: #800000;
}

.toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 7px;
  border-left: 0;
  border-right: 0;
  border-top: 0;
}

.main-grid {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 8px;
  padding: 8px;
}

.pane {
  min-height: 0;
  background: #d4d0c8;
  display: flex;
  flex-direction: column;
}

.pane-title {
  padding: 5px 7px;
  font-weight: 700;
  border-bottom: 2px outset #fff;
}

.listbox {
  min-height: 0;
  flex: 1;
  margin: 6px;
  overflow: auto;
  background: #fff;
  border: 2px inset #d4d0c8;
}

.list-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 6px 7px;
  border-bottom: 1px solid #d4d0c8;
  cursor: default;
  user-select: none;
}

.list-item.selected {
  color: #fff;
  background: #000080;
}

.list-item.selected .muted {
  color: #e6e6e6;
}

.list-item.unpublished:not(.selected) {
  color: #555;
  background: #ece9d8;
}

.list-item.dragging {
  opacity: 0.55;
}

.list-item.drop-before {
  box-shadow: inset 0 3px 0 #000080;
}

.list-item.drop-after {
  box-shadow: inset 0 -3px 0 #000080;
}

.drag-handle {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  display: grid;
  place-items: center;
  color: #333;
  background: #c0c0c0;
  border: 2px outset #fff;
  cursor: move;
  touch-action: none;
}

.drag-handle::before {
  content: "";
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  box-shadow:
    6px 0 currentColor,
    0 6px currentColor,
    6px 6px currentColor,
    0 12px currentColor,
    6px 12px currentColor;
  transform: translate(-3px, -6px);
}

.drag-handle:focus-visible {
  outline: 1px dotted #000;
  outline-offset: -4px;
}

.classroom-info {
  min-width: 0;
}

.classroom-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classroom-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.publish-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 5px;
  color: #003b00;
  background: #dff0d8;
  border: 1px solid #008000;
}

.publish-badge.unpublished {
  color: #5f0000;
  background: #f2dede;
  border-color: #800000;
}

.cover-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 5px;
  color: #00305f;
  background: #d9edf7;
  border: 1px solid #005a9c;
}

.cover-badge.default {
  color: #6b3600;
  background: #fcf8e3;
  border-color: #9a5a00;
}

.list-item.selected .publish-badge,
.list-item.selected .cover-badge {
  color: #000;
  background: #c0c0c0;
  border-color: #fff;
}

.classroom-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.classroom-actions button {
  min-width: 42px;
  padding-left: 4px;
  padding-right: 4px;
}

.muted {
  color: #555;
}

.workspace {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 0.8fr);
  gap: 8px;
  padding: 8px;
}

.groupbox {
  position: relative;
  min-height: 0;
  padding: 18px 8px 8px;
  background: #c0c0c0;
  display: flex;
  flex-direction: column;
}

.legend {
  position: absolute;
  top: -8px;
  left: 10px;
  padding: 0 5px;
  background: #c0c0c0;
  font-weight: 700;
}

.course-list {
  min-height: 0;
  overflow: auto;
}

.course-card {
  margin-bottom: 8px;
  padding: 8px;
  background: #d4d0c8;
  border: 2px outset #fff;
}

.course-card.dragging {
  opacity: 0.55;
}

.course-card.drop-before {
  box-shadow: inset 0 3px 0 #000080;
}

.course-card.drop-after {
  box-shadow: inset 0 -3px 0 #000080;
}

.course-header {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 7px;
}

.course-info {
  min-width: 0;
  flex: 1;
}

.course-title {
  font-weight: 700;
}

.course-actions,
.video-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.video-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px;
  margin-top: 5px;
  background: #fff;
  border: 2px inset #d4d0c8;
}

.video-meta {
  min-width: 0;
}

.video-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pending {
  color: #804000;
}

.status-uploaded {
  color: #006000;
}

video {
  display: block;
  width: 100%;
  min-height: 220px;
  background: #000;
  border: 2px inset #d4d0c8;
}

.hint {
  margin-top: 8px;
  color: #333;
}

.share-layout {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(360px, 1.2fr);
  gap: 8px;
  padding: 8px;
}

.share-title {
  margin: 0 0 8px;
  font-size: 18px;
}

.share-description {
  min-height: 18px;
  margin: 0 0 12px;
  color: #333;
}

.share-video-list {
  min-height: 0;
  overflow: auto;
}

#shareVideoPlayer {
  aspect-ratio: 16 / 9;
  min-height: 0;
  height: auto;
}

.status-bar {
  height: 26px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 7px;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
}

.vb-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  background: #c0c0c0;
  border: 2px outset #fff;
  box-shadow: 2px 2px 0 #000;
}

#classroomDialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
}

#classroomDialog form {
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
}

.share-dialog {
  width: min(720px, calc(100vw - 32px));
}

.vb-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.vb-dialog form {
  padding: 12px;
}

.dialog-title {
  margin: -12px -12px 12px;
  padding: 5px 7px;
  color: #fff;
  font-weight: 700;
  background: #000080;
}

.dialog-section {
  margin: 0 0 12px;
  padding: 10px;
  border: 2px inset #fff;
}

.dialog-section legend {
  padding: 0 4px;
  font-weight: 700;
}

.classroom-card-section {
  padding-bottom: 8px;
}

.vb-dialog .classroom-card-file-label {
  margin-bottom: 8px;
}

.classroom-card-preview {
  width: min(100%, 343px);
  aspect-ratio: 343 / 189;
  margin: 0 auto 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
  border: 2px inset #d4d0c8;
  padding: 0;
  cursor: pointer;
}

button.classroom-card-preview {
  min-width: 0;
  min-height: 0;
  color: inherit;
}

button.classroom-card-preview:focus-visible {
  outline: 2px solid #000080;
  outline-offset: 2px;
}

.classroom-card-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.classroom-card-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.classroom-card-controls span {
  min-width: 0;
  flex: 1;
}

.classroom-card-controls button {
  flex: 0 0 auto;
}

.classroom-card-hint {
  margin: 8px 0 0;
  color: #333;
  line-height: 1.45;
}

.radio-row {
  display: flex !important;
  width: fit-content;
  align-items: center;
  gap: 6px;
}

.radio-row input[type="radio"] {
  width: auto;
}

.share-hours-row input[type="number"] {
  width: 110px;
}

.share-password-form {
  margin: 10px 0;
  padding: 10px;
  background: #d4d0c8;
  border: 2px inset #fff;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 860px) {
  body {
    padding: 8px;
  }

  .app-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
  }

  .main-grid,
  .workspace,
  .share-layout {
    grid-template-columns: 1fr;
  }

  .classroom-pane {
    min-height: 190px;
  }
}

@media (max-width: 640px) {
  .login-window {
    width: calc(100vw - 16px);
    margin-top: 8px;
  }

  .login-body {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  body.share-page {
    padding: 0;
    font-size: 14px;
  }

  .share-window button {
    min-height: 34px;
    padding: 5px 10px;
  }

  .share-window {
    width: 100vw;
    min-height: 100dvh;
    height: 100dvh;
    border: 0;
    box-shadow: none;
  }

  .share-window .title-bar {
    height: 32px;
  }

  .share-layout {
    overflow: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .share-player-panel {
    order: -1;
  }

  .share-window .groupbox {
    padding: 20px 10px 10px;
  }

  #shareVideoPlayer {
    min-height: 0;
  }

  .share-title {
    font-size: 18px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .share-description,
  .hint {
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .share-video-list {
    overflow: visible;
  }

  .share-video-list .video-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
  }

  .share-video-list .video-actions {
    justify-content: stretch;
  }

  .share-video-list .video-actions button {
    width: 100%;
  }
}
