html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body {
  position: fixed;
  inset: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-text-size-adjust: 100%;
}

.mobile-app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: calc(62px + env(safe-area-inset-top)) minmax(0, 1fr) calc(74px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--brand), transparent 80%), transparent 34%),
    var(--bg);
  color: var(--text);
  overflow: hidden;
}

.mobile-topbar {
  padding: calc(0.55rem + env(safe-area-inset-top)) 0.85rem 0.55rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg), transparent 8%);
  backdrop-filter: blur(14px);
  z-index: 20;
}

.circle-btn {
  display: grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  flex: 0 0 auto;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 1.2rem;
}

.top-title {
  min-width: 0;
  text-align: center;
}

.top-title span {
  display: block;
  color: var(--brand);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 900;
}

.top-title strong {
  display: block;
  margin-top: 0.12rem;
  font-size: 1.02rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-content {
  min-height: 0;
  overflow: hidden;
  padding: 0.85rem;
}

.screen {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
  gap: 0.8rem;
  align-content: start;
  animation: fadeIn 120ms ease-out;
}

.screen.allow-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 0.75rem;
}

.screen.document-mode {
  overflow: auto;
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-user-select: text;
  user-select: text;
}

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

.mobile-card {
  background: color-mix(in srgb, var(--panel), transparent 3%);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.mobile-card h2,
.mobile-card h3,
.mobile-card p {
  margin-top: 0;
}

.mobile-card p {
  color: var(--muted);
  line-height: 1.5;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.stat {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 0.8rem;
}

.stat strong {
  display: block;
  font-size: 1.4rem;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 0.15rem;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
}

.action-tile {
  min-height: 6.7rem;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  text-align: left;
  justify-content: space-between;
}

.action-tile span {
  font-size: 1.5rem;
}

.action-tile strong {
  line-height: 1.1;
}

.list-stack {
  display: grid;
  gap: 0.65rem;
}

.list-item {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 1.05rem;
  padding: 0.8rem;
}

.list-item h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.list-item .meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.bottom-nav {
  padding: 0.48rem 0.55rem calc(0.48rem + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.35rem;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg), transparent 5%);
  backdrop-filter: blur(18px);
  z-index: 20;
}

.bottom-nav button {
  min-width: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 1rem;
  padding: 0.36rem 0.15rem;
}

.bottom-nav button.active {
  color: var(--text);
  background: var(--panel-2);
}

.bottom-nav span,
.bottom-nav strong {
  display: block;
}

.bottom-nav span {
  font-size: 1.15rem;
  line-height: 1;
}

.bottom-nav strong {
  font-size: 0.68rem;
  margin-top: 0.2rem;
}

.drawer {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(84vw, 340px);
  transform: translateX(-104%);
  transition: transform 170ms ease;
  z-index: 40;
  padding: calc(0.85rem + env(safe-area-inset-top)) 0.85rem calc(0.85rem + env(safe-area-inset-bottom));
  pointer-events: none;
}

.drawer.open {
  transform: translateX(0);
  pointer-events: auto;
}

.drawer-card {
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  box-shadow: var(--shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-row span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #06101d;
  font-weight: 950;
}

.drawer-nav {
  display: grid;
  gap: 0.35rem;
}

.drawer-nav button {
  color: var(--text);
  background: transparent;
  border-radius: 0.95rem;
  padding: 0.78rem;
  text-align: left;
}

.drawer-nav button:hover,
.drawer-nav button.active {
  background: var(--panel-2);
}

.drawer-note {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 170ms ease;
}

.scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.form-row {
  display: grid;
  gap: 0.45rem;
}

.mobile-input {
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.82rem;
  width: 100%;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-top: 0.8rem;
  padding: 0.3rem;
  border-radius: 1rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.mode-tabs button {
  color: var(--muted);
  background: transparent;
  border-radius: 0.8rem;
  padding: 0.65rem 0.5rem;
  font-weight: 850;
}

.mode-tabs button.active {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
}

.is-hidden {
  display: none;
}

.mobile-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.mobile-preview {
  margin: 0.3rem 0 0.85rem;
  padding: 0.82rem;
  border-radius: 1rem;
  background: var(--panel-2);
  border: 1px dashed var(--line);
  color: var(--brand);
  font-weight: 900;
  word-break: break-word;
}

.class-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
}

.mini-btn {
  color: #06101d;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 999px;
  padding: 0.55rem 0.75rem;
  font-weight: 900;
}

.form-row select.mobile-input {
  appearance: none;
}

.mini-actions {
  display: grid;
  gap: 0.35rem;
  justify-items: end;
}

.ghost-mini-btn {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 0.72rem;
  font-weight: 850;
}

.stacked-actions {
  display: grid;
  gap: 0.55rem;
}

.forum-group-card {
  display: grid;
  gap: 0.75rem;
}

.forum-group-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
}

.forum-group-head h2,
.forum-group-head p,
.forum-item h3 {
  margin: 0;
}

.forum-item .meta {
  margin-top: 0.25rem;
}

.danger-card p {
  color: var(--danger);
  margin-bottom: 0;
}

textarea.mobile-input {
  min-height: 8rem;
  resize: vertical;
  font: inherit;
}

.post-list {
  display: grid;
  gap: 0.65rem;
}

.post-row {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.82rem;
}

.post-row p {
  margin: 0 0 0.45rem;
}

.post-row span {
  color: var(--muted);
  font-size: 0.78rem;
}

.share-link-row {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.qr-wrap {
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  margin-top: 0.85rem;
}

.qr-wrap img {
  width: 220px;
  height: 220px;
  max-width: 100%;
  padding: 0.7rem;
  border-radius: 1rem;
  background: white;
  border: 1px solid var(--line);
}


.auth-card form {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.auth-card .mode-tabs {
  margin: 0.8rem 0;
}

#profileForm {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.date-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: start;
}

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

.compact-mobile-card {
  padding: 0.82rem;
}

.chat-screen {
  gap: 0.65rem;
}

.chat-panel-mobile {
  padding: 0;
  overflow: hidden;
}

.chat-scroll {
  display: grid;
  gap: 0.62rem;
  padding: 0.8rem;
  max-height: 46vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chat-message {
  display: flex;
}

.chat-bubble {
  width: fit-content;
  max-width: 92%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.72rem 0.82rem;
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.76rem;
  margin-bottom: 0.35rem;
}

.chat-bubble p {
  margin: 0;
  line-height: 1.42;
}

.mobile-chat-composer {
  display: grid;
  gap: 0.55rem;
  border-top: 1px solid var(--line);
  padding: 0.75rem;
  background: color-mix(in srgb, var(--panel), transparent 3%);
}

.mobile-chat-composer textarea.mobile-input {
  min-height: 4.25rem;
}

.file-picker {
  display: grid;
  gap: 0.35rem;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.7rem;
  margin: 0;
}

.file-picker input {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: 100%;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.attachment-chip {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel), transparent 4%);
  border-radius: 999px;
  padding: 0.38rem 0.55rem;
  font-size: 0.8rem;
}

/* Compact chat/forum refresh pass */
.compact-chat-screen {
  gap: 0;
  padding: 0.45rem;
}

.chat-shell-mobile {
  min-height: calc(100dvh - 7.5rem);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.mobile-chat-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.65rem 0.72rem;
  border-bottom: 1px solid var(--line);
}

.mobile-chat-topbar h2,
.mobile-chat-topbar p {
  margin: 0;
}

.mobile-chat-topbar h2 {
  font-size: 1.05rem;
  line-height: 1.12;
}

.mobile-chat-actions {
  display: grid;
  gap: 0.35rem;
  justify-items: end;
}

.mobile-chat-tools {
  display: grid;
  gap: 0.45rem;
  padding: 0.5rem 0.72rem;
  border-bottom: 1px solid var(--line);
}

.mobile-chat-tools .mobile-input {
  padding: 0.58rem 0.72rem;
  border-radius: 999px;
}

.mobile-compact-share {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 0.5rem 0.6rem;
}

.mobile-compact-share summary {
  font-weight: 850;
  cursor: pointer;
}

.compact-tabs {
  margin: 0.5rem 0;
}

.small-qr img {
  max-width: 180px;
}

.chat-shell-mobile .chat-scroll {
  max-height: none;
  min-height: 0;
  padding: 0.55rem 0.72rem;
  gap: 0.36rem;
}

.chat-shell-mobile .chat-bubble {
  max-width: 94%;
  border-radius: 0.9rem;
  padding: 0.48rem 0.58rem;
}

.chat-shell-mobile .chat-meta {
  font-size: 0.7rem;
  margin-bottom: 0.2rem;
}

.chat-shell-mobile .chat-bubble p {
  font-size: 0.92rem;
  line-height: 1.3;
}

.chat-empty {
  padding: 0.7rem;
}

.compact-mobile-composer {
  gap: 0.42rem;
  padding: 0.52rem 0.72rem;
}

.compact-mobile-composer textarea.mobile-input {
  min-height: 2.9rem;
  max-height: 7rem;
  padding: 0.6rem 0.72rem;
}

.mobile-composer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.compact-mobile-composer .file-picker {
  padding: 0.48rem 0.58rem;
  border-radius: 0.85rem;
  font-size: 0.84rem;
}

.compact-mobile-composer #postMessage {
  margin: 0;
}

/* Denser mobile chat and non-destructive search highlighting */
.chat-shell-mobile .chat-scroll {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  align-content: flex-start;
  gap: 0.26rem;
  padding: 0.42rem 0.58rem;
}

.chat-shell-mobile .chat-message {
  width: 100%;
}

.chat-shell-mobile .chat-bubble {
  max-width: 92%;
  border-radius: 0.68rem;
  padding: 0.3rem 0.44rem;
}

.chat-shell-mobile .chat-meta {
  font-size: 0.64rem;
  margin-bottom: 0.1rem;
}

.chat-shell-mobile .chat-bubble p {
  font-size: 0.86rem;
  line-height: 1.22;
}

.chat-message.search-hit .chat-bubble {
  border-color: color-mix(in srgb, var(--brand), var(--line) 30%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand), transparent 68%);
}

