:root {
  --bg-a: #f5fbff;
  --bg-b: #ecf8ff;
  --bg-c: #f7fff7;
  --ink: #162743;
  --ink-soft: #5a6f90;
  --line: rgba(27, 67, 125, 0.16);
  --card: rgba(255, 255, 255, 0.8);
  --card-strong: rgba(255, 255, 255, 0.92);
  --blue: #1e90ff;
  --blue-strong: #0f6fd7;
  --teal: #08b7b0;
  --orange: #ff9342;
  --danger: #df4356;
  --success: #239d6b;
  --shadow-lg: 0 22px 56px rgba(11, 37, 86, 0.16);
  --shadow-md: 0 12px 26px rgba(14, 42, 93, 0.11);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Plus Jakarta Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 12%, rgba(8, 183, 176, 0.18), transparent 38%),
    radial-gradient(circle at 90% 14%, rgba(255, 147, 66, 0.18), transparent 40%),
    linear-gradient(155deg, var(--bg-a), var(--bg-b) 48%, var(--bg-c));
  overflow-x: hidden;
}

.fx-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(74, 112, 165, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 112, 165, 0.11) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at center, black 34%, transparent 90%);
  animation: gridShift 18s linear infinite;
}

.fx-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(42px);
  opacity: 0.38;
  z-index: 0;
  pointer-events: none;
}

.orb-a {
  width: 300px;
  height: 300px;
  top: -80px;
  left: -70px;
  background: rgba(18, 190, 174, 0.55);
  animation: driftA 11s ease-in-out infinite alternate;
}

.orb-b {
  width: 280px;
  height: 280px;
  top: 14%;
  right: -90px;
  background: rgba(255, 146, 75, 0.58);
  animation: driftB 14s ease-in-out infinite alternate;
}

.orb-c {
  width: 250px;
  height: 250px;
  bottom: -70px;
  right: 14%;
  background: rgba(30, 144, 255, 0.46);
  animation: driftC 16s ease-in-out infinite alternate;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: #2e76a2;
  font-weight: 700;
}

h1,
h2,
h3 {
  font-family: "Syne", "Plus Jakarta Sans", sans-serif;
  letter-spacing: -0.01em;
}

.hub-shell,
.page-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 92vw);
  margin: 28px auto 34px;
}

.hub-header,
.page-top {
  padding: 24px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(130deg, var(--card-strong), rgba(255, 255, 255, 0.74));
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}

.hub-header h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.04;
}

.hub-header p {
  margin: 12px 0 0;
  color: var(--ink-soft);
  max-width: 640px;
}

.hub-section {
  margin-top: 18px;
}

.hub-section h2 {
  margin: 0 0 10px;
  font-size: 27px;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.portal-card {
  display: block;
  text-decoration: none;
  color: inherit;
  min-height: 196px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.95), rgba(248, 254, 255, 0.76));
  box-shadow: var(--shadow-md);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  overflow: hidden;
}

.portal-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.6) 48%, transparent 68%);
  transform: translateX(-120%);
  transition: transform 0.7s ease;
}

.portal-card:hover {
  transform: translateY(-4px);
  border-color: rgba(31, 102, 185, 0.35);
  box-shadow: 0 20px 38px rgba(19, 56, 110, 0.18);
}

.portal-card:hover::after {
  transform: translateX(120%);
}

.portal-card.member {
  background:
    linear-gradient(158deg, rgba(255, 255, 255, 0.92), rgba(247, 255, 252, 0.76)),
    repeating-linear-gradient(
      135deg,
      rgba(18, 190, 174, 0.05),
      rgba(18, 190, 174, 0.05) 10px,
      rgba(30, 144, 255, 0.05) 10px,
      rgba(30, 144, 255, 0.05) 20px
    );
}

.portal-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #2e5888;
  background: #edf5ff;
  border: 1px solid rgba(31, 87, 154, 0.24);
  border-radius: 999px;
  padding: 6px 10px;
}

.portal-card h3 {
  margin: 12px 0 8px;
  font-size: 22px;
  line-height: 1.14;
}

.portal-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.page-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.page-top h1 {
  margin: 8px 0 0;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.06;
}

