/* Student classroom — night campus (aligned with login) */
:root {
  --sf-ink: #050a14;
  --sf-text: #f4f8fc;
  --sf-muted: #a8b8cb;
  --sf-gold: #ffd400;
  --sf-cyan: #3de7ff;
  --sf-line: rgba(255, 255, 255, 0.16);
  --sf-panel: rgba(8, 14, 26, 0.78);
  --sf-ok: #3dd68c;
  --sf-danger: #ff6b86;
  --sf-shadow: 0 28px 60px rgba(0, 0, 0, 0.42);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--sf-ink);
}

body.student-page {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  color: var(--sf-text);
  background: var(--sf-ink);
  font-family: "Segoe UI Variable Text", "Microsoft YaHei", "PingFang SC", sans-serif;
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* Stage background */
.student-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #050a14;
}

.student-stage-media {
  position: absolute;
  inset: -4%;
  width: 108%;
  height: 108%;
  object-fit: cover;
  object-position: 58% 48%;
  filter: saturate(1.1) contrast(1.25) brightness(0.52) hue-rotate(-8deg);
}

.student-stage-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 10, 20, 0.55) 0%, rgba(5, 10, 20, 0.35) 40%, rgba(5, 10, 20, 0.78) 100%),
    radial-gradient(ellipse at 70% 40%, rgba(40, 140, 220, 0.14), transparent 55%);
}

.student-classroom-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 48px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 28px 0 56px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Topbar + brand (match login) */
.student-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
}

.login-brand.student-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.login-brand-logo-wrap {
  position: relative;
  display: inline-block;
  flex: 0 1 auto;
  max-width: min(46vw, 420px);
  line-height: 0;
}

.login-brand-logo {
  display: block;
  height: 56px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
  border-radius: 4px;
}

.login-brand-logo--base {
  filter: grayscale(1) brightness(0.78) contrast(0.92);
}

.login-brand-logo--color {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  clip-path: inset(0 100% 0 0);
  animation: login-brand-color-wipe 7.5s ease-in-out infinite;
}

.login-brand-divider {
  width: 1px;
  height: 28px;
  flex: 0 0 auto;
  background: #8b9098;
  animation: login-brand-divider-gold 7.5s ease-in-out infinite;
}

.login-brand-org {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.14em;
  white-space: nowrap;
  color: transparent;
  background-image:
    linear-gradient(#ffd400, #ffd400),
    linear-gradient(#8b9098, #8b9098);
  background-repeat: no-repeat;
  background-size: 0% 100%, 100% 100%;
  background-position: left center, left center;
  -webkit-background-clip: text;
  background-clip: text;
  animation: login-brand-text-gold 7.5s ease-in-out infinite;
}

@keyframes login-brand-color-wipe {
  0%, 12% { clip-path: inset(0 100% 0 0); }
  48%, 68% { clip-path: inset(0 0 0 0); }
  88%, 100% { clip-path: inset(0 100% 0 0); }
}

@keyframes login-brand-text-gold {
  0%, 12% { background-size: 0% 100%, 100% 100%; }
  48%, 68% { background-size: 100% 100%, 100% 100%; }
  88%, 100% { background-size: 0% 100%, 100% 100%; }
}

@keyframes login-brand-divider-gold {
  0%, 12% { background: #8b9098; }
  48%, 68% { background: #ffd400; }
  88%, 100% { background: #8b9098; }
}

.student-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.student-mode-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(61, 231, 255, 0.35);
  border-radius: 999px;
  color: #9befff;
  background: rgba(61, 231, 255, 0.1);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.teacher-system-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--sf-line);
  border-radius: 999px;
  color: var(--sf-muted);
  background: rgba(8, 16, 30, 0.55);
  text-decoration: none;
  font-size: 12px;
  font-weight: 650;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.teacher-system-link:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

/* Join view */
.student-join-view {
  flex: 1;
  display: flex;
  align-items: center;
}

.student-join-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 420px);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}

.student-join-copy h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: 0.06em;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.35),
    0 12px 40px rgba(0, 0, 0, 0.75);
}

