:root {
  --bg: #f7fbff;
  --paper: #ffffff;
  --paper-soft: #fff8fb;
  --ink: #25324a;
  --muted: #6d7b91;
  --line: #dce8f5;
  --sky: #74c7ee;
  --sky-deep: #2f8dc7;
  --sakura: #ff9fbd;
  --sun: #ffd66b;
  --leaf: #7fc7a5;
  --shadow: 0 16px 40px rgba(64, 105, 144, 0.14);
  --site-mascot: url("assets/chibi-boy-openclipart.svg");
  --custom-page-bg: none;
  --custom-bg-opacity: 0.72;
  --custom-stage-bg: var(--custom-page-bg);
  --custom-stage-opacity: var(--custom-bg-opacity);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  position: relative;
  margin: 0;
  background:
    linear-gradient(180deg, #eef8ff 0%, #fffafd 42%, #f7fbff 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
  line-height: 1.65;
}
body[data-custom-bg="true"] {
  background:
    linear-gradient(
      180deg,
      rgba(238, 248, 255, var(--custom-bg-opacity)) 0%,
      rgba(255, 250, 253, var(--custom-bg-opacity)) 44%,
      rgba(247, 251, 255, var(--custom-bg-opacity)) 100%
    ),
    var(--custom-stage-bg) center / cover fixed;
}
body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 159, 189, 0.22), transparent 15%),
    radial-gradient(circle at 82% 12%, rgba(116, 199, 238, 0.2), transparent 18%),
    radial-gradient(circle at 74% 78%, rgba(255, 214, 107, 0.18), transparent 16%);
  animation: softFloat 9s ease-in-out infinite alternate;
  pointer-events: none;
}
body::after {
  position: fixed;
  z-index: 2;
  right: clamp(10px, 2.6vw, 30px);
  bottom: clamp(10px, 2.6vw, 30px);
  width: clamp(92px, 11vw, 168px);
  aspect-ratio: 1;
  content: "";
  background: var(--site-mascot) center / contain no-repeat;
  filter: drop-shadow(0 18px 24px rgba(64, 105, 144, .18));
  opacity: .82;
  pointer-events: none;
  animation: mascotFloat 5.6s ease-in-out infinite;
  display: none;
}
body[data-page="home"] { --site-mascot: url("assets/chibi-boy-openclipart.svg"); }
body[data-page="about"] { --site-mascot: url("assets/laughing-boy-openclipart.svg"); }
body[data-page="home"]::after, body[data-page="about"]::after { display: block; }
button, input, textarea, select {
  font: inherit;
}
button, select, dialog {
  appearance: none;
  -webkit-appearance: none;
}
button:focus, button:focus-visible, select:focus, select:focus-visible, dialog:focus, dialog:focus-visible {
  outline: none;
}
a { color: inherit; text-decoration: none; }

[data-shell] {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: minmax(170px, auto) minmax(0, 1fr) minmax(170px, auto);
  gap: 18px;
  align-items: center;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid rgba(116, 199, 238, 0.32);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 28px rgba(73, 128, 171, 0.08);
}
.brand {
  color: var(--ink);
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-weight: 900;
  white-space: nowrap;
}
.brand:hover { color: var(--sky-deep); }
.brand-mark {
  width: 24px;
  height: 24px;
  border: 3px solid var(--sky);
  border-radius: 50%;
  background: linear-gradient(135deg, #fff, #e8f7ff 55%, #ffd9e6);
  box-shadow: inset -3px -3px 0 rgba(255, 159, 189, 0.35);
}
.nav {
  display: flex;
  justify-content: center;
  justify-self: center;
  gap: clamp(8px, 1.5vw, 18px);
}
.nav a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.nav a:hover { color: var(--sky-deep); }
.account, .top-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.top-tools {
  justify-self: end;
}
.user-badge {
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.language-button, .icon-button, .ghost, .primary, .secondary, .tabs button {
  min-height: 40px;
  border: 1px solid rgba(116, 199, 238, 0.22);
  border-radius: 8px;
  cursor: pointer;
}
.language-button {
  min-width: 44px;
  border-color: rgba(116, 199, 238, 0.2) !important;
  background: rgba(255, 255, 255, 0.74) !important;
  color: var(--sky-deep);
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(73, 128, 171, 0.08);
  backdrop-filter: blur(12px);
}
.icon-button {
  width: 42px;
  border-color: rgba(255, 159, 189, 0.22) !important;
  background: rgba(255, 255, 255, 0.76) !important;
  color: var(--sky-deep);
  font-size: 18px;
  box-shadow: 0 8px 22px rgba(73, 128, 171, 0.1);
  backdrop-filter: blur(12px);
}
.language-button:hover, .icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(116, 199, 238, 0.46) !important;
  background: rgba(255, 255, 255, 0.92) !important;
}
.language-button:focus-visible, .icon-button:focus-visible {
  box-shadow:
    0 0 0 3px rgba(116, 199, 238, 0.18),
    0 8px 22px rgba(73, 128, 171, 0.1);
}
.ghost, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  color: var(--sky-deep);
  padding: 9px 14px;
}
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: transparent;
  background: linear-gradient(135deg, var(--sky), #9ee6ff 55%, #ffe1ec);
  color: #183047;
  font-weight: 900;
  padding: 10px 18px;
  box-shadow: 0 10px 24px rgba(47, 141, 199, 0.2);
}
.hidden { display: none !important; }

