@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&family=Sora:wght@500;600;700&display=swap');

/* Visual refresh: aurora surfaces, distinctive type, and elevated interaction states. */
:root {
  --bg: #f4f6ff;
  --panel: rgba(255, 255, 255, .78);
  --ink: #15192f;
  --muted: #69718b;
  --line: rgba(91, 101, 145, .14);
  --brand: #6c4cf5;
  --brand-deep: #4b2fd0;
  --brand-soft: #ede9ff;
  --teal: #1bb5c0;
  --orange: #f6a94e;
  --shadow: 0 20px 56px rgba(40, 42, 88, .11);
  --radius: 22px;
}

body {
  background:
    radial-gradient(70rem 44rem at 88% -15%, rgba(138, 111, 255, .18), transparent 58%),
    radial-gradient(55rem 38rem at -16% 28%, rgba(25, 190, 200, .11), transparent 59%),
    var(--bg);
  font-family: "Manrope", "DM Sans", system-ui, sans-serif;
}

.brand, .page-heading h1, .auth-card h2, .card h2, .group-hero h1, .section-heading h2, .study-panel h2, .resource-card h3, .assignment-title, .discussion h3, .empty-study h2 {
  font-family: "Sora", "Plus Jakarta Sans", sans-serif;
}

.eyebrow, .nav-label, .breadcrumbs, .metric-label, .activity-time, .tag, .message-label { font-family: "DM Mono", monospace; }