.student-join-copy > p {
  max-width: 34ch;
  margin: 18px 0 0;
  color: rgba(220, 232, 244, 0.9);
  font-size: 1.05rem;
  line-height: 1.75;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.65);
}

.student-join-points {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.student-join-points li {
  position: relative;
  padding-left: 22px;
  color: rgba(200, 220, 236, 0.88);
  font-size: 14px;
  font-weight: 600;
}

.student-join-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sf-cyan);
  box-shadow: 0 0 12px rgba(61, 231, 255, 0.55);
}

.student-join-panel {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: visible;
}

.student-join-form {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 28px 30px 28px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  color: var(--sf-text);
  background: var(--sf-panel);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    var(--sf-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: visible;
}

.student-join-form-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 6px;
}

.student-join-form-head .student-ball-widget {
  align-self: center;
  margin: 0 0 14px;
}

.student-join-form-head h2 {
  margin: 0;
  color: #fff;
  font-size: 1.55rem;
  font-weight: 800;
}

.student-join-form-head p {
  margin: 8px 0 0;
  color: var(--sf-muted);
  font-size: 13px;
}

.student-join-form label,
.student-submission-form label {
  display: grid;
  gap: 8px;
}

.student-join-form label > span,
.student-submission-form label > span {
  color: rgba(220, 232, 244, 0.82);
  font-size: 12px;
  font-weight: 700;
}

.student-join-form input,
.student-submission-form input,
.student-submission-form textarea,
.student-task-submit-form input,
.student-task-submit-form textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  outline: 0;
  color: #fff;
  background: rgba(4, 10, 20, 0.72);
  font-size: 15px;
}

.student-join-form input {
  padding: 14px 15px;
}

.student-submission-form input,
.student-submission-form textarea,
.student-task-submit-form input,
.student-task-submit-form textarea {
  padding: 12px 13px;
  font-size: 13px;
}

.student-task-submit-form textarea {
  min-height: 100px;
  resize: vertical;
}

::placeholder {
  color: #6d7f93;
  opacity: 1;
}

.student-join-form input:focus,
.student-submission-form input:focus,
.student-submission-form textarea:focus,
.student-task-submit-form input:focus,
.student-task-submit-form textarea:focus {
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.student-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.student-form-message,
.student-task-form-message {
  min-height: 20px;
  margin: 0;
  color: var(--sf-danger);
  font-size: 12px;
}

.student-primary-btn,
.student-checkin-btn,
.student-submit-btn {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  color: #0b1220;
  background: #f4f8fc;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  font-weight: 800;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.student-primary-btn:hover,
.student-checkin-btn:hover,
.student-submit-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.student-primary-btn:disabled,
.student-checkin-btn:disabled,
.student-submit-btn:disabled {
  opacity: 0.55;
  transform: none;
}

/* Grok ball above join form */
.login-ball-widget.student-ball-widget {
  position: relative;
  align-self: center;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  overflow: visible;
  pointer-events: none;
}

.student-ball-widget.is-session {
  display: none;
}

.login-ball-tips {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px) scale(0.98);
  width: max-content;
  min-width: 148px;
  max-width: 200px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px 16px 16px 16px;
  color: #122033;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 650;
  writing-mode: horizontal-tb;
  white-space: normal;
  word-break: break-word;
  opacity: 0;
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: none;
  z-index: 6;
}

.login-ball-tips.is-on {
  opacity: 1;
  transform: translateY(-50%) translateX(0) scale(1);
}

.login-ball-mount {
  width: 96px;
  height: 96px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.35));
  transition: transform 0.18s ease, filter 0.18s ease;
  pointer-events: auto;
}

.login-ball-mount:hover {
  transform: translateY(-3px);
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.45));
}

.login-ball-mount:active {
  transform: scale(0.96);
}

.login-ball-mount svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Session */
.student-session-view {
  display: grid;
  gap: 18px;
}

.student-session-header,
.student-attendance-band,
.student-answer-history,
.student-question-card,
.student-submission-card,
.student-task-card,
.student-task-item {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(8, 14, 26, 0.72);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.student-session-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 26px;
}

