:root {
  color-scheme: light;
  --blue: #1677ff;
  --panel: #ffffff;
  --text: #111827;
  --muted: #667085;
  --line: #d7dfeb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  background: #f5f7fb;
  color: var(--text);
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.auth-panel {
  width: min(420px, 100%);
  margin: 14vh auto 0;
  background: var(--panel);
  border: 1px solid #edf0f5;
  border-radius: 12px;
  box-shadow: 0 18px 60px rgb(31 41 55 / 10%);
  padding: 44px;
}

.logo {
  width: 78px;
  height: 78px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  font-size: 24px;
}

.logo.small {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  font-size: 18px;
}

.auth-panel h1,
.home-header h1 {
  margin: 24px 0 8px;
  font-size: 34px;
}

.auth-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 24px 0 16px;
}

.tabs button,
.primary,
#sendCode,
.user-box button,
.home-tabs button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.tabs button,
.home-tabs button,
.user-box button {
  padding: 10px 12px;
  background: #eef2f7;
  color: var(--muted);
}

.tabs .active,
.home-tabs .active {
  background: #e8f1ff;
  color: var(--blue);
  font-weight: 800;
}

input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.code-row {
  display: grid;
  grid-template-columns: 1fr 116px;
  gap: 10px;
  margin-top: 12px;
}

#sendCode {
  background: #eef2f7;
  color: #475467;
}

.primary {
  width: 100%;
  height: 48px;
  margin-top: 16px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

#status {
  min-height: 28px;
  margin: 12px 0 0;
  color: var(--blue);
}

.home-view {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.home-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 18px;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.home-tabs {
  display: flex;
  gap: 10px;
  padding: 10px 0 14px;
  overflow: auto;
}

.topic-strip {
  display: flex;
  gap: 10px;
  overflow: auto;
  padding: 0 0 22px;
}

.topic-strip span {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e8eef7;
  color: var(--blue);
  font-weight: 800;
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.note-card {
  min-height: 310px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e8eef7;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 32px rgb(31 41 55 / 6%);
}

.note-card:nth-child(3n) {
  min-height: 380px;
}

.note-card:nth-child(5n) {
  min-height: 350px;
}

.visual {
  min-height: 150px;
  display: flex;
  align-items: end;
  padding: 16px;
  background: linear-gradient(135deg, #d7ebff, #fff 48%, #d9f2df);
  background-size: cover;
  background-position: center;
}

.visual.has-image {
  min-height: 230px;
}

.visual span {
  display: inline-block;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgb(255 255 255 / 82%);
  color: #111827;
  font-weight: 900;
  line-height: 1.4;
}

.note-card h2 {
  margin: 18px 18px 8px;
  font-size: 20px;
}

.note-card p {
  margin: 0 18px 16px;
  color: var(--muted);
  line-height: 1.65;
}

.note-card footer {
  margin-top: auto;
  padding: 0 18px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.note-card footer span,
.actions button {
  color: var(--blue);
  font-weight: 800;
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 18px 18px;
}

.actions button {
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: #eef2f7;
  cursor: pointer;
  font-size: 13px;
}

.empty {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.comment-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(17 24 39 / 58%);
}

.comment-panel {
  width: min(620px, 100%);
  max-height: min(760px, 90vh);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 30px 90px rgb(0 0 0 / 28%);
  overflow: hidden;
}

.comment-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #edf0f5;
}

.comment-panel header strong {
  display: block;
  font-size: 20px;
}

.comment-panel header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

#closeComments {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #eef2f7;
  color: var(--text);
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.comment-list {
  overflow: auto;
  padding: 8px 20px;
}

.comment-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #f0f3f8;
}

.comment-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8f1ff;
  color: var(--blue);
  font-weight: 900;
}

.comment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.comment-head span {
  color: #98a2b3;
  font-size: 13px;
}

.comment-item p {
  margin: 6px 0 0;
  color: #344054;
  line-height: 1.65;
}

.comment-empty {
  padding: 44px 0;
  text-align: center;
  color: var(--muted);
}

.comment-form {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid #edf0f5;
}

.comment-form button {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.note-card.blue {
  background: var(--blue);
  color: #fff;
}

.note-card.blue p,
.note-card.blue footer span {
  color: #eef5ff;
}

.note-card.blue .visual {
  background: linear-gradient(135deg, #075ed8, #43a5ff);
}

.note-card.green .visual {
  background: linear-gradient(135deg, #d8f5df, #ffffff 45%, #7fb98c);
}

.note-card.dark {
  background: #151922;
  color: #fff;
}

.note-card.dark p {
  color: #c4cbd7;
}

.note-card.dark .visual {
  background: linear-gradient(135deg, #10131a, #3b4659);
}

.note-card.sky .visual {
  background: linear-gradient(135deg, #d7ebff, #fff 48%, #d9f2df);
}

.note-card.orange .visual {
  background: linear-gradient(135deg, #ffe2c7, #fff6ee 50%, #ffc46b);
}

.note-card.light .visual {
  background: linear-gradient(135deg, #fff, #ecf3ff);
}

.note-card.purple .visual {
  background: linear-gradient(135deg, #eee8ff, #fff 52%, #c8b6ff);
}

@media (max-width: 860px) {
  .feed-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 0;
  }

  .auth-panel {
    min-height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 36px 22px;
  }

  .auth-panel h1,
  .home-header h1 {
    font-size: 30px;
  }

  .home-view {
    padding: 20px;
  }

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

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

  .comment-modal {
    align-items: end;
    padding: 0;
  }

  .comment-panel {
    max-height: 86vh;
    border-radius: 16px 16px 0 0;
  }
}
