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

:root {
  --bg: #f0f7fb;
  --bg2: #e4f0f7;
  --surface: #ffffff;
  --surface2: #f5faff;
  --accent: #4ab8e8;
  --accent2: #7ec8e3;
  --accent-dark: #2d8ebd;
  --gold: #f5a623;
  --text: #2c3e50;
  --text2: #7a9bb5;
  --text3: #aac3d4;
  --danger: #e74c5e;
  --success: #2ecc71;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.1);
}

@font-face {
  font-family: 'PingFang SC';
  src: local('PingFang SC'), local('PingFang'), local('-apple-system');
}

body {
  font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* === Ocean background === */
.ocean-bg {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(180deg, #d4eaf7 0%, #e8f4fa 30%, #f0f7fb 60%, #e4f0f7 100%);
  z-index: -2;
}

.bubbles {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.bubble {
  position: absolute;
  bottom: -60px;
  background: radial-gradient(circle at 30% 30%, rgba(74,184,232,0.2), transparent 70%);
  border-radius: 50%;
  border: 1px solid rgba(74,184,232,0.08);
  animation: rise linear infinite;
}

@keyframes rise {
  to { transform: translateY(-110vh) scale(0.3); opacity: 0; }
}

/* === Layout === */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* === Header === */
header {
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(74,184,232,0.12);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-dark);
  text-decoration: none;
}

.logo span { font-weight: 400; color: var(--accent); }

nav { display: flex; gap: 8px; }

.nav-btn {
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid rgba(74,184,232,0.2);
  background: transparent;
  color: var(--text2);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
  font-family: inherit;
}

.nav-btn:hover {
  background: rgba(74,184,232,0.08);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.nav-btn.active {
  background: rgba(74,184,232,0.1);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.nav-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
}

.nav-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(74,184,232,0.35); }

/* === Hero === */
.hero {
  text-align: center;
  padding: 40px 20px 32px;
}

.hero h1 {
  font-size: 38px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.hero p {
  color: var(--text2);
  font-size: 16px;
  max-width: 500px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

.hero .stats {
  display: flex;
  justify-content: center;
  gap: 30px;
}

.stat-item { text-align: center; }

.stat-number {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent-dark);
  display: block;
}

.stat-label { font-size: 13px; color: var(--text2); }

/* === Gallery header === */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 { font-size: 20px; color: var(--text); }

.section-header .tabs { display: flex; gap: 4px; }

.tab-btn {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--surface);
  border-color: rgba(74,184,232,0.2);
  color: var(--accent-dark);
  box-shadow: var(--shadow);
}

.tab-btn:hover:not(.active) { color: var(--text); }

/* === Fish Grid === */
.fish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 40px;
}

.fish-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(74,184,232,0.1);
  transition: all 0.25s;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.fish-card:hover {
  transform: translateY(-4px);
  border-color: rgba(74,184,232,0.25);
  box-shadow: var(--shadow-hover);
}

.fish-card .preview {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(74,184,232,0.06), transparent);
  padding: 16px;
}

.fish-card .preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.fish-card .info {
  padding: 10px 14px;
}

.fish-card .info .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.fish-card .info .author {
  font-size: 12px;
  color: var(--text2);
}

.fish-card .info .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 13px;
}

.fish-card .votes { display: flex; align-items: center; gap: 4px; }

.fish-card .votes span { color: var(--text2); }