.session-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: #041810;
  background: var(--sf-ok);
  box-shadow: 0 0 0 3px rgba(61, 214, 140, 0.22);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.student-session-header h1 {
  margin: 11px 0 5px;
  color: #fff;
  font-size: 26px;
  line-height: 1.25;
}

.student-session-header p {
  margin: 0;
  color: var(--sf-muted);
  font-size: 13px;
}

.student-session-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-code-chip {
  min-width: 110px;
  padding: 8px 12px;
  border: 1px solid rgba(61, 231, 255, 0.28);
  border-radius: 10px;
  background: rgba(61, 231, 255, 0.08);
}

.student-code-chip span,
.student-code-chip strong {
  display: block;
}

.student-code-chip span {
  color: var(--sf-muted);
  font-size: 10px;
}

.student-code-chip strong {
  margin-top: 3px;
  color: #9befff;
  font-family: Consolas, "SF Mono", monospace;
  font-size: 17px;
  letter-spacing: 2px;
}

.student-icon-btn {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--sf-line);
  border-radius: 9px;
  color: var(--sf-muted);
  background: rgba(8, 16, 30, 0.7);
  font-size: 11px;
  font-weight: 700;
}

.student-attendance-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
}

.student-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.student-avatar {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #0b1220;
  background: #f4f8fc;
  font-weight: 900;
}

.student-identity strong,
.student-identity div span {
  display: block;
}

.student-identity strong {
  color: #fff;
  font-size: 14px;
}

.student-identity div span {
  margin-top: 3px;
  color: var(--sf-muted);
  font-size: 11px;
}

.student-checkin-btn {
  min-height: 38px;
  padding: 0 15px;
  font-size: 12px;
}

.student-checkin-btn.checked {
  color: var(--sf-ok);
  background: rgba(61, 214, 140, 0.12);
  box-shadow: none;
}

.student-question-area {
  min-height: 250px;
}

.student-waiting-state {
  display: grid;
  place-items: center;
  gap: 14px;
  min-height: 250px;
  padding: 32px;
  border: 1px dashed rgba(61, 231, 255, 0.28);
  border-radius: 16px;
  color: var(--sf-muted);
  background: rgba(8, 16, 30, 0.45);
  text-align: center;
}

.waiting-pulse {
  display: block;
  width: 34px;
  height: 34px;
  border: 4px solid rgba(61, 231, 255, 0.16);
  border-top-color: var(--sf-cyan);
  border-radius: 50%;
  animation: student-spin 900ms linear infinite;
}

.student-question-card {
  padding: 25px;
}

.student-question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
  color: var(--sf-muted);
  font-size: 11px;
}

.student-question-card h2 {
  margin: 0;
  color: #fff;
  font-size: 21px;
  line-height: 1.5;
}

.student-question-options {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.student-answer-option {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: 44px;
  padding: 12px 13px;
  border: 1px solid var(--sf-line);
  border-radius: 11px;
  background: rgba(4, 10, 20, 0.55);
  cursor: pointer;
}

.student-answer-option:has(input:checked) {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.08);
}

.student-answer-option input {
  flex: 0 0 auto;
  margin-top: 2px;
  accent-color: #fff;
}

.student-answer-option span {
  color: rgba(230, 238, 246, 0.9);
  font-size: 13px;
  line-height: 1.5;
}

.student-question-footer,
.student-submission-actions,
.student-task-submit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
}

.student-question-result,
.student-submission-status {
  min-height: 18px;
  color: var(--sf-muted);
  font-size: 12px;
}

.student-question-result.correct,
.student-submission-status.reviewed,
.student-task-status {
  color: var(--sf-ok);
  font-weight: 700;
}

.student-question-result.wrong,
.student-submission-status.returned {
  color: var(--sf-danger);
  font-weight: 700;
}

.student-submit-btn {
  min-width: 110px;
  min-height: 40px;
  padding: 0 14px;
  font-size: 12px;
}

.student-answer-history,
.student-submission-card,
.student-task-card {
  padding: 22px;
}

