/* 课间 · 同校学业互助：同一套高端玻璃，纸感和墨绿色 */
body[data-page="study"] #page-back { display: none !important; }
body[data-page="study"] main > header.has-pb { padding-left: 0 !important; }

.study-page {
  --study-accent: #4b7a65;
  --study-accent-soft: rgba(75, 122, 101, .13);
  --study-paper: rgba(255, 252, 245, .62);
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 4px 10px calc(94px + env(safe-area-inset-bottom, 0px));
  color: var(--ink, #1d2a24);
}

.study-top {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
}

.study-back {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  flex: 0 0 42px;
  width: 42px !important;
  height: 42px !important;
  margin: 0 !important;
}

.study-school-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  max-width: calc(100% - 54px);
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted, #66736c);
  background: rgba(255, 255, 255, .46);
  border: 1px solid rgba(255, 255, 255, .68);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 11px;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.study-school-pill i {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: #64b58a;
  box-shadow: 0 0 0 4px rgba(100, 181, 138, .14);
}

.study-eyebrow {
  margin: 0 0 7px;
  color: var(--muted, #66736c);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.study-hero {
  padding: 4px 8px 10px;
}

.study-hero h1 {
  margin: 0;
  color: var(--ink, #1d2a24);
  font-size: clamp(31px, 8.4vw, 38px);
  line-height: 1.06;
  font-weight: 650;
  letter-spacing: -.055em;
}

.study-hero-sub {
  margin: 8px 0 0;
  max-width: 25em;
  color: var(--muted, #66736c);
  font-size: 13px;
  line-height: 1.6;
}

.study-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.study-action {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 84px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 20px;
  background:
    radial-gradient(110% 110% at 8% 0%, rgba(255, 255, 255, .94), rgba(255, 255, 255, 0) 58%),
    linear-gradient(155deg, rgba(255, 255, 255, .8), rgba(252, 250, 244, .48));
  box-shadow: 0 14px 30px -24px rgba(58, 47, 31, .32), inset 0 1px 0 rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: blur(18px) saturate(1.45);
  backdrop-filter: blur(18px) saturate(1.45);
  color: var(--ink, #1d2a24);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform .22s cubic-bezier(.22, 1, .36, 1), box-shadow .22s ease;
}

.study-action::after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -50px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--study-accent-soft), transparent 68%);
  pointer-events: none;
}

.study-action:active { transform: scale(.975); }

.study-action-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 10px;
  color: var(--study-accent);
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(255, 255, 255, .9);
  font-size: 13px;
  font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .98);
}

.study-action-icon svg { width: 16px; height: 16px; }

.study-action b {
  position: relative;
  z-index: 1;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -.03em;
}