.hero {
  position: relative;
  min-height: 88vh;
  display: flex;
  align-items: center;
  padding: 112px clamp(18px, 7vw, 96px) 84px;
  overflow: hidden;
}
.hero::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(247, 251, 255, 0.96) 0%, rgba(247, 251, 255, 0.74) 48%, rgba(255, 248, 251, 0.28) 100%),
    radial-gradient(circle at 76% 28%, rgba(255, 159, 189, 0.36), transparent 28%),
    radial-gradient(circle at 22% 76%, rgba(116, 199, 238, 0.24), transparent 24%);
}
.hero::before {
  position: absolute;
  z-index: 1;
  right: clamp(24px, 8vw, 120px);
  bottom: 58px;
  width: min(340px, 34vw);
  aspect-ratio: 1;
  content: "";
  background: url("assets/chibi-boy-openclipart.svg") center / contain no-repeat;
  filter: drop-shadow(0 24px 36px rgba(47, 141, 199, .18));
  opacity: .88;
  animation: mascotFloat 4.8s ease-in-out infinite;
}
.hero-media {
  position: absolute;
  inset: 0;
  background-image: url("https://images.unsplash.com/photo-1540959733332-eab4deabeeaf?auto=format&fit=crop&w=1800&q=82");
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 760px;
}
.kicker {
  margin: 0 0 10px;
  color: var(--sky-deep);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 14px;
  color: #1e3148;
  font-size: clamp(44px, 8vw, 92px);
  line-height: 0.98;
}
.hero-copy, .page-hero p {
  max-width: 720px;
  color: #445773;
  font-size: clamp(18px, 2.3vw, 24px);
  font-weight: 700;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.about-page {
  min-height: 100vh;
}
.about-hero {
  --about-bg: url("https://images.unsplash.com/photo-1540959733332-eab4deabeeaf?auto=format&fit=crop&w=1800&q=82");
  --about-bg-opacity: 0.68;
  --about-card-opacity: 0.56;
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: 118px clamp(16px, 6vw, 84px) 70px;
  background:
    linear-gradient(120deg, rgba(239, 248, 255, var(--about-bg-opacity)), rgba(255, 247, 251, calc(var(--about-bg-opacity) * 0.74))),
    var(--about-bg);
  background-size: cover;
  background-position: center;
}
.about-hero::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 14% 22%, rgba(116, 199, 238, 0.32), transparent 24%),
    radial-gradient(circle at 82% 14%, rgba(255, 159, 189, 0.34), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(247, 251, 255, 0.72));
}
.about-hero::before {
  position: absolute;
  z-index: 1;
  right: clamp(18px, 7vw, 110px);
  bottom: 18px;
  width: clamp(150px, 22vw, 270px);
  aspect-ratio: 1;
  content: "";
  background: var(--site-mascot) center / contain no-repeat;
  filter: drop-shadow(0 22px 32px rgba(64, 105, 144, .22));
  opacity: .88;
  animation: mascotFloat 5.2s ease-in-out infinite;
}
.about-content {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
}
.about-content h1 {
  max-width: 920px;
  text-shadow: 0 14px 36px rgba(64, 105, 144, 0.2);
}
.about-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}
.glass-card, .about-editor {
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 8px;
  background: rgba(255, 255, 255, var(--about-card-opacity));
  box-shadow: 0 24px 60px rgba(64, 105, 144, 0.18);
  backdrop-filter: blur(20px) saturate(1.14);
  -webkit-backdrop-filter: blur(20px) saturate(1.14);
}
.glass-card {
  min-height: 280px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 20px;
  animation: floatCard 7s ease-in-out infinite;
}
.glass-card span {
  color: var(--sky-deep);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.glass-card h2 {
  margin: 0;
  color: #203a55;
  font-size: 24px;
}
.glass-card p {
  margin: 0;
  color: #415875;
  font-weight: 800;
  white-space: pre-wrap;
}
.drift-two { animation-delay: -1.6s; }
.drift-three { animation-delay: -3.1s; }
.bilibili-link {
  width: fit-content;
  margin-top: 12px;
}
.about-float {
  position: absolute;
  z-index: 0;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
  filter: blur(1px);
  animation: floatBubble 10s ease-in-out infinite;
}
.float-a { left: 8%; top: 22%; }
.float-b { right: 10%; top: 20%; animation-delay: -2.5s; }
.float-c { right: 24%; bottom: 12%; animation-delay: -5s; }
.about-editor {
  max-width: 760px;
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
}
.about-editor label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}
.about-editor textarea {
  min-height: 96px;
  resize: vertical;
}
.about-editor input[type="range"] {
  padding: 0;
  accent-color: var(--sky-deep);
}
.range-label {
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: center;
}
@keyframes floatCard {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes floatBubble {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.58; }
  50% { transform: translate3d(18px, -24px, 0) scale(1.08); opacity: 0.84; }
}

.japan-band {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 24px;
  align-items: stretch;
  padding: 58px clamp(16px, 5vw, 72px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.94), rgba(255, 248, 251, 0.76)),
    url("https://images.unsplash.com/photo-1524413840807-0c3cb6fa808d?auto=format&fit=crop&w=1600&q=82");
  background-size: cover;
  background-position: center;
}
.japan-band h2, .section-title h2 {
  margin: 0 0 10px;
  color: #213852;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.05;
}
.japan-band p {
  max-width: 620px;
  color: #52647d;
  font-weight: 700;
}
.japan-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.japan-cards article {
  min-height: 160px;
  display: grid;
  align-content: end;
  border: 1px solid rgba(255, 159, 189, 0.36);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
  padding: 16px;
}
.japan-cards span {
  color: var(--sakura);
  font-size: 28px;
  font-weight: 900;
}
.japan-cards strong {
  color: var(--ink);
  font-weight: 800;
}

