:root {
  --x-bg: #ffffff;
  --x-text: #0f1419;
  --x-muted: #536471;
  --x-border: #eff3f4;
  --x-hover: rgba(15, 20, 25, 0.08);
  --x-blue: #1d9bf0;
  --x-blue-soft: rgba(29, 155, 240, 0.1);
  --x-red: #f4212e;
  --x-pink: #f91880;
  --x-green: #00ba7c;
  --x-main-left: calc(50% - 360px);
  --x-left-edge: calc(50% - 630px);
  --x-right-left: calc(50% + 270px);
  --x-main-width: 600px;
  --x-nav-width: 260px;
  --x-right-width: 350px;
  --x-column-gap: 30px;
  --x-total-width: calc(var(--x-nav-width) + 10px + var(--x-main-width) + var(--x-column-gap) + var(--x-right-width));
}

html {
  color-scheme: light;
  scrollbar-gutter: stable;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background: var(--x-bg);
  color: var(--x-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body::before,
.paper-sweep {
  display: none !important;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
summary,
[role="button"] {
  cursor: pointer;
}

.lucide {
  display: block;
  flex: 0 0 auto;
}

.site-shell {
  position: static;
  width: 0;
  margin: 0;
  display: block;
}

.appbar {
  position: fixed;
  inset: 0 auto 0 var(--x-left-edge);
  z-index: 40;
  width: 260px;
  height: 100dvh;
  border: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 4px;
  padding: 10px 12px 12px;
  box-shadow: none;
}

.brand {
  width: 100%;
  max-width: 236px;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--x-text);
  text-decoration: none;
}

.brand:hover {
  background: var(--x-hover);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--x-text);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 800;
}

.brand-name {
  min-width: 0;
  white-space: nowrap;
  font-size: 18px;
  font-weight: 800;
}

.top-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}

.nav-item {
  position: relative;
  width: fit-content;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  background: transparent;
  color: var(--x-text);
  text-decoration: none;
  font-size: 20px;
  font-weight: 400;
}

.nav-item:hover {
  background: var(--x-hover);
}

.nav-item.is-active {
  font-weight: 700;
}

.nav-item.is-active .lucide {
  stroke-width: 2.6;
}

.nav-item.has-unread::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 31px;
  width: 7px;
  height: 7px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--x-blue);
  pointer-events: none;
}

.x-compose-nav {
  width: 100%;
  max-width: 236px;
  min-height: 52px;
  margin: 10px 0 8px;
  border-radius: 999px;
  background: var(--x-text);
  color: #fff;
  display: grid;
  place-items: center;
  text-decoration: none;
  font-size: 17px;
  font-weight: 800;
}

.x-compose-nav:hover {
  background: #272c30;
}

.x-account-menu {
  position: relative;
  margin-top: auto;
}

.x-account-menu summary {
  min-height: 64px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 8px 10px;
  list-style: none;
}

.x-account-menu summary::-webkit-details-marker {
  display: none;
}

.x-account-menu summary:hover {
  background: var(--x-hover);
}

.x-account-menu summary span {
  min-width: 0;
  display: grid;
}

.x-account-menu summary b,
.x-account-menu summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.x-account-menu summary small {
  color: var(--x-muted);
}

.x-account-popover {
  position: absolute;
  left: 0;
  bottom: 70px;
  width: 270px;
  overflow: hidden;
  border: 1px solid var(--x-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 0 18px rgba(15, 20, 25, 0.18);
}

.x-account-popover a,
.x-account-popover button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--x-text);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  text-decoration: none;
  text-align: left;
  font-weight: 700;
}

.x-account-popover a:hover,
.x-account-popover button:hover {
  background: var(--x-hover);
}

.x-account-popover form {
  margin: 0;
}

.locationbar {
  position: fixed;
  top: 0;
  left: var(--x-main-left);
  z-index: 35;
  width: var(--x-main-width);
  max-width: var(--x-main-width);
  min-height: 54px;
  border-width: 0 1px 1px;
  border-style: solid;
  border-color: var(--x-border);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
}

.back-button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  flex: 0 0 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  display: grid;
  place-items: center;
  padding: 0;
  text-decoration: none;
}

.back-button:hover {
  background: var(--x-hover);
}

.addressline {
  min-width: 0;
  min-height: 53px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  padding: 0;
}

.addressline b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 800;
}