.search-highlight {
  background: color-mix(in srgb, var(--brand), transparent 74%);
  color: var(--text);
  border-radius: 0.25rem;
  padding: 0 0.1em;
  font-weight: 850;
}

.compact-mobile-composer {
  padding: 0.4rem 0.58rem;
}

.compact-mobile-composer textarea.mobile-input {
  min-height: 2.25rem;
  max-height: 5.5rem;
  padding: 0.46rem 0.58rem;
}

.mobile-composer-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.38rem;
}

.attachment-picker {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.35rem;
}

.compact-mobile-composer .file-picker {
  position: relative;
  display: inline-flex;
  white-space: nowrap;
  padding: 0.4rem 0.54rem;
  border-radius: 0.7rem;
  font-size: 0.8rem;
}

.file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-count {
  max-width: 8.5rem;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
}

/* Fixed-height mobile chat layout and preserved message line breaks */
.chat-screen.compact-chat-screen {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  padding-bottom: 0;
}

.chat-shell-mobile {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.chat-shell-mobile .chat-scroll {
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-shell-mobile .chat-bubble p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-shell-mobile .compact-mobile-composer {
  align-self: end;
  margin: 0;
  flex-shrink: 0;
}

.chat-shell-mobile .attachment-picker {
  max-width: 13rem;
}

.chat-shell-mobile .file-count {
  max-width: 7.5rem;
}

/* Consolidated mobile classes page */
.mobile-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
}

.mobile-section-head h2,
.mobile-section-head p {
  margin: 0;
}

.mobile-class-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
  margin-top: 0.65rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.mobile-class-tabs button {
  color: var(--muted);
  background: transparent;
  border-radius: 999px;
  padding: 0.5rem 0.35rem;
  font-weight: 850;
}

.mobile-class-tabs button.active {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
}

.compact-add-mobile {
  padding: 0.78rem;
}

.compact-add-mobile .mode-tabs {
  margin: 0.6rem 0;
}

.mobile-add-section {
  display: grid;
  gap: 0.55rem;
}

.mobile-inline-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.compact-result-list {
  max-height: 36vh;
  overflow-y: auto;
  padding-right: 0.1rem;
}

.mobile-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.4rem;
  align-items: center;
}