.page-top p {
  margin: 10px 0 0;
  color: var(--ink-soft);
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.back-link,
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid rgba(26, 70, 130, 0.2);
  background: #f2f8ff;
  color: #27507f;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.back-link:hover,
.link-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(36, 95, 168, 0.18);
}

.member-state {
  border-radius: 999px;
  background: linear-gradient(140deg, #f1f8ff, #e8f2ff);
  border: 1px solid rgba(36, 91, 159, 0.24);
  color: #205391;
  font-weight: 700;
  font-size: 13px;
  padding: 9px 14px;
}

.member-state.online {
  color: #1c754f;
  border-color: rgba(35, 157, 107, 0.24);
  background: linear-gradient(140deg, #ecfff5, #e0f9ec);
}

.tool-panel {
  margin-top: 14px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(152deg, var(--card-strong), rgba(255, 255, 255, 0.74));
  box-shadow: var(--shadow-md);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 12px;
}

.tool-card {
  border-radius: 14px;
  border: 1px solid rgba(23, 68, 126, 0.16);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.94), rgba(244, 252, 255, 0.78));
  padding: 14px;
}

.tool-card h2 {
  margin: 0;
  font-size: 25px;
}

.tool-card .sub {
  margin: 8px 0 12px;
  color: var(--ink-soft);
  font-size: 13px;
}

label {
  display: block;
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: #2b4e79;
}

textarea,
input {
  width: 100%;
  margin: 0 0 10px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(26, 69, 126, 0.2);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

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

textarea:focus,
input:focus {
  border-color: rgba(30, 144, 255, 0.62);
  box-shadow: 0 0 0 4px rgba(30, 144, 255, 0.14);
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  color: #f7fbff;
  background: linear-gradient(140deg, var(--blue), var(--teal));
  box-shadow: 0 10px 20px rgba(30, 144, 255, 0.24);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 14px 24px rgba(30, 144, 255, 0.3);
}

button:active {
  transform: translateY(0);
}

.ghost {
  background: linear-gradient(140deg, #eff5ff, #e2ebf9);
  color: #30517b;
  border: 1px solid rgba(41, 76, 122, 0.2);
  box-shadow: none;
}

.danger {
  background: linear-gradient(140deg, var(--danger), #ec5d67);
  box-shadow: 0 10px 20px rgba(223, 67, 86, 0.24);
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hint {
  margin: 8px 0 0;
  min-height: 18px;
  color: #5c7498;
  font-size: 13px;
}

.dropzone {
  border: 2px dashed rgba(30, 144, 255, 0.45);
  border-radius: 16px;
  padding: 20px 14px;
  background:
    radial-gradient(circle at 80% 20%, rgba(255, 147, 66, 0.16), transparent 42%),
    linear-gradient(160deg, rgba(241, 252, 255, 0.96), rgba(247, 255, 250, 0.88));
  text-align: center;
  cursor: pointer;
  transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}

.dropzone.active {
  border-color: var(--orange);
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(255, 147, 66, 0.24);
}

.result {
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid rgba(31, 78, 138, 0.2);
  background: linear-gradient(160deg, #f8fdff, #eef8ff);
  padding: 10px;
  word-break: break-all;
}

.result p {
  margin: 6px 0;
}

.result-text {
  margin: 8px 0 0;
  color: #274a74;
  word-break: break-all;
}

.note-workspace {
  margin-top: 14px;
  min-height: calc(100vh - 145px);
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(152deg, var(--card-strong), rgba(255, 255, 255, 0.74));
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.note-layout {
  display: block;
  flex: 1;
}

.note-list-pane {
  border-radius: 14px;
  border: 1px solid rgba(26, 69, 126, 0.18);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.94), rgba(245, 252, 255, 0.8));
  padding: 12px;
  min-height: 0;
}

.note-list-pane {
  display: flex;
  flex-direction: column;
}

.note-list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.note-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.note-toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.auth-user-label {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: linear-gradient(140deg, #ecfff7, #e0f6ee);
  border: 1px solid rgba(32, 151, 106, 0.24);
  color: #1f7b55;
  font-size: 12px;
  font-weight: 700;
}

.note-list-pane h3 {
  margin: 0;
  font-size: 20px;
}

.add-note-btn,
.note-action-btn {
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
  box-shadow: 0 6px 14px rgba(30, 144, 255, 0.2);
}

.note-action-btn.danger,
.danger.note-action-btn {
  box-shadow: 0 6px 14px rgba(223, 67, 86, 0.2);
}

.trash-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(31, 84, 148, 0.2);
  color: #214e83;
  font-size: 11px;
  font-weight: 700;
}

.note-search-wrap {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.note-search-wrap input {
  margin: 0;
}

.note-search-wrap button {
  white-space: nowrap;
}

#noteSearchCount {
  margin-top: 8px;
  margin-bottom: 0;
}

.note-auth-panel {
  border-radius: 14px;
  border: 1px solid rgba(26, 69, 126, 0.18);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.94), rgba(245, 252, 255, 0.8));
  padding: 14px;
}

.note-auth-panel h3 {
  margin: 0;
  font-size: 22px;
}

.note-auth-panel .hint {
  margin-bottom: 10px;
}

.note-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.note-item {
  border-radius: 12px;
  border: 1px solid rgba(26, 69, 126, 0.2);
  background: linear-gradient(145deg, #fafdff, #f3f9ff);
  padding: 10px;
}

.note-item h4 {
  margin: 0;
  font-size: 15px;
}

.note-item p {
  margin: 8px 0;
  color: #3a5372;
  white-space: pre-wrap;
}

.trash-item {
  background: linear-gradient(150deg, #fffaf4, #fff4ea);
}

.trash-meta {
  margin: 6px 0 8px;
  color: #7c6a55;
  font-size: 12px;
}

.note-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 14px;
}

.note-modal[hidden] {
  display: none;
}

.note-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 30, 58, 0.42);
  backdrop-filter: blur(3px);
}

.note-modal-dialog {
  position: relative;
  width: min(640px, 96vw);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.95), rgba(245, 252, 255, 0.85));
  box-shadow: var(--shadow-lg);
  padding: 14px;
}

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