.x-right-sidebar {
  position: fixed;
  top: 0;
  left: var(--x-right-left);
  z-index: 20;
  width: 350px;
  height: 100dvh;
  overflow-y: auto;
  padding: 6px 0 30px 30px;
}

.x-global-search {
  position: sticky;
  top: 5px;
  z-index: 2;
  min-height: 44px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #eff3f4;
  padding: 0 14px;
}

.x-global-search:focus-within {
  border-color: var(--x-blue);
  background: #fff;
  color: var(--x-blue);
}

.x-global-search input {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: 0;
  padding: 0;
  color: var(--x-text);
}

.x-notice-card,
.x-side-card {
  margin-top: 16px;
  border: 1px solid var(--x-border);
  border-radius: 16px;
  background: #fff;
}

.x-notice-card {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  text-decoration: none;
}

.x-notice-card:hover,
.x-side-card a:hover {
  background: rgba(0, 0, 0, 0.03);
}

.x-notice-card.is-unread {
  border-color: rgba(244, 33, 46, 0.3);
}

.x-notice-card.is-unread b {
  color: var(--x-red);
}

.x-notice-card span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.x-notice-card b {
  color: var(--x-muted);
  font-size: 14px;
}

.x-side-card {
  overflow: hidden;
}

.x-side-card h2 {
  margin: 0;
  padding: 12px 16px;
  font-size: 20px;
}

.x-side-card a {
  display: grid;
  gap: 3px;
  padding: 12px 16px;
  color: var(--x-text);
  text-decoration: none;
  font-weight: 700;
}

.x-side-card a span {
  color: var(--x-muted);
  font-size: 13px;
  font-weight: 400;
}

.x-mobile-nav,
.x-mobile-compose,
.x-mobile-menu {
  display: none;
}

.feed-layout,
.profile-layout,
.notice-page,
.classmates-page,
.books-page,
.admin-workspace,
.admin-detail-page,
.workspace {
  width: var(--x-main-width);
  max-width: var(--x-main-width);
  min-height: 100dvh;
  margin: 0 0 0 var(--x-main-left);
  padding: 54px 0 0;
  border-right: 1px solid var(--x-border);
  border-left: 1px solid var(--x-border);
  background: #fff;
  display: block;
}

.feed-layout > .rail {
  display: none;
}

.timeline,
.post-list,
.notice-list {
  display: block;
}

.timeline {
  border: 0;
}

.timeline-tabs,
.profile-tabs {
  min-height: 52px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--x-border);
}

.timeline-tabs a,
.profile-tabs button {
  position: relative;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--x-muted);
  display: grid;
  place-items: center;
  padding: 0 14px;
  text-decoration: none;
  font-weight: 600;
}

.timeline-tabs a:hover,
.profile-tabs button:hover {
  background: var(--x-hover);
}

.timeline-tabs .is-active,
.profile-tabs .is-active {
  color: var(--x-text);
  font-weight: 800;
}

.timeline-tabs .is-active::after,
.profile-tabs .is-active::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 56px;
  height: 4px;
  border-radius: 999px;
  background: var(--x-blue);
}

.flash,
.status {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--x-border);
  border-radius: 0;
  padding: 12px 16px;
  font-size: 14px;
}

.flash.success,
.status.approved {
  background: rgba(0, 186, 124, 0.08);
  color: #007a52;
}

.flash.warn,
.status.neutral {
  background: rgba(255, 212, 0, 0.12);
}

.flash.error,
.status.rejected {
  background: rgba(244, 33, 46, 0.08);
  color: #b21621;
}

.x-composer {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--x-border);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  padding: 14px 16px 8px;
}

.x-composer-main {
  min-width: 0;
}

.composer-field {
  display: block;
}

.x-composer .rich-editor {
  min-height: 72px;
  max-height: 360px;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: 0;
  padding: 8px 0 12px;
  color: var(--x-text);
  font-size: 20px;
  line-height: 1.35;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--x-muted);
}

.x-composer .composer-tools {
  min-height: 48px;
  border-top: 1px solid var(--x-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.x-media-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--x-blue);
}

.x-icon-button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--x-blue);
  cursor: pointer;
}

.x-icon-button:hover {
  background: var(--x-blue-soft);
}