.update-notice {
  max-width: 1100px;
  margin: 28px auto 0;
  padding: 18px clamp(18px, 4vw, 30px);
  border: 1px solid rgba(116, 199, 238, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.update-notice h2 {
  margin: 2px 0 8px;
  color: #213852;
  font-size: clamp(22px, 3vw, 34px);
}
.update-notice p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
  font-weight: 800;
}

.entry-test {
  padding: 58px clamp(16px, 5vw, 72px);
  background: linear-gradient(180deg, #f8fcff, #fff7fb);
  border-bottom: 1px solid var(--line);
}
.section-title {
  max-width: 1100px;
  margin: 0 auto 22px;
}
.section-title p:last-child { color: var(--muted); }
.quiz-form {
  max-width: 1100px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  padding: 16px;
}
.quiz-form label {
  display: grid;
  gap: 8px;
  color: #4f6178;
  font-weight: 800;
}
.quiz-form button, .quiz-form .form-message { grid-column: 1 / -1; }
.quiz-results {
  max-width: 1100px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 16px auto 0;
}
.quiz-results article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 12px;
}
.quiz-results .correct { border-color: rgba(127, 199, 165, 0.72); }
.quiz-results .wrong { border-color: rgba(255, 159, 189, 0.78); }
.quiz-results span, .quiz-results small { color: var(--muted); }

.portal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 28px clamp(16px, 5vw, 72px) 72px;
  background: #eef8ff;
}
.portal-grid a {
  min-height: 132px;
  display: grid;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 18px;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.portal-grid a:hover { transform: translateY(-4px); }
.portal-grid span {
  color: var(--sky-deep);
  font-weight: 900;
  font-size: 22px;
}
.portal-grid strong {
  color: var(--muted);
  font-weight: 700;
}

.page { padding-top: 68px; }
.page-hero {
  position: relative;
  min-height: 360px;
  display: grid;
  align-content: end;
  padding: 78px clamp(16px, 5vw, 72px) 46px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.95), rgba(238, 248, 255, 0.7)),
    var(--hero-image);
  background-size: cover;
  background-position: center;
}
.page-hero > * {
  position: relative;
  z-index: 1;
}
.page-hero::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 16% 28%, rgba(255, 159, 189, .18), transparent 19%),
    radial-gradient(circle at 86% 26%, rgba(116, 199, 238, .2), transparent 24%),
    linear-gradient(135deg, rgba(255,255,255,.16), rgba(255,248,251,.4));
}
.page-hero::after {
  position: absolute;
  right: clamp(18px, 7vw, 96px);
  bottom: -18px;
  width: clamp(148px, 21vw, 250px);
  aspect-ratio: 1;
  content: "";
  display: none;
  background: var(--site-mascot) center / contain no-repeat;
  filter: drop-shadow(0 18px 28px rgba(64, 105, 144, .2));
  opacity: .9;
  animation: mascotFloat 5s ease-in-out infinite;
}
.image-hero { --hero-image: url("https://images.unsplash.com/photo-1493976040374-85c8e12f0c0e?auto=format&fit=crop&w=1600&q=82"); }
.video-hero { --hero-image: url("https://images.unsplash.com/photo-1542051841857-5f90071e7989?auto=format&fit=crop&w=1600&q=82"); }
.forum-hero { --hero-image: url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1600&q=82"); }
.game-hero { --hero-image: url("https://images.unsplash.com/photo-1511512578047-dfb367046420?auto=format&fit=crop&w=1600&q=82"); }
.vr-hero { --hero-image: url("https://images.unsplash.com/photo-1593508512255-86ab42a8e620?auto=format&fit=crop&w=1600&q=82"); }
.math-hero { --hero-image: url("https://images.unsplash.com/photo-1635070041078-e363dbe005cb?auto=format&fit=crop&w=1600&q=82"); }
.cloud-hero { --hero-image: url("https://images.unsplash.com/photo-1451187580459-43490279c0fa?auto=format&fit=crop&w=1600&q=82"); }
.anime-hero { --hero-image: url("assets/anime-asuna-sword-art-online.jpg"); }
.music-hero { --hero-image: url("assets/music-your-name-sky.jpg"); }
.terminal-hero { --hero-image: url("assets/music-your-name-sunset.jpg"); }
.tool-band, .teaching-layout { padding: 34px clamp(16px, 5vw, 72px) 80px; }

.upload-form, .forum-form, .post-card, .empty, .side-panel, .formula-panel, .file-row, .media-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.upload-form {
  max-width: 1100px;
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1fr) auto;
  gap: 12px;
  margin: 0 auto 18px;
  padding: 16px;
}
input, textarea, select {
  width: 100%;
  border: 1px solid #c9dced;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 4px rgba(116, 199, 238, 0.2);
}
input[type="file"] { min-height: 44px; }
.form-message {
  min-height: 24px;
  margin: 0;
  color: #d17b22;
  font-weight: 800;
}
.upload-progress {
  position: relative;
  grid-column: 1 / -1;
  min-height: 28px;
  overflow: hidden;
  border: 1px solid rgba(116, 199, 238, 0.34);
  border-radius: 8px;
  background: rgba(234, 247, 255, 0.82);
}
.upload-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(116, 199, 238, 0.92), rgba(127, 199, 165, 0.9));
  transition: width .18s ease;
}
.upload-progress b {
  position: relative;
  z-index: 1;
  display: block;
  padding: 2px 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}
.upload-form .form-message { grid-column: 1 / -1; }
body[data-page="cloud"] .upload-form {
  grid-template-columns: minmax(160px, 0.8fr) minmax(130px, 0.55fr) minmax(170px, 0.75fr) minmax(220px, 1fr) auto;
}
.cloud-manage-form {
  max-width: 1100px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin: 0 auto 16px;
  padding: 0 16px;
}
.cloud-manage-form .form-message {
  grid-column: 1 / -1;
}
.cloud-labels {
  max-width: 1100px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 auto 16px;
}
.cloud-labels button {
  min-height: 40px;
}
.cloud-labels span {
  margin-left: 4px;
  font-size: 12px;
  opacity: 0.76;
}

