:root {
  --bg: #eef0e7;
  --bg-2: #e2e5d7;
  --paper: rgba(255, 252, 246, 0.92);
  --paper-strong: #fffdf8;
  --ink: #2e3a2e;
  --muted: #6b7664;
  --line: rgba(136, 152, 124, 0.28);
  --accent: #c06a3c;
  --accent-2: #718c58;
  --accent-soft: #eef2e3;
  --gold: #c8a25a;
  --danger: #ba5a5f;
  --shadow: 0 14px 30px rgba(63, 72, 50, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.66), transparent 26%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  font-family: "LXGW WenKai", "KaiTi", "Kaiti SC", "STKaiti", "Noto Serif SC", serif;
  min-height: 100vh;
}

body.auth-mode {
  overflow: hidden;
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 10%, rgba(255, 255, 255, 0.58), transparent 22%),
    radial-gradient(circle at 88% 12%, rgba(215, 224, 198, 0.34), transparent 20%),
    radial-gradient(circle at 78% 82%, rgba(207, 216, 191, 0.28), transparent 24%);
  z-index: 0;
}

.hero {
  position: relative;
  z-index: 1;
  padding: 2.2rem 1rem 1rem;
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.badge {
  display: inline-block;
  margin: 0;
  padding: 0.2rem 0.7rem;
  background: rgba(255, 127, 80, 0.16);
  border: 1px solid rgba(255, 127, 80, 0.3);
  border-radius: 999px;
  font-size: 0.9rem;
}

h1 {
  margin: 0.8rem 0 0.3rem;
  font-size: clamp(1.6rem, 2.5vw, 2.4rem);
  line-height: 1.2;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 1.2rem 1.2rem 1.5rem;
}

body.auth-mode .container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

body.app-mode .container {
  display: block;
  min-height: auto;
}

.card {
  background: var(--paper);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(162, 173, 145, 0.28);
  border-radius: 22px;
  padding: 1.15rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.login-card {
  max-width: 720px;
  margin: 0 auto;
}

.group-login-card {
  width: 100%;
  max-width: 980px;
  border-radius: 30px;
  border-color: #d2d8c5;
  background: rgba(246, 245, 238, 0.94);
  padding: 1.05rem 1.1rem 0.92rem;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  margin: 0;
}

.group-title {
  margin: 0.25rem 0 0.75rem;
  font-size: clamp(1.6rem, 2.15vw, 2.45rem);
  line-height: 1.2;
  text-align: center;
  color: #536248;
}

.group-shell {
  border: 1px solid #ccd4bc;
  border-radius: 18px;
  padding: 0.7rem;
  margin-bottom: 0.65rem;
  background: rgba(255, 255, 255, 0.55);
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
}

.group-tile {
  border: 1px solid #c2cdb4;
  border-radius: 14px;
  height: 48px;
  background: rgba(255, 252, 247, 0.86);
  color: #59674d;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 180ms ease;
}

.group-tile:hover {
  border-color: #9ead85;
  transform: translateY(-1px);
}

.group-tile.active {
  background: #f4f2df;
  border-color: #8fa06d;
  color: #576744;
  box-shadow: 0 0 0 4px rgba(143, 160, 109, 0.18);
}

.group-status-btn {
  width: 100%;
  height: 52px;
  border: 1px solid #ccd3c0;
  border-radius: 14px;
  background: rgba(252, 250, 243, 0.95);
  color: #57674c;
  font-size: 1.08rem;
  font-weight: 700;
  margin-bottom: 0.62rem;
  cursor: pointer;
}

.group-status-btn.active {
  background: #f5f2df;
  border-color: #8fa06d;
  color: #576744;
}

.group-enter-btn {
  width: 100%;
  height: 56px;
  border-radius: 14px;
  border: 0;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  background: linear-gradient(90deg, #ab6d3f 0%, #cf8d5b 100%);
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(152, 94, 50, 0.26);
}

.group-enter-btn:hover {
  filter: brightness(1.03);
}

.group-footer {
  margin-top: 0.45rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}

.group-footer .hint {
  color: #6b7664;
}

h2,
h3 {
  margin-top: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.95rem;
}

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

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.72rem 0.8rem;
  background: rgba(255, 253, 248, 0.98);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.98);
  color: var(--ink);
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(36, 52, 71, 0.14);
}

.btn.primary {
  background: linear-gradient(90deg, var(--accent) 0%, #d28b58 100%);
  border-color: rgba(192, 106, 60, 0.45);
  color: #fff;
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.row {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.hidden {
  display: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.topbar-shell {
  padding: 1rem 1.15rem;
}

.topbar-copy {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.topbar-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0.14em;
}

.topbar-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.topbar-title-row strong {
  font-size: 1.18rem;
  color: #45533d;
}

.topbar-actions {
  justify-content: flex-end;
}

.tab-nav {
  display: none;
}

.tab-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}

.tab-panel .card {
  animation: fadeSlideIn 340ms ease both;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid-2 {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
}

.student-stage {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.5fr 1fr;
  align-items: stretch;
}

.poetry-hero-card {
  overflow: hidden;
  position: relative;
}

.poetry-hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5), transparent 45%),
    radial-gradient(circle at 90% 20%, rgba(212, 188, 132, 0.16), transparent 24%);
  pointer-events: none;
}

.hero-badge-row,
.hero-steps {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  background: rgba(192, 106, 60, 0.14);
  border: 1px solid rgba(192, 106, 60, 0.2);
  color: #9a603a;
  font-size: 0.88rem;
}

.hero-badge.soft {
  background: rgba(113, 140, 88, 0.12);
  border-color: rgba(113, 140, 88, 0.2);
  color: #617453;
}

.poetry-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 1rem;
  margin-top: 0.85rem;
  align-items: end;
}

.poetry-hero-copy h2 {
  margin: 0.2rem 0 0.65rem;
  font-size: clamp(2rem, 3vw, 3.2rem);
  color: #4d5d43;
}

.hero-lead {
  margin: 0;
  max-width: 38rem;
  color: #5d6856;
  font-size: 1.04rem;
  line-height: 1.8;
}

.hero-steps {
  margin-top: 1rem;
}

.hero-steps span {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(155, 165, 137, 0.3);
  color: #59674d;
}

.hero-aside {
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(155, 165, 137, 0.24);
}

.aside-title {
  margin: 0 0 0.7rem;
  color: #49563f;
  font-size: 1rem;
  font-weight: 700;
}

.compact-list {
  margin-top: 0;
  margin-bottom: 0;
}

.compact-list li {
  margin-bottom: 0.45rem;
}

.module-nav-stage {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.section-kicker {
  margin: 0 0 0.25rem;
  color: #9a8862;
  letter-spacing: 0.08em;
  font-size: 0.84rem;
}

.section-head h3 {
  margin: 0;
  font-size: 1.35rem;
  color: #4c5b42;
}

.module-nav-card h3 {
  margin-bottom: 0;
}

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

.module-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 0.8rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(146, 160, 127, 0.28);
  text-decoration: none;
  color: #4e6045;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(244, 244, 234, 0.9));
  font-weight: 700;
  text-align: center;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.module-nav-btn:hover {
  border-color: rgba(146, 160, 127, 0.5);
  box-shadow: 0 10px 20px rgba(80, 93, 63, 0.08);
  transform: translateY(-1px);
}

.student-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(340px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.workspace-main,
.workspace-side {
  display: grid;
  gap: 1rem;
}

.feature-card,
.writing-card,
.side-card {
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.95), rgba(250, 248, 240, 0.88));
}

.writing-card textarea {
  min-height: 300px;
}

.toolbar-row {
  margin-top: 0.2rem;
}

.toolbar-row input,
.toolbar-row button,
.toolbar-row select {
  flex: 1 1 180px;
}

.side-card .btn.primary,
.side-card .btn {
  width: 100%;
}

.side-card .toolbar-row .btn {
  flex: 1 1 100%;
}

.growth-card .chart {
  margin-bottom: 0.85rem;
}

.list {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.5rem;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.82);
}