.x-icon-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.x-upload-status {
  overflow: hidden;
  color: var(--x-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.x-post-submit,
.x-reply-composer .primary {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--x-text);
  color: #fff;
  padding: 0 18px;
  font-weight: 800;
}

.x-post-submit:disabled {
  opacity: 0.45;
  cursor: default;
}

.post {
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 4px;
  border: 0;
  border-bottom: 1px solid var(--x-border);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  padding: 12px 16px 8px;
  animation: none;
  outline: 0;
}

.post:not(.is-detail):hover,
.post:not(.is-detail):focus-visible {
  background: rgba(0, 0, 0, 0.025);
}

.post-head {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 32px;
  align-items: start;
  gap: 12px;
  margin: 0;
}

.post-byline {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding-top: 1px;
  white-space: nowrap;
}

.post-byline > span {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.post-author {
  overflow: hidden;
  color: var(--x-text) !important;
  text-overflow: ellipsis;
  text-decoration: none;
  font-size: 15px !important;
  font-weight: 800 !important;
}

.post-author:hover {
  text-decoration: underline;
}

.post-byline small,
.post-time {
  color: var(--x-muted) !important;
  font-size: 15px !important;
  font-weight: 400 !important;
}

.post-time {
  overflow: hidden;
  flex: 0 1 auto;
  text-overflow: ellipsis;
  text-decoration: none;
  white-space: nowrap;
}

.post-content {
  grid-column: 2;
  min-width: 0;
}

.post-content p,
.post-rich {
  margin: 0;
  color: var(--x-text);
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.35;
}

.post-rich a {
  color: var(--x-blue);
}

.post-media {
  width: auto;
  max-width: 100%;
  max-height: 510px;
  display: block;
  margin: 12px 0 4px;
  border: 1px solid var(--x-border);
  border-radius: 16px;
  background: #000;
  object-fit: contain;
}

.post img.post-media {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 510px;
}

.file-attachment {
  width: fit-content;
  display: inline-flex;
  margin-top: 10px;
  border: 1px solid var(--x-border);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--x-text);
  text-decoration: none;
}

.post-actions {
  grid-column: 2;
  width: min(100%, 430px);
  min-height: 34px;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 2px 0 0;
}

.post-actions form {
  width: auto;
  margin: 0;
}

.post-action {
  min-width: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--x-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  text-decoration: none;
  font-size: 13px;
}

.post-action:hover {
  background: var(--x-blue-soft);
  color: var(--x-blue);
}

.like-action:hover,
.like-action.is-active {
  background: rgba(249, 24, 128, 0.1);
  color: var(--x-pink);
}

.like-action.is-active .lucide {
  fill: currentColor;
}

.bookmark-action:hover,
.bookmark-action.is-active {
  background: var(--x-blue-soft);
  color: var(--x-blue);
}

.bookmark-action.is-active .lucide {
  fill: currentColor;
}

.post-overflow {
  position: relative;
  justify-self: end;
}

.post-overflow summary {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--x-muted);
  list-style: none;
}

.post-overflow summary::-webkit-details-marker {
  display: none;
}

.post-overflow summary:hover {
  background: var(--x-blue-soft);
  color: var(--x-blue);
}

.post-overflow > div {
  position: absolute;
  top: 34px;
  right: 0;
  z-index: 8;
  width: 170px;
  overflow: hidden;
  border: 1px solid var(--x-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(15, 20, 25, 0.16);
}

.post-overflow a,
.post-overflow button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--x-text);
  display: flex;
  align-items: center;
  padding: 0 14px;
  text-decoration: none;
  text-align: left;
  font-weight: 700;
}

.post-overflow a:hover,
.post-overflow button:hover {
  background: var(--x-hover);
}

.post-overflow form {
  margin: 0;
}

.post.is-detail {
  padding-top: 16px;
}

.post.is-detail .post-content {
  grid-column: 1 / -1;
  padding-top: 12px;
}

.post.is-detail .post-content p,
.post.is-detail .post-rich {
  font-size: 22px;
  line-height: 1.4;
}

.post.is-detail .post-actions {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 10px;
  border-top: 1px solid var(--x-border);
  border-bottom: 1px solid var(--x-border);
  padding: 6px 12%;
}

.x-reply-composer {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  border-top: 1px solid var(--x-border);
  margin-top: 8px;
  padding-top: 12px;
}

.x-reply-composer form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.x-reply-composer textarea {
  min-height: 58px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: 0;
  padding: 8px 0;
  resize: vertical;
  font-size: 18px;
}

.comment-thread {
  border: 0;
  padding: 0;
}

.comment-thread > h2 {
  margin: 0;
  border-bottom: 1px solid var(--x-border);
  padding: 14px 16px;
  font-size: 18px;
}

.comment-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--x-border);
  border-radius: 0;
  padding: 12px 16px;
}

.comment-item header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.comment-item time {
  color: var(--x-muted);
  font-size: 13px;
}

.comment-item p {
  margin: 4px 0 0;
  line-height: 1.4;
}

.compact-head,
.post-detail-layout .notice-head {
  display: none;
}

.profile-layout {
  padding-top: 54px;
}

.profile-hero {
  border: 0;
  border-bottom: 1px solid var(--x-border);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  padding: 0;
}

.profile-cover {
  height: 200px;
  background: #cfd9de;
}

.profile-summary {
  padding: 0 16px 14px;
}

.profile-avatar-row {
  min-height: 68px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.profile-avatar-row > .avatar-xl {
  width: 142px;
  height: 142px;
  margin-top: -74px;
  border: 4px solid #fff;
  font-size: 36px;
}

.x-avatar-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
}

.x-avatar-edit {
  width: 38px;
  height: 38px;
  border: 1px solid var(--x-border);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--x-text);
  cursor: pointer;
}

.x-avatar-edit:hover {
  background: var(--x-hover);
}

.x-avatar-edit input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.x-avatar-form .primary {
  min-height: 38px;
  border: 1px solid var(--x-border);
  border-radius: 999px;
  background: #fff;
  color: var(--x-text);
  padding: 0 15px;
}

.profile-copy h1 {
  margin: 6px 0 0;
  font-size: 21px;
  line-height: 1.2;
}

.profile-copy > span,
.profile-joined {
  color: var(--x-muted);
}

.profile-bio {
  margin: 14px 0 8px;
}

.profile-joined {
  margin: 0;
  font-size: 14px;
}

.kunkuang-form {
  margin-top: 12px;
}

.profile-tab-panel {
  display: none;
}

.profile-tab-panel.is-active {
  display: block;
}

