:root {
  --blue: #1b7fff;
  --green: #18b982;
  --ink: #163048;
  --muted: #607080;
  --line: #d9edf0;
  --bg: #f4fbfb;
  --panel: #ffffff;
  --shadow: 0 14px 38px rgba(24, 88, 104, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(244, 251, 251, 0.3), rgba(244, 251, 251, 0.8)),
    url("assets/classroom-sunlight-bg.png") center top / cover fixed,
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.72)),
    radial-gradient(circle at 16% 8%, rgba(255, 244, 193, 0.45), transparent 24rem);
  pointer-events: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
.file-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 0.72rem 1rem;
  cursor: pointer;
  min-height: 42px;
}

button.primary {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.mobile-entry {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background:
    linear-gradient(180deg, rgba(230, 249, 255, 0.7), rgba(235, 255, 244, 0.96)),
    url("assets/classroom-sunlight-bg.png") center / cover;
}

.mobile-entry[hidden] {
  display: none;
}

.mobile-entry-card {
  width: min(420px, 100%);
  display: grid;
  gap: 0.75rem;
  padding: 1.2rem;
  border: 1px solid rgba(217, 237, 240, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 70px rgba(22, 48, 72, 0.2);
}

.mobile-entry-card img {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.mobile-entry-card h1,
.mobile-entry-card p {
  margin: 0;
}

.mobile-entry-card input,
.mobile-entry-card select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.78rem;
  background: #fbffff;
}

.mobile-user-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 0.25rem;
  padding: 0.24rem 0.5rem;
  border-radius: 999px;
  color: #0d6d4f;
  background: #eaf9f3;
  font-size: 0.8rem;
  font-weight: 700;
}

#musicToggle.is-playing {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #16a3ff, #18b982);
}

#installApp {
  border-color: rgba(24, 185, 130, 0.35);
  background: #eaf9f3;
  color: #0d6d4f;
  font-weight: 700;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.file-button input,
.upload-box input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(244, 251, 251, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(217, 237, 240, 0.9);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: var(--shadow);
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3.5vw, 2.1rem);
  line-height: 1.15;
  outline-color: var(--green);
}

.kicker {
  margin: 0 0 0.25rem;
  color: var(--green);
  font-weight: 700;
  font-size: 0.86rem;
}

.top-actions,
.tabs {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}

.tabs {
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  overflow-x: auto;
}

.tabs button {
  white-space: nowrap;
}

.tabs button.active {
  color: #fff;
  border-color: transparent;
  background: var(--ink);
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto 5rem;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.7fr);
  gap: 1rem;
  align-items: stretch;
  margin-top: 1rem;
}

.hero-copy,
.hero-figure,
.panel,
.quick-grid article,
.student-card,
.teacher-card,
.memory-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(217, 237, 240, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-copy {
  padding: clamp(1.2rem, 4vw, 2rem);
}

.hero-copy textarea,
.panel textarea,
.dialog-card textarea,
.dialog-card input,
.dialog-card select,
.section-head input,
.note-list textarea,
.teacher-card input,
.teacher-card textarea,
.memory-card input,
.memory-card textarea,
.stage-card input,
.stage-card textarea,
.game-card input,
.game-card textarea,
.dev-card input,
.dev-card textarea,
.community-layout input,
.community-layout select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
  background: #fbffff;
  color: var(--ink);
  resize: vertical;
}

.hero-copy textarea {
  min-height: 150px;
  border: 0;
  padding: 0;
  font-size: clamp(1.35rem, 4vw, 2.7rem);
  line-height: 1.25;
  font-weight: 800;
  background: transparent;
}

.hero-figure {
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow: hidden;
}