.featured-gallery, .media-grid {
  max-width: 1100px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 0 auto;
}
.featured-gallery {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 18px;
}
.featured-gallery article, .media-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.featured-gallery article:hover, .media-card:hover, .post-card:hover, .file-row:hover, .portal-grid a:hover {
  border-color: rgba(255, 159, 189, 0.42);
  box-shadow: 0 20px 46px rgba(64, 105, 144, 0.18);
  transform: translateY(-4px);
}
.featured-gallery img, .media-card img, .media-card video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eef8ff;
}
.featured-gallery img {
  background:
    linear-gradient(135deg, rgba(255, 159, 189, 0.18), rgba(116, 199, 238, 0.2)),
    #fff;
}
.featured-gallery img, .media-card img[data-lightbox-src] {
  cursor: zoom-in;
}
.featured-gallery div, .media-card div {
  display: grid;
  gap: 6px;
  padding: 12px;
}
.featured-gallery span, .media-card span, .file-row span, .post-card span {
  color: var(--muted);
  font-size: 13px;
}

.anime-stage {
  position: relative;
  display: grid;
  gap: 0;
  padding: 0;
  background: #101827;
}
.anime-stage::before {
  content: none;
}
.anime-stage > * {
  position: relative;
  z-index: 1;
}
.anime-feature {
  position: relative;
  width: 100%;
  max-width: none;
  min-height: min(760px, calc(100vh - 78px));
  display: grid;
  align-items: end;
  overflow: hidden;
  margin: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(12, 18, 30, 0.42), rgba(12, 18, 30, 0.08)),
    var(--anime-bg) var(--anime-pos, center) / cover no-repeat,
    #0f1724;
  box-shadow: 0 26px 70px rgba(47, 68, 96, 0.22);
}
.anime-feature::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(12, 18, 30, 0.72), rgba(12, 18, 30, 0.22) 54%, rgba(12, 18, 30, 0.08)),
    radial-gradient(circle at 18% 24%, rgba(116, 199, 238, 0.34), transparent 28%);
}
.anime-feature div {
  position: relative;
  z-index: 1;
  max-width: 460px;
  margin: clamp(22px, 6vw, 72px);
  border-radius: 8px;
  background: rgba(12, 18, 30, 0.42);
  padding: clamp(22px, 5vw, 48px);
  color: #fff;
  backdrop-filter: blur(14px) saturate(1.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
}
.anime-feature span, .anime-scroll span {
  display: block;
  margin: 0 0 12px;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 800;
}
.anime-feature .anime-download, .anime-scroll .anime-download {
  width: fit-content;
  border-color: rgba(255, 255, 255, 0.24) !important;
  background: rgba(255, 255, 255, 0.78) !important;
}
.anime-feature h2 {
  margin: 0 0 10px;
  font-size: clamp(36px, 6vw, 72px);
  line-height: 1;
}
.anime-feature p:not(.kicker) {
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  font-weight: 800;
}
.anime-scroll {
  width: 100%;
  max-width: none;
  display: grid;
  gap: 0;
  margin: 0;
}
.anime-scroll article {
  position: relative;
  min-height: min(760px, 88vh);
  overflow: hidden;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(12, 18, 30, 0.62), rgba(12, 18, 30, 0.12) 58%, rgba(12, 18, 30, 0.04)),
    var(--anime-bg) var(--anime-pos, center) / cover no-repeat,
    #101827;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.anime-scroll article:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: none;
}
.anime-scroll div {
  position: absolute;
  left: clamp(22px, 6vw, 72px);
  bottom: clamp(22px, 6vw, 72px);
  width: min(420px, calc(100% - 32px));
  display: grid;
  gap: 5px;
  border-radius: 8px;
  background: rgba(12, 18, 30, 0.42);
  padding: clamp(22px, 5vw, 48px);
  color: #fff;
  backdrop-filter: blur(12px) saturate(1.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.08);
}
.anime-scroll strong {
  color: #fff;
  display: block;
  margin: 0 0 10px;
  font-size: clamp(22px, 4vw, 42px);
  line-height: 1;
}
.anime-scroll span {
  font-size: 14px;
}

