:root {
  --ink: #1c2834;
  --ink-soft: #4a5b6b;
  --paper: #e8f1f4;
  --paper-2: #f3ebe6;
  --teal: #0d7377;
  --teal-deep: #095456;
  --mist: #7ba3b0;
  --gold: #c9a227;
  --coral: #d97757;
  --line: rgba(28, 40, 52, 0.1);
  --shadow: 0 18px 50px rgba(28, 40, 52, 0.12);
  --radius: 18px;
  --font-display: "Noto Serif SC", "Songti SC", serif;
  --font-body: "Outfit", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(13, 115, 119, 0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(201, 162, 39, 0.16), transparent 55%),
    linear-gradient(160deg, var(--paper) 0%, #eef4f6 45%, var(--paper-2) 100%);
  background-attachment: fixed;
  line-height: 1.55;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, textarea {
  font: inherit;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.mist {
  position: absolute;
  width: 48vw;
  height: 48vw;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  animation: drift 18s ease-in-out infinite alternate;
}

.mist-a {
  left: -10%;
  top: 20%;
  background: #9fc5ce;
}

.mist-b {
  right: -15%;
  bottom: 5%;
  background: #e8c9b4;
  animation-delay: -6s;
}

.glow {
  position: absolute;
  left: 50%;
  top: 12%;
  width: 280px;
  height: 280px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(201, 162, 39, 0.22), transparent 70%);
  animation: pulse 8s ease-in-out infinite;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(40px, -30px, 0) scale(1.08); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.9; transform: translateX(-50%) scale(1.12); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.topbar, .app, .modal {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 840px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-mark {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.7rem;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), #14919b 55%, var(--gold));
  background-size: 180% 180%;
  animation: shimmer 6s linear infinite alternate;
  box-shadow: 0 8px 20px rgba(13, 115, 119, 0.28);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.nav {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.nav a {
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}

.nav a:hover,
.nav a.active {
  background: rgba(13, 115, 119, 0.1);
  color: var(--teal-deep);
}

.app {
  max-width: 840px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem 4rem;
  animation: rise 0.55s ease both;
}

.hero {
  padding: 1.5rem 0 1.75rem;
  text-align: left;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

.hero p {
  margin: 0.7rem 0 0;
  max-width: 28rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  font-weight: 300;
}

.composer, .panel, .post, .profile-card, .encounter-card {
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.composer {
  padding: 1rem 1.1rem 1.1rem;
  margin-bottom: 1.25rem;
}

.composer textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 1.05rem;
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.mood-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1;
}

.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s;
}

.chip.active,
.chip:hover {
  border-color: rgba(13, 115, 119, 0.35);
  background: rgba(13, 115, 119, 0.1);
  color: var(--teal-deep);
}

.feed {
  display: grid;
  gap: 0.95rem;
}

.post {
  padding: 1.15rem 1.2rem 1rem;
  animation: rise 0.45s ease both;
}

.post-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  flex-shrink: 0;
}

.meta {
  min-width: 0;
}

.meta .name {
  font-weight: 600;
}

.meta .sub {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.mood-tag {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--teal-deep);
  background: rgba(13, 115, 119, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.post-body {
  margin: 0.85rem 0 0.9rem;
  font-size: 1.08rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-actions {
  display: flex;
  gap: 0.5rem;
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
}

.action {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.action:hover {
  background: rgba(13, 115, 119, 0.08);
  color: var(--teal-deep);
}

.action.liked {
  color: var(--coral);
}

.comments {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.55rem;
}

.comment {
  display: flex;
  gap: 0.55rem;
  font-size: 0.95rem;
}

.comment .bubble {
  background: rgba(13, 115, 119, 0.06);
  border-radius: 12px;
  padding: 0.45rem 0.7rem;
  flex: 1;
}

.comment-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.comment-form input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  background: rgba(255, 255, 255, 0.7);
  outline: none;
}

.comment-form input:focus {
  border-color: rgba(13, 115, 119, 0.45);
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: linear-gradient(135deg, var(--teal), #14919b);
  color: #fff;
  box-shadow: 0 10px 24px rgba(13, 115, 119, 0.28);
}

.btn.primary:hover {
  background: linear-gradient(135deg, var(--teal-deep), var(--teal));
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn.wide {
  width: 100%;
}

.btn.gold {
  background: linear-gradient(135deg, #c9a227, #d4b44a);
  color: #1c2834;
  box-shadow: 0 10px 24px rgba(201, 162, 39, 0.28);
}

.profile-card, .encounter-card {
  padding: 1.4rem 1.35rem;
}

.profile-head {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.profile-head .avatar {
  width: 4rem;
  height: 4rem;
  font-size: 1.4rem;
}

.stats {
  display: flex;
  gap: 1.2rem;
  margin-top: 1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.stats strong {
  color: var(--ink);
  font-weight: 600;
}

.encounter-hero {
  text-align: center;
  padding: 1.5rem 0 1rem;
}

.encounter-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.8rem);
  margin: 0;
  letter-spacing: 0.06em;
}

.encounter-hero p {
  color: var(--ink-soft);
  margin: 0.6rem auto 1.4rem;
  max-width: 22rem;
}

.encounter-card {
  text-align: center;
  max-width: 460px;
  margin: 0 auto;
  animation: rise 0.5s ease both;
}

.encounter-card .avatar {
  width: 5rem;
  height: 5rem;
  margin: 0 auto 0.9rem;
  font-size: 1.7rem;
}

.snippet {
  margin: 1rem 0 1.25rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: rgba(13, 115, 119, 0.07);
  color: var(--ink-soft);
  font-style: italic;
  text-align: left;
}

.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 2.5rem 1rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(28, 40, 52, 0.38);
  display: grid;
  place-items: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-backdrop.hidden,
.hidden {
  display: none !important;
}

.modal {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 22px;
  padding: 1.6rem 1.4rem 1.3rem;
  box-shadow: var(--shadow);
  animation: rise 0.35s ease both;
  position: relative;
}

.modal-close {
  position: absolute;
  right: 0.8rem;
  top: 0.6rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  color: var(--ink-soft);
  cursor: pointer;
}

.modal-title {
  font-family: var(--font-display);
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: 0.06em;
}

.modal-sub {
  margin: 0.25rem 0 1.1rem;
  color: var(--ink-soft);
}

.modal label {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.modal input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: #fff;
  outline: none;
  color: var(--ink);
}

.modal input:focus {
  border-color: rgba(13, 115, 119, 0.5);
}

.form-error {
  color: var(--coral);
  min-height: 1.2em;
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
}

.linkish {
  display: block;
  width: 100%;
  margin-top: 0.85rem;
  border: none;
  background: transparent;
  color: var(--teal-deep);
  cursor: pointer;
  font-weight: 500;
}

.edit-form {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.edit-form input,
.edit-form textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.75);
  outline: none;
}

.history {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.6rem;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.05rem;
  height: 1.05rem;
  margin-left: 0.2rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  vertical-align: middle;
}

.quota {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
}

.quota strong {
  color: var(--teal-deep);
}

.bottle-card, .chat-thread, .notify-item, .chat-panel {
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.bottle-card {
  max-width: 460px;
  margin: 1rem auto 0;
  padding: 1.35rem 1.25rem;
  text-align: center;
  animation: rise 0.45s ease both;
}

.bottle-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0.55rem 0;
}

.thread-list, .notify-list {
  display: grid;
  gap: 0.65rem;
}

.chat-thread, .notify-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  text-align: left;
  transition: transform 0.15s;
}

.chat-thread:hover, .notify-item:hover {
  transform: translateY(-1px);
}

.chat-thread .preview, .notify-item .preview {
  color: var(--ink-soft);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.unread-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--coral);
  margin-left: auto;
  flex-shrink: 0;
}

.chat-panel {
  padding: 1rem;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 420px;
  max-height: 70vh;
}

.chat-log {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.75rem 0;
}

.bubble-row {
  display: flex;
}

.bubble-row.mine {
  justify-content: flex-end;
}

.msg-bubble {
  max-width: 78%;
  padding: 0.55rem 0.85rem;
  border-radius: 14px;
  background: rgba(13, 115, 119, 0.1);
  word-break: break-word;
}

.bubble-row.mine .msg-bubble {
  background: linear-gradient(135deg, var(--teal), #14919b);
  color: #fff;
}

.chat-compose {
  display: flex;
  gap: 0.5rem;
}

.chat-compose input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.65rem 0.95rem;
  background: rgba(255, 255, 255, 0.75);
  outline: none;
}

.notify-item.unread {
  border-color: rgba(13, 115, 119, 0.28);
  background: rgba(13, 115, 119, 0.08);
}

.tabs {
  display: flex;
  gap: 0.4rem;
  margin: 1rem 0 0.85rem;
}

.tab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  color: var(--ink-soft);
}

.tab.active {
  background: rgba(13, 115, 119, 0.12);
  color: var(--teal-deep);
  border-color: rgba(13, 115, 119, 0.3);
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
  }
  .nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
    overflow-x: auto;
    gap: 0.1rem;
  }
  .nav a {
    padding: 0.4rem 0.55rem;
    font-size: 0.86rem;
    white-space: nowrap;
  }
  .composer-bar {
    flex-direction: column;
    align-items: stretch;
  }
}