.hero-figure img {
  width: min(100%, 320px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.stats span {
  background: #eaf9f3;
  border: 1px solid #c8f0e2;
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
}

.quick-grid,
.words-layout,
.community-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.words-layout {
  grid-template-columns: 1.3fr 0.7fr;
}

.community-layout {
  grid-template-columns: 0.8fr 1.2fr;
}

.quick-grid article,
.panel {
  padding: 1rem;
}

.profile-card {
  display: grid;
  grid-template-columns: 1.1fr repeat(3, 1fr);
  gap: 0.85rem;
  align-items: end;
  margin-top: 1rem;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(230, 255, 247, 0.9));
  border: 1px solid rgba(217, 237, 240, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.profile-card h2 {
  margin-bottom: 0;
  outline-color: var(--green);
}

.profile-card label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.profile-card input,
.profile-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  background: #fbffff;
  color: var(--ink);
}

.profile-card label:last-child {
  grid-column: 1 / -1;
}

.stage-grid,
.game-grid,
.dev-list,
.template-list,
.class-album-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.stage-card,
.game-card,
.dev-card,
.template-card,
.class-album-card {
  position: relative;
  display: grid;
  gap: 0.7rem;
  padding: 1rem;
  min-height: 260px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(217, 237, 240, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.platform-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  gap: 1rem;
  align-items: center;
}

.platform-hero p {
  font-size: 1rem;
  line-height: 1.75;
}

.platform-steps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

.platform-steps span {
  min-height: 72px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(27, 127, 255, 0.9), rgba(24, 185, 130, 0.9));
}

.album-builder {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1rem;
}

.album-builder label,
.album-live-grid label {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.7rem;
  color: var(--muted);
}

.album-live-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.template-card h3,
.class-album-card h3 {
  margin: 0;
}

.template-card.is-selected {
  border-color: rgba(27, 127, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(27, 127, 255, 0.12), var(--shadow);
}

.template-sunny-classroom {
  background: linear-gradient(160deg, rgba(255, 248, 216, 0.94), rgba(224, 247, 255, 0.9));
}

.template-fresh-campus {
  background: linear-gradient(160deg, rgba(224, 255, 241, 0.94), rgba(229, 242, 255, 0.9));
}

.template-comic-memory {
  background: linear-gradient(160deg, rgba(255, 236, 246, 0.94), rgba(255, 249, 218, 0.9));
}

.template-classic-yearbook {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(235, 242, 246, 0.9));
}

.class-album-meta {
  display: grid;
  gap: 0.35rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.class-workspace {
  display: grid;
  gap: 1rem;
}

.class-workspace-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.class-workspace-stats span {
  padding: 0.7rem;
  border: 1px solid rgba(200, 240, 226, 0.95);
  border-radius: 8px;
  background: #eaf9f3;
  color: #0d6d4f;
  font-weight: 800;
}

.class-workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 1rem;
}

.class-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 0.55rem;
  max-height: 460px;
  overflow: auto;
  padding-right: 0.2rem;
}

.class-slot {
  min-height: 74px;
  display: grid;
  gap: 0.25rem;
  place-items: center;
  text-align: center;
  border: 1px dashed #9bded5;
  background: rgba(244, 255, 253, 0.85);
}

.class-slot b {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.class-slot span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

.class-slot.is-certified {
  border-style: solid;
  background: linear-gradient(160deg, #e6f4ff, #e9fff4);
}

.class-memory-mini {
  display: grid;
  gap: 0.65rem;
  max-height: 460px;
  overflow: auto;
}

.class-memory-mini article {
  display: grid;
  gap: 0.35rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
}

.album-media-wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.album-media-card {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.album-media-preview {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(135deg, #e9f8ff, #e9fff5);
  color: var(--muted);
}

.album-media-preview img,
.album-media-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-media-preview.multi-preview {
  aspect-ratio: auto;
  min-height: 180px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6rem;
  padding: 0.65rem;
  place-items: stretch;
}

.multi-preview-item {
  min-width: 0;
  display: grid;
  gap: 0.35rem;
}

.multi-preview-item img,
.multi-preview-item video {
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
}

.multi-preview-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.78rem;
}

.small-preview {
  min-height: 150px;
  margin-top: 0.7rem;
  aspect-ratio: 16 / 9;
}

.upload-status {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.upload-status.is-error {
  color: #b42318;
}

.upload-status.is-success {
  color: #0d6d4f;
}

.empty-state {
  margin: 0;
  padding: 1rem;
  border: 1px dashed #9bded5;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(244, 255, 253, 0.82);
}

.join-guide {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.75rem 0;
}

.join-guide div {
  min-height: 82px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.35rem;
  padding: 0.65rem;
  text-align: center;
  border: 1px solid rgba(191, 229, 229, 0.95);
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(234, 249, 255, 0.94), rgba(233, 255, 245, 0.94));
}

.join-guide b {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.join-guide span {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.join-tip {
  padding: 0.8rem;
  border: 1px solid rgba(255, 213, 136, 0.9);
  border-radius: 8px;
  background: rgba(255, 250, 225, 0.86);
}

.join-tip strong {
  color: #9a6100;
}

.join-tip p {
  margin: 0.35rem 0 0;
  line-height: 1.65;
}

.stage-number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-weight: 800;
}

#timeline > .section-head,
#timeline > #stageList {
  display: none;
}

.timeline-capsule {
  margin-top: 1rem;
  padding: clamp(1rem, 3vw, 1.4rem);
  border: 1px solid rgba(190, 232, 226, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(241, 255, 250, 0.88)),
    radial-gradient(circle at 12% 10%, rgba(255, 222, 112, 0.32), transparent 18rem);
  box-shadow: var(--shadow);
}

.timeline-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.34fr);
  gap: 1rem;
  align-items: stretch;
  min-height: 190px;
  padding: clamp(1rem, 3vw, 1.4rem);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(224, 246, 255, 0.86), rgba(232, 255, 244, 0.88)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px 28px);
  overflow: hidden;
}

.timeline-hero h2 {
  margin: 0.2rem 0 0.5rem;
  font-size: clamp(2rem, 5vw, 3.4rem);
  color: #16435a;
}

.timeline-hero p {
  max-width: 760px;
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.8;
}

.timeline-hero-card,
.timeline-tools,
.timeline-detail {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid rgba(205, 237, 235, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.timeline-hero-card {
  align-content: center;
  background: rgba(255, 255, 255, 0.72);
}

.timeline-hero-card strong {
  font-size: 1.15rem;
  color: #0d6d4f;
}

.timeline-hero-card span {
  color: var(--muted);
  line-height: 1.65;
}

.timeline-workspace {
  display: grid;
  grid-template-columns: minmax(230px, 0.75fr) minmax(0, 1.5fr) minmax(230px, 0.72fr);
  gap: 1rem;
  margin-top: 1rem;
  align-items: start;
}

.timeline-tools label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.timeline-tools input,
.timeline-tools select,
.timeline-tools textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  background: #fbffff;
  color: var(--ink);
}

.timeline-main {
  min-width: 0;
}

.timeline-filters {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding: 0.1rem 0 0.8rem;
}

.timeline-filters button {
  min-height: 38px;
  padding: 0.45rem 0.8rem;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  border: 1px solid var(--line);
}

.timeline-filters button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.capsule-board {
  position: relative;
  display: grid;
  gap: 1rem;
}

.capsule-board::before {
  content: "";
  position: absolute;
  left: 27px;
  top: 1.4rem;
  bottom: 1.4rem;
  width: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #62c8ff, #69dbaf, #ffd36b, #ff9b88);
}

.capsule-grade {
  position: relative;
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem 0.9rem 0.9rem 4.4rem;
  border: 1px solid rgba(215, 236, 237, 0.96);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 28px rgba(41, 111, 130, 0.08);
}

.capsule-grade-head {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.capsule-grade-head > span {
  position: absolute;
  left: 0.82rem;
  top: 1rem;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  background: var(--grade-color);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.86);
}

.capsule-grade h3,
.timeline-detail h3,
.timeline-tools h3 {
  margin: 0;
}

.capsule-grade p {
  margin: 0.2rem 0 0;
}

.capsule-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.capsule-card {
  display: grid;
  gap: 0.45rem;
  min-height: 150px;
  padding: 0.75rem;
  text-align: left;
  color: var(--ink);
  border: 1px solid rgba(213, 236, 238, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 255, 251, 0.9)),
    linear-gradient(90deg, var(--grade-color), transparent 40%);
}

.capsule-card strong {
  font-size: 1rem;
}

.capsule-card small,
.timeline-detail small {
  color: var(--muted);
}

.capsule-card p {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.capsule-empty {
  padding: 0.8rem;
  border: 1px dashed rgba(130, 202, 202, 0.9);
  border-radius: 8px;
  background: rgba(243, 255, 252, 0.8);
}

.timeline-detail {
  position: sticky;
  top: 1rem;
}

.timeline-detail-media {
  min-height: 170px;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(135deg, #e9f8ff, #e9fff5);
  color: var(--muted);
}

.timeline-detail-media img,
.timeline-detail-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.danger-lite {
  color: #b42318;
  background: #fff3f0;
  border: 1px solid #ffd3ca;
}

.member-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.member-pill {
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  background: #eaf9f3;
  color: var(--ink);
  cursor: pointer;
}

.chat-panel {
  min-height: 620px;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.chat-messages {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  min-height: 360px;
  max-height: 560px;
  overflow: auto;
  padding: 0.25rem;
}

.chat-message {
  max-width: 78%;
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
}

.chat-message.mine {
  justify-self: end;
  background: #dcf8ef;
}

.chat-message div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.chat-message p {
  margin: 0.45rem 0 0;
  color: var(--ink);
}

.chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
}

.card-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.featured-game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  margin: 0 0 1rem;
  padding: clamp(1rem, 3vw, 1.4rem);
  border: 1px solid rgba(217, 237, 240, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(230, 246, 255, 0.94), rgba(226, 255, 245, 0.92)),
    radial-gradient(circle at 86% 20%, rgba(255, 222, 112, 0.36), transparent 18rem);
  box-shadow: var(--shadow);
}

.featured-game h2 {
  margin-bottom: 0.45rem;
}

.featured-game p {
  max-width: 760px;
  margin: 0;
  line-height: 1.7;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 8px;
  padding: 0.8rem 1.1rem;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  background: linear-gradient(135deg, var(--blue), var(--green));
  box-shadow: 0 12px 24px rgba(27, 127, 255, 0.18);
  white-space: nowrap;
}

.hint {
  margin-top: 0;
}

.share-tools,
.share-link-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}

.share-tools input,
.share-link-item input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  background: #fbffff;
  color: var(--ink);
}

