:root {
  --sea-deep: #0a1628;
  --sea-mid: #0d2137;
  --sky-top: #050d18;
  --accent-gold: #f4d03f;
  --accent-cyan: #5dade2;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.15);
  --text: #e8eef5;
  --text-muted: #8fa3b8;
  --badge: #e74c3c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--sea-deep);
}

body.sea-body {
  overflow: hidden;
}

/* --- Night sky + stars --- */
.sky {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sea-mid) 55%, var(--sea-deep) 100%);
  z-index: 0;
}

.stars {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #fff;
  border-radius: 50%;
  animation: twinkle var(--dur, 3s) ease-in-out infinite;
  opacity: var(--op, 0.6);
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}

/* --- Waves --- */
.waves {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28vh;
  z-index: 1;
  pointer-events: none;
}

.wave {
  position: absolute;
  left: -10%;
  width: 120%;
  height: 100%;
  border-radius: 45% 48% 0 0;
  opacity: 0.35;
}

.wave-1 {
  bottom: 0;
  background: linear-gradient(180deg, transparent, #1a4a6e);
  animation: wave-drift 8s ease-in-out infinite;
}

.wave-2 {
  bottom: 8%;
  background: linear-gradient(180deg, transparent, #143d5c);
  opacity: 0.25;
  animation: wave-drift 11s ease-in-out infinite reverse;
}

.wave-3 {
  bottom: 14%;
  background: linear-gradient(180deg, transparent, #0f3048);
  opacity: 0.18;
  animation: wave-drift 14s ease-in-out infinite;
}

@keyframes wave-drift {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  50% { transform: translateX(-3%) rotate(-1deg); }
}

/* --- Layout --- */
.content {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}

.top-bar {
  display: flex;
  justify-content: flex-end;
  padding: 12px 8px;
}

.link-mine {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  backdrop-filter: blur(8px);
  font-size: 0.9rem;
  transition: box-shadow 0.2s;
}

.link-mine:hover {
  box-shadow: 0 0 20px rgba(93, 173, 226, 0.35);
}

.badge-count {
  background: var(--badge);
  color: #fff;
  font-size: 0.75rem;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 10px;
  padding: 0 6px;
}

.sea-actions {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 8vw, 80px);
  padding-bottom: 18vh;
}

.btn-sea {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(120px, 32vw, 160px);
  height: clamp(120px, 32vw, 160px);
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 600;
  background: radial-gradient(circle at 30% 30%, rgba(93, 173, 226, 0.25), var(--glass));
  border: 1px solid var(--glass-border);
  box-shadow: 0 0 30px rgba(244, 208, 63, 0.15), inset 0 0 20px rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-sea:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(93, 173, 226, 0.4);
}

.btn-sea span.icon { font-size: 2rem; margin-bottom: 8px; }

.sea-footer {
  text-align: center;
  padding: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sea-footer a {
  color: var(--accent-cyan);
  text-decoration: none;
  margin: 0 8px;
}

/* --- Cards / forms --- */
.page-card {
  max-width: 520px;
  margin: 40px auto;
  padding: 28px 24px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
}

.page-card h1 {
  font-size: 1.4rem;
  margin-bottom: 8px;
  text-align: center;
}

.page-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

input[type="text"], textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

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

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  min-height: 44px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #2980b9, #1a5276);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover { filter: brightness(1.1); }

.btn-back {
  display: inline-block;
  margin-top: 16px;
  color: var(--accent-cyan);
  text-decoration: none;
  font-size: 0.9rem;
}

.char-hint {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.alert-err { background: rgba(231, 76, 60, 0.2); border: 1px solid var(--badge); }
.alert-ok { background: rgba(46, 204, 113, 0.2); border: 1px solid #2ecc71; }

/* --- Detail --- */
.detail-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 120px;
}

.detail-card {
  padding: 20px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  margin-bottom: 20px;
}

.detail-card .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.detail-card .body {
  white-space: pre-wrap;
  line-height: 1.6;
  word-break: break-word;
}

.replies-title {
  font-size: 1rem;
  margin: 16px 0 10px;
  color: var(--text-muted);
}

.reply-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--glass-border);
}

.reply-item .reply-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.reply-item .reply-body {
  white-space: pre-wrap;
  line-height: 1.5;
  word-break: break-word;
}

.reply-form-fixed {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(10, 22, 40, 0.92);
  border-top: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
}

.reply-form-fixed form {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.reply-form-fixed textarea {
  flex: 1;
  min-height: 48px;
  max-height: 120px;
}

.reply-form-fixed button {
  flex-shrink: 0;
  padding: 12px 18px;
  min-height: 44px;
  border: none;
  border-radius: 10px;
  background: #2980b9;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

.load-more {
  display: block;
  width: 100%;
  margin: 12px 0;
  padding: 10px;
  background: transparent;
  border: 1px dashed var(--glass-border);
  color: var(--accent-cyan);
  border-radius: 8px;
  cursor: pointer;
}

/* --- Mine list --- */
.mine-list { max-width: 640px; margin: 0 auto; padding: 16px; }

.mine-item {
  display: block;
  position: relative;
  padding: 16px 48px 16px 16px;
  margin-bottom: 12px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
}

.mine-item .excerpt { font-size: 1rem; margin-bottom: 6px; }
.mine-item .time { font-size: 0.8rem; color: var(--text-muted); }

.mine-item .badge-count {
  position: absolute;
  top: 12px;
  right: 12px;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  max-width: 640px;
  margin: 0 auto;
}

.page-header h1 { font-size: 1.2rem; flex: 1; }

/* --- Admin --- */
body.admin-body {
  background: #1a1a2e;
}

.admin-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th, .admin-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #333;
  text-align: left;
}

.admin-table a { color: var(--accent-cyan); }

.btn-danger {
  padding: 6px 12px;
  background: var(--badge);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.admin-nav {
  margin-bottom: 20px;
  display: flex;
  gap: 16px;
}

.admin-nav a { color: var(--accent-cyan); }