.music-stage {
  min-height: 620px;
  padding: 34px clamp(16px, 5vw, 72px) 110px;
  background:
    linear-gradient(120deg, rgba(239, 248, 255, 0.78), rgba(255, 248, 251, 0.82)),
    url("assets/music-your-name-sunset.jpg") center / cover fixed;
}
body[data-custom-bg="true"] .music-stage,
body[data-custom-bg="true"] .terminal-stage {
  background:
    linear-gradient(
      120deg,
      rgba(239, 248, 255, var(--custom-stage-opacity)),
      rgba(255, 248, 251, var(--custom-stage-opacity))
    ),
    var(--custom-stage-bg) center / cover fixed;
}
.music-list, .terminal-list {
  width: 100%;
  max-width: 1100px;
  display: grid;
  gap: 12px;
  margin: 0 auto;
}
.music-row, .terminal-bg-row, .terminal-anime-row, .terminal-entry-row {
  width: 100%;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
  padding: 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.music-row.active {
  background: rgba(255, 248, 251, 0.9);
}
.music-row strong em {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 214, 107, 0.34);
  color: #9a6b00;
  font-size: 12px;
  font-style: normal;
}
.music-row span {
  color: var(--muted);
  font-size: 13px;
}
.music-row .form-message {
  grid-column: 1 / -1;
}
.music-float {
  position: fixed;
  z-index: 12;
  left: clamp(10px, 2vw, 22px);
  bottom: clamp(10px, 2vw, 22px);
  width: min(430px, calc(100vw - 20px));
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 38px 38px 38px 92px;
  gap: 8px;
  align-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 46px rgba(64, 105, 144, 0.22);
  padding: 10px;
  backdrop-filter: blur(20px) saturate(1.14);
  -webkit-backdrop-filter: blur(20px) saturate(1.14);
}
.music-float.collapsed {
  width: 48px;
  grid-template-columns: 1fr;
  padding: 8px;
}
.music-float.collapsed > :not(.music-collapse):not(audio) {
  display: none;
}
.music-collapse {
  min-height: 30px !important;
  padding: 0;
}
.music-float.collapsed .music-collapse {
  transform: rotate(180deg);
}
.music-float div {
  min-width: 0;
  display: grid;
}
.music-float strong, .music-float span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.music-float span {
  color: var(--muted);
  font-size: 12px;
}
.music-float button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(234, 247, 255, 0.88);
  color: var(--sky-deep);
  font-weight: 900;
  cursor: pointer;
}
.music-float input[type="range"] {
  padding: 0;
}
.music-seek {
  grid-column: 2 / -2;
  width: 100%;
}
.music-time {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}
.terminal-stage {
  display: grid;
  gap: 26px;
  padding: 34px clamp(16px, 5vw, 72px) 110px;
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.86), rgba(255, 248, 251, 0.92)),
    url("assets/music-your-name-sky.jpg") center / cover fixed;
}
.terminal-stage > section {
  width: min(100%, 1100px);
  margin: 0 auto;
}
.terminal-stage h2 {
  width: 100%;
  margin: 0 0 12px;
}
.terminal-bg-row {
  grid-template-columns: 92px minmax(240px, 1.3fr) minmax(180px, 0.7fr) minmax(180px, 0.75fr) auto;
  align-items: end;
}
.terminal-bg-row.has-stage-bg {
  grid-template-columns: 92px minmax(240px, 1.2fr) minmax(180px, 0.7fr) minmax(170px, 0.7fr);
}
.terminal-bg-row.has-stage-bg button[type="submit"] {
  grid-column: 4;
}
.terminal-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.terminal-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.terminal-field input {
  min-width: 0;
}
.terminal-field input[type="file"]::file-selector-button {
  margin-right: 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(234, 247, 255, 0.95);
  color: var(--sky-deep);
  padding: 8px 10px;
  font-weight: 900;
}
.terminal-bg-url {
  min-width: min(100%, 260px);
}
.opacity-control {
  align-self: stretch;
}
.opacity-control input {
  padding: 0;
}
.opacity-control b {
  color: var(--sky-deep);
  font-weight: 900;
}
.terminal-anime-row {
  grid-template-columns: repeat(3, minmax(130px, 1fr)) minmax(220px, 1.25fr) minmax(120px, .7fr) minmax(105px, .55fr) minmax(160px, .85fr) auto auto;
  align-items: end;
}
.terminal-entry-row {
  grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1.2fr) minmax(150px, .75fr) minmax(100px, .45fr) auto auto;
  align-items: end;
}
.terminal-announcement-row {
  margin: 0;
  grid-template-columns: minmax(180px, .65fr) minmax(280px, 1.4fr) auto;
}
.terminal-entry-row textarea {
  min-height: 76px;
  resize: vertical;
}
.terminal-help {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.terminal-anime-row .form-message, .terminal-bg-row .form-message, .terminal-entry-row .form-message {
  grid-column: 1 / -1;
}

.video-studio {
  max-width: 1100px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  margin: 0 auto;
}
.video-player-card, .video-playlist {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.player-screen {
  position: relative;
  background: linear-gradient(135deg, #dff3ff, #fff2f7);
}
#mainVideo {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 0;
  background: #dbeefa;
  object-fit: contain;
}
.video-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(238, 248, 255, 0.84)),
    url("https://images.unsplash.com/photo-1542051841857-5f90071e7989?auto=format&fit=crop&w=1200&q=72");
  background-size: cover;
  background-position: center;
}
.player-info {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}
.player-info div {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.player-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-info span {
  color: var(--muted);
  font-size: 13px;
}
.player-controls {
  display: grid;
  grid-template-columns: 42px auto minmax(130px, 1fr) auto 42px 110px 82px 42px;
  gap: 10px;
  align-items: center;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}
.player-button {
  width: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--sky-deep);
  cursor: pointer;
  font-weight: 900;
}
.player-controls span {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.player-controls input[type="range"] {
  padding: 0;
  accent-color: var(--sky-deep);
}
.player-controls select {
  min-height: 40px;
  border: 1px solid #c9dced;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
}
.disabled-link {
  opacity: 0.45;
  pointer-events: none;
}
.danger {
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(216, 91, 104, 0.38);
  border-radius: 8px;
  background: #fff4f5;
  color: #c24152;
  padding: 9px 13px;
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}
.danger:hover {
  background: #ffe7ea;
  border-color: rgba(216, 91, 104, 0.62);
}
.playlist-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.playlist-head span {
  color: var(--muted);
  font-size: 13px;
}
.playlist-list {
  max-height: 560px;
  overflow: auto;
  padding: 10px;
}
.playlist-item {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 10px;
  text-align: left;
  cursor: pointer;
}
.playlist-item:hover, .playlist-item.active {
  border-color: rgba(116, 199, 238, 0.5);
  background: #eef8ff;
}
.playlist-thumb {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #dff3ff, #fff0f6);
  color: var(--sky-deep);
  font-weight: 900;
}
.playlist-item span:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.playlist-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.playlist-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.playlist-item small {
  color: var(--muted);
}

.file-list, .post-list {
  max-width: 1100px;
  display: grid;
  gap: 12px;
  margin: 0 auto;
}
.file-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
}
.file-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.row-actions {
  display: flex !important;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}
