﻿:root {
  --bg: #f3f3f4;
  --surface: #ffffff;
  --border: #dedee1;
  --text: #17181a;
  --muted: #6c7078;
  --accent: #141519;
  --chip: #f7f7f8;
  --link: #17488e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

.app {
  width: 90%;
  max-width: none;
  margin: 0 auto;
  padding: 22px 32px 110px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg);
  padding-top: 6px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 10px;
}

.brand-left {
  min-width: 250px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-name {
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 800;
  letter-spacing: 0.25px;
}

.search-box {
  flex: 1;
  max-width: 460px;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 12px;
  position: relative;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 16px;
  width: 100%;
  color: #2d3138;
}

.search-box input.search-miss {
  color: #9a1d1d;
}

.search-box.search-box-enhanced {
  background: #ffffff;
  border-color: #d8dde8;
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: #ffffff;
  border: 1px solid #dde2ec;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.16);
  z-index: 80;
}

.search-suggestion-item {
  margin: 0;
}

.search-suggestion-btn {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 14px;
  cursor: pointer;
  display: grid;
  gap: 2px;
}

.search-suggestion-item.active .search-suggestion-btn,
.search-suggestion-btn:hover {
  background: #f3f7ff;
}

.search-suggestion-title {
  font-size: 14px;
  font-weight: 700;
  color: #121620;
}

.search-suggestion-meta {
  font-size: 12px;
  color: #657084;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: #676b74;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.icon-btn:hover {
  background: #ececef;
  border-color: #d9dadf;
}

.icon-btn .notif {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 11px;
  font-weight: 700;
  color: #646872;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.nav-link {
  font-size: clamp(13px, 1vw, 16px);
  font-weight: 700;
  color: #2f333a;
  padding: 10px 0;
  border-bottom: 3px solid transparent;
}

.nav-link.active {
  color: #0f1115;
  border-bottom-color: #111318;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.content-col {
  min-width: 0;
}

.sidebar-col {
  display: grid;
  gap: 14px;
  align-content: start;
}

.composer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.composer-button {
  width: 100%;
  border: 0;
  background: #f6f6f8;
  border-radius: 10px;
  text-align: left;
  font-size: clamp(16px, 1.3vw, 21px);
  font-weight: 700;
  color: #3f434a;
  padding: 12px 14px;
  cursor: pointer;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: #50545b;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
}

.chip.active {
  border-color: #c8cbd5;
  background: var(--chip);
  color: #141519;
}

.welcome {
  padding: 14px 16px;
  margin-bottom: 14px;
}

.welcome h3 {
  margin: 0 0 8px;
  font-size: clamp(18px, 1.5vw, 24px);
}

.welcome-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.welcome-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #17488e;
  font-weight: 700;
}

.welcome-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #989ca5;
  flex: 0 0 auto;
}

.feed {
  display: grid;
  gap: 12px;
}

.post-card {
  padding: 16px;
}

.post-card.is-pinned {
  border-color: #ead174;
  box-shadow: 0 0 0 2px rgba(234, 209, 116, 0.17);
}

.post-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #0f1115;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.author-name {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.post-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.pin-label {
  color: #3b4048;
  font-size: 13px;
  font-weight: 800;
}

.post-title {
  margin: 4px 0 8px;
  font-size: clamp(22px, 1.7vw, 32px);
  line-height: 1.15;
}

.post-body {
  margin: 0 0 12px;
  color: #22262b;
  font-size: clamp(16px, 1.2vw, 21px);
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  border-top: 1px solid #ececf0;
  padding-top: 10px;
  color: #4f535c;
  font-size: 14px;
  font-weight: 700;
}

.post-actions span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pager {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #5e626b;
}

.pager-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pager-btn {
  border: none;
  background: transparent;
  color: #6d717b;
  font-weight: 700;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
}

.pager-btn:hover:not(:disabled) {
  background: #ececef;
  color: #111318;
}

.pager-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager-page {
  min-width: 18px;
  text-align: center;
  color: #131418;
  font-weight: 800;
}

.pager-count {
  font-weight: 700;
}

.group-sidebar {
  padding: 14px;
}