.links-list {
  display: grid;
  gap: 0.65rem;
  max-height: 360px;
  overflow: auto;
  margin-top: 0.8rem;
}

.share-link-item {
  grid-template-columns: 150px minmax(0, 1fr) auto;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 255, 255, 0.82);
}

.link-preview {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.65rem;
  border-radius: 8px;
  background: rgba(232, 248, 245, 0.72);
  color: #405466;
  line-height: 1.55;
}

h2 {
  margin: 0 0 0.75rem;
}

p {
  color: var(--muted);
}

.panel {
  margin-top: 1rem;
}

.panel-head,
.section-head,
.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.note-list,
.teacher-list,
.memory-list {
  display: grid;
  gap: 0.8rem;
}

.note-item,
.teacher-card,
.memory-card {
  display: grid;
  gap: 0.65rem;
  padding: 1rem;
}

.teacher-title {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.section-head {
  margin-top: 1rem;
}

.section-head input {
  max-width: 280px;
}

.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.9rem;
}

.student-card {
  min-height: 260px;
  padding: 0.9rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.student-card:hover {
  transform: translateY(-2px);
}

.student-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.student-card p {
  margin: 0.45rem 0;
}

.student-preview {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.75rem;
}

.student-preview strong {
  font-size: 0.82rem;
  color: var(--ink);
}

.student-preview p {
  min-height: 38px;
  max-height: 84px;
  overflow: auto;
  padding: 0.55rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: #405466;
  font-size: 0.88rem;
}

.badge-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.78rem;
  border-radius: 999px;
  padding: 0.3rem 0.55rem;
  background: rgba(255, 255, 255, 0.74);
}