.move-label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.move-label select {
  width: 150px;
  min-height: 38px;
  padding: 7px 10px;
}
.forum-form {
  max-width: 1100px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin: 0 auto 18px;
  padding: 16px;
}
.forum-form textarea, .forum-form .form-message { grid-column: 1 / -1; }
.forum-form textarea {
  min-height: 130px;
  resize: vertical;
}
.post-card, .empty { padding: 16px; }
.post-card h3 { margin: 0 0 8px; }
.post-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}
.post-head h3 { min-width: 0; }
.reply-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.reply-panel > strong {
  color: var(--sky-deep);
  font-size: 14px;
}
.reply-list {
  display: grid;
  gap: 8px;
}
.reply-card {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(116, 199, 238, 0.28);
  border-radius: 8px;
  background: rgba(238, 248, 255, 0.68);
  padding: 10px 12px;
}
.reply-card p {
  margin: 0;
  line-height: 1.7;
}
.reply-card div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.reply-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}
.reply-form textarea {
  min-height: 72px;
  resize: vertical;
}
.reply-form .form-message {
  grid-column: 1 / -1;
}
.compact {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}
.no-scroll {
  overflow: hidden;
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(21, 33, 44, 0.32);
  backdrop-filter: blur(4px);
}
.lightbox.hidden {
  display: none;
}
.lightbox figure {
  width: min(760px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 70px rgba(39, 61, 78, 0.28);
}
.lightbox img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 8px;
  object-fit: contain;
  background: #f4fbff;
}
.lightbox figcaption {
  min-height: 20px;
  color: var(--ink);
  font-weight: 900;
  text-align: center;
}
.lightbox-close {
  position: absolute;
  top: calc(50% - min(560px, calc(100vh - 32px)) / 2 - 14px);
  right: calc(50% - min(760px, calc(100vw - 32px)) / 2 - 14px);
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-size: 26px;
  font-weight: 900;
  cursor: pointer;
}

.game-shell {
  max-width: 1100px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  margin: 0 auto;
}
canvas, video {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f8ff;
}
#gameCanvas, #mathCanvas { width: 100%; }
#mathCanvas { min-height: 360px; }
.side-panel, .formula-panel {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 18px;
}
.side-panel span {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.vr-stage {
  position: relative;
  max-width: 1100px;
  height: 430px;
  overflow: hidden;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(116, 199, 238, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 159, 189, 0.16) 1px, transparent 1px),
    radial-gradient(circle at 50% 48%, rgba(116, 199, 238, 0.26), transparent 34%),
    #ffffff;
  background-size: 44px 44px, 44px 44px, auto, auto;
  box-shadow: var(--shadow);
  perspective: 900px;
}
.vr-ring {
  position: absolute;
  inset: 72px 20%;
  border: 2px solid rgba(47, 141, 199, 0.58);
  border-radius: 50%;
  animation: spin 9s linear infinite;
}
.ring-b { border-color: rgba(255, 159, 189, 0.72); animation-duration: 12s; }
.ring-c { border-color: rgba(127, 199, 165, 0.72); animation-duration: 15s; }
.vr-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff, #e7f7ff);
  color: var(--sky-deep);
  font-size: 34px;
  font-weight: 900;
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
}
@keyframes spin { to { transform: rotateX(66deg) rotateZ(360deg); } }

.teaching-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}
body[data-page="math"] [data-forum="math"] { grid-column: 1 / -1; }

.math-quiz-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(255, 170, 194, 0.32);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 46px rgba(95, 113, 151, 0.12);
  backdrop-filter: blur(16px);
}

.math-quiz-panel .section-head,
.math-question-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.math-quiz-panel .section-head h2,
.math-question-head h3 {
  margin: 2px 0 0;
}

.math-quiz-panel .section-head span,
.math-question-tools span {
  color: var(--muted);
  font-size: 14px;
}

.math-question-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.math-create-box,
.math-question-card,
.math-admin-grade article {
  border: 1px solid rgba(255, 170, 194, 0.26);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 12px 30px rgba(95, 113, 151, 0.10);
}

.math-create-box {
  padding: 14px 16px;
}

.math-create-box summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--ink);
}

.math-question-form,
.math-answer-form,
.math-admin-grade form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.math-question-form label,
.math-answer-form label,
.math-admin-grade label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.math-question-form input,
.math-question-form select,
.math-question-form textarea,
.math-answer-form input,
.math-answer-form textarea,
.math-admin-grade input {
  width: 100%;
}

.math-question-form textarea,
.math-answer-form textarea {
  min-height: 90px;
}

.math-body-field {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.math-editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.math-editor-toolbar span,
.math-body-field small {
  color: var(--muted);
  font-size: 13px;
}

.math-rich-editor {
  min-height: 168px;
  padding: 14px;
  border: 1px solid rgba(125, 148, 182, 0.25);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  line-height: 1.8;
  outline: none;
  overflow: auto;
}

.math-rich-editor:focus {
  border-color: rgba(116, 199, 238, 0.72);
  box-shadow: 0 0 0 4px rgba(116, 199, 238, 0.15);
}

.math-rich-editor:empty::before {
  content: attr(data-placeholder);
  color: rgba(93, 108, 133, 0.58);
}

.math-rich-editor.uploading {
  opacity: 0.68;
}

.math-rich-editor img,
.math-question-body img {
  display: block;
  max-width: min(100%, 720px);
  max-height: 520px;
  margin: 10px 0;
  border-radius: 14px;
  border: 1px solid rgba(125, 148, 182, 0.2);
  background: #fff;
  object-fit: contain;
}
.math-question-body img[data-lightbox-src] {
  cursor: zoom-in;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.math-question-body img[data-lightbox-src]:hover,
.math-question-body img[data-lightbox-src]:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(68, 92, 112, 0.18);
}

.math-paste-note {
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 170, 194, 0.34);
  border-radius: 12px;
  background: rgba(255, 246, 250, 0.86);
  color: #9b5264;
}