.note-modal-head h3 {
  margin: 0;
  font-size: 22px;
}

.note-modal-dialog textarea {
  min-height: 220px;
}

.modal-actions {
  justify-content: flex-end;
}

.modal-actions-start {
  justify-content: flex-start;
}

.trash-modal-dialog {
  width: min(760px, 96vw);
}

.trash-list {
  max-height: 48vh;
}

.confirm-dialog {
  width: min(460px, 94vw);
}

body.modal-open {
  overflow: hidden;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.guard {
  margin-top: 14px;
}

.guard-card {
  border-radius: 14px;
  border: 1px dashed rgba(31, 85, 152, 0.36);
  background: linear-gradient(150deg, rgba(250, 253, 255, 0.95), rgba(242, 249, 255, 0.8));
  padding: 16px;
}

.guard-card h2 {
  margin: 0;
}

.guard-card p {
  margin: 8px 0 14px;
  color: var(--ink-soft);
}

.member-links {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.member-link-card {
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  border: 1px solid rgba(25, 74, 131, 0.18);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.92), rgba(245, 252, 255, 0.8));
  padding: 12px;
}

.member-link-card h3 {
  margin: 0;
  font-size: 18px;
}

.member-link-card p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.status-ok {
  color: var(--success);
  font-weight: 700;
}

.status-warn {
  color: #bd5d19;
  font-weight: 700;
}

@keyframes gridShift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-54px, -54px, 0);
  }
}

@keyframes driftA {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(34px, 18px) scale(1.12);
  }
}

@keyframes driftB {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(-30px, 28px) scale(1.16);
  }
}

@keyframes driftC {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(-20px, -30px) scale(1.1);
  }
}

@media (max-width: 960px) {
  .page-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .note-workspace {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .hub-shell,
  .page-shell {
    width: min(1180px, 94vw);
    margin-top: 16px;
  }

  .hub-header,
  .page-top,
  .tool-panel,
  .note-workspace {
    padding: 14px;
    border-radius: 16px;
  }

  .hub-header h1 {
    font-size: 38px;
  }

  .page-top h1 {
    font-size: 34px;
  }

  .portal-card {
    min-height: 174px;
  }

  .tool-card h2 {
    font-size: 23px;
  }

  .note-search-wrap {
    grid-template-columns: 1fr;
  }

  .note-list-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .note-toolbar-actions {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