/* Auth becomes a cinematic split screen instead of a basic form. */
.auth-art {
  background: #11152d;
  isolation: isolate;
  padding: 50px clamp(38px, 8vw, 136px);
}
.auth-art::before, .auth-art::after { border-radius: 999px; content: ""; position: absolute; z-index: -1; }
.auth-art::before { background: radial-gradient(circle at 35% 35%, #b8acff 0, #7658fa 31%, rgba(118, 88, 250, 0) 70%); height: 610px; left: -218px; top: 128px; width: 610px; }
.auth-art::after { background: radial-gradient(circle, rgba(32, 214, 208, .88), rgba(32, 214, 208, 0) 68%); bottom: -275px; height: 610px; right: -150px; width: 610px; }
.auth-art .brand-mark { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255,255,255,.2); box-shadow: none; }
.auth-art .eyebrow { color: #b9b2ff; }
.auth-copy { margin-top: clamp(92px, 18vh, 180px); max-width: 590px; }
.auth-copy h1 { font-size: clamp(42px, 5vw, 72px); letter-spacing: -4.2px; line-height: 1.04; }
.auth-copy p { color: #cfd2e9; line-height: 1.75; max-width: 505px; }
.feature-pills span { backdrop-filter: blur(14px); background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16); font-size: 13px; }
.auth-form-wrap { background: rgba(255,255,255,.95); }
.auth-card { animation: rise .55s ease-out both; }
.auth-card h2 { font-size: 30px; letter-spacing: -1.55px; }

.brand { font-size: 19px; letter-spacing: -1px; }
.brand-mark { background: linear-gradient(135deg, #8e72ff 0%, #633ef3 55%, #2fc6d0 140%); box-shadow: 0 7px 17px rgba(94,66,238,.3); }
.eyebrow { font-size: 10px; letter-spacing: .13em; }
input, textarea, select { background: #fbfcff; border-color: #e2e5f1; border-radius: 12px; padding: 12px 14px; }
input:hover, textarea:hover, select:hover { border-color: #c9c8dc; }
input:focus, textarea:focus, select:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(108,76,245,.11); }
.button { border-radius: 12px; font-size: 13px; font-weight: 800; transition: box-shadow .18s, transform .18s, background .18s; }
.button:hover { transform: translateY(-2px); }
.button-primary { background: linear-gradient(135deg, #795af6, #5a38ea); box-shadow: 0 9px 18px rgba(91,57,234,.23); }
.button-primary:hover { background: linear-gradient(135deg, #8468fb, #4e2de1); box-shadow: 0 12px 24px rgba(91,57,234,.3); }
.button-secondary { background: #eeebff; color: #5737d5; }
.demo-login { background: #f5f3ff; border: 1px solid #e9e5ff; border-radius: 10px; color: #68608e; padding: 10px 12px; }

/* Dark glass navigation shell. */
.app-shell { grid-template-columns: 1fr; }
@media (min-width: 769px) { .app-shell { grid-template-columns: 264px minmax(0, 1fr); } }
.sidebar {
  background: radial-gradient(26rem 20rem at -30% 35%, rgba(123,91,255,.33), transparent 65%), linear-gradient(180deg, #14172d 0%, #0d1021 100%);
  padding: 27px 16px 21px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
}
@media (max-width: 768px) {
  .sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 264px;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0,0,0,0.3);
  }
  .sidebar.mobile-open { display: flex; }
}

.mobile-sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }
.app-shell.mobile-sidebar-open .mobile-sidebar-backdrop { display: block; animation: fadeIn .2s ease-out; }
.app-shell.mobile-sidebar-open .sidebar { animation: slideIn .3s cubic-bezier(0.4, 0, 0.2, 1); }

.mobile-nav-toggle { background: transparent; border: none; color: #69718b; cursor: pointer; font-size: 20px; padding: 8px; }
.mobile-sidebar-close { background: transparent; border: none; color: #8d91b0; cursor: pointer; font-size: 18px; padding: 4px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }

.app-shell.mobile-sidebar-open .sidebar { display: flex !important; }

@keyframes slideIn { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Desktop sidebar styles - only apply on larger screens */
@media (min-width: 481px) {
  .sidebar {
    position: sticky;
    top: 0;
    transform: none;
  }
  
  .sidebar::before { border: 1px solid rgba(255,255,255,.06); border-radius: 50%; content: ""; height: 330px; position: absolute; right: -190px; top: 100px; width: 330px; }
  .sidebar .brand { margin-bottom: 34px; position: relative; }
  .sidebar .brand-mark { background: linear-gradient(135deg, #a58fff, #7254f7); box-shadow: 0 10px 22px rgba(121,89,247,.34); }
  .nav-group { gap: 5px; position: relative; }
  .nav-label { color: #5f6688; font-size: 9px; letter-spacing: .14em; }
  .nav-item { border-radius: 12px; font-size: 13px; font-weight: 700; padding: 12px; transition: background .17s, color .17s, transform .17s; }
  .nav-item:hover { background: rgba(255,255,255,.055); transform: translateX(2px); }
  .nav-item.active { background: linear-gradient(90deg, rgba(130,101,255,.24), rgba(130,101,255,.08)); box-shadow: inset 2px 0 #9a82ff; }
  .nav-icon { color: #8d91b0; font-size: 18px; }
  .nav-item.active .nav-icon { color: #b6a7ff; }
  .help-card { background: linear-gradient(145deg, rgba(102,82,213,.38), rgba(42,39,78,.66)); border: 1px solid rgba(182,166,255,.13); border-radius: 17px; overflow: hidden; position: relative; }
  .help-card::after { color: rgba(255,255,255,.1); content: "✦"; font-size: 85px; position: absolute; right: -10px; top: -20px; }
  .help-card h3, .help-card p, .help-card button { position: relative; z-index: 1; }
  .help-card button { border: 1px solid rgba(255,255,255,.11); border-radius: 9px; }
  .profile-bar { border-top-color: rgba(255,255,255,.08); }
  .avatar { background: linear-gradient(135deg, #ffdba4, #f3afbb); box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); color: #774454; }
  .profile-name { font-weight: 800; }

  /* Hide mobile-only elements on desktop */
  .sidebar-head { display: none !important; }
  .mobile-sidebar-close { display: none !important; }
  .mobile-nav-toggle { display: none !important; }
  .mobile-sidebar-backdrop { display: none !important; }
}

.topbar { backdrop-filter: blur(16px); background: rgba(244,246,255,.73); border-bottom: 1px solid rgba(105,111,157,.09); padding: 20px clamp(16px, 4vw, 58px) 16px; display: flex; align-items: center; }
.mobile-menu-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: transparent; border: none; cursor: pointer; font-size: 20px; margin-right: 10px; }
@media (min-width: 769px) { .mobile-menu-btn { display: none; } }.breadcrumbs { font-size: 11px; }.icon-button { background: rgba(255,255,255,.72); border-color: var(--line); border-radius: 12px; transition: box-shadow .18s, transform .18s; }.icon-button:hover { box-shadow: 0 8px 24px rgba(31,35,72,.09); transform: translateY(-2px); }
.page { animation: rise .42s ease-out both; max-width: 1500px; padding: 27px clamp(16px, 4vw, 58px) clamp(16px, 4vw, 58px); }
@media (max-width: 768px) { .page { padding: 20px 14px; } }.page-heading { margin-bottom: 30px; }.page-heading h1 { font-size: clamp(27px, 2.5vw, 36px); letter-spacing: -2px; }.page-heading p { line-height: 1.65; }

/* Dashboard cards have stronger depth and individual color stories. */
.metric-grid { gap: 15px; }.metric { background: var(--panel); border-color: rgba(255,255,255,.8); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(31,35,72,.06); overflow: hidden; position: relative; transition: box-shadow .2s, transform .2s; }.metric::before { background: linear-gradient(90deg, var(--metric-color, var(--brand)), transparent); content: ""; height: 3px; left: 0; position: absolute; top: 0; width: 52%; }.metric:nth-child(2) { --metric-color: #1bb5c0; }.metric:nth-child(3) { --metric-color: #f6a94e; }.metric:nth-child(4) { --metric-color: #ec709e; }.metric:hover, .resource-card:hover { box-shadow: var(--shadow); transform: translateY(-4px); }.metric-icon { border-radius: 12px; height: 40px; width: 40px; }.metric-label { font-size: 10px; letter-spacing: .04em; }.metric-value { font-family: "Sora", sans-serif; font-size: 27px; letter-spacing: -1.7px; }.metric-trend { border-radius: 999px; padding: 5px 7px; }
.content-grid { gap: 20px; margin-top: 22px; }.card { background: var(--panel); border-color: rgba(255,255,255,.78); box-shadow: 0 8px 24px rgba(31,35,72,.06); }.card-head { padding: 21px 21px 11px; }.card h2 { font-size: 15px; letter-spacing: -.7px; }.small-link { background: #f2efff; border-radius: 999px; color: #5d3fe0; font-size: 10px; padding: 7px 10px; }
.group-row { border: 1px solid transparent; border-radius: 16px; transition: background .18s, border .18s, transform .18s; }.group-row:hover { background: rgba(255,255,255,.8); border-color: #ebeafa; transform: translateX(3px); }.group-cover { border-radius: 13px; box-shadow: 0 8px 15px rgba(60,65,114,.16); }.group-row-title { font-weight: 800; }.activity { border-bottom-color: rgba(100,107,153,.09); }.activity-dot { align-items: center; background: linear-gradient(135deg, #eeeaff, #ddf9f7); border-radius: 10px; display: flex; justify-content: center; }.activity-time { font-size: 9px; }
.study-nudge { background: linear-gradient(135deg, #6d50e8 0%, #8d68f2 47%, #26bac4 145%); box-shadow: 0 20px 35px rgba(87,59,208,.22); }.study-nudge::before { background: rgba(255,255,255,.11); border-radius: 50%; content: ""; height: 180px; position: absolute; right: -60px; top: -65px; width: 180px; }.study-nudge h2 { font-family: "Sora", sans-serif; letter-spacing: -1px; }.study-nudge .button { box-shadow: 0 8px 18px rgba(44,22,151,.16); }

/* Group and resource pages. */
.group-hero { background: linear-gradient(118deg, #26244c 0%, #4c3e91 52%, #237f91 150%); border: 1px solid rgba(255,255,255,.24); border-radius: 30px; box-shadow: 0 20px 50px rgba(57,50,118,.2); isolation: isolate; padding: 33px; }.group-hero::before { background: radial-gradient(circle, rgba(205,193,255,.46), transparent 64%); content: ""; height: 360px; position: absolute; right: -90px; top: -170px; width: 360px; z-index: -1; }.group-hero::after { border: 1px solid rgba(255,255,255,.17); height: 245px; right: -32px; top: -91px; width: 245px; }.group-hero h1 { font-size: clamp(25px, 3vw, 35px); letter-spacing: -1.8px;color: #b8acff; }.group-hero p { color: #dfdff1; font-size: 13px; line-height: 1.65; }.group-hero .chip { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.16); color: #f6f5ff; }.chip { border-radius: 999px; font-size: 12px; font-weight: 800; padding: 14px 8px; }.tabs { gap: 24px; }.tab { font-size: 12px; position: relative; }.tab.active { border-bottom: 0; }.tab.active::after { background: linear-gradient(90deg, var(--brand), #a58bff); border-radius: 999px; bottom: -1px; content: ""; height: 3px; left: 0; position: absolute; width: 100%; }
.section-heading h2 { font-size: 17px; letter-spacing: -1px; }.resource-grid { gap: 15px; }.resource-card { background: rgba(255,255,255,.82); border-color: rgba(255,255,255,.9); border-radius: 19px; box-shadow: 0 8px 24px rgba(31,35,72,.06); transition: box-shadow .2s, transform .2s; }.file-icon { background: linear-gradient(135deg, #ffebe6, #fff4ea); border-radius: 12px; font-family: "DM Mono", monospace; }.file-icon.docx { background: linear-gradient(135deg, #e4f0ff, #f0f7ff); }.file-icon.file { background: linear-gradient(135deg, #eee9ff, #f5f1ff); }.resource-card h3 { letter-spacing: -.5px; }.tag { border-radius: 999px; font-family: "DM Mono", monospace; font-size: 9px; padding: 5px 7px; }.resource-footer { border-top-color: rgba(98,105,152,.1); }.resource-footer span:nth-child(2) { color: #12916d; font-weight: 800; }.resource-footer .button { font-size: 10px; min-height: 30px; padding: 0 10px; }
.assignment, .discussion { background: rgba(255,255,255,.8); border-color: rgba(255,255,255,.85); border-radius: 19px; box-shadow: 0 8px 24px rgba(31,35,72,.06); }.assignment { transition: transform .18s; }.assignment:hover { transform: translateX(3px); }.assignment-title, .discussion h3 { letter-spacing: -.4px; }.discussion p { line-height: 1.65; }
/*.invite-code { align-items: center; display: inline-flex; gap: 9px; padding: 5px 6px 5px 11px; }.invite-code strong { color: #fff; font-family: "DM Mono", monospace; font-size: 11px; letter-spacing: .09em; margin-left: 4px; }.invite-code button { background: rgba(255,255,255,.19); border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: #fff; cursor: pointer; font-size: 10px; font-weight: 800; padding: 6px 9px; transition: background .18s, transform .18s; }.invite-code button:hover { background: rgba(255,255,255,.28); transform: translateY(-1px); }*/
.discussion { padding: 19px; }.discussion-meta { gap: 8px; }.discussion > h3 { margin: 14px 0 8px; }.discussion-actions { align-items: center; border-bottom: 1px solid rgba(98,105,152,.1); display: flex; justify-content: space-between; margin-top: 15px; padding-bottom: 12px; }.comment-count { color: #6e748b; font-family: "DM Mono", monospace; font-size: 10px; font-weight: 700; }.reply-link { background: #f0edff; border: 0; border-radius: 999px; color: #5c3de0; cursor: pointer; font-size: 10px; font-weight: 800; padding: 6px 10px; transition: background .18s, transform .18s; }.reply-link:hover { background: #e5e0ff; transform: translateY(-1px); }.comment-thread { border-left: 2px solid #e4dfff; display: grid; gap: 12px; margin: 16px 0 0 12px; padding-left: 15px; }.comment-item { display: flex; gap: 9px; }.comment-avatar { align-items: center; background: linear-gradient(135deg, #e7e0ff, #d9f7f5); border-radius: 9px; color: #5946ac; display: inline-flex; flex: 0 0 auto; font-size: 9px; font-weight: 800; height: 26px; justify-content: center; width: 26px; }.comment-body { background: #f8f8fd; border: 1px solid #ececf5; border-radius: 12px; flex: 1; min-width: 0; padding: 10px 12px; }.comment-meta { align-items: baseline; display: flex; gap: 8px; }.comment-meta strong { color: #3d435e; font-size: 11px; }.comment-meta span { color: #969bb0; font-family: "DM Mono", monospace; font-size: 9px; }.comment-body p { color: #5c627a; font-size: 12px; line-height: 1.55; margin: 5px 0 0; }.no-comments { color: #8c91a5; font-size: 11px; margin: 16px 0 0 12px; }.inline-reply-form { align-items: center; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr) auto; margin-top: 15px; }.inline-reply-form input { border-radius: 11px; font-size: 12px; min-width: 0; padding: 10px 12px; }.inline-reply-form .button { font-size: 11px; min-height: 38px; }

/* StudyBot feels like a focused, premium workspace. */
.study-layout { gap: 20px; }.study-layout > .study-panel { position: sticky; top: 84px; }.study-panel { padding: 22px; }.study-panel h2 { font-size: 18px; letter-spacing: -1px; }.study-answer { background: rgba(255,255,255,.72); padding: 22px; }.message { border-color: rgba(102,107,153,.1); border-radius: 17px; padding: 16px; }.message.user { background: linear-gradient(135deg, #e9e5ff, #eef2ff); border-color: #ded8ff; }.message.assistant { background: #fff; box-shadow: 0 7px 18px rgba(41,44,83,.05); }.message-label { color: var(--brand); font-size: 9px; letter-spacing: .1em; }.message p { color: #454b65; font-size: 13px; line-height: 1.7; }.empty-study .spark { background: conic-gradient(from 210deg, #dff8f7, #eee8ff, #ffeff4, #dff8f7); box-shadow: 0 12px 25px rgba(92,75,203,.12); }.ai-warning { background: #fff8e8; border-color: #ffebbc; border-radius: 13px; color: #775b08; }
.study-response { color: #464c65; font-size: 13px; line-height: 1.72; }.study-response > :first-child { margin-top: 0; }.study-response > :last-child { margin-bottom: 0; }.study-response h3 { color: #242943; font-family: "Sora", sans-serif; font-size: 17px; letter-spacing: -.7px; line-height: 1.35; margin: 18px 0 10px; }.study-response h4 { color: #5c40d6; font-family: "Sora", sans-serif; font-size: 12px; letter-spacing: -.25px; margin: 18px 0 7px; }.study-response h5 { color: #616780; font-size: 11px; margin: 15px 0 6px; text-transform: uppercase; }.study-response p { margin: 0 0 11px; }.study-response ul, .study-response ol { background: #faf9ff; border: 1px solid #ece9fa; border-radius: 12px; margin: 9px 0 15px; padding: 10px 14px 10px 32px; }.study-response li { margin: 4px 0; padding-left: 2px; }.study-response strong { color: #343951; font-weight: 800; }.study-response code { background: #f0edff; border-radius: 5px; color: #5b3acf; font-family: "DM Mono", monospace; font-size: 11px; padding: 2px 5px; }.study-response pre { background: #191c31; border-radius: 12px; color: #e6e8f9; margin: 10px 0 15px; overflow-x: auto; padding: 14px; }.study-response pre code { background: transparent; color: inherit; padding: 0; }.study-response blockquote { background: #f3f0ff; border-left: 3px solid #8d78ec; border-radius: 0 10px 10px 0; color: #565073; margin: 12px 0; padding: 10px 12px; }

.modal-backdrop { backdrop-filter: blur(7px); background: rgba(10,12,29,.48); }.modal { animation: modal-in .23s ease-out both; background: rgba(255,255,255,.96); border-color: rgba(255,255,255,.8); border-radius: 23px; box-shadow: 0 28px 80px rgba(10,12,38,.3); }.modal h2 { letter-spacing: -1px; }.close { background: #f2f2f8; border-radius: 10px; }.file-drop { background: linear-gradient(135deg, #fafaff, #f1efff); border-color: #af9eff; border-radius: 13px; }.toast { animation: toast-in .27s ease-out both; background: #202441; border: 1px solid rgba(255,255,255,.12); border-radius: 13px; }.empty { background: rgba(255,255,255,.55); border-radius: 17px; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(9px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1050px) { .study-layout > .study-panel { position: static; } }
@media (max-width: 760px) {
  .auth-art { display: none; }.auth-form-wrap { padding: 28px; }.sidebar::before { display: none; }
  .nav-item { border-radius: 10px; }.nav-item:hover { transform: none; }.top-actions .button { font-size: 0; min-width: 42px; padding: 0; }.top-actions .button::after { content: "+"; font-size: 19px; }
  .page { padding: 21px 19px 85px; }.page-heading h1 { font-size: 26px; letter-spacing: -1.6px; }.metric { border-radius: 17px; }.metric-label { font-size: 10px; }.metric-trend { display: none; }.content-grid { gap: 15px; }.group-hero { border-radius: 22px; padding: 23px; }.group-hero::after { display: none; }.resource-card { padding: 17px; }.modal { border-radius: 20px; padding: 22px; }.toast-region { bottom: 76px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 768px) {
  .auth-art { display: none; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-form-wrap { padding: 24px 20px; }
  .page-heading { flex-direction: column; gap: 12px; }
  .page-heading h1 { font-size: clamp(22px, 6vw, 28px); }
  .group-row { gap: 10px; padding: 9px; }
  .group-row-title { font-size: 12px; }
  .group-row-sub { font-size: 10px; }
  .tabs { gap: 12px; margin-top: 15px; }
  .resource-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .study-layout { grid-template-columns: 1fr; }
  .study-answer { min-height: auto; padding: 16px; }
  .message-list { max-height: calc(100vh - 280px); }
  .metric-grid { gap: 12px; }
  .modal { max-width: calc(100% - 40px); padding: 20px; }
  .assignment { flex-direction: column; align-items: flex-start; gap: 12px; }
  .assignment .button { margin-left: 0; width: 100%; }
} 
.card,
.metric,
.study-answer,
.message,
.resource-card,
.discussion,
.assignment {
    min-width: 0;
}

.message,
.study-response,
.resource-card p,
.discussion p {
    overflow-wrap: anywhere;
    word-break: break-word;
}

pre,
code {
    overflow-x: auto;
}
/* ===========================
   MOBILE RESPONSIVE FIXES
   =========================== */

html,
body {
    width: 100%;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    max-width: 100%;
    box-sizing: border-box;
}

img,
video,
canvas,
svg {
    max-width: 100%;
    height: auto;
}

/* Small tablets */
@media (max-width: 480px) {

    .metric-grid,
    .content-grid,
    .study-layout {
        grid-template-columns: 1fr;
    }

    .study-panel {
        position: static !important;
    }

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

    .page-heading>* {
        width: 100%;
    }
}

/* Phones */
@media (max-width: 480px) {

    .page {
        padding: 16px 16px 90px;
    }

    .topbar {
        flex-wrap: wrap;
        gap: 12px;
    }

    .top-actions {
        width: 100%;
        justify-content: space-between;
    }

    .metric-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

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

    .assignment,
    .group-row,
    .discussion {
        flex-direction: column;
        align-items: flex-start;
    }

    .assignment .button {
        width: 100%;
        margin-left: 0;
        margin-top: 12px;
    }

    .modal {
        width: calc(100% - 20px);
        max-width: none;
        margin: 10px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .hero-meta,
    .tag-row {
        flex-wrap: wrap;
    }

    .message-list {
        max-height: none;
    }

    .study-answer {
        min-height: auto;
    }
}

/* Small phones */
@media (max-width: 480px) {

    h1 {
        font-size: 1.7rem !important;
    }

    h2 {
        font-size: 1.3rem !important;
    }

    .page-heading h1 {
        font-size: 1.6rem !important;
    }

    .group-hero {
        padding: 18px;
    }

    .group-hero h1 {
        font-size: 1.5rem;
    }

    .metric {
        padding: 14px;
    }

    .metric-value {
        font-size: 22px;
    }

    .button,
    .button-primary,
    .button-secondary {
        width: 100%;
    }

    .card,
    .resource-card,
    .discussion,
    .assignment {
        padding: 14px;
    }

    .comment-item {
        flex-direction: column;
    }

    .comment-avatar {
        display: none;
    }

    .inline-reply-form {
        grid-template-columns: 1fr;
    }

    .inline-reply-form .button {
        width: 100%;
    }

    .study-response pre {
        overflow-x: auto;
        white-space: pre;
    }

    table {
        display: block;
        overflow-x: auto;
        width: 100%;
    }
}

/* Additional responsive hardening for small phones and cramped layouts */
@media (max-width: 480px) {
    .content-grid,
    .study-layout {
        grid-template-columns: 1fr;
    }

    .study-layout > .study-panel {
        position: static !important;
    }
}

@media (max-width: 480px) {
    .app-shell {
        display: block;
        grid-template-columns: 1fr;
        position: relative;
    }

    .mobile-sidebar-backdrop {
        background: rgba(8, 10, 24, 0.48);
        display: none;
        inset: 0;
        position: fixed;
        z-index: 18;
    }

    .app-shell.mobile-sidebar-open .mobile-sidebar-backdrop {
        display: block;
    }

    .sidebar {
        align-items: stretch;
        background: #14172d;
        box-shadow: 16px 0 40px rgba(8, 10, 24, 0.28);
        flex-direction: column;
        gap: 10px;
        min-height: 100vh;
        padding: 16px;
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        width: min(82vw, 320px);
        z-index: 19;
    }

    .app-shell.mobile-sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-head {
        align-items: center;
        display: flex;
        justify-content: space-between;
        margin-bottom: 4px;
    }

    .mobile-sidebar-close {
        background: rgba(255,255,255,0.12);
        border: 0;
        border-radius: 999px;
        color: white;
        font-size: 18px;
        height: 34px;
        width: 34px;
    }

    .sidebar .brand,
    .sidebar .brand-mark {
        display: flex;
    }

    .sidebar .brand {
        margin: 0;
    }

    .sidebar .nav-label,
    .sidebar-spacer,
    .profile-bar,
    .help-card {
        display: none;
    }

    .nav-group {
        display: grid;
        gap: 4px;
    }

    .nav-item {
        justify-content: flex-start;
        min-width: 0;
        padding: 10px 12px;
    }

    .main {
        min-width: 0;
    }

    .mobile-nav-toggle {
        background: white;
        border: 1px solid var(--line);
        border-radius: 10px;
        color: #555a74;
        font-size: 18px;
        height: 40px;
        width: 40px;
    }

    .topbar {
        gap: 12px;
        padding: 14px 16px 12px;
    }

    .page {
        padding: 16px 16px 24px;
    }

    .page-heading,
    .section-heading,
    .card-head,
    .modal-head {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 12px;
    }

    .page-heading > div:last-child,
    .top-actions,
    .hero-meta,
    .tag-row,
    .resource-footer,
    .discussion-actions,
    .modal-actions,
    .inline-reply-form {
        flex-wrap: wrap;
    }

    .group-row,
    .assignment,
    .discussion,
    .resource-card,
    .study-panel,
    .study-answer,
    .metric,
    .card {
        min-width: 0;
    }

    .group-row,
    .assignment,
    .discussion {
        align-items: flex-start;
        flex-direction: column;
    }

    .assignment .button {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }

    .study-answer {
        min-height: auto;
        padding: 16px;
    }

    .message-list {
        max-height: none;
    }

    .modal {
        margin: 10px;
        max-width: calc(100vw - 20px);
        padding: 18px;
        width: calc(100vw - 20px);
    }

    .toast-region {
        bottom: 20px;
        left: 12px;
        right: 12px;
    }
}

@media (max-width: 480px) {
    .page {
        padding: 14px 14px 108px;
    }

    .page-heading h1 {
        font-size: 1.5rem;
    }

    .group-hero,
    .card,
    .resource-card,
    .discussion,
    .assignment,
    .study-panel,
    .study-answer {
        padding: 14px;
    }

    .button,
    .button-primary,
    .button-secondary {
        justify-content: center;
        width: 100%;
        min-height: 44px;
    }

    .button + .button {
        margin-top: 8px;
    }

    .page-heading > div:last-child {
        width: 100%;
    }

    .resource-footer span:last-child {
        margin-left: 0;
    }

    .comment-item {
        flex-direction: column;
    }

    .comment-avatar {
        display: none;
    }

    .inline-reply-form {
        grid-template-columns: 1fr;
    }

    .inline-reply-form .button {
        width: 100%;
    }

    /* Additional mobile enhancements */
    label {
        font-size: 13px;
    }

    input, textarea, select {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px;
    }

    .metric-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .metric {
        padding: 14px;
    }

    .metric-value {
        font-size: 24px;
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .study-layout {
        grid-template-columns: 1fr;
    }

    .study-layout > .study-panel {
        position: static !important;
        margin-bottom: 16px;
    }

    .resource-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .resource-card {
        padding: 14px;
    }

    .resource-footer {
        flex-wrap: wrap;
        flex-direction: column;
        gap: 8px;
    }

    .resource-footer a {
        width: 100%;
    }

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

    .assignment .button {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
    }

    .discussion {
        padding: 14px;
    }

    .discussion-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .reply-link {
        width: 100%;
    }

    .group-row {
        flex-wrap: wrap;
    }

    .group-cover {
        flex-shrink: 0;
    }

    .topbar {
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 14px;
    }

    .breadcrumbs {
        width: 100%;
        order: 2;
    }

    .top-actions {
        width: 100%;
        order: 1;
        justify-content: space-between;
    }

    .modal {
        margin: 10px auto;
        max-width: calc(100vw - 20px);
        padding: 16px;
        width: auto;
    }

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

    .close {
        position: absolute;
        top: 12px;
        right: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal .form-stack {
        margin-top: 16px;
    }

    .modal-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-actions .button {
        width: 100%;
    }

    .group-hero {
        padding: 16px;
        border-radius: 20px;
    }

    .group-hero h1 {
        font-size: 1.4rem;
    }

    .group-hero p {
        font-size: 12px;
    }

    .hero-meta {
        flex-direction: column;
        width: 100%;
    }

    .hero-meta .chip {
        width: 100%;
    }

    .tabs {
        gap: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        white-space: nowrap;
        font-size: 11px;
    }

    /*.invite-code {
        flex-direction: column;
        width: 100%;
    }*/

    .message-list {
        max-height: none;
        padding-right: 0;
    }

    .message {
        margin: 0;
        padding: 12px;
    }

    .comment-thread {
        margin: 12px 0 0 0;
        padding-left: 10px;
    }

    .comment-body {
        padding: 8px 10px;
        font-size: 12px;
    }

    .study-response {
        font-size: 12px;
    }

    .study-response h3 {
        font-size: 15px;
    }

    .study-response h4 {
        font-size: 11px;
    }

    .study-response ul, .study-response ol {
        padding: 8px 12px 8px 28px;
    }

    .study-response pre {
        padding: 10px;
        font-size: 11px;
    }

    .tag {
        font-size: 8px;
        padding: 4px 6px;
    }

    .toast {
        width: calc(100vw - 24px);
        font-size: 12px;
    }

    .toast-region {
        left: 12px;
        right: 12px;
        bottom: 80px;
    }

    .empty {
        padding: 20px;
    }

    /* Touch-friendly spacing */
    button {
        min-height: 44px;
        padding: 10px 12px;
    }

    a, button {
        -webkit-tap-highlight-color: transparent;
    }

    /* Ensure text is readable without zoom */
    body {
        font-size: 16px;
    }

    /* Prevent horizontal scroll */
    body, html {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .app-shell {
        max-width: 100vw;
    }

    .main {
        min-width: 0;
        max-width: 100%;
    }

    .page {
        max-width: 100%;
    }

    /* Responsive tables */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    /* Responsive images */
    img {
        max-width: 100%;
        height: auto;
    }
}
.invite-code {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 150px;
    min-height: 56px;
    padding: 10px 14px;

    border: 1px solid rgba(255,255,255,.15);
    border-radius: 14px;
    background: rgb(80, 8, 212);
}

.invite-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.invite-label {
    font-size: 11px;
    color: rgba(255,255,255,.75);
}

.invite-content strong {
    color: #fff;
    font-size: 15px;
    letter-spacing: 2px;
}

.copy-btn {
    width: 38px;
    height: 38px;
    padding: 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 10px;

    background: rgb(106, 8, 210);
    color: #ffffff;

    flex-shrink: 0;
    cursor: pointer;
    transition: .2s;
}

.copy-btn:hover {
    background: rgba(255,255,255,.24);
}

@media (max-width:480px) {
    .invite-code {
        padding: 10px 12px;
        min-height: 52px;
        min-width: 50px;
    }

    .copy-btn {
        font-size: larger;
        width: 34px;
        height: 34px;
        border-radius: 28%;
    }
}