.math-question-form label:nth-of-type(3),
.math-question-form label:nth-of-type(4),
.math-question-form .math-options-field,
.math-question-form .math-answer-field,
.math-question-form button,
.math-question-form .form-message,
.math-answer-form label,
.math-answer-form button,
.math-answer-form .form-message {
  grid-column: 1 / -1;
}

.math-question-form.essay-mode .math-answer-field,
.math-question-form:not(.choice-mode) .math-options-field {
  display: none;
}

.math-question-list {
  display: grid;
  gap: 18px;
}

.math-question-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.math-question-body {
  margin: 0;
  line-height: 1.8;
  white-space: pre-wrap;
}

.math-question-body math {
  font-size: 1.08em;
}

.math-answer-key {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 214, 107, 0.22);
  color: #9a6b00;
  font-weight: 700;
}

.math-options {
  display: grid;
  gap: 10px;
}

.math-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(125, 148, 182, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
}

.math-options input {
  width: auto;
}

.math-submission-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(151, 214, 198, 0.20);
}

.math-submission-state span {
  color: var(--muted);
}

.math-rank,
.math-admin-grade {
  display: grid;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(125, 148, 182, 0.16);
}

.math-admin-grade summary {
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 246, 250, 0.82);
  color: var(--ink);
  font-weight: 800;
}

.math-admin-grade summary span {
  margin-left: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.math-rank ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.math-rank li {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.64);
}

.math-rank li span {
  font-weight: 800;
}

.math-rank small {
  margin-left: 8px;
  color: var(--muted);
}

.math-admin-grade article {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.math-admin-grade article > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.math-admin-grade article p {
  margin: 0;
  white-space: pre-wrap;
}

.math-admin-grade .inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.math-admin-grade .inline-check input {
  width: auto;
}

.auth-dialog, .profile-dialog, .language-dialog {
  width: min(420px, calc(100vw - 28px));
  border: 1px solid rgba(116, 199, 238, 0.24) !important;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66) !important;
  color: var(--ink);
  box-shadow: 0 22px 60px rgba(64, 105, 144, 0.22);
  backdrop-filter: blur(24px) saturate(1.12);
  -webkit-backdrop-filter: blur(24px) saturate(1.12);
}
.auth-dialog[open], .profile-dialog[open], .language-dialog[open] {
  animation: dialogIn .22s ease-out both;
}
.auth-dialog::backdrop, .profile-dialog::backdrop, .language-dialog::backdrop {
  background: rgba(90, 123, 156, 0.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.auth-dialog form {
  display: grid;
  gap: 14px;
}
.locked .tool-band, .locked .teaching-layout, .locked .anime-stage, .locked .music-stage, .locked .terminal-stage {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}
.access-gate {
  position: fixed;
  z-index: 9;
  inset: 92px clamp(16px, 5vw, 72px) auto;
  max-width: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  padding: 24px;
  backdrop-filter: blur(18px);
}
.access-gate h2 {
  margin: 0 0 8px;
  font-size: clamp(26px, 4vw, 44px);
}
.access-gate p { color: var(--muted); }
.close {
  justify-self: end;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--sky-deep);
  cursor: pointer;
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tabs button {
  background: var(--paper-soft);
  color: var(--muted);
}
.tabs .active {
  background: #eaf7ff;
  border-color: var(--sky);
  color: var(--sky-deep);
}
.profile-dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: min(680px, calc(100vh - 40px));
  overflow: hidden;
}
.language-card {
  display: grid;
  gap: 14px;
  padding: 2px;
}
.language-card h2 {
  margin: -10px 0 0;
}
.language-card select {
  min-height: 44px;
  border-color: rgba(116, 199, 238, 0.26) !important;
  background: rgba(255, 255, 255, 0.78) !important;
  box-shadow: 0 8px 20px rgba(73, 128, 171, 0.08);
}
.profile-card {
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 72px);
  overflow: auto;
  padding: 4px;
}
.profile-card h2 {
  margin: -10px 0 0;
  font-size: 30px;
}
.profile-uid {
  margin: -12px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.profile-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}