.student-section-heading span {
  display: inline-block;
  color: #9befff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.student-section-heading h2 {
  margin: 6px 0 16px;
  color: #fff;
  font-size: 18px;
}

.student-history-list {
  display: grid;
  gap: 2px;
}

.student-history-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px 11px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.student-history-item:last-child {
  border-bottom: 0;
}

.student-history-item::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 17px;
  width: 6px;
  height: 6px;
  border: 1px solid var(--sf-cyan);
  border-radius: 50%;
  background: transparent;
}

.student-history-item strong {
  color: rgba(230, 238, 246, 0.9);
  overflow-wrap: anywhere;
  font-size: 12px;
}

.student-history-item span {
  display: block;
  margin-top: 3px;
  color: var(--sf-muted);
  font-size: 11px;
}

.student-history-result {
  flex: 0 0 auto;
  color: var(--sf-muted);
  font-size: 11px;
}

.student-history-result.correct {
  color: var(--sf-ok);
  font-weight: 800;
}

.student-history-result.wrong {
  color: var(--sf-danger);
  font-weight: 800;
}

.student-submission-intro {
  margin: -6px 0 18px;
  color: var(--sf-muted);
  font-size: 12px;
  line-height: 1.65;
}

.student-task-list {
  display: grid;
  gap: 12px;
}

.student-task-item {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.student-task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.student-task-head > div {
  display: grid;
  gap: 4px;
}

.student-task-head span,
.student-task-meta {
  color: var(--sf-muted);
  font-size: 12px;
}

.student-task-head h3 {
  margin: 0;
  color: #fff;
  font-size: 16px;
}

.student-task-status {
  white-space: nowrap;
}

.student-task-item > p {
  margin: 0;
  color: rgba(220, 232, 244, 0.88);
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.55;
}

.student-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.student-task-feedback {
  padding: 10px 12px;
  border: 1px solid rgba(255, 212, 0, 0.25);
  border-radius: 9px;
  color: #ffe566;
  background: rgba(255, 212, 0, 0.08);
  font-size: 13px;
}

.student-task-submit-form {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.student-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(360px, calc(100% - 40px));
  padding: 12px 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: #0b1220;
  background: #f4f8fc;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
  font-size: 12px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.student-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes student-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 980px) {
  .student-join-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .student-join-copy {
    text-align: left;
  }

  .login-ball-tips {
    left: 50%;
    top: auto;
    bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(6px) scale(0.98);
    border-radius: 16px 16px 16px 4px;
  }

  .login-ball-tips.is-on {
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@media (max-width: 640px) {
  .student-classroom-shell {
    width: min(100% - 24px, 920px);
    padding-top: 16px;
  }

  .login-brand-logo {
    height: 42px;
  }

  .login-brand-logo-wrap {
    max-width: min(55vw, 280px);
  }

  .login-brand-org {
    font-size: 13px;
    letter-spacing: 0.08em;
  }

  .student-form-grid {
    grid-template-columns: 1fr;
  }

  .student-session-header,
  .student-attendance-band {
    flex-direction: column;
  }

  .student-session-actions {
    width: 100%;
    justify-content: space-between;
  }

  .student-question-footer,
  .student-submission-actions,
  .student-task-submit-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .student-submit-btn,
  .student-checkin-btn,
  .student-primary-btn {
    width: 100%;
  }

  .login-ball-mount {
    width: 80px;
    height: 80px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-brand-logo--base {
    filter: none;
  }

  .login-brand-logo--color {
    animation: none;
    clip-path: none;
  }

  .login-brand-org {
    animation: none;
    color: #ffd400;
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
  }

  .login-brand-divider {
    animation: none;
    background: rgba(255, 212, 0, 0.55);
  }

  .waiting-pulse,
  .login-brand-logo--color,
  .login-brand-org,
  .login-brand-divider {
    animation: none !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .student-join-form,
  .student-session-header,
  .student-attendance-band,
  .student-answer-history,
  .student-question-card,
  .student-submission-card,
  .student-task-card,
  .student-task-item {
    background: #0c1524;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