.list-item p {
  margin: 0.35rem 0;
}

pre {
  margin: 0.45rem 0;
  white-space: pre-wrap;
  line-height: 1.65;
  font-family: inherit;
  background: #fffdf7;
  border: 1px solid rgba(229, 219, 193, 0.7);
  border-radius: 12px;
  padding: 0.7rem;
}

.plain-list {
  margin: 0.7rem 0 0;
  padding-left: 1.1rem;
}

.plain-list li {
  margin-bottom: 0.35rem;
}

.examples {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.65rem;
}

.example-card {
  border: 1px dashed rgba(154, 136, 98, 0.35);
  border-radius: 14px;
  padding: 0.65rem;
  background: rgba(255, 250, 239, 0.9);
}

.art-wrap {
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  min-height: 230px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.8);
  overflow: hidden;
}

.art-wrap img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

.feedback-box {
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  padding: 0.75rem;
}

.stars {
  color: var(--gold);
  font-size: 1.1rem;
}

.showcase-box {
  margin-top: 0.7rem;
}

.share-link {
  word-break: break-all;
  color: #1264a3;
}

.stats {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  margin-bottom: 0.8rem;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
  padding: 0.65rem;
}

.stat .k {
  color: var(--muted);
  font-size: 0.85rem;
}

.stat .v {
  font-size: 1.15rem;
  font-weight: 700;
}

