:root {
  color-scheme: light;
  --ink: #24231f;
  --muted: #686760;
  --paper: #f6f3ea;
  --white: #fffdf8;
  --line: #ddd7c9;
  --soft: #eee9dd;
  --rust: #96513d;
  --rust-dark: #793e2e;
  --green: #436a58;
  --shadow: 0 12px 32px rgba(42, 36, 26, 0.08);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-height: 100%; color: var(--ink); background: #eae6dc; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
input, textarea, select { color: var(--ink); }
:focus-visible { outline: 3px solid #ad745a; outline-offset: 3px; }

.app-shell {
  min-height: 100dvh;
  max-width: 980px;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 60px rgba(28, 25, 20, 0.12);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

.masthead {
  position: relative;
  overflow: hidden;
  min-height: 148px;
  color: #fffaf1;
  background: #252521;
  padding: 26px clamp(20px, 5vw, 46px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.masthead::before {
  content: "";
  position: absolute;
  inset: -65% -20%;
  opacity: 0.52;
  background:
    repeating-radial-gradient(ellipse at 63% 44%, transparent 0 13px, rgba(248,245,235,0.3) 14px 15px, transparent 17px 25px),
    repeating-radial-gradient(ellipse at 14% 75%, transparent 0 19px, rgba(248,245,235,0.21) 20px 21px, transparent 23px 38px),
    linear-gradient(130deg, rgba(255,255,255,0.05), transparent 50%);
  transform: rotate(-16deg) scale(1.25);
  pointer-events: none;
}
.brand, .masthead-actions { position: relative; z-index: 1; }
.brand { display: flex; gap: 15px; align-items: center; }
.brand-mark {
  width: 54px;
  height: 64px;
  border-radius: 3px 9px 9px 3px;
  border-left: 6px solid #c2b8a6;
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-size: 27px;
  font-style: italic;
  color: var(--ink);
  background: #f6f1e5;
  box-shadow: 3px 5px 0 rgba(0,0,0,0.25);
  flex: 0 0 auto;
}
.brand-title { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(24px, 4.3vw, 35px); line-height: 1.05; letter-spacing: -0.035em; }
.brand-tagline { margin: 7px 0 0; color: #e7dfd3; font-size: 13px; line-height: 1.3; max-width: 380px; }
.masthead-actions { display: flex; align-items: center; }
.masthead-actions .button { background: #f7f0e2; color: var(--ink); border-color: #f7f0e2; white-space: nowrap; }

.content { padding: 28px clamp(18px, 5vw, 46px) 48px; }
.pool-shell .content, .profile-shell .content { padding-top: 16px; }
.pool-view { max-width: 760px; margin: 0 auto; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--rust); font-weight: 800; text-transform: uppercase; letter-spacing: 0.11em; font-size: 11px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
.view-title { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(30px, 5vw, 43px); line-height: 1.1; letter-spacing: -0.04em; }
.view-description { color: var(--muted); margin: 8px 0 0; line-height: 1.5; }
.section-title { margin: 32px 0 14px; font-family: Georgia, "Times New Roman", serif; font-size: 23px; letter-spacing: -0.02em; }
.small-title { font-size: 16px; margin: 0; line-height: 1.3; }
.muted { color: var(--muted); }
.tiny { color: var(--muted); font-size: 12px; line-height: 1.4; }
.strong { font-weight: 750; }

.button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 16px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease;
}
.button:hover { transform: translateY(-1px); }
.button.secondary { color: var(--ink); background: transparent; border-color: #c9c2b3; }
.button.ghost { color: var(--rust-dark); background: transparent; border-color: transparent; padding-inline: 8px; }
.button.danger { color: #8a342f; background: transparent; border-color: #d7b7af; }
.button.small { min-height: 44px; padding: 9px 11px; font-size: 13px; border-radius: 9px; }
.button.full { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.icon-button { width: 44px; height: 44px; padding: 0; border: 1px solid #d5cec0; border-radius: 12px; background: var(--white); color: var(--ink); font-size: 23px; }
.back-button { border: 0; color: var(--rust-dark); background: transparent; padding: 5px 0; font-weight: 700; min-height: 44px; margin-bottom: 10px; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.featured { background: #f9f4e9; border-color: #d9caba; padding: clamp(20px, 4vw, 28px); }
.featured h2 { margin: 10px 0 5px; font-family: Georgia, serif; font-size: clamp(24px, 4vw, 32px); line-height: 1.13; }
.featured .stage { color: var(--rust-dark); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; }
.featured p { line-height: 1.5; }
.featured .button-row { margin-top: 20px; }
.featured-top, .card-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; background: var(--soft); color: #524b42; padding: 6px 10px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.pill.late { background: #f7e1da; color: #903d33; }
.pill.done { background: #e0eee4; color: #35614a; }
.pill.warn { background: #fff0d4; color: #80561b; }
.card-list { display: grid; gap: 12px; }
.assignment-card { width: 100%; text-align: left; color: inherit; }
.assignment-card h3 { margin: 0 0 7px; font-family: Georgia, serif; font-size: 21px; }
.assignment-card:hover, .page-card:hover { border-color: #bdab98; transform: translateY(-1px); }
.assignment-card, .page-card { transition: border-color 120ms ease, transform 120ms ease; }
.progress-track { height: 7px; border-radius: 999px; background: #e6e0d4; overflow: hidden; margin-top: 15px; }
.progress-track > span { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.progress-label { margin: 7px 0 0; font-size: 12px; color: var(--muted); }
.inline-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--muted); font-size: 13px; }

.session-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.session-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 13px; align-items: start; border: 1px solid var(--line); border-radius: 13px; padding: 14px; background: var(--white); }
.session-card.completed { opacity: 0.68; }
.session-card.completed .session-name { text-decoration: line-through; }
.check-button { width: 44px; height: 44px; border-radius: 12px; border: 2px solid #999083; color: white; background: transparent; flex: 0 0 auto; margin-top: 1px; font-size: 16px; line-height: 1; }
.check-button.checked { background: var(--green); border-color: var(--green); }
.session-name { margin: 0 0 5px; font-weight: 750; line-height: 1.3; }
.session-actions { margin-top: 11px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.session-date { min-height: 44px; max-width: 150px; border: 1px solid #d9d2c3; background: #fffefa; border-radius: 8px; padding: 6px; font-size: 13px; }
.notice { border-left: 4px solid #b37947; background: #fff3df; padding: 12px 15px; border-radius: 0 10px 10px 0; color: #614622; line-height: 1.45; margin: 16px 0; }
.notice.good { border-color: var(--green); background: #eaf2eb; color: #2f5d43; }
.empty { border: 1px dashed #bfb5a5; background: #faf7f0; border-radius: 18px; padding: 32px 24px; text-align: center; }
.empty-icon { display: block; font-family: Georgia, serif; font-size: 57px; color: var(--rust); line-height: 1; margin-bottom: 9px; }
.empty h2 { font-family: Georgia, serif; font-size: 24px; margin: 0 0 8px; }
.empty p { color: var(--muted); line-height: 1.5; max-width: 440px; margin: 0 auto 20px; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label, .field .label { font-size: 13px; font-weight: 750; }
.field input, .field textarea, .field select, .search-input {
  width: 100%; min-height: 44px; border: 1px solid #cfc7b9; border-radius: 10px; background: #fffefa; padding: 10px 12px; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus, .search-input:focus { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(150,81,61,0.14); }
.field textarea { resize: vertical; min-height: 104px; line-height: 1.5; }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.4; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.radio-row { display: flex; gap: 9px; flex-wrap: wrap; }
.radio-card { flex: 1; min-width: 145px; border: 1px solid #cec6b7; border-radius: 12px; padding: 12px; background: #fffefa; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--rust); background: #fbf0e9; box-shadow: inset 0 0 0 1px var(--rust); }
.radio-card input { width: auto; min-height: 0; margin: 0 7px 0 0; }
.radio-card strong { font-size: 14px; }
.radio-card small { display: block; margin: 5px 0 0 22px; color: var(--muted); line-height: 1.35; }
.days-row { display: flex; gap: 6px; flex-wrap: wrap; }
.day-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; border: 1px solid #cdc4b6; border-radius: 10px; background: #fffefa; cursor: pointer; font-size: 12px; font-weight: 750; }
.day-chip:has(input:checked) { color: white; background: var(--ink); border-color: var(--ink); }
.day-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day-chip:has(input:focus-visible) { outline: 3px solid #ad745a; outline-offset: 3px; }
.form-error { color: #8a342f; font-size: 13px; font-weight: 650; min-height: 20px; }

.overlay { position: fixed; z-index: 20; inset: 0; background: rgba(21,20,17,0.6); display: flex; align-items: flex-end; justify-content: center; }
.dialog { width: min(100%, 680px); max-height: min(92dvh, 900px); overflow: auto; border-radius: 20px 20px 0 0; padding: 24px clamp(18px, 4vw, 32px) calc(28px + env(safe-area-inset-bottom)); background: var(--paper); box-shadow: 0 -20px 65px rgba(0,0,0,0.23); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 18px; }
.dialog h2 { margin: 0; font-family: Georgia, serif; font-size: 28px; }
.dialog-close { border: 0; background: transparent; font-size: 27px; min-width: 44px; min-height: 44px; }
.dialog .button-row { margin-top: 19px; }

.notebook-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 16px 0 22px; }
.notebook-tools .search-input { flex: 1 1 230px; }
.page-card { border: 1px solid var(--line); border-radius: 13px; padding: 15px 18px; background: var(--white); width: 100%; text-align: left; color: inherit; }
.page-card h3 { margin: 0 0 6px; font-family: Georgia, serif; font-size: 19px; }
.page-card p { color: var(--muted); margin: 0 0 10px; line-height: 1.35; font-size: 13px; }
.page-editor { background: #fffdf7; border: 1px solid #d8d0c1; border-radius: 15px; overflow: hidden; box-shadow: var(--shadow); }
.page-meta { border-bottom: 1px solid #e0d9ca; padding: 14px 18px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.page-title-input { border: 0; width: 100%; background: transparent; font: 700 clamp(22px, 4vw, 31px) Georgia, serif; outline: none; color: var(--ink); }
.page-title-input:focus { outline: none; }
.writing-page { position: relative; background: repeating-linear-gradient(to bottom, #fffdf7 0, #fffdf7 34px, #dbe2e2 35px, #fffdf7 36px); padding: 19px 22px 26px 48px; min-height: 340px; }
.writing-page::before { content: ""; position: absolute; top: 0; bottom: 0; left: 34px; width: 2px; background: rgba(173,87,75,0.35); }
.writing-page textarea { display: block; width: 100%; min-height: 420px; resize: vertical; border: 0; outline: 0; background: transparent; color: var(--ink); font: 17px/36px Georgia, serif; padding: 0; margin: 0; }
.writing-page textarea::placeholder { color: #8c8980; }
.margin-section { border-top: 1px solid #ddd5c8; background: #f3eee4; padding: 16px 20px 19px; }
.margin-section h3 { font-family: Georgia, serif; margin: 0 0 5px; }
.margin-section textarea { width: 100%; min-height: 94px; resize: vertical; background: #fffdf8; border: 1px solid #d3cab9; border-radius: 10px; padding: 10px 12px; line-height: 1.5; }
.page-title-input:focus-visible, .writing-page textarea:focus-visible, .margin-section textarea:focus-visible { outline: 3px solid #ad745a; outline-offset: 2px; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin: 15px 0; }
.save-state { margin-left: auto; font-size: 12px; color: var(--muted); }
.draft-preview { white-space: pre-wrap; word-break: break-word; background: #fffdf8; border: 1px solid var(--line); border-radius: 12px; padding: 18px; max-height: 46dvh; overflow: auto; line-height: 1.6; font-family: Georgia, serif; }
.draft-page-list { display: grid; gap: 8px; margin: 14px 0; }
.draft-page-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); padding: 7px 9px; }
.draft-page-row label { display: flex; align-items: center; gap: 8px; line-height: 1.3; font-weight: 650; }
.draft-page-row input { width: 19px; height: 19px; accent-color: var(--rust); }

/* Community keeps the look of a shared composition book. */
.community-banner {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(19px, 3.5vw, 26px);
  margin-bottom: 20px;
  border: 1px solid #d9c8a9;
  border-radius: 17px;
  background: linear-gradient(115deg, #f1e8d4, #fbf6e9 62%, #f4e5d8);
}
.community-banner::after {
  content: "";
  position: absolute;
  top: -95px;
  right: -75px;
  width: 250px;
  height: 250px;
  border: 2px solid rgba(120, 84, 56, 0.1);
  border-radius: 50%;
  box-shadow: 0 0 0 22px rgba(120, 84, 56, 0.035), 0 0 0 50px rgba(120, 84, 56, 0.025);
  pointer-events: none;
}
.community-banner > * { position: relative; z-index: 1; }
.community-banner h2 { margin: 0 0 6px; font: 26px/1.13 Georgia, serif; letter-spacing: -0.03em; }
.community-banner p { margin: 0; max-width: 570px; color: #5c5549; line-height: 1.5; }
.preview-badge { display: inline-flex; align-items: center; width: fit-content; padding: 5px 9px; margin-bottom: 9px; border-radius: 999px; color: #6a4433; background: #e9d4c3; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.community-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 270px); align-items: start; gap: 20px; }
.community-main, .community-side { min-width: 0; }
.community-main > .section-title, .community-side > .section-title { margin-top: 0; }
.subject-tools { padding: 17px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.subject-tools h2, .subject-tools h3 { margin: 0 0 11px; font-family: Georgia, serif; font-size: 18px; }
.subject-tools p { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.subject-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.subject-chip { min-height: 40px; padding: 8px 11px; border: 1px solid #d3cbbb; border-radius: 999px; color: #4f4b43; background: #fcfaf3; font-size: 12px; font-weight: 700; line-height: 1.2; text-align: center; }
.subject-chip:hover { border-color: var(--rust); background: #faf0e8; }
.subject-chip.active, .subject-chip[aria-pressed="true"] { border-color: var(--rust-dark); color: #fffaf1; background: var(--rust-dark); }
.subject-count { color: var(--muted); font-size: 12px; line-height: 1.4; }
.subject-chip.active .subject-count { color: #fff1e8; }
.community-hint { padding: 12px 14px; margin: 0 0 16px; border-left: 3px solid #c1a47e; border-radius: 0 8px 8px 0; color: #675746; background: #f5ecd9; font-size: 12px; line-height: 1.5; }
.feed-header { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 22px 0 13px; }
.feed-header .section-title { margin: 0 0 4px; }
.feed-header .tiny { margin: 0; }
.pool-toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.pool-toolbar label { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 750; }
.pool-toolbar select { min-width: 0; max-width: 220px; min-height: 38px; padding: 7px 10px; border: 1px solid #d0c7b7; border-radius: 9px; color: var(--ink); background: var(--white); font-size: 13px; font-weight: 700; }
.pool-toolbar .tiny { flex: 0 0 auto; margin: 0 0 0 auto; }
.pool-footnote { margin: 16px 0 0; text-align: center; }
.feed-list { display: grid; gap: 12px; }
.feed-card { padding: 19px; border: 1px solid var(--line); border-radius: 15px; background: var(--white); box-shadow: var(--shadow); }
.feed-card h3 { margin: 10px 0 8px; font: 22px/1.2 Georgia, serif; letter-spacing: -0.02em; }
.feed-card p { line-height: 1.5; }
.feed-card-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.feed-meta { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.3; }
.feed-meta strong { color: var(--ink); font-size: 13px; }
.feed-meta > div { min-width: 0; }
.feed-meta .pill { margin-left: auto; }
.feed-author { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 750; color: var(--ink); }
.feed-author > div { min-width: 0; }
.feed-topic { display: inline-flex; width: fit-content; padding: 5px 9px; border-radius: 999px; color: #644b3c; background: #efe4d4; font-size: 11px; font-weight: 750; white-space: nowrap; }
.feed-avatar { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; overflow: hidden; border-radius: 50%; color: #76503c; background: #e9d7c3; font: italic 18px Georgia, serif; }
.feed-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.feed-body { margin: 0 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: #4b4841; }
.feed-card .post-source-note { margin: 0; }
.feed-empty { padding: 28px 20px; border: 1px dashed #bfb5a5; border-radius: 15px; color: var(--muted); background: #faf7f0; text-align: center; line-height: 1.5; }
.post-composer { padding: 18px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--white); }
.post-composer h2, .post-composer h3 { margin: 0 0 5px; font: 20px Georgia, serif; }
.post-composer p { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.post-composer .form-grid { gap: 12px; }
.post-composer .button-row { margin-top: 14px; }
.post-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 13px; }
.post-source-note { color: var(--muted); font-size: 12px; line-height: 1.45; }
.profile-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--white); box-shadow: var(--shadow); }
.profile-cover { position: relative; height: 125px; overflow: hidden; background: radial-gradient(circle at 20% 20%, #ded5b6 0 11%, transparent 12%), repeating-radial-gradient(ellipse at 68% 40%, #39403b 0 9px, #313833 10px 12px, #39403b 13px 23px); }
.profile-cover img, .profile-cover-image { display: block; width: 100%; height: 100%; object-fit: cover; }
.profile-placeholder { display: grid; place-items: center; width: 100%; height: 100%; color: #f5eee1; font: italic 35px Georgia, serif; opacity: 0.8; }
.profile-info { position: relative; padding: 0 17px 18px; }
.profile-avatar { display: grid; place-items: center; width: 65px; height: 65px; margin-top: -31px; overflow: hidden; border: 3px solid var(--white); border-radius: 50%; color: #76503c; background: #ead7c0; box-shadow: 0 3px 10px rgba(0,0,0,0.14); font: italic 30px Georgia, serif; }
.profile-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.profile-name { margin: 10px 0 3px; font: 21px/1.2 Georgia, serif; }
.profile-bio { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.profile-actions .button { flex: 1 1 auto; }
.profile-card .post-source-note { padding: 0 17px 17px; margin: 0; }

/* A member's Community tab opens their full profile and subject posts. */
.community-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px;
  margin: 0 0 22px;
  border: 1px solid #d6cdbd;
  border-radius: 13px;
  background: #eee8dc;
}
.community-switcher button {
  min-height: 40px;
  padding: 8px 15px;
  border: 0;
  border-radius: 9px;
  color: #655d52;
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}
.community-switcher button:hover { color: var(--ink); background: #f8f3e9; }
.community-switcher button.active,
.community-switcher button[aria-pressed="true"],
.community-switcher button[aria-current="page"] { color: var(--ink); background: var(--white); box-shadow: 0 2px 8px rgba(52, 43, 30, 0.1); }
.assignment-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px;
  margin: 0 0 22px;
  border: 1px solid #d6cdbd;
  border-radius: 13px;
  background: #eee8dc;
}
.assignment-switcher button {
  min-height: 40px;
  padding: 8px 15px;
  border: 0;
  border-radius: 9px;
  color: #655d52;
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}
.assignment-switcher button:hover { color: var(--ink); background: #f8f3e9; }
.assignment-switcher button.active,
.assignment-switcher button[aria-pressed="true"] { color: var(--ink); background: var(--white); box-shadow: 0 2px 8px rgba(52, 43, 30, 0.1); }
.community-profile-page { max-width: 850px; margin-inline: auto; }
.community-profile-hero {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.community-profile-cover {
  height: clamp(180px, 24vw, 245px);
  overflow: hidden;
  background: radial-gradient(circle at 17% 18%, #ded5b6 0 9%, transparent 10%),
    repeating-radial-gradient(ellipse at 67% 48%, #39403b 0 13px, #313833 14px 16px, #39403b 17px 34px);
}
.community-profile-cover-image { display: block; width: 100%; height: 100%; object-fit: cover; }
.community-profile-content { position: relative; padding: 0 clamp(18px, 4vw, 30px) clamp(22px, 4vw, 30px); }
.community-profile-avatar {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin-top: -48px;
  border: 4px solid var(--white);
  border-radius: 50%;
  overflow: hidden;
  color: #76503c;
  background: #ead7c0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.17);
  font: italic 39px Georgia, serif;
}
.community-profile-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.community-profile-header { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 12px 20px; margin-top: 13px; }
.community-profile-name { margin: 0 0 5px; font: 33px/1.14 Georgia, serif; letter-spacing: -0.035em; }
.community-profile-bio { margin: 8px 0 0; max-width: 620px; color: var(--muted); line-height: 1.55; white-space: pre-wrap; }
.community-profile-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 17px 0 0; }
.community-profile-stats span { display: inline-flex; align-items: center; min-height: 31px; padding: 6px 11px; border-radius: 999px; color: #5a4c3e; background: #f2eadc; font-size: 12px; font-weight: 750; }
.community-profile-actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-top: 19px; }
.community-posts-head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 10px 18px; margin: 27px 0 13px; }
.community-posts-head h2 { margin: 0; font: 25px/1.2 Georgia, serif; letter-spacing: -0.02em; }
.community-posts-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.community-posts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.community-own-filters { margin-bottom: 13px; }
.community-posts-grid .feed-card { min-width: 0; }
.community-empty-posts { padding: 28px 24px; border: 1px dashed #bfb5a5; border-radius: 16px; background: #faf7f0; text-align: center; }
.community-empty-posts h3 { margin: 0 0 8px; font: 23px/1.2 Georgia, serif; }
.community-empty-posts p { max-width: 450px; margin: 0 auto 16px; color: var(--muted); line-height: 1.5; }
.community-empty-posts .button-row { justify-content: center; }

.workspace-section { margin: 27px 0 8px; }
.workspace-section .section-title { margin: 0 0 12px; }
.workspace-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.workspace-card { width: 100%; min-height: 96px; display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--white); box-shadow: var(--shadow); text-align: left; transition: border-color 120ms ease, transform 120ms ease; }
.workspace-card:hover { border-color: #bda991; transform: translateY(-1px); }
.workspace-card-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; color: var(--rust-dark); background: #f0e3d4; font: 25px/1 Georgia, serif; }
.workspace-card-copy { min-width: 0; }
.workspace-card-copy strong { display: block; margin-bottom: 4px; font: 20px/1.2 Georgia, serif; }
.workspace-card-copy small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.workspace-card-arrow { color: var(--rust-dark); font-size: 21px; line-height: 1; }

.tabbar { position: fixed; z-index: 10; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 980px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; padding: 7px 12px calc(7px + env(safe-area-inset-bottom)); background: rgba(255,253,248,0.97); border-top: 1px solid #d8d0c1; backdrop-filter: blur(16px); }
.tab { width: 100%; max-width: 160px; justify-self: center; min-width: 0; min-height: 55px; background: transparent; border: 0; border-radius: 12px; color: var(--muted); display: grid; place-content: center; gap: 4px; font-size: 12px; font-weight: 750; }
.tab::before { content: ""; width: 21px; height: 3px; margin: 0 auto; background: #c4bfb3; border-radius: 3px; }
.tab.active { background: #f0e9db; color: var(--ink); }
.tab.active::before { background: var(--rust); }
.tab-create { position: relative; width: 100%; max-width: 160px; justify-self: center; min-width: 0; min-height: 55px; display: grid; align-content: center; justify-items: center; gap: 2px; padding: 0; border: 0; border-radius: 12px; color: var(--rust-dark); background: transparent; font-size: 11px; font-weight: 800; }
.tab-create-circle { display: grid; place-items: center; width: 47px; height: 47px; margin-top: -15px; border: 3px solid var(--white); border-radius: 50%; color: #fffaf1; background: var(--rust-dark); box-shadow: 0 5px 16px rgba(67, 34, 25, 0.28); font: 34px/1 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.tab-create-label { line-height: 1; }
.tab-create:hover .tab-create-circle { background: var(--rust); transform: translateY(-1px); }
.tab-create:focus-visible { outline-offset: -2px; }
.tab-pool { gap: 2px; }
.tab-pool::before, .tab-pool.active::before { display: none; }
.tab-pool-icon { display: grid; place-items: center; width: 27px; height: 27px; margin: 0 auto; border: 2px solid #b4a896; border-radius: 8px; color: #75634f; background: #e8dfd0; }
.tab-pool-icon svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab-pool.active .tab-pool-icon { border-color: var(--rust); color: var(--rust-dark); background: #f9eae1; }
.tab-community { gap: 2px; }
.tab-community::before, .tab-community.active::before { display: none; }
.tab-community-icon { display: grid; place-items: center; width: 27px; height: 27px; margin: 0 auto; overflow: hidden; border: 2px solid #b4a896; border-radius: 50%; color: #75634f; background: #e8dfd0; }
.tab-community-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tab-community-icon svg { display: block; width: 19px; height: 19px; fill: currentColor; }
.tab-community.active .tab-community-icon { border-color: var(--rust); color: var(--rust-dark); background: #f9eae1; }
.quick-create-list { display: grid; gap: 10px; }
.quick-create-option { width: 100%; min-height: 75px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--white); text-align: left; }
.quick-create-option:hover { border-color: #b78f78; background: #fcf7ef; }
.quick-create-option > span:last-child { color: var(--rust-dark); font-size: 20px; }
.quick-create-option strong { display: block; margin-bottom: 3px; font-size: 15px; }
.quick-create-option small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.quick-create-glyph { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--rust-dark); background: #f0e3d4; font: 25px/1 Georgia, serif; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); min-width: 150px; max-width: min(90vw, 440px); padding: 11px 16px; border-radius: 11px; background: #26231f; color: #fff; text-align: center; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity 160ms ease, transform 160ms ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 620px) {
  .masthead { min-height: 118px; padding: 21px 18px; }
  .brand { gap: 11px; }
  .brand-mark { width: 43px; height: 52px; font-size: 22px; border-left-width: 5px; }
  .brand-title { font-size: 23px; }
  .brand-tagline { font-size: 11px; max-width: 230px; }
  .masthead-actions { display: none; }
  .content { padding-top: 23px; }
  .pool-shell .content, .profile-shell .content { padding-top: 12px; }
  .view-head { align-items: start; }
  .view-head > .button { white-space: nowrap; padding-inline: 12px; font-size: 13px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .dialog { max-height: 96dvh; }
  .writing-page { padding-left: 37px; padding-right: 14px; }
  .writing-page::before { left: 26px; }
  .writing-page textarea { font-size: 16px; }
  .community-layout { grid-template-columns: 1fr; }
  .community-side { grid-row: 1; }
  .community-switcher { display: flex; width: 100%; }
  .community-switcher button { flex: 1 1 0; padding-inline: 8px; }
  .assignment-switcher { display: flex; width: 100%; }
  .assignment-switcher button { flex: 1 1 0; padding-inline: 8px; }
  .community-profile-cover { height: clamp(145px, 42vw, 190px); }
  .community-profile-content { padding-inline: 17px; }
  .community-profile-avatar { width: 78px; height: 78px; margin-top: -39px; font-size: 31px; }
  .community-profile-name { font-size: 27px; }
  .community-profile-actions { width: 100%; }
  .community-profile-actions .button { flex: 1 1 0; }
  .community-posts-grid { grid-template-columns: 1fr; }
  .workspace-grid { grid-template-columns: 1fr; }
  .profile-cover { height: 114px; }
  .subject-tools { padding: 14px; }
  .subject-grid { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 5px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
  .subject-chip { flex: 0 0 auto; scroll-snap-align: start; }
  .feed-card { padding: 16px; }
  .tabbar { padding-inline: 8px; }
  .tab { font-size: 11px; white-space: nowrap; }
  .tab-create { font-size: 11px; }
  .tab-create-circle { width: 45px; height: 45px; font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