.group-cover {
  height: 150px;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(125deg, #1b2e41 0%, #446f8d 45%, #d8af8e 100%);
  margin-bottom: 12px;
}

.group-cover::before {
  content: "CND";
  position: absolute;
  left: 12px;
  top: 8px;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(40px, 4vw, 58px);
  font-weight: 900;
  letter-spacing: 1px;
}

.group-cover::after {
  content: "MOTIVE Â· CLARITY Â· ACTION";
  position: absolute;
  left: 14px;
  bottom: 12px;
  color: #f2f2f2;
  font-size: 12px;
  font-weight: 800;
}

.group-cover-person {
  position: absolute;
  right: 18px;
  bottom: 0;
  width: 70px;
  height: 220px;
  border-radius: 40px 40px 0 0;
  background: linear-gradient(#f4d4bc, #b9896d);
  border: 4px solid rgba(255, 255, 255, 0.28);
  border-bottom: 0;
}

.group-sidebar h2 {
  margin: 0 0 4px;
  font-size: clamp(24px, 1.8vw, 34px);
}

.group-url {
  margin: 0 0 10px;
  color: #50545c;
  font-size: 14px;
  font-weight: 700;
}

.group-text {
  margin: 0 0 14px;
  font-size: clamp(17px, 1.25vw, 24px);
}

.group-stats {
  border-top: 1px solid #ebecef;
  border-bottom: 1px solid #ebecef;
  margin-bottom: 12px;
  padding: 12px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
}

.group-stats strong {
  display: block;
  font-size: clamp(19px, 1.4vw, 24px);
}

.group-stats span {
  font-size: 12px;
  color: #666a73;
}

.side-members {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.invite-btn {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8f8f9;
  padding: 12px;
  color: #2d3138;
  font-weight: 800;
  cursor: pointer;
}

.powered {
  margin-top: 10px;
  text-align: center;
  color: #646872;
  font-size: 14px;
}

.leader-mini {
  padding: 14px;
}

.leader-mini h3 {
  margin: 0 0 12px;
  font-size: clamp(20px, 1.5vw, 26px);
}

.leader-line {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #ececf0;
  border-bottom: 1px solid #ececf0;
  padding: 10px 0;
  margin-bottom: 10px;
}

.leader-line strong {
  margin-left: auto;
  color: #3c4ec4;
}

.small-link {
  color: #17488e;
  font-size: 14px;
  font-weight: 700;
}

.avatar {
  border: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: #ffffff;
  background: linear-gradient(145deg, #2e3642, #0f1114);
}

.avatar-xs {
  width: 28px;
  height: 28px;
  font-size: 10px;
}

.avatar-sm {
  width: 34px;
  height: 34px;
  font-size: 11px;
}

.avatar-md {
  width: 44px;
  height: 44px;
  font-size: 14px;
}

.avatar-xl {
  width: 124px;
  height: 124px;
  font-size: 30px;
  border: 4px solid #ffffff;
  box-shadow: 0 0 0 4px #4158d7;
}

.avatar.monkey {
  background: radial-gradient(circle at 35% 30%, #dbb286, #5e3f2a 52%, #1a1412 100%);
}

.bottom-search {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  width: calc(100% - 52px);
  max-width: 1160px;
  height: 56px;
  border-radius: 12px;
  border: 1px solid #d8d8dc;
  background: #f7f7f8;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  z-index: 55;
}

.bottom-search input {
  border: 0;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 16px;
  color: #33363d;
}

.notif-badge {
  color: #636872;
  font-size: 12px;
  font-weight: 700;
}

.search-icon {
  width: 14px;
  height: 14px;
  border: 2px solid #838791;
  border-radius: 50%;
  position: relative;
  flex: 0 0 auto;
}

.search-icon::after {
  content: "";
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: #838791;
  position: absolute;
  right: -6px;
  bottom: -3px;
  transform: rotate(45deg);
}

.bubble-icon {
  width: 17px;
  height: 13px;
  border: 2px solid #8b8f98;
  border-radius: 8px;
  position: relative;
  display: inline-block;
}

.bubble-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  bottom: -5px;
  border: 5px solid transparent;
  border-top-color: #8b8f98;
  border-right: 0;
}

.bell-icon {
  width: 16px;
  height: 16px;
  border: 2px solid #8b8f98;
  border-radius: 9px 9px 7px 7px;
  position: relative;
  display: inline-block;
}

.bell-icon::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 4px;
  width: 6px;
  height: 4px;
  border: 2px solid #8b8f98;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}

.caret {
  width: 8px;
  height: 8px;
  border-right: 2px solid #7f838b;
  border-bottom: 2px solid #7f838b;
  transform: rotate(45deg);
  margin-top: -2px;
}

.classroom-wrap {
  padding-top: 4px;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  grid-auto-rows: 1fr;
}

.course-card {
  min-height: 370px;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.course-cover {
  height: 220px;
  background: linear-gradient(125deg, #f8f8f9, #d7dce2);
}

.course-cover.is-motive {
  background: linear-gradient(120deg, #ffffff, #dbe8f2);
  position: relative;
  overflow: hidden;
}

.course-cover.is-motive::before {
  content: "MOTIVE";
  position: absolute;
  left: 14px;
  top: 18px;
  font-size: clamp(24px, 2vw, 34px);
  font-weight: 900;
}

.course-cover.is-motive::after {
  content: "CND";
  position: absolute;
  right: 16px;
  top: 8px;
  font-size: clamp(46px, 4vw, 68px);
  font-weight: 900;
  color: rgba(34, 96, 141, 0.5);
}

.course-content {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.course-title {
  margin: 0;
  font-size: clamp(20px, 1.5vw, 29px);
  line-height: 1.2;
}

.course-desc {
  margin: 0;
  color: #41464e;
  font-size: clamp(15px, 1.05vw, 18px);
  flex: 1;
}

.course-progress {
  margin-top: auto;
  color: #3f434a;
  font-size: 13px;
  font-weight: 800;
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.about-main {
  padding: 18px;
}

.about-title {
  margin: 0 0 14px;
  font-size: clamp(26px, 2vw, 38px);
}

.about-cover {
  height: 380px;
  border-radius: 10px;
  background: linear-gradient(125deg, #1b2e41 0%, #406e8f 45%, #d8af8e 100%);
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
}

.about-cover::before {
  content: "CND";
  position: absolute;
  left: 16px;
  top: 10px;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(84px, 8vw, 126px);
  font-weight: 900;
}

.about-cover::after {
  content: "MOTIVE - CLARITY - ACTION";
  position: absolute;
  left: 16px;
  bottom: 14px;
  color: #ffffff;
  font-size: clamp(16px, 1.3vw, 21px);
  font-weight: 800;
}

.about-cover-person {
  position: absolute;
  right: 32px;
  bottom: 0;
  width: 170px;
  height: 280px;
  border-radius: 90px 90px 0 0;
  background: linear-gradient(#f5d8c2, #bf9172);
  border: 5px solid rgba(255, 255, 255, 0.28);
  border-bottom: 0;
}

.about-logo-square {
  width: 88px;
  height: 88px;
  border: 4px solid #32363e;
  border-radius: 14px;
  margin: 14px 0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  border-bottom: 1px solid #ebebee;
  margin-bottom: 16px;
  padding-bottom: 12px;
}

.meta-item {
  font-size: clamp(16px, 1.1vw, 19px);
  font-weight: 800;
  color: #2e3138;
}

.about-main p {
  margin: 0 0 14px;
  max-width: 95%;
  font-size: clamp(18px, 1.35vw, 24px);
}

.terms-link {
  margin-top: 20px;
  display: inline-block;
  font-size: 14px;
  color: #5f6470;
}

.leader-summary {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 18px;
}

.profile-pane {
  text-align: center;
}

.profile-ring {
  position: relative;
  display: inline-block;
  margin-bottom: 8px;
}

.rank-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  background: #4b60e2;
  color: #ffffff;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 6px;
  bottom: 6px;
}

.profile-pane h2 {
  margin: 4px 0 0;
  font-size: clamp(24px, 1.8vw, 34px);
}

.profile-pane p {
  margin: 2px 0;
  color: #5f6370;
  font-weight: 700;
}

.levels-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
}

.level-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 0;
}

.lock {
  font-size: 16px;
  opacity: 0.75;
  line-height: 1.3;
}

.level-item h4 {
  margin: 0;
  font-size: clamp(17px, 1.2vw, 22px);
}

.level-item p {
  margin: 0;
  color: #676b74;
  font-size: 13px;
  font-weight: 700;
}

.last-updated {
  margin: 12px 0 10px;
  color: #5f6470;
  font-size: 14px;
  font-style: italic;
}

.leaderboard-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.board-card {
  padding: 14px;
}

.board-card h3 {
  margin: 0 0 12px;
  font-size: clamp(19px, 1.4vw, 25px);
}

.board-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #ececf0;
  padding-top: 10px;
}

.board-entry strong {
  margin-left: auto;
  color: #4256cc;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

.event-list,
.calendar-panel {
  padding: 16px;
}

.event-list h2,
.calendar-panel h2,
.member-list h2 {
  margin: 0 0 14px;
  font-size: clamp(23px, 1.8vw, 32px);
}

.event-item {
  background: #fafafb;
  border: 1px solid #ececf0;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.event-time {
  color: #3d4270;
  font-size: 14px;
  font-weight: 800;
}

.event-title {
  margin: 4px 0;
  font-size: clamp(18px, 1.3vw, 24px);
  font-weight: 800;
}

.event-desc {
  margin: 0;
  color: #5b606a;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.day-head {
  text-align: center;
  color: #6d7078;
  font-size: 12px;
  font-weight: 800;
  padding-bottom: 4px;
}

.day-cell {
  min-height: 56px;
  border-radius: 8px;
  border: 1px solid #e3e4e8;
  background: #ffffff;
  font-weight: 700;
  padding: 6px;
}

.day-cell.has-event {
  background: #eef2ff;
  border-color: #b5c1ff;
  color: #1f2f80;
}

.members-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

.member-list,
.member-sidebar {
  padding: 14px;
}

.member-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 140px;
  gap: 12px;
  align-items: center;
  border-top: 1px solid #ececf0;
  padding: 10px;
}

.member-row:first-of-type {
  border-top: 0;
}

.member-name {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.member-role {
  margin: 0;
  color: #666b74;
  font-size: 14px;
}

.member-level {
  text-align: right;
  color: #373d47;
  font-weight: 800;
}

.member-level small {
  display: block;
  color: #676d77;
  font-weight: 700;
}

.stat-stack {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-box {
  background: #fafafb;
  border: 1px solid #ececf0;
  border-radius: 10px;
  text-align: center;
  padding: 12px;
}

.stat-box strong {
  display: block;
  font-size: 24px;
}

.stat-box span {
  color: #666b74;
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .page-grid,
  .about-layout,
  .calendar-layout,
  .members-layout {
    grid-template-columns: 1fr;
  }

  .sidebar-col {
    grid-template-columns: 1fr 1fr;
  }

  .leader-summary {
    grid-template-columns: 1fr;
  }

  .leaderboard-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app {
    padding: 16px 14px 100px;
  }

  .brand-row {
    gap: 10px;
    flex-wrap: wrap;
  }

  .brand-left {
    min-width: 0;
  }

  .search-box {
    order: 3;
    max-width: none;
    min-width: 0;
    width: 100%;
    background: #ffffff;
    border-color: var(--border);
  }

  .main-nav {
    overflow-x: auto;
    white-space: nowrap;
    gap: 16px;
  }

  .course-grid {
    grid-template-columns: 1fr 1fr;
  }

  .levels-list {
    grid-template-columns: 1fr;
  }

  .member-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .member-level {
    text-align: left;
  }

  .sidebar-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .course-grid {
    grid-template-columns: 1fr;
  }

  .bottom-search {
    width: calc(100% - 20px);
    bottom: 8px;
  }

  .about-cover {
    height: 260px;
  }

  .about-main p {
    max-width: 100%;
  }
}

/* Welcome page single front-card layout */
.welcome-only {
  max-width: 920px;
  margin: 0 auto;
}

.front-page-card {
  padding: 16px;
}

.front-page-card .group-cover {
  height: 220px;
  margin-bottom: 16px;
}

.front-page-card h2 {
  margin: 0 0 6px;
  font-size: clamp(42px, 5vw, 56px);
  line-height: 1.02;
}

.front-page-card .group-url {
  margin: 0 0 14px;
  font-size: 34px;
  line-height: 1.1;
  color: #2f3440;
}

.front-page-card .group-text {
  margin: 0 0 18px;
  font-size: clamp(22px, 2.2vw, 42px);
  line-height: 1.25;
}

.front-page-card .group-stats {
  margin-bottom: 16px;
  padding: 14px 0;
}

.front-page-card .group-stats strong {
  font-size: clamp(26px, 2.2vw, 34px);
}

.front-page-card .group-stats span {
  font-size: 22px;
}

.front-page-card .side-members {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .welcome-only {
    max-width: 100%;
  }

  .front-page-card .group-cover {
    height: 220px;
  }

  .front-page-card h2 {
    font-size: clamp(28px, 8vw, 44px);
  }

  .front-page-card .group-url {
    font-size: clamp(22px, 5vw, 30px);
  }

  .front-page-card .group-text {
    font-size: clamp(20px, 5vw, 30px);
  }

  .front-page-card .group-stats span {
    font-size: clamp(14px, 3.5vw, 20px);
  }
}

/* Library page */
.library-layout {
  display: grid;
  gap: 16px;
}

.library-shelf {
  padding: 16px;
}

.library-shelf h2 {
  margin: 0 0 12px;
  font-size: clamp(24px, 1.8vw, 34px);
}

.library-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 14px;
}

.library-item {
  background: #fafafb;
  border: 1px solid #ececf0;
  border-radius: 10px;
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.library-item-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.library-read-toggle {
  border: 1px solid #d8dde8;
  background: #ffffff;
  border-radius: 8px;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #364154;
  cursor: pointer;
}

.library-read-toggle:hover {
  background: #f4f8ff;
}

.library-read-circle {
  width: 18px;
  height: 18px;
  border: 2px solid #8e99ab;
  border-radius: 50%;
  display: inline-block;
  position: relative;
  flex: 0 0 auto;
}

.library-item.is-read .library-read-circle {
  border-color: #2d6e3c;
  background: #2d6e3c;
}

.library-item.is-read .library-read-circle::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(45deg);
}

.library-item.is-read .library-read-toggle {
  border-color: #b9dec1;
  background: #eff9f1;
  color: #1f5b2d;
}

.page-read-toggle {
  box-shadow: 0 8px 20px rgba(13, 21, 38, 0.16);
}

.book-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.book-title-row .book-title {
  text-align: left;
  flex: 1;
}

.page-read-toggle-book {
  font-size: 14px;
  padding: 10px 14px;
  gap: 10px;
}

.page-read-toggle-book .library-read-circle {
  width: 22px;
  height: 22px;
}

.page-read-toggle-category {
  margin-top: 4px;
}

.page-read-toggle.is-read {
  border-color: #b9dec1;
  background: #eff9f1;
  color: #1f5b2d;
}

.page-read-toggle.is-read .library-read-circle {
  border-color: #2d6e3c;
  background: #2d6e3c;
}

.page-read-toggle.is-read .library-read-circle::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(45deg);
}

@media (max-width: 700px) {
  .book-title-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

.book-comments {
  margin-top: 14px;
  padding: 16px;
  width: 100%;
  max-width: 980px;
}

.book-comments-title {
  margin: 0 0 10px;
  font-size: clamp(22px, 1.8vw, 30px);
}

.book-comments-form {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.book-comments-form textarea {
  width: 100%;
  border: 1px solid #d4dbe8;
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 96px;
  outline: none;
}

.book-comments-form textarea:focus {
  border-color: #7aa2d8;
}

.book-comments-form button {
  width: fit-content;
  border: 0;
  border-radius: 999px;
  background: #2f6fb3;
  color: #ffffff;
  padding: 8px 14px;
  font-weight: 800;
  cursor: pointer;
}

.book-comments-form button:hover {
  background: #275f99;
}

.book-comments-list {
  display: grid;
  gap: 8px;
}

.book-comment {
  border: 1px solid #e5e8ef;
  border-radius: 10px;
  background: #fafcff;
  padding: 10px 12px;
}

.book-comment-meta {
  margin: 0 0 4px;
  font-size: 12px;
  color: #5f6673;
  font-weight: 700;
}

.book-comment-body {
  margin: 0;
  color: #1f2530;
  white-space: pre-wrap;
}

.book-comments-empty {
  margin: 0;
  color: #5f6673;
  font-size: 14px;
}

.library-item img {
  width: 54%;
  aspect-ratio: 63 / 100;
  object-fit: cover;
  object-position: center top;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}

.library-item h3 {
  margin: 7px 0 5px;
  font-size: clamp(14px, 1vw, 17px);
  line-height: 1.2;
  text-align: center;
}

.library-desc {
  margin: 0;
  min-height: 2.4em;
  color: #5a5f69;
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
}

.library-link {
  display: block;
  width: fit-content;
  margin-left: auto;
  font-weight: 800;
  color: #17488e;
}

@media (max-width: 900px) {
  .library-items {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .library-items {
    grid-template-columns: 1fr;
  }
}

.back-home-btn {
  margin-left: auto;
  margin-right: 0;
  padding: 11px 18px;
  border: 1px solid #d7dceb;
  border-radius: 999px;
  background: #f4f7ff;
  color: #123a78;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.back-home-btn:hover {
  background: #e9f0ff;
  border-color: #c4d0ea;
}


/* Front page banner image */
.front-page-card .group-cover::before,
.front-page-card .group-cover::after {
  content: none;
}

.group-cover-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.front-page-card .group-cover {
  width: 100%;
}

/* Index banner: full width with fixed 1080x576 ratio */
.welcome-only {
  width: 100%;
  max-width: 100%;
}

.front-page-card .group-cover {
  width: 100%;
  height: auto;
  aspect-ratio: 1080 / 576;
}

@media (max-width: 900px) {
  .front-page-card .group-cover {
    height: auto;
    aspect-ratio: 1080 / 576;
  }
}

/* Chats page */
.community-chat-page {
  display: grid;
  gap: 14px;
}

.community-chat-title {
  margin: 0;
  font-size: clamp(28px, 2.2vw, 42px);
}

.chat-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 620px;
  overflow: hidden;
}

.chat-list {
  border-right: 1px solid #e8e9ee;
  background: #f8f9fb;
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.chat-room {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.chat-room:hover {
  background: #eceff5;
}

.chat-room.active {
  background: #d9ecff;
}

.chat-room-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #d8dee8;
}

.chat-room-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chat-room-content strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
  margin-bottom: 2px;
}

.chat-room-content small {
  color: #5f6570;
  font-size: 13px;
}

.chat-room-time {
  color: #667080;
  font-size: 12px;
  font-weight: 700;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #edf4ff;
}

.chat-panel-head {
  border-bottom: 1px solid #dde3ec;
  background: #ffffff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.chat-panel-head p {
  margin: 0;
  color: #606773;
  font-size: 13px;
}

.chat-messages {
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 10px;
  background-image: radial-gradient(circle at 1px 1px, rgba(77, 126, 191, 0.1) 1px, transparent 0);
  background-size: 18px 18px;
}

.message {
  max-width: min(82%, 480px);
  border-radius: 12px;
  padding: 10px 12px 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.message p {
  margin: 0;
  font-size: 14px;
}

.message .message-author {
  font-size: 12px;
  font-weight: 800;
  color: #295386;
  margin-bottom: 4px;
}

.message time {
  margin-top: 6px;
  display: block;
  text-align: right;
  color: #657082;
  font-size: 11px;
  font-weight: 700;
}

.message.incoming {
  justify-self: start;
  background: #ffffff;
}

.message.outgoing {
  justify-self: end;
  background: #d8fbcf;
}

.chat-input {
  border-top: 1px solid #dde3ec;
  background: #ffffff;
  padding: 12px;
  display: flex;
  gap: 10px;
}

.chat-input input {
  flex: 1;
  border: 1px solid #d5dbe6;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
}

.chat-input button {
  border: 0;
  border-radius: 999px;
  background: #2f6fb3;
  color: #ffffff;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.chat-input button:hover {
  background: #275f99;
}

@media (max-width: 900px) {
  .chat-shell {
    grid-template-columns: 1fr;
  }

  .chat-list {
    border-right: 0;
    border-bottom: 1px solid #e8e9ee;
  }
}


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

.course-card-link {
  color: inherit;
  text-decoration: none;
  display: flex;
  height: 100%;
}

.course-card-link:focus-visible .course-card {
  outline: 3px solid #4a6fd3;
  outline-offset: 2px;
}

.course-card-link .course-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.course-card-link:hover .course-card {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.course-detail-page {
  padding-top: 6px;
}

.course-detail-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.course-detail-sidebar,
.course-detail-main {
  padding: 16px;
}

.course-detail-sidebar h1 {
  margin: 0 0 14px;
  font-size: clamp(24px, 1.8vw, 32px);
}

.detail-progress-track {
  width: 100%;
  height: 24px;
  border-radius: 999px;
  background: #e5e6ea;
  margin-bottom: 22px;
  overflow: hidden;
}

.detail-progress-fill {
  width: 0%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  padding-left: 12px;
  font-size: 14px;
  font-weight: 800;
  color: #1f2430;
  background: #d5d7df;
}

.detail-lesson-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.detail-lesson-link {
  display: block;
  border-radius: 12px;
  padding: 11px 12px;
  color: #1f2430;
  font-size: 16px;
  font-weight: 600;
}

.detail-lesson-link.active {
  background: #f3dd9f;
}

.course-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.course-detail-head h2 {
  margin: 0;
  font-size: clamp(26px, 2vw, 40px);
  line-height: 1.14;
}

.detail-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #a4a7ae;
  position: relative;
  flex: 0 0 auto;
}

.detail-check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 6px;
  height: 10px;
  border-right: 2px solid #7f838b;
  border-bottom: 2px solid #7f838b;
  transform: rotate(45deg);
}

.course-video {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 18px;
}

.course-video img {
  width: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 16 / 9;
}

.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 52px;
  border: 0;
  border-radius: 12px;
  background: rgba(22, 24, 29, 0.88);
}

.video-play::before {
  content: "";
  position: absolute;
  left: 25px;
  top: 17px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid #ffffff;
}

.video-duration {
  position: absolute;
  right: 10px;
  bottom: 10px;
  border-radius: 6px;
  background: rgba(17, 19, 22, 0.88);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 8px;
}

.course-detail-copy h3 {
  margin: 0 0 12px;
  font-size: clamp(28px, 2vw, 44px);
}

.course-detail-copy p {
  margin: 0 0 14px;
  font-size: clamp(22px, 1.45vw, 30px);
  color: #1f2530;
}

@media (max-width: 1100px) {
  .course-detail-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .course-detail-copy h3 {
    font-size: clamp(24px, 7vw, 32px);
  }

  .course-detail-copy p {
    font-size: clamp(16px, 4.4vw, 22px);
  }
}


.detail-lesson-link {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.course-detail-panel[hidden] {
  display: none !important;
}

.course-video-player {
  width: 100%;
  border-radius: 12px;
  background: #0f1115;
  display: block;
}

.chat-auth-hint {
  margin: 0;
  padding: 0 14px 12px;
  font-size: 13px;
  color: #2d5f15;
}

.chat-auth-hint.error {
  color: #a31d1d;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.62);
  display: grid;
  place-items: center;
  z-index: 200;
  padding: 16px;
}

.auth-modal {
  width: min(460px, 100%);
  padding: 18px;
  border-radius: 14px;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.auth-mode-btn {
  border: 1px solid #d5d9e5;
  background: #f6f8fc;
  color: #2f3441;
  border-radius: 999px;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
}

.auth-mode-btn.active {
  background: #dbe9ff;
  border-color: #a9c4ea;
  color: #123b70;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form h2 {
  margin: 0;
  font-size: 24px;
}

.auth-form label {
  display: grid;
  gap: 6px;
}

.auth-form span {
  font-size: 13px;
  font-weight: 700;
  color: #3a404c;
}

.auth-form input {
  width: 100%;
  border: 1px solid #d0d7e5;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

.auth-form input:focus {
  border-color: #6a95d6;
}

.auth-form button[type="submit"] {
  margin-top: 4px;
  border: 0;
  border-radius: 999px;
  background: #2969b2;
  color: #ffffff;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
}

.auth-message {
  margin: 0;
  min-height: 18px;
  padding-top: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #2d5f15;
}

.auth-message.error {
  color: #a31d1d;
}