.search-counter {
  color: var(--muted);
  font-size: 0.72rem;
  min-width: 2.6rem;
}

.active-search-highlight {
  outline: 2px solid var(--brand);
  background: color-mix(in srgb, var(--brand), white 18%);
  color: #06101d;
}

.chat-message.focused-search-hit .chat-bubble {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand), transparent 42%);
}

.qr-wrap img,
.small-qr img {
  width: 180px;
  height: 180px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.qr-wrap:not(.small-qr) img {
  width: 220px;
  height: 220px;
}

.attention-card {
  border-color: color-mix(in srgb, var(--brand), var(--line) 45%);
  background: color-mix(in srgb, var(--brand), var(--panel) 88%);
}

.mobile-inline-actions {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

/* Compact title rows and cleaner class/date layout */
.mobile-title-block {
  padding: 0.35rem 0.1rem 0.15rem;
  display: grid;
  gap: 0.35rem;
}

.mobile-title-block h2,
.mobile-title-block p {
  margin: 0;
}

.mobile-title-block p {
  color: var(--muted);
  line-height: 1.35;
}

.section-title-row {
  display: grid;
  gap: 0.55rem;
}

.compact-actions {
  align-content: start;
}

.action-tile {
  min-height: 5.5rem;
  background: color-mix(in srgb, var(--panel-2), var(--brand) 5%);
}

.mobile-card {
  padding: 0.9rem;
}

.auth-card {
  padding: clamp(1rem, 4vw, 1.35rem);
}

.mobile-class-tabs {
  grid-template-columns: repeat(2, 1fr);
}

.mobile-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.class-dates-card .list-stack,
.compact-date-list {
  gap: 0.45rem;
}

.date-item {
  padding: 0.58rem 0.62rem;
  border-radius: 0.85rem;
  gap: 0.5rem;
  align-items: center;
}

.date-item h3 {
  font-size: 0.94rem;
  margin-bottom: 0.12rem;
}

.date-item .meta,
.date-item p {
  line-height: 1.25;
}

.date-actions {
  display: grid;
  gap: 0.3rem;
  justify-items: end;
}

.danger-mini {
  color: color-mix(in srgb, var(--danger), white 8%);
  border-color: color-mix(in srgb, var(--danger), transparent 45%);
}

.chat-scroll {
  scroll-behavior: smooth;
}

/* Organized Settings / Appearance */
.drawer-spacer {
  flex: 1 1 auto;
}

.drawer-bottom-nav {
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.settings-screen {
  gap: 0.75rem;
}

.settings-section {
  display: grid;
  gap: 0.75rem;
}

.settings-section h3,
.settings-section p {
  margin: 0;
}

.settings-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
}

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

.theme-choice {
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.7rem;
  min-height: 6.1rem;
  display: grid;
  gap: 0.32rem;
  text-align: left;
  align-content: start;
}

.theme-choice.active {
  border-color: color-mix(in srgb, var(--brand), white 18%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand), transparent 60%);
}

.theme-choice small {
  color: var(--muted);
  line-height: 1.25;
}

.theme-swatch {
  width: 100%;
  height: 0.72rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.theme-light { background: linear-gradient(90deg, #fffdf8, #c9b7e8); }
.theme-dark { background: linear-gradient(90deg, #171b25, #d7c7ef); }
.theme-nature { background: linear-gradient(90deg, #eef4e8, #9fcf9d, #d7c99b); }
.theme-calm { background: linear-gradient(90deg, #eef5f8, #a8d3dc, #cfc6ea); }
.theme-psychedelic { background: linear-gradient(90deg, #171225, #f0a6ff, #99f0dc); }
.theme-sunset { background: linear-gradient(90deg, #fff1e8, #f3b7a0, #e8c38a); }
.theme-campus { background: linear-gradient(90deg, #101720, #bed7a5, #a8c6df); }

.settings-form {
  display: grid;
  gap: 0.75rem;
}


.compact-settings-actions {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

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

/* More usable mobile forum space */
.chat-screen.compact-chat-screen {
  padding: 0.25rem;
}

.mobile-chat-topbar {
  padding: 0.42rem 0.56rem;
}

.mobile-chat-topbar .kicker {
  font-size: 0.58rem;
  letter-spacing: 0.08em;
}

.mobile-chat-topbar h2 {
  font-size: 0.98rem;
}

.mobile-chat-summary {
  margin-top: 0.08rem;
  font-size: 0.72rem;
  line-height: 1.22;
}

.mobile-chat-tools {
  padding: 0.36rem 0.56rem;
}

.mobile-chat-tools .mobile-input {
  min-height: 2.05rem;
  padding: 0.4rem 0.6rem;
}

.chat-shell-mobile .chat-scroll {
  padding: 0.38rem 0.5rem;
}

.chat-shell-mobile .compact-mobile-composer {
  padding: 0.45rem 0.56rem;
}

.compact-mobile-composer textarea.mobile-input {
  min-height: 3.45rem;
  max-height: 7.25rem;
}

.forum-preview-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* Final mobile forum tightening: more message area, bigger composer, less wasted shell padding. */
.mobile-content:has(.compact-chat-screen) {
  padding: 0.32rem;
}

.chat-screen.compact-chat-screen {
  padding: 0;
}

.chat-shell-mobile {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: 100%;
}

.mobile-chat-topbar {
  padding: 0.34rem 0.5rem;
  gap: 0.42rem;
}

.mobile-chat-actions {
  gap: 0.25rem;
}

.mobile-chat-actions .mini-btn,
.mobile-chat-actions .ghost-mini-btn {
  padding: 0.34rem 0.52rem;
  font-size: 0.76rem;
}

.mobile-chat-tools {
  padding: 0.3rem 0.5rem;
  gap: 0.32rem;
}

.mobile-search-row {
  gap: 0.3rem;
}

.mobile-search-row .ghost-mini-btn,
.search-counter {
  font-size: 0.7rem;
}

.chat-shell-mobile .chat-scroll {
  padding: 0.32rem 0.45rem;
  gap: 0.24rem;
}

.chat-shell-mobile .compact-mobile-composer {
  padding: 0.5rem;
}

.compact-mobile-composer textarea.mobile-input {
  min-height: 4.35rem;
  max-height: 8.5rem;
  font-size: 0.96rem;
  line-height: 1.35;
}

.compact-mobile-composer .file-picker {
  padding: 0.36rem 0.5rem;
}



/* Small mobile forum attachment affordance. */
.compact-mobile-composer .compact-attach-button {
  width: 2.35rem;
  height: 2.35rem;
  min-width: 2.35rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.compact-mobile-composer .compact-attach-button span {
  transform: translateY(-0.04rem);
}

.chat-shell-mobile .attachment-picker {
  max-width: 100%;
  gap: 0.42rem;
}

.chat-shell-mobile .file-count {
  max-width: min(42vw, 12rem);
}

/* Obvious mobile section switcher near the top of a class. */
.mobile-section-switch-card {
  display: grid;
  gap: 0.65rem;
}

.mobile-section-switch-card h2 {
  margin-bottom: 0;
}

.mobile-section-switch-card .form-row {
  margin: 0;
}

/* Mobile class details sheet */
.mobile-class-details-sheet {
  display: grid;
  gap: 0.75rem;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: var(--panel);
  box-shadow: 0 0.8rem 2rem color-mix(in srgb, #000, transparent 76%);
  animation: mobileDetailsIn 180ms ease-out;
}

@keyframes mobileDetailsIn {
  from { transform: translateY(0.8rem); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.mobile-detail-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-2), transparent 18%);
}

.mobile-detail-tabs button {
  border: 0;
  border-radius: 999px;
  padding: 0.58rem 0.7rem;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mobile-detail-tabs button.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 0.35rem 1rem color-mix(in srgb, #000, transparent 88%);
}

.mobile-details-section {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--panel-2), transparent 15%);
}

.mobile-details-form {
  display: grid;
  gap: 0.65rem;
}

.class-person-card-mobile {
  display: grid;
  gap: 0.2rem;
}

.class-person-card-mobile p {
  margin: 0;
  line-height: 1.35;
}

.mobile-mini-card {
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: var(--panel);
}

/* Class collapsible cards */
.mobile-class-card-stack {
  display: grid;
  gap: 0.75rem;
}

.mobile-collapse-card {
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.mobile-collapse-card.collapsed:active {
  transform: scale(0.995);
}

.mobile-collapse-card.expanded {
  cursor: default;
  border-color: color-mix(in srgb, var(--brand), var(--line) 45%);
}

.mobile-collapse-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
}

.mobile-collapse-head h2 {
  margin: 0.12rem 0 0;
}

.mobile-collapse-head p {
  margin: 0.25rem 0 0;
}

.mobile-collapse-indicator {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.5rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel-2), transparent 18%);
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.mobile-collapse-body {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  cursor: default;
}

.mobile-card-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.mobile-card-options button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.48rem 0.68rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel-2), transparent 18%);
  font-weight: 850;
}

.mobile-card-options button.active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--brand), var(--line) 50%);
  background: color-mix(in srgb, var(--brand), transparent 82%);
}

.mobile-collapse-body .mobile-detail-tabs {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

/* Class card refinements and class files/schedule */
.mobile-collapse-card {
  cursor: default;
}

.mobile-collapse-head {
  cursor: pointer;
  align-items: center;
}

.mobile-section-control {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.mobile-details-section,
.class-file-form,
.schedule-form {
  margin-top: 0.85rem;
}

.class-schedule-row,
.class-file-row {
  display: grid;
  gap: 0.35rem;
}

.class-file-row a {
  word-break: break-word;
}

.compact-file-picker {
  width: 100%;
}

/* Compact class detail cleanup and nested schedule card */
.compact-mobile-class-head {
  padding: 0.72rem;
  gap: 0.6rem;
}

.compact-mobile-class-head .mobile-section-control {
  margin-top: 0.3rem;
}

.mobile-nested-collapse-card {
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  background: color-mix(in srgb, var(--panel-2), transparent 22%);
  margin-top: 0.75rem;
  overflow: hidden;
}

.mobile-nested-collapse-head {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0.68rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  font-weight: 900;
}

.mobile-nested-collapse-head span:last-child {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.48rem;
  font-size: 0.72rem;
}

.mobile-nested-collapse-body {
  border-top: 1px solid var(--line);
  padding: 0.7rem;
  display: grid;
  gap: 0.55rem;
}

.compact-mobile-form {
  display: grid;
  gap: 0.48rem;
}

.compact-mobile-form .form-row {
  margin-bottom: 0;
  gap: 0.24rem;
}

.compact-mobile-form .mobile-input,
.compact-mobile-form textarea.mobile-input {
  padding: 0.48rem 0.58rem;
  border-radius: 0.65rem;
}

.compact-mobile-form textarea.mobile-input {
  min-height: 3.2rem;
}

.mobile-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  color: var(--text);
  font-weight: 800;
  margin: 0.1rem 0;
}

.mobile-inline-check input {
  width: auto;
  margin: 0;
}

.mobile-card-section-picker {
  margin-bottom: 0.45rem;
}

.mobile-default-section-note {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.42rem 0.58rem;
  background: color-mix(in srgb, var(--panel-2), transparent 18%);
  color: var(--text);
  font-weight: 900;
  width: fit-content;
}

/* Clickable class/chat cards and clearer class section heading */
.tappable-card {
  cursor: pointer;
  -webkit-tap-highlight-color: color-mix(in srgb, var(--brand), transparent 78%);
}

.tappable-card:active {
  transform: translateY(1px);
}

.chat-card.class-result {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.chat-card-icon {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand), transparent 82%);
  border: 1px solid var(--line);
  font-size: 1.05rem;
}

.mobile-class-section-subtitle {
  color: var(--text) !important;
  font-weight: 950;
  font-size: 1.02rem;
  margin-top: 0.1rem !important;
}

.file-group-card .class-file-row {
  margin-top: 0.15rem;
}

/* Persistent sign-in and compact class heading */
.remember-me-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: fit-content;
  color: var(--text);
  font-weight: 850;
  line-height: 1.3;
}

.remember-me-row input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--brand);
}

.mobile-class-title-line {
  display: flex;
  align-items: center;
  gap: 0.55rem 0.75rem;
  flex-wrap: wrap;
}

.mobile-class-title-line h2 {
  margin: 0;
  font-size: clamp(1.2rem, 6vw, 1.65rem);
  line-height: 1.12;
}

.mobile-default-section-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.34rem 0.58rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-2), transparent 10%);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.compact-mobile-class-head {
  padding-top: 0.35rem;
}

.compact-mobile-class-head .mobile-section-control {
  max-width: 34rem;
}

.compact-add-mobile .mode-tabs,
.mobile-card .mode-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