.study-action small {
  position: relative;
  z-index: 1;
  color: var(--muted, #66736c);
  font-size: 10px;
  line-height: 1.4;
}

.study-filter {
  display: flex;
  gap: 4px;
  margin: 1px 4px 8px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 999px;
  background: rgba(255, 255, 255, .34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.study-filter-btn {
  min-width: 0;
  min-height: 31px;
  flex: 1;
  border: 0;
  border-radius: 999px;
  color: var(--muted, #66736c);
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease;
}

.study-filter-btn.is-on {
  color: #fff;
  background: var(--ink, #1d2a24);
  font-weight: 600;
  box-shadow: 0 7px 16px -13px rgba(29, 42, 36, .6);
}

.study-filter-btn span {
  display: inline-block;
  margin-left: 3px;
  font-size: 9px;
  opacity: .62;
}

.study-feed {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 170px;
  max-height: min(38vh, 320px);
  max-height: min(38dvh, 320px);
  padding: 2px 2px 90px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.study-feed::-webkit-scrollbar { display: none; }

.study-loading,
.study-empty {
  margin: auto;
  padding: 25px 16px;
  color: var(--muted, #66736c);
  text-align: center;
}

.study-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.study-empty strong {
  color: var(--ink, #1d2a24);
  font-size: 17px;
  font-weight: 600;
}

.study-empty p {
  margin: 0;
  max-width: 22em;
  font-size: 12px;
  line-height: 1.6;
}

.study-empty-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--study-accent);
  background: rgba(255, 255, 255, .62);
  border: 1px solid rgba(255, 255, 255, .82);
}

.study-empty-mark svg { width: 29px; height: 29px; }

.study-empty button,
.study-sheet-submit {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 999px;
  color: var(--ink, #1d2a24);
  background: rgba(255, 255, 255, .68);
  box-shadow: 0 8px 18px -14px rgba(34, 44, 38, .36), inset 0 1px 0 rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.study-msg {
  position: relative;
  align-self: flex-start;
  max-width: 92%;
  padding: 10px 12px 9px;
  border-radius: 17px 17px 17px 7px;
  color: var(--ink, #1d2a24);
  background: rgba(255, 255, 255, .56);
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: 0 8px 20px -17px rgba(58, 47, 31, .32), inset 0 1px 0 rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.study-msg.is-post {
  max-width: 96%;
  background:
    radial-gradient(120% 110% at 12% 0%, rgba(255, 255, 255, .92), rgba(255, 255, 255, .36)),
    var(--study-paper);
}

.study-msg.is-mine {
  align-self: flex-end;
  border-radius: 17px 17px 7px 17px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .76), rgba(237, 246, 239, .62));
}

.study-msg-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.study-msg-head b {
  color: var(--ink, #1d2a24);
  font-size: 11px;
  font-weight: 600;
}

.study-msg-head time {
  margin-left: auto;
  color: var(--muted, #66736c);
  font-size: 10px;
}

.study-tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .02em;
}

.study-tag.is-ask {
  color: #a3554d;
  background: rgba(242, 210, 195, .52);
  border: 1px solid rgba(255, 255, 255, .72);
}

.study-tag.is-offer {
  color: #3e7057;
  background: rgba(207, 231, 216, .58);
  border: 1px solid rgba(255, 255, 255, .72);
}

.study-msg p {
  margin: 0;
  color: var(--ink, #1d2a24);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.study-report {
  margin-top: 4px;
  padding: 0;
  border: 0;
  color: var(--muted, #66736c);
  background: transparent;
  font: inherit;
  font-size: 10px;
  opacity: .62;
  cursor: pointer;
}

.study-composer {
  position: sticky;
  bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  z-index: 12;
  margin: 12px 0 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 21px;
  background:
    radial-gradient(120% 100% at 16% 0%, rgba(255, 255, 255, .96), rgba(255, 255, 255, .56) 58%, rgba(255, 252, 247, .46));
  box-shadow: 0 16px 34px -23px rgba(58, 47, 31, .38), inset 0 1px 0 rgba(255, 255, 255, .98);
  -webkit-backdrop-filter: blur(20px) saturate(1.55);
  backdrop-filter: blur(20px) saturate(1.55);
}

.study-composer-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  margin-bottom: 7px;
}

.study-free {
  color: var(--study-accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .03em;
}

.study-status {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  color: var(--muted, #66736c);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-status.is-bad { color: #b95f59; }

.study-composer-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.study-input {
  min-width: 0;
  height: 38px;
  flex: 1;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 14px;
  outline: 0;
  color: var(--ink, #1d2a24);
  background: rgba(255, 255, 255, .56);
  font: inherit;
  font-size: 13px;
}

.study-input::placeholder { color: var(--muted, #66736c); opacity: .74; }

.study-send {
  width: 40px;
  height: 38px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 14px;
  color: var(--study-accent);
  background: rgba(255, 255, 255, .7);
  cursor: pointer;
}

.study-send:disabled { opacity: .55; }
.study-send svg { width: 18px; height: 18px; }

.study-composer-note {
  margin: 6px 2px 0;
  color: var(--muted, #66736c);
  font-size: 10px;
  line-height: 1.4;
}

/* ---- 互助浮层 ---- */
body.study-sheet-open { overflow: hidden; }

.study-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.study-sheet[hidden] { display: none; }

.study-sheet-veil {
  position: absolute;
  inset: 0;
  background: rgba(24, 30, 36, .20);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
}

.study-sheet-card {
  position: relative;
  width: min(100%, 430px);
  max-height: min(86vh, 660px);
  max-height: min(86dvh, 660px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .88);
  border-radius: 24px;
  background:
    radial-gradient(120% 100% at 12% 0%, rgba(255, 255, 255, .98), rgba(255, 255, 255, .64) 58%, rgba(249, 246, 239, .52));
  box-shadow: 0 30px 70px -26px rgba(27, 40, 34, .42), inset 0 1px 0 rgba(255, 255, 255, .98);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  backdrop-filter: blur(28px) saturate(1.6);
  color: var(--ink, #1d2a24);
}

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

.study-sheet-head h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: -.04em;
}

.study-sheet-close {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid rgba(255, 255, 255, .76);
  border-radius: 50%;
  color: var(--muted, #66736c);
  background: rgba(255, 255, 255, .52);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.study-type-switch {
  display: flex;
  gap: 4px;
  margin: 0 0 12px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 999px;
  background: rgba(255, 255, 255, .38);
}

.study-type-switch button {
  min-height: 30px;
  flex: 1;
  border: 0;
  border-radius: 999px;
  color: var(--muted, #66736c);
  background: transparent;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.study-type-switch button.is-on {
  color: #fff;
  background: var(--ink, #1d2a24);
  font-weight: 600;
}

.study-sheet-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 10px;
  color: var(--muted, #66736c);
  font-size: 11px;
}

.study-sheet-card label > span {
  color: var(--muted, #66736c);
  font-size: 10px;
  opacity: .75;
}

.study-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.study-sheet-card input:not([type="checkbox"]),
.study-sheet-card select,
.study-sheet-card textarea {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .74);
  border-radius: 12px;
  outline: 0;
  color: var(--ink, #1d2a24);
  background: rgba(255, 255, 255, .58);
  font: inherit;
  font-size: 13px;
  box-sizing: border-box;
}

.study-sheet-card textarea {
  height: 76px;
  padding: 9px 10px;
  line-height: 1.55;
  resize: vertical;
}

.study-ack {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 8px !important;
  margin-top: 3px !important;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, .66);
  border-radius: 12px;
  background: rgba(255, 255, 255, .36);
  line-height: 1.5;
}

.study-ack input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 1px 0 0;
  accent-color: var(--study-accent);
}

.study-ack span {
  font-size: 10px !important;
  opacity: .88 !important;
}

.study-sheet-note {
  margin: 2px 0 13px;
  color: var(--muted, #66736c);
  font-size: 10px;
  line-height: 1.55;
}

.study-sheet-submit {
  width: 100%;
  min-height: 44px;
  color: var(--ink, #1d2a24);
  background: rgba(255, 255, 255, .82);
  font-size: 13px;
}

/* ---- 深色玻璃 ---- */
html[data-scheme="dark"] .study-school-pill,
html[data-scheme="dark"] .study-composer,
html[data-scheme="dark"] .study-input,
html[data-scheme="dark"] .study-sheet-card {
  color: #f4efe5;
  background: rgba(20, 27, 38, .56);
  border-color: rgba(255, 255, 255, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .13), 0 16px 34px -24px rgba(0, 0, 0, .6);
}

html[data-scheme="dark"] .study-action {
  color: #f4efe5;
  background:
    radial-gradient(120% 96% at 10% 0%, rgba(255, 255, 255, .17), rgba(255, 255, 255, 0) 58%),
    linear-gradient(155deg, rgba(30, 40, 53, .84), rgba(18, 24, 34, .66));
  border-color: rgba(255, 255, 255, .2);
  box-shadow: 0 16px 34px -24px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .18);
}

html[data-scheme="dark"] .study-action-icon {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .22);
  color: #aad8be;
}

html[data-scheme="dark"] .study-hero h1,
html[data-scheme="dark"] .study-action b,
html[data-scheme="dark"] .study-empty strong,
html[data-scheme="dark"] .study-msg-head b,
html[data-scheme="dark"] .study-msg p,
html[data-scheme="dark"] .study-sheet-head h2 {
  color: #f4efe5;
}

html[data-scheme="dark"] .study-filter {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .16);
}

html[data-scheme="dark"] .study-filter-btn.is-on,
html[data-scheme="dark"] .study-type-switch button.is-on {
  color: #101713;
  background: #e8f0ea;
}

html[data-scheme="dark"] .study-msg {
  color: #f4efe5;
  background: rgba(28, 36, 48, .7);
  border-color: rgba(255, 255, 255, .18);
  box-shadow: 0 8px 20px -17px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .12);
}

html[data-scheme="dark"] .study-msg.is-mine {
  background: linear-gradient(145deg, rgba(45, 58, 66, .82), rgba(32, 49, 44, .7));
}

html[data-scheme="dark"] .study-msg.is-post {
  background:
    radial-gradient(120% 110% at 12% 0%, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0) 58%),
    rgba(28, 36, 48, .76);
}

html[data-scheme="dark"] .study-tag.is-ask {
  color: #f0b4ad;
  background: rgba(164, 86, 76, .3);
}

html[data-scheme="dark"] .study-tag.is-offer {
  color: #a9d8bc;
  background: rgba(59, 109, 80, .3);
}

html[data-scheme="dark"] .study-input::placeholder { color: rgba(244, 239, 229, .58); }

html[data-scheme="dark"] .study-sheet-card input:not([type="checkbox"]),
html[data-scheme="dark"] .study-sheet-card select,
html[data-scheme="dark"] .study-sheet-card textarea {
  color: #f4efe5;
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .2);
}

html[data-scheme="dark"] .study-ack,
html[data-scheme="dark"] .study-type-switch {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .16);
}

html[data-scheme="dark"] .study-empty button,
html[data-scheme="dark"] .study-sheet-submit {
  color: #f4efe5;
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .22);
}

@media (max-width: 350px) {
  .study-page { padding-left: 7px; padding-right: 7px; }
  .study-actions { gap: 8px; }
  .study-action { min-height: 86px; padding-left: 11px; padding-right: 11px; }
  .study-action b { font-size: 15px; }
  .study-hero h1 { font-size: 29px; }
  .study-form-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}