.theme-ocean {
  background: linear-gradient(160deg, #e6f4ff, #d9fff2);
}

.theme-forest {
  background: linear-gradient(160deg, #e7fff1, #fffddb);
}

.theme-sunny {
  background: linear-gradient(160deg, #fff7c7, #dff8ff);
}

.theme-berry {
  background: linear-gradient(160deg, #ffe8f3, #e9fff9);
}

.theme-space {
  background: linear-gradient(160deg, #ece8ff, #e0f6ff);
}

.theme-paper {
  background: #fffef8;
}

dialog {
  width: min(620px, calc(100% - 1.2rem));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 28px 80px rgba(22, 48, 72, 0.28);
}

dialog.dialog-fallback[open] {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 80;
  max-height: calc(100vh - 1.5rem);
  overflow: auto;
}

dialog::backdrop {
  background: rgba(22, 48, 72, 0.32);
  backdrop-filter: blur(4px);
}

.dialog-card {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
}

.dialog-head button {
  font-size: 1.6rem;
  line-height: 1;
  width: 42px;
  padding: 0;
}

.upload-box {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 86px;
  border: 2px dashed #9bded5;
  border-radius: 8px;
  background: #f4fffd;
  color: var(--muted);
  overflow: hidden;
}

video {
  width: 100%;
  max-height: 280px;
  border-radius: 8px;
  background: #eaf2f5;
}

.avatar-picker {
  display: grid;
  gap: 1rem;
  justify-items: start;
}

.avatar-picker img {
  width: min(100%, 280px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.ai-assistant {
  position: fixed;
  right: clamp(0.8rem, 3vw, 1.4rem);
  bottom: 4.2rem;
  z-index: 30;
  pointer-events: none;
}

.ai-fab {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 0;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue), var(--green));
  box-shadow: 0 18px 42px rgba(22, 48, 72, 0.28);
  pointer-events: auto;
}

.ai-fab[hidden],
.ai-panel[hidden] {
  display: none !important;
}

.ai-assistant:not(.is-open) .ai-panel {
  display: none !important;
}

.ai-assistant.is-open .ai-fab {
  display: none !important;
}

.ai-panel {
  width: min(380px, calc(100vw - 1.6rem));
  max-height: min(640px, calc(100vh - 7rem));
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto auto;
  overflow: hidden;
  border: 1px solid rgba(217, 237, 240, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 74px rgba(22, 48, 72, 0.24);
  backdrop-filter: blur(16px);
  pointer-events: auto;
}

.ai-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.ai-head div {
  display: grid;
  gap: 0.2rem;
}

.ai-head span {
  font-size: 0.78rem;
  opacity: 0.92;
}

.ai-head button {
  width: 38px;
  min-height: 38px;
  padding: 0;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.16);
  font-size: 1.35rem;
}

.ai-messages {
  display: grid;
  align-content: start;
  gap: 0.7rem;
  padding: 0.85rem;
  overflow: auto;
}

.ai-message {
  max-width: 86%;
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  line-height: 1.55;
  background: #edf8ff;
  color: var(--ink);
}

.ai-message.user {
  justify-self: end;
  color: #fff;
  background: #1b7fff;
}

.ai-message p {
  margin: 0;
  color: inherit;
}

.ai-message button {
  margin-top: 0.55rem;
  min-height: 34px;
  padding: 0.4rem 0.65rem;
  color: #0d6d4f;
  background: #eaf9f3;
}

.ai-suggestions {
  display: flex;
  gap: 0.45rem;
  padding: 0 0.85rem 0.75rem;
  overflow-x: auto;
}

.ai-suggestions button {
  white-space: nowrap;
  min-height: 34px;
  padding: 0.4rem 0.65rem;
  font-size: 0.86rem;
}

.ai-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  padding: 0.85rem;
  border-top: 1px solid var(--line);
}

.ai-input input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  background: #fbffff;
  color: var(--ink);
}

@media (max-width: 760px) {
  .topbar,
  .hero,
  .quick-grid,
  .words-layout,
  .community-layout,
  .platform-hero,
  .album-builder,
  .album-live-grid,
  .class-workspace-layout,
  .class-workspace-stats,
  .timeline-hero,
  .timeline-workspace,
  .profile-card,
  .share-tools,
  .share-link-item,
  .featured-game,
  .section-head {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head {
    align-items: stretch;
  }

  .topbar {
    position: static;
    display: grid;
    gap: 0.45rem;
    padding: 0.55rem 0.7rem;
    background: rgba(244, 251, 251, 0.96);
  }

  .brand {
    gap: 0.55rem;
  }

  .brand img {
    width: 40px;
    height: 40px;
    border-width: 2px;
  }

  .brand h1 {
    font-size: 1.02rem;
    line-height: 1.18;
  }

  .brand .kicker {
    display: none;
  }

  .mobile-user-badge {
    margin-top: 0.15rem;
    font-size: 0.72rem;
    padding: 0.18rem 0.42rem;
  }

  .top-actions {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 0.05rem;
  }

  .top-actions button,
  .top-actions .file-button {
    min-height: 34px;
    padding: 0.42rem 0.62rem;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  #saveNow,
  #exportData,
  .top-actions .file-button {
    display: none;
  }

  .tabs {
    padding: 0.45rem 0.65rem;
    gap: 0.42rem;
  }

  .tabs button {
    min-height: 34px;
    padding: 0.42rem 0.62rem;
    font-size: 0.84rem;
  }

  main {
    width: min(100% - 0.8rem, 1180px);
    margin-bottom: 1.6rem;
  }

  .hero {
    display: flex;
    flex-direction: column-reverse;
  }

  .quick-grid,
  .words-layout,
  .community-layout,
  .chat-input {
    display: grid;
  }

  .section-head input {
    max-width: none;
  }

  footer {
    position: static;
    flex-direction: column;
  }

  .ai-assistant {
    right: 0.65rem;
    bottom: 0.65rem;
    z-index: 80;
  }

  .ai-fab {
    width: 54px;
    height: 54px;
    box-shadow: 0 12px 28px rgba(22, 48, 72, 0.24);
  }

  .ai-panel {
    width: min(340px, calc(100vw - 1.1rem));
    max-height: min(42vh, 360px);
    grid-template-rows: auto minmax(96px, 1fr) auto auto;
    border-radius: 8px;
  }

  .ai-head {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0.7rem;
  }

  .ai-head span {
    display: none;
  }

  .ai-head button {
    width: 44px;
    min-height: 44px;
    font-size: 1.5rem;
  }

  .ai-messages {
    max-height: 19vh;
    padding: 0.65rem;
  }

  .ai-suggestions {
    padding: 0 0.65rem 0.55rem;
  }

  .ai-input {
    padding: 0.65rem;
  }

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