:root {
  --bg: #0a0b0f;
  --panel: #151821;
  --text: #f3f4f6;
  --line: #252a35;
  --chip: #1b1f29;
  --brand: #e687ad;
  --brand-soft: #f3a9c4;
}

html,
body {
  width: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: radial-gradient(1200px 450px at 50% -180px, #23283a, transparent 68%), var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  display: grid;
  grid-template-columns: 210px minmax(0, 1180px);
  justify-content: center;
  column-gap: 26px;
  transition: background 0.2s ease, color 0.2s ease;
}

body.theme-light {
  --bg: #f5f2f4;
  --panel: #ffffff;
  --text: #2f2d2f;
  --line: #e6dfe3;
  --chip: #f0e9ed;
  background: radial-gradient(1200px 450px at 50% -180px, #f2e7eb, transparent 68%), var(--bg);
  display: grid;
  grid-template-columns: 210px minmax(0, 1180px);
  justify-content: center;
  column-gap: 26px;
}

body.theme-light .sidebar {
  background: transparent;
  border-right: 0;
  width: 210px;
  padding: 16px 0;
}

body.theme-light .sidebar-inner {
  max-width: none;
  min-height: calc(100vh - 32px);
}

body.theme-light .nav-item {
  color: #3f3a3d;
}

body.theme-light .nav-item:hover,
body.theme-light .nav-item.active {
  background: #f2eaee;
}

body.theme-light .logo-pill {
  background: #ff2e5f;
  color: #fff;
}

body.theme-light .main {
  justify-content: flex-start;
  padding: 8px 0 20px;
}

body.theme-light .main-inner {
  width: 1180px;
  max-width: 100%;
}

body.theme-light .search-wrap {
  background: #fff;
  border-color: #e8dfe3;
}

body.theme-light .search-wrap #searchBtn {
  color: #8f8f95;
}

body.theme-light input,
body.theme-light textarea {
  background: #fff;
  border-color: #e7dde2;
  color: #3e3b3d;
}

body.theme-light .ghost {
  background: #f1e9ed;
  color: #4b4348;
}

body.theme-light .user-pill {
  background: #eedfe4;
  color: #644e57;
}

body.theme-light .content {
  color: #5d585b;
}

body.theme-light .author {
  color: #7b7277;
}

body.theme-light .modal-card {
  background: #fff;
  border-color: #e8dfe3;
}

body.theme-light .auth-divider::before {
  border-top-color: #e7dde2;
}

body.theme-light .auth-divider span {
  background: #fff;
}

body.theme-light label {
  color: #5b5458;
}

button,
input,
textarea {
  font: inherit;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 210px;
  background: #08090c;
  border-right: 1px solid #161922;
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

.sidebar-inner {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  min-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}

.logo-pill {
  align-self: flex-start;
  margin: 0 0 18px 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: #f75b7a;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.5px;
  font-size: 22px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  text-decoration: none;
  color: #e5e8ef;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-icon {
  width: 20px;
  text-align: center;
  opacity: 0.92;
  font-size: 18px;
}

.nav-item:hover,
.nav-item.active {
  background: #171b25;
}

.more-btn {
  margin-top: auto;
  background: #151a25;
  color: #e8ebf2;
  border: 1px solid #222837;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  width: 100%;
}

.nav-item-bottom {
  margin-top: auto;
}

.main {
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  padding: 8px 0 20px;
  display: flex;
  justify-content: flex-start;
}

.main-inner {
  width: 1180px;
  max-width: 100%;
}

.topbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 4px;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.language-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--line);
}

.lang-chip {
  min-width: 58px;
  padding: 7px 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
}

.lang-chip.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-soft));
  color: #fff;
}

.search-wrap {
  flex: 1;
  max-width: 760px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #10131b;
  border: 1px solid #1f2534;
  border-radius: 999px;
  padding: 10px 12px 10px 18px;
}

input,
textarea {
  width: 100%;
  background: #10131b;
  border: 1px solid #252a36;
  border-radius: 10px;
  color: #f4f6fb;
  padding: 10px 12px;
  outline: none;
}

.search-wrap input {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 18px;
  line-height: 1.3;
  min-height: 28px;
}

.search-wrap #searchBtn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  padding: 0;
  background: transparent;
  color: #9599a4;
}

.search-icon {
  font-size: 20px;
  line-height: 1;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
}

.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-soft));
  color: #fff;
  font-weight: 700;
}

.ghost {
  background: #202531;
  color: #f2f4f8;
}

.auth-area {
  display: flex;
  gap: 8px;
  align-items: center;
}

.user-pill,
.warn-pill,
.ok-pill {
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
}

.user-pill {
  background: #242938;
}

.warn-pill {
  background: #3f3212;
  color: #ffd66e;
}

.ok-pill {
  background: #183722;
  color: #7cf0a1;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  width: 100%;
}

.profile-view {
  margin-top: 12px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.profile-avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: #eadce2;
  display: grid;
  place-items: center;
  font-size: 52px;
}

.profile-name {
  margin: 0;
  font-size: 46px;
}

.profile-meta {
  margin: 6px 0 8px;
  color: #8c8a8c;
  font-size: 18px;
}

.profile-stats {
  display: flex;
  gap: 24px;
  color: #5f5c5e;
  font-size: 30px;
}

.profile-tabs {
  display: flex;
  gap: 12px;
  margin: 6px 0 16px;
}

.profile-tab {
  background: #ece4e8;
  color: #434043;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 26px;
}

.profile-tab.active {
  background: #f7dde9;
  color: #b95f86;
  font-weight: 700;
}

body.theme-dark .profile-avatar,
body:not(.theme-light) .profile-avatar {
  background: #2c2430;
}

body.theme-dark .profile-meta,
body:not(.theme-light) .profile-meta {
  color: #9f9ca1;
}

body.theme-dark .profile-stats,
body:not(.theme-light) .profile-stats {
  color: #e6e3e8;
}

body.theme-dark .profile-tab,
body:not(.theme-light) .profile-tab {
  background: #2f2430;
  color: #e9dfe3;
}

body.theme-dark .profile-tab.active,
body:not(.theme-light) .profile-tab.active {
  background: #4b2a36;
  color: #f1b8cf;
}

.note-card {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.cover-image {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: #11151d;
}

.card-body {
  padding: 12px;
}

.title {
  margin: 0 0 8px;
  font-size: 21px;
  line-height: 1.28;
}

.content {
  margin: 0 0 10px;
  color: #cfd4de;
  line-height: 1.45;
}

.meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.author {
  margin-right: auto;
  color: #a9b1be;
  font-size: 13px;
}

.card-likes {
  color: #93919a;
  font-size: 13px;
  white-space: nowrap;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.58);
  padding: 12px;
}

.hidden {
  display: none;
}

.modal-card {
  width: min(640px, 100%);
  background: #151922;
  border: 1px solid #262c3a;
  border-radius: 16px;
  padding: 16px;
}

.auth-card {
  width: min(420px, 100%);
}

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

form {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: #d5dae3;
  font-size: 14px;
}

.switch-auth {
  width: 100%;
  margin-top: 8px;
}

.oauth-actions {
  display: grid;
  gap: 10px;
  margin: 6px 0 14px;
}

.oauth-btn {
  text-decoration: none;
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
  font-weight: 700;
  color: #fff;
}

.oauth-google {
  background: #4285f4;
}

.oauth-github {
  background: #24292f;
}

.auth-divider {
  position: relative;
  text-align: center;
  color: #8d93a1;
  margin-bottom: 14px;
  font-size: 13px;
}

.auth-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid #2a3040;
}

.auth-divider span {
  position: relative;
  padding: 0 10px;
  background: #151922;
}

.settings-card {
  width: min(420px, 100%);
  background: #e9e7e8;
  color: #373737;
}

#settingsModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 12px;
  background: transparent;
}

#settingsModal:not(.hidden) {
  display: flex;
}

#settingsModal .settings-card {
  width: 316px;
  max-height: 82vh;
  overflow: auto;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border: 1px solid #dcd7d9;
}

.settings-group {
  border-bottom: 1px solid #d3ced0;
  padding: 6px 0;
}

.settings-group:last-of-type {
  border-bottom: 0;
}

.setting-label {
  color: #8a8889;
  font-size: 14px;
  padding: 8px 10px;
}

.setting-row {
  width: 100%;
  background: transparent;
  color: #4a4a4a;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 10px;
  font-size: 18px;
}

.setting-row span {
  color: #9f9f9f;
}

.logout-row {
  color: #4a4a4a;
}

.mode-switch {
  display: inline-flex;
  background: #f0eff0;
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}

.mode-chip {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: #777;
  padding: 0;
}

.mode-chip.active {
  background: #fff;
  color: #333;
}

.full-width {
  width: 100%;
  margin-top: 10px;
}

.detail-shell {
  width: min(1280px, 96vw);
  height: min(92vh, 900px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  background: #f0efee;
  border-radius: 14px;
  overflow: hidden;
}

.detail-left {
  background: #ece9e5;
  display: grid;
  place-items: center;
}

.detail-cover {
  width: min(92%, 760px);
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
}

.detail-right {
  background: #f7f7f7;
  border-left: 1px solid #e0ddda;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 10px;
  color: #434343;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #d8d1cd, #c0b7b2);
}

.detail-author {
  font-weight: 600;
}

.detail-date {
  font-size: 13px;
  color: #838383;
}

.follow-btn {
  background: #f277a3;
  color: #fff;
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 700;
}

.detail-title {
  margin: 16px 0 8px;
  font-size: 38px;
  line-height: 1.2;
  color: #2f2f2f;
}

.detail-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 2px;
}

.detail-tag-row .tag {
  background: transparent;
  color: #2a67c7;
  padding: 0;
  border-radius: 0;
  font-size: 15px;
}

.detail-content {
  margin: 0 0 6px;
  color: #6a6a6a;
}

.detail-comments-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #e3e0de;
  padding-top: 10px;
  margin-bottom: 8px;
  color: #858585;
}

.detail-comments {
  flex: 1;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.comment-item {
  display: block;
  border-bottom: 1px solid #ece8e5;
  padding-bottom: 8px;
  align-items: start;
}

.comment-user {
  font-size: 14px;
  color: #777;
}

.comment-text {
  color: #444;
  margin-top: 2px;
}

.comment-time {
  color: #9a9a9a;
  font-size: 12px;
  margin-top: 4px;
}

.comment-actions {
  margin-top: 6px;
  display: flex;
  gap: 12px;
}

.comment-action {
  color: #8f8f8f;
  font-size: 13px;
}

.detail-bottom {
  margin-top: 10px;
  border-top: 1px solid #e3e0de;
  padding-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #666;
}

.detail-input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid #e0dbd8;
  background: #f0efee;
  color: #666;
}

.floating-refresh {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid #384051;
  background: #1a1f2a;
  color: #f2f5fb;
  font-size: 24px;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  z-index: 40;
}

.floating-refresh:hover {
  transform: translateY(-1px);
}

body.theme-light .floating-refresh {
  border-color: #e3dce0;
  background: #fff;
  color: #6f5f66;
  box-shadow: 0 8px 18px rgba(130, 108, 118, 0.18);
}

@media (max-width: 920px) {
  body {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid #1a1d24;
    justify-content: flex-start;
    padding: 14px;
  }

  .sidebar-inner {
    max-width: none;
    min-height: 0;
  }

  .main {
    width: 100%;
    display: block;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .topbar-tools {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .detail-shell {
    grid-template-columns: 1fr;
    width: 96vw;
    height: 92vh;
  }

  .detail-right {
    border-left: 0;
    border-top: 1px solid #e0ddda;
  }

  #settingsModal {
    padding: 10px;
  }

  #settingsModal .settings-card {
    width: min(360px, calc(100vw - 20px));
  }

}
