/* ==================== 全局重置 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ocean-deep: #0a1a2e;
  --ocean-mid: #163050;
  --ocean-light: #1e4870;
  --ocean-surface: #2a6a9c;
  --ocean-glow: #3a8cb8;
  --foam: #e0f0f5;
  --bottle-color: #2a9d8f;
  --accent: #e9a04a;
  --male-color: #4a9eda;
  --female-color: #e94560;
  --other-color: #9b59b6;
  --text-light: #e8f0f5;
  --text-dim: #7a9ab0;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-hover: rgba(255, 255, 255, 0.1);
  --danger: #e94560;
  --success: #2a9d8f;
}

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(180deg, var(--ocean-deep) 0%, var(--ocean-mid) 40%, var(--ocean-light) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text-light);
  overflow-x: hidden;
  position: relative;
}

/* ==================== 海浪动画 ==================== */
.ocean-bg {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 250px;
  pointer-events: none;
  z-index: 0;
}

.wave {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-repeat: repeat-x;
  background-position: 0 bottom;
}

.wave-1 {
  height: 100px;
  background-size: 200px 100px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 100'%3E%3Cpath d='M0 50 Q50 0 100 50 T200 50 V100 H0 Z' fill='%233a8cb8' opacity='0.25'/%3E%3C/svg%3E");
  animation: waveMove 8s linear infinite;
}

.wave-2 {
  height: 80px;
  background-size: 200px 80px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 80'%3E%3Cpath d='M0 40 Q50 10 100 40 T200 40 V80 H0 Z' fill='%232a6a9c' opacity='0.35'/%3E%3C/svg%3E");
  animation: waveMove 12s linear infinite reverse;
}

.wave-3 {
  height: 60px;
  background-size: 200px 60px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 60'%3E%3Cpath d='M0 30 Q50 5 100 30 T200 30 V60 H0 Z' fill='%231e4870' opacity='0.5'/%3E%3C/svg%3E");
  animation: waveMove 16s linear infinite;
}

@keyframes waveMove {
  0% { background-position: 0 bottom; }
  100% { background-position: 200px bottom; }
}

/* ==================== 气泡装饰 ==================== */
.bubbles {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bubble {
  position: absolute;
  bottom: -50px;
  width: 30px;
  height: 30px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.15), rgba(58,140,184,0.05));
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  animation: bubbleUp 15s linear infinite;
}

.bubble:nth-child(1) { left: 10%; animation-duration: 18s; animation-delay: 0s; width: 20px; height: 20px; }
.bubble:nth-child(2) { left: 25%; animation-duration: 22s; animation-delay: 3s; width: 35px; height: 35px; }
.bubble:nth-child(3) { left: 45%; animation-duration: 16s; animation-delay: 6s; width: 15px; height: 15px; }
.bubble:nth-child(4) { left: 65%; animation-duration: 20s; animation-delay: 1s; width: 40px; height: 40px; }
.bubble:nth-child(5) { left: 80%; animation-duration: 14s; animation-delay: 4s; width: 25px; height: 25px; }
.bubble:nth-child(6) { left: 92%; animation-duration: 19s; animation-delay: 8s; width: 18px; height: 18px; }

@keyframes bubbleUp {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.3; }
  100% { transform: translateY(-100vh); opacity: 0; }
}

/* ==================== 玻璃效果 ==================== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
}

/* ==================== 视图切换 ==================== */
.view { display: none; min-height: 100vh; position: relative; z-index: 1; }
.view.active { display: block; }

/* ==================== 登录界面 ==================== */
#login-view {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#login-view.active {
  display: flex;
  min-height: 100vh;
}

.login-card {
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.login-logo {
  font-size: 64px;
  margin-bottom: 16px;
  animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.login-card h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #4a9eda, #2a9d8f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#nickname-input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 16px;
  color: var(--text-light);
  outline: none;
  transition: border-color 0.3s;
  font-family: inherit;
}

#nickname-input::placeholder { color: var(--text-dim); }
#nickname-input:focus { border-color: var(--ocean-glow); }

.gender-select { text-align: left; }
.select-label { font-size: 14px; color: var(--text-dim); margin-bottom: 10px; }

.gender-options { display: flex; gap: 10px; }

.gender-btn {
  flex: 1;
  padding: 12px 8px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.g-icon { font-size: 16px; }
.g-icon.male { color: var(--male-color); }
.g-icon.female { color: var(--female-color); }
.g-icon.other { color: var(--other-color); }

.gender-btn:hover { background: var(--glass-hover); color: var(--text-light); }
.gender-btn.selected { color: var(--text-light); }
.gender-btn.selected[data-gender="male"] { border-color: var(--male-color); background: rgba(74,158,218,0.2); }
.gender-btn.selected[data-gender="female"] { border-color: var(--female-color); background: rgba(233,69,96,0.2); }
.gender-btn.selected[data-gender="other"] { border-color: var(--other-color); background: rgba(155,89,182,0.2); }

.primary-btn, .big-btn {
  background: linear-gradient(135deg, var(--ocean-glow), var(--bottle-color));
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.primary-btn:hover:not(:disabled), .big-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(58,140,184,0.4);
}

.primary-btn:disabled, .big-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ==================== 主界面 ==================== */
#main-view {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  margin-bottom: 12px;
}

.header-left { display: flex; align-items: center; gap: 8px; }
.logo { font-size: 24px; }
.app-name { font-size: 20px; font-weight: 700; }

.header-right { display: flex; align-items: center; gap: 12px; }

.user-info { font-size: 14px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }

.gender-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.gender-tag.male { background: rgba(74,158,218,0.2); color: var(--male-color); }
.gender-tag.female { background: rgba(233,69,96,0.2); color: var(--female-color); }
.gender-tag.other { background: rgba(155,89,182,0.2); color: var(--other-color); }

.icon-btn {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.3s;
}

.icon-btn:hover { background: var(--glass-hover); color: var(--danger); }

/* ==================== 限额栏 ==================== */
.limits-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 20px;
  margin-bottom: 12px;
  gap: 20px;
}