.chart {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  min-height: 180px;
  overflow: hidden;
}

.book-modal {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  padding: 0.8rem;
  margin-top: 0.7rem;
}

.book-page {
  border-bottom: 1px dashed var(--line);
  padding: 0.6rem 0;
}

.student-lite-shell {
  display: grid;
  gap: 1rem;
}

.student-lite-head h2 {
  margin: 0.1rem 0 0.6rem;
  color: #43523b;
  font-size: clamp(1.45rem, 2.2vw, 2rem);
}

.module-outline-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.75rem;
}

.module-outline-item {
  border: 1px solid rgba(146, 160, 127, 0.28);
  border-radius: 14px;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.82);
}

.module-outline-item strong {
  display: block;
  margin-bottom: 0.35rem;
  color: #4d5d43;
}

.module-outline-item p {
  margin: 0;
  color: #64745b;
  line-height: 1.6;
  font-size: 0.9rem;
}

.simple-modules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.simple-module-card {
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.95), rgba(250, 248, 240, 0.88));
}

.simple-module-card h3 {
  margin: 0 0 0.3rem;
  color: #4b5a41;
  font-size: 1.2rem;
}

.simple-module-card .hint {
  margin: 0 0 0.65rem;
}

.simple-module-card .toolbar-row {
  margin-bottom: 0.35rem;
}

.simple-module-card textarea {
  min-height: 96px;
}

.simple-module-card #poemText {
  min-height: 220px;
}

.archive-toolbar {
  margin-top: 0.35rem;
}

.simple-module-card .stats {
  margin-top: 0.75rem;
}

@media (max-width: 1400px) {
  .group-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .group-title {
    font-size: clamp(1.7rem, 3vw, 2.6rem);
  }
}

@media (max-width: 1024px) {
  .group-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .group-tile {
    height: 50px;
    font-size: 1.2rem;
  }

  .group-status-btn {
    height: 52px;
    font-size: 1.05rem;
  }

  .group-enter-btn {
    height: 56px;
    font-size: 1.2rem;
  }
}

@media (max-width: 900px) {
  .student-stage,
  .student-workspace,
  .grid-2,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .simple-modules-grid {
    grid-template-columns: 1fr;
  }

  .poetry-hero-grid,
  .module-nav-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-head {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0.6rem 0.6rem 1.2rem;
  }

  .group-login-card {
    width: calc(100vw - 1.2rem);
    border-radius: 22px;
    padding: 1rem;
  }

  .group-shell {
    border-radius: 16px;
    padding: 0.7rem;
  }

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

  .group-tile {
    height: 56px;
    border-radius: 14px;
    font-size: 1.35rem;
  }

  .group-status-btn {
    height: 56px;
    border-radius: 14px;
    font-size: 1.1rem;
  }

  .group-enter-btn {
    height: 60px;
    border-radius: 14px;
    font-size: 1.35rem;
  }

  .group-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .poetry-hero-grid,
  .module-nav-grid {
    grid-template-columns: 1fr;
  }

  .module-outline-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .btn {
    flex: 1 1 auto;
  }
}