.vote-count {
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

/* === Aquarium === */
.aquarium-section { margin: 32px 0; }

.aquarium-stage {
  width: 100%;
  height: 500px;
  background: linear-gradient(180deg, #b8ddee 0%, #c5e4f2 20%, #cce8f4 50%, #bfdde8 100%);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(74,184,232,0.12);
}

/* Sea floor */
.sea-floor {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40px;
  background: linear-gradient(180deg, transparent, rgba(180,200,160,0.3));
}

.sea-floor::before {
  content: '';
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 12px;
  background: linear-gradient(90deg, #b8c9a8, #c9d8b8, #b8c9a8);
  opacity: 0.4;
}

/* Seaweed */
.seaweed {
  position: absolute;
  bottom: 12px;
  width: 4px;
  background: linear-gradient(to top, #7ab87a, transparent);
  border-radius: 2px;
  transform-origin: bottom center;
  animation: sway 4s ease-in-out infinite;
}

@keyframes sway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

/* Light rays */
.light-ray {
  position: absolute;
  top: -100px;
  width: 3px;
  height: 300px;
  background: linear-gradient(180deg, rgba(255,255,255,0.3), transparent);
  transform: rotate(8deg);
  animation: ray-move 8s ease-in-out infinite;
}

@keyframes ray-move {
  0%, 100% { opacity: 0.4; transform: rotate(6deg); }
  50% { opacity: 0.8; transform: rotate(10deg); }
}

/* Aquarium fish */
.aquarium-fish {
  position: absolute;
  cursor: pointer;
}

.aquarium-fish canvas { display: block; }

.aquarium-fish:hover {
  z-index: 10 !important;
  filter: brightness(1.1) drop-shadow(0 0 6px rgba(74,184,232,0.4));
}

/* Fish tooltip */
.fish-tooltip {
  position: absolute;
  background: var(--surface);
  border: 1px solid rgba(74,184,232,0.15);
  border-radius: 10px;
  padding: 14px;
  min-width: 180px;
  z-index: 50;
  box-shadow: var(--shadow-hover);
  pointer-events: none;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 30px;
  max-width: 460px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  position: relative;
  animation: modal-in 0.3s ease;
}

@keyframes modal-in {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 20px;
  cursor: pointer;
}

.modal-close:hover { color: var(--text); }

.modal .fish-display {
  text-align: center;
  margin: 16px 0;
}

.modal .fish-display img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.modal .modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.btn-upvote, .btn-downvote {
  padding: 10px 24px;
  border-radius: 24px;
  border: none;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-upvote {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
}

.btn-upvote:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(74,184,232,0.35); }

.btn-downvote {
  background: var(--bg);
  color: var(--text2);
  border: 1px solid rgba(74,184,232,0.15) !important;
}

.btn-downvote:hover { color: var(--text); border-color: var(--accent) !important; }

/* === Drawing Page === */
.drawing-page {
  display: flex;
  gap: 24px;
  padding: 24px 0;
  flex-wrap: wrap;
}

.drawing-canvas-wrap {
  flex: 1;
  min-width: 300px;
}

.drawing-canvas-wrap h2 {
  font-size: 22px;
  margin-bottom: 4px;
  color: var(--text);
}

#drawCanvas {
  width: 100%;
  aspect-ratio: 2/1;
  border-radius: var(--radius);
  border: 2px solid rgba(74,184,232,0.2);
  background: #fff;
  cursor: crosshair;
  touch-action: none;
}

/* Canvas focus glow */
.canvas-wrap {
  position: relative;
  border-radius: 12px;
  transition: box-shadow 0.3s ease;
}

/* Fish detection indicator */
.fish-indicator {
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 0;
  color: var(--text3);
  transition: all 0.3s;
}

.fish-indicator.ok { color: var(--gold); }
.fish-indicator.good { color: var(--success); }

.tools {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.color-btn.active { border-color: var(--accent-dark); transform: scale(1.15); }

.tool-btn {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(74,184,232,0.15);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
}

.tool-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.tool-btn.active { border-color: var(--accent); color: var(--accent-dark); }

.size-slider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
}

.size-slider input { width: 80px; accent-color: var(--accent); }
.size-slider span { font-size: 13px; color: var(--text2); }

/* Sidebar */
.sidebar {
  width: 300px;
}

.sidebar h3 { font-size: 16px; margin-bottom: 12px; color: var(--text); }

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 4px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(74,184,232,0.15);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74,184,232,0.1); }

.submit-btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.submit-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(74,184,232,0.3); }
.submit-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Tips */
.tips {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid rgba(74,184,232,0.1);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
}

.tips strong { color: var(--text); }

/* === Responsive === */
@media (max-width: 768px) {
  .hero h1 { font-size: 26px; }
  .drawing-page { flex-direction: column; }
  .sidebar { width: 100%; }
  .fish-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .aquarium-stage { height: 320px; }
  .hero .stats { gap: 16px; }
  nav { gap: 4px; }
  .nav-btn { padding: 6px 10px; font-size: 12px; }
}

/* === Loading === */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text2);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(74,184,232,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid rgba(74,184,232,0.15);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: var(--shadow-hover);
  pointer-events: none;
  color: var(--text);
}

.toast.show { opacity: 1; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text2);
}

.empty-state .big-icon { font-size: 60px; margin-bottom: 16px; opacity: 0.5; }

kbd {
  background: rgba(74,184,232,0.1);
  border: 1px solid rgba(74,184,232,0.2);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text2);
}