.limit-item { font-size: 14px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.limit-item b { color: var(--text-light); font-size: 16px; }
.limit-divider { width: 1px; height: 20px; background: var(--glass-border); }

/* ==================== 标签栏 ==================== */
.tab-bar {
  display: flex;
  padding: 4px;
  margin-bottom: 16px;
  gap: 4px;
}

.tab-btn {
  flex: 1;
  padding: 10px 4px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.tab-btn:hover { background: var(--glass-hover); }
.tab-btn.active { background: rgba(58,140,184,0.25); color: var(--text-light); }

/* ==================== 面板 ==================== */
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.3s; }

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

/* ==================== 捞瓶子区域 ==================== */
.pick-area { text-align: center; padding: 20px 0; }

.gender-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 28px;
}

.filter-label { font-size: 14px; color: var(--text-dim); margin-right: 4px; }

.filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.filter-btn:hover { background: var(--glass-hover); }
.filter-btn.active { background: rgba(58,140,184,0.25); border-color: var(--ocean-glow); color: var(--text-light); }

.big-btn { width: 100%; max-width: 320px; padding: 16px; font-size: 18px; }
.pick-hint { font-size: 13px; color: var(--text-dim); margin-top: 16px; }

/* ==================== 扔瓶子区域 ==================== */
.throw-area { padding: 20px 0; }

#bottle-message {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 16px;
  font-size: 15px;
  color: var(--text-light);
  outline: none;
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  line-height: 1.6;
  transition: border-color 0.3s;
}

#bottle-message::placeholder { color: var(--text-dim); }
#bottle-message:focus { border-color: var(--ocean-glow); }

.char-count { text-align: right; font-size: 12px; color: var(--text-dim); margin: 8px 0 16px; }

/* ==================== 瓶子列表 ==================== */
.bottle-list { display: flex; flex-direction: column; gap: 12px; }

.bottle-card {
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.3s;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
}

.bottle-card:hover { background: var(--glass-hover); transform: translateX(4px); }

.message-preview {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.bottle-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 6px;
}

.bottle-meta-left { display: flex; align-items: center; gap: 6px; }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.status-badge.waiting { background: rgba(233,160,74,0.2); color: var(--accent); }
.status-badge.picked { background: rgba(42,157,143,0.2); color: var(--success); }

.reply-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(74,158,218,0.2);
  color: var(--male-color);
}

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state p { font-size: 14px; line-height: 1.8; }

/* ==================== 弹窗 ==================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active { display: flex; animation: fadeIn 0.2s; }

.modal-content {
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
}

/* ==================== 瓶子详情 ==================== */
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.detail-header h3 { font-size: 18px; }

.close-btn {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
  font-family: inherit;
}

.close-btn:hover { background: var(--glass-hover); color: var(--danger); }

.original-bottle {
  background: rgba(42,157,143,0.08);
  border: 1px solid rgba(42,157,143,0.3);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.original-bottle .label { font-size: 12px; color: var(--success); margin-bottom: 8px; font-weight: 600; }
.original-bottle .message { font-size: 15px; line-height: 1.6; color: var(--text-light); }
.original-bottle .meta { margin-top: 12px; font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ==================== 聊天 ==================== */
.chat-area { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }

.chat-msg { max-width: 80%; padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.5; word-break: break-word; }

.chat-msg.other {
  align-self: flex-start;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--glass-border);
}

.chat-msg.me {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--ocean-glow), var(--bottle-color));
}

.chat-msg .sender { font-size: 11px; margin-bottom: 4px; opacity: 0.8; }
.chat-msg.me .sender { color: rgba(255,255,255,0.85); }
.chat-msg.other .sender { color: var(--text-dim); }

.chat-time { font-size: 11px; opacity: 0.5; margin-top: 4px; }

.reply-area { display: flex; gap: 8px; }

.reply-area input {
  flex: 1;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text-light);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.3s;
}

.reply-area input::placeholder { color: var(--text-dim); }
.reply-area input:focus { border-color: var(--ocean-glow); }

.reply-area button {
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  background: var(--bottle-color);
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  font-weight: 600;
}

.reply-area button:hover { background: #1e7d70; }
.reply-area button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 24px;
  color: var(--text-light);
  font-size: 14px;
  z-index: 200;
  transition: transform 0.3s ease;
  white-space: nowrap;
  max-width: 90vw;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--danger); background: rgba(233,69,96,0.3); }
.toast.success { border-color: var(--success); background: rgba(42,157,143,0.3); }

/* ==================== 响应式 ==================== */
@media (max-width: 600px) {
  .login-card { padding: 32px 24px; }
  .tab-btn { font-size: 12px; padding: 8px 2px; }
  .modal-content { padding: 20px; }
  .gender-filter { flex-direction: column; gap: 8px; }
  .gender-options .gender-btn { font-size: 14px; padding: 10px 6px; }
  .app-header { padding: 12px 16px; }
  .limits-bar { padding: 10px 16px; gap: 12px; }
  .chat-msg { max-width: 90%; }
}