.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.profile-actions.with-return {
  grid-template-columns: 1fr 1fr 1fr;
}
.impersonation-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 187, 92, 0.42);
  border-radius: 8px;
  background: rgba(255, 249, 232, 0.78);
  color: #9a5b12;
  font-size: 13px;
  font-weight: 900;
}
.profile-meta div, .account-list article {
  border: 1px solid rgba(116, 199, 238, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 13px 14px;
  box-shadow: 0 8px 22px rgba(73, 128, 171, 0.08);
}
.profile-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.profile-meta dd {
  margin: 4px 0 0;
  font-weight: 900;
}
.account-list {
  display: grid;
  gap: 10px;
}
.account-list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.account-list strong {
  font-size: 18px;
}
.account-list-head span, .account-loading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.account-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.account-sort select {
  min-height: 34px;
  padding: 6px 28px 6px 10px;
}
.account-list article {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(220px, 0.9fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 64px;
}
.account-list article > div:first-child {
  display: grid;
  gap: 3px;
}
.account-list span {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-weight: 900;
}
.account-list em {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid rgba(255, 159, 189, 0.38);
  border-radius: 8px;
  background: rgba(255, 248, 251, 0.78);
  color: #c24152;
  padding: 2px 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}
.account-list small, .account-list time {
  color: var(--muted);
  font-size: 12px;
}
.title-form {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.account-manage {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.title-form input {
  min-height: 36px;
  padding: 8px 10px;
}
.title-form button,
.impersonate-button {
  min-height: 36px;
  padding: 7px 10px;
}
.account-list .owner-account {
  border-color: rgba(255, 159, 189, 0.72);
  background: linear-gradient(135deg, rgba(255, 248, 251, 0.92), rgba(234, 247, 255, 0.9));
  box-shadow: 0 12px 30px rgba(255, 159, 189, 0.18);
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes mascotFloat {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-14px) rotate(1.5deg); }
}
@keyframes softFloat {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(0, -18px, 0) scale(1.03); }
}

@media (max-width: 920px) {
  body::after {
    width: 86px;
    opacity: .58;
  }
  .hero::before {
    right: 16px;
    bottom: 28px;
    width: min(220px, 44vw);
    opacity: .46;
  }
  .page-hero::after, .about-hero::before {
    width: 118px;
    opacity: .5;
  }
  [data-shell] { grid-template-columns: auto 1fr auto; }
  .brand { grid-column: 1; }
  .top-tools { grid-column: 3; }
  .nav {
    grid-column: 1 / -1;
    justify-self: center;
    justify-content: center;
    overflow-x: auto;
  }
  .page { padding-top: 110px; }
  .portal-grid, .media-grid, .featured-gallery { grid-template-columns: repeat(2, 1fr); }
  .about-cards { grid-template-columns: 1fr; }
  .japan-band { grid-template-columns: 1fr; }
  .japan-cards, .quiz-results { grid-template-columns: 1fr; }
  .game-shell, .teaching-layout, .video-studio { grid-template-columns: 1fr; }
  .player-controls {
    grid-template-columns: 42px auto 1fr auto 42px;
  }
  #volumeBar, #speedSelect, #fullscreenBtn {
    grid-column: span 1;
  }
  .terminal-bg-row, .terminal-anime-row, .terminal-entry-row, .terminal-announcement-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .terminal-bg-row.has-stage-bg,
  .terminal-bg-row.has-stage-bg button[type="submit"] {
    grid-column: 1 / -1;
  }
  .terminal-stage {
    padding-inline: 16px;
    gap: 22px;
  }
  .terminal-list {
    max-width: 100%;
    gap: 14px;
  }
  .terminal-bg-row button,
  .terminal-anime-row button,
  .terminal-entry-row button {
    width: 100%;
  }
  .terminal-field,
  .terminal-bg-url {
    min-width: 0;
  }
  .terminal-help {
    padding: 9px 10px;
    border-radius: 8px;
    background: rgba(234, 247, 255, 0.72);
  }
}
@media (max-width: 620px) {
  .user-badge { display: none; }
  [data-shell] {
    gap: 10px;
    padding-inline: 14px;
  }
  .brand span:last-child {
    max-width: 132px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .portal-grid, .media-grid, .featured-gallery, .upload-form, .cloud-manage-form, .forum-form, .quiz-form, .math-question-form, .math-answer-form, .math-admin-grade form { grid-template-columns: 1fr; }
  .math-quiz-panel .section-head, .math-question-head, .math-admin-grade article > div { flex-direction: column; }
  .update-notice {
    margin: 18px 14px 0;
  }
  .terminal-stage {
    gap: 20px;
    padding: 22px 12px 110px;
    background-attachment: scroll;
  }
  body[data-page="terminal"] .page {
    padding-top: 96px;
  }
  body[data-page="terminal"] .page-hero {
    min-height: 250px;
    padding: 118px 16px 30px;
  }
  body[data-page="terminal"] .page-hero h1 {
    font-size: 38px;
  }
  .terminal-stage > section {
    display: grid;
    gap: 10px;
  }
  .terminal-stage h2 {
    margin: 0 2px 2px;
    padding-left: 10px;
    border-left: 4px solid rgba(116, 199, 238, 0.72);
    font-size: 22px;
    line-height: 1.25;
  }
  .terminal-bg-row,
  .terminal-anime-row,
  .terminal-entry-row {
    gap: 12px;
    padding: 14px;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(64, 105, 144, 0.13);
  }
  .terminal-bg-row > *,
  .terminal-anime-row > *,
  .terminal-entry-row > * {
    grid-column: 1 / -1 !important;
  }
  .terminal-field {
    gap: 7px;
  }
  .terminal-field span {
    font-size: 13px;
    color: #39546f;
  }
  .terminal-field input,
  .terminal-field textarea,
  .terminal-field select {
    min-height: 44px;
    font-size: 16px;
  }
  .terminal-entry-row textarea,
  .terminal-announcement-row textarea {
    min-height: 104px;
  }
  .terminal-bg-row button,
  .terminal-anime-row button,
  .terminal-entry-row button {
    min-height: 44px;
  }
  .terminal-help {
    font-size: 12px;
    line-height: 1.65;
  }
  .terminal-bg-row .form-message,
  .terminal-anime-row .form-message,
  .terminal-entry-row .form-message {
    min-height: 18px;
  }
  .anime-feature, .anime-scroll article { min-height: 520px; }
  .hero { padding-top: 150px; }
  .access-gate { inset: 132px 16px auto; }
  .file-row {
    align-items: stretch;
    flex-direction: column;
  }
  .profile-meta {
    grid-template-columns: 1fr;
  }
  .profile-actions,
  .profile-actions.with-return {
    grid-template-columns: 1fr;
  }
  .account-list article {
    align-items: stretch;
    grid-template-columns: 1fr;
  }
  .account-manage {
    grid-template-columns: 1fr;
  }
  .title-form {
    grid-template-columns: 1fr auto;
  }
  .row-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .move-label, .move-label select {
    width: 100%;
  }
  .player-info, .player-controls {
    grid-template-columns: 1fr;
  }
  .player-info {
    align-items: stretch;
  }
  .player-button {
    width: 100%;
  }
  .music-float {
    grid-template-columns: 30px 1fr 34px 34px 34px;
  }
  .music-float input[type="range"], .music-time {
    grid-column: 1 / -1;
    width: 100%;
  }
  .music-float.collapsed {
    grid-template-columns: 1fr;
  }
}