.profile-contact-panel .contact-home {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.contact-home,
.notice,
.book-card,
.admin-user,
.admin-settings,
.classmates-head,
.search-panel,
.notice-head {
  border: 0;
  border-bottom: 1px solid var(--x-border);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.notice-head,
.classmates-head,
.search-panel {
  padding: 16px;
}

.notice-head h1,
.classmates-head h1,
.search-panel h1,
.admin-head h1 {
  margin: 0;
  font-size: 22px;
}

.eyebrow {
  color: var(--x-muted);
}

.search-form,
.classmates-head .search {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-form input,
.classmates-head .search input,
.search input {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #eff3f4;
  box-shadow: none;
  padding: 0 16px;
}

.search-form input:focus,
.classmates-head .search input:focus,
.search input:focus {
  border-color: var(--x-blue);
  background: #fff;
  box-shadow: none;
  transform: none;
}

.classmates-head {
  display: grid;
  gap: 14px;
}

.classmate-grid {
  display: block;
}

.classmate-card {
  min-height: 88px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  border: 0;
  border-bottom: 1px solid var(--x-border);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  padding: 12px 16px;
}

.classmate-card:hover {
  background: rgba(0, 0, 0, 0.025);
  box-shadow: none;
  transform: none;
}

.classmate-card .avatar {
  grid-row: 1 / span 2;
}

.classmate-card strong,
.classmate-card span,
.classmate-card small {
  grid-column: 2;
}

.classmate-card strong {
  font-size: 15px;
}

.classmate-card div {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
}

.classmate-card em,
.metric-pill {
  border: 1px solid var(--x-border);
  border-radius: 999px;
  background: #fff;
  padding: 5px 9px;
}

.notice {
  padding: 14px 16px;
}

.notice header {
  justify-content: flex-start;
  gap: 8px;
}

.notice time {
  color: var(--x-muted);
}

.notice p {
  margin: 7px 0 0;
  line-height: 1.45;
}

.books-grid,
.admin-grid {
  display: block;
}

.book-card,
.admin-user {
  padding: 16px;
}

.book-card iframe {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--x-border);
  border-radius: 16px;
}

.admin-workspace,
.admin-detail-page {
  padding-inline: 0;
}

.admin-head,
.section-title {
  padding: 14px 16px;
}

.admin-settings {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0;
  padding: 16px;
}

.admin-user header {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 12px;
}

.admin-user-tools {
  margin-left: 0;
}

.admin-user .profile-form,
.contact-home .profile-form {
  display: grid;
  gap: 12px;
}

.primary,
.ghost,
.link-button {
  border-radius: 999px;
  box-shadow: none;
}

.primary:hover,
.ghost:hover {
  box-shadow: none;
  transform: none;
}

input,
textarea,
select {
  max-width: 100%;
}

img,
video,
iframe {
  max-width: 100%;
}

@media (min-width: 1280px) {
  :root {
    --x-left-edge: max(10px, calc((100vw - var(--x-total-width)) / 2));
    --x-main-left: calc(var(--x-left-edge) + var(--x-nav-width) + 10px);
    --x-right-left: calc(var(--x-main-left) + var(--x-main-width) + var(--x-column-gap));
  }

  .appbar {
    left: var(--x-left-edge);
    width: var(--x-nav-width);
    max-width: var(--x-nav-width);
    right: auto;
  }

  .locationbar,
  .feed-layout,
  .profile-layout,
  .notice-page,
  .classmates-page,
  .books-page,
  .admin-workspace,
  .admin-detail-page,
  .workspace {
    width: var(--x-main-width);
    max-width: var(--x-main-width);
    margin-left: var(--x-main-left);
  }

  .x-right-sidebar {
    left: var(--x-right-left);
    width: var(--x-right-width);
  }
}

@media (min-width: 1280px) {
  .appbar {
    inset: 0 auto 0 max(10px, calc((100vw - 1250px) / 2)) !important;
    width: 260px !important;
    max-width: 260px !important;
    min-width: 260px !important;
  }

  .locationbar,
  .feed-layout,
  .profile-layout,
  .notice-page,
  .classmates-page,
  .books-page,
  .admin-workspace,
  .admin-detail-page,
  .workspace {
    width: 600px !important;
    max-width: 600px !important;
    margin-left: max(280px, calc((100vw - 1250px) / 2 + 270px)) !important;
  }

  .locationbar {
    left: max(280px, calc((100vw - 1250px) / 2 + 270px)) !important;
  }

  .x-right-sidebar {
    left: max(910px, calc((100vw - 1250px) / 2 + 900px)) !important;
    width: 350px !important;
    max-width: 350px !important;
  }
}

.empty {
  margin: 0;
  border-bottom: 1px solid var(--x-border);
  padding: 34px 20px;
  color: var(--x-muted);
  text-align: center;
}

@media (max-width: 1279px) and (min-width: 760px) {
  :root {
    --x-main-left: clamp(88px, calc(50vw - 300px), 340px);
    --x-main-width: min(600px, calc(100vw - var(--x-main-left)));
  }

  .appbar {
    left: calc(var(--x-main-left) - 80px);
    width: 72px;
    align-items: center;
    padding-inline: 6px;
  }

  .brand-name,
  .nav-item span,
  .x-account-menu summary span,
  .x-account-menu summary > .lucide {
    display: none;
  }

  .nav-item {
    width: 50px;
    justify-content: center;
    padding: 0;
  }

  .x-compose-nav {
    width: 50px;
    height: 50px;
    min-height: 50px;
    overflow: hidden;
    color: transparent;
    font-size: 0;
  }

  .x-compose-nav::before {
    content: "+";
    color: #fff;
    font-size: 28px;
  }

  .x-account-menu summary {
    width: 52px;
    grid-template-columns: 40px;
    padding: 6px;
  }

  .x-account-popover {
    left: 0;
  }

  .x-right-sidebar {
    display: none;
  }

  .locationbar,
  .feed-layout,
  .profile-layout,
  .notice-page,
  .classmates-page,
  .books-page,
  .admin-workspace,
  .admin-detail-page,
  .workspace {
    width: var(--x-main-width);
    max-width: var(--x-main-width);
    margin-left: var(--x-main-left);
  }
}

@media (max-width: 759px) {
  body {
    padding-bottom: calc(62px + env(safe-area-inset-bottom));
  }

  .appbar,
  .x-right-sidebar {
    display: none;
  }

  .site-shell {
    width: 100%;
  }

  .locationbar {
    position: fixed;
    left: 0;
    width: 100%;
    min-height: 52px;
    border-right: 0;
    border-left: 0;
    padding: 0 56px 0 12px;
  }

  .addressline {
    min-height: 51px;
  }

  .addressline b {
    font-size: 18px;
  }

  .feed-layout,
  .profile-layout,
  .notice-page,
  .classmates-page,
  .books-page,
  .admin-workspace,
  .admin-detail-page,
  .workspace {
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
    margin: 0;
    padding: 52px 0 0;
    border: 0;
  }

  .x-mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 50;
    height: calc(58px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--x-border);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: start;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .x-mobile-nav .nav-item {
    width: 100%;
    min-width: 0;
    min-height: 57px;
    border-radius: 0;
    display: grid;
    place-items: center;
    padding: 0;
  }

  .x-mobile-nav .nav-item span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .x-mobile-nav .nav-item.has-unread::after {
    top: 8px;
    left: calc(50% + 4px);
    transform: translateX(-50%);
  }

  .x-mobile-compose {
    position: fixed;
    right: 18px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 45;
    width: 54px;
    height: 54px;
    border-radius: 999px;
    background: var(--x-text);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 12px rgba(15, 20, 25, 0.18);
  }

  .x-mobile-menu {
    position: fixed;
    top: 7px;
    right: 10px;
    z-index: 60;
    display: block;
  }

  .x-mobile-menu > summary {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    list-style: none;
  }

  .x-mobile-menu > summary::-webkit-details-marker {
    display: none;
  }

  .x-mobile-menu > summary .avatar {
    width: 32px;
    height: 32px;
  }

  .x-mobile-menu[open]::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(15, 20, 25, 0.4);
  }

  .x-mobile-drawer {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 320px);
    overflow-y: auto;
    background: #fff;
    box-shadow: 4px 0 20px rgba(15, 20, 25, 0.18);
    padding: max(18px, env(safe-area-inset-top)) 12px 24px;
  }

  .x-mobile-drawer header {
    display: grid;
    gap: 4px;
    padding: 8px 8px 18px;
  }

  .x-mobile-drawer header b {
    margin-top: 8px;
    font-size: 18px;
  }

  .x-mobile-drawer header span {
    color: var(--x-muted);
  }

  .x-mobile-drawer .nav-item,
  .x-mobile-drawer form button {
    width: 100%;
    min-height: 50px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    padding: 0 12px;
    color: var(--x-text);
    font-size: 17px;
    font-weight: 700;
  }

  .x-mobile-drawer form {
    margin: 0;
  }

  .x-mobile-drawer .nav-item:hover,
  .x-mobile-drawer form button:hover {
    background: var(--x-hover);
  }

  .timeline-tabs {
    min-height: 48px;
  }

  .x-composer {
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 12px;
  }

  .x-composer > .avatar {
    width: 38px;
    height: 38px;
  }

  .x-composer .rich-editor {
    min-height: 64px;
    font-size: 19px;
    touch-action: manipulation;
    -webkit-user-select: text;
    user-select: text;
  }

  .post {
    grid-template-columns: 40px minmax(0, 1fr);
    column-gap: 10px;
    padding: 11px 12px 7px;
  }

  .post-head {
    grid-template-columns: 40px minmax(0, 1fr) 30px;
    gap: 10px;
  }

  .post-head > .avatar {
    width: 40px;
    height: 40px;
  }

  .post-byline {
    display: block;
    white-space: normal;
  }

  .post-byline > span {
    min-width: 0;
  }

  .post-time {
    display: block;
    margin-top: 1px;
  }

  .post-content,
  .post-actions {
    grid-column: 2;
  }

  .post-action {
    min-width: 32px;
    padding: 0 6px;
  }

  .post-action span {
    font-size: 12px;
  }

  .post-media,
  .post img.post-media {
    width: 100%;
    max-height: 360px;
  }

  .post.is-detail .post-content p,
  .post.is-detail .post-rich {
    font-size: 20px;
  }

  .profile-cover {
    height: 150px;
  }

  .profile-avatar-row > .avatar-xl {
    width: 112px;
    height: 112px;
    margin-top: -58px;
  }

  .classmate-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .classmate-card div {
    grid-column: 2;
    grid-row: auto;
  }

  .admin-user header {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .admin-user-tools {
    grid-column: 1 / -1;
  }
}

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