:root {
  color-scheme: dark;
  --bg: #0b2447;
  --panel: rgba(10, 30, 58, 0.72);
  --panel-border: rgba(92, 185, 255, 0.16);
  --text: #d7e7f5;
  --muted: #8fb2cf;
  --accent: #ff7f6e;
  --accent-2: #00b4d8;
  --coral: #ff6b8a;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 600px at 15% -10%, #0e3a6b 0%, transparent 60%),
    radial-gradient(1000px 700px at 110% 30%, #04305a 0%, transparent 55%),
    linear-gradient(180deg, #021a33 0%, #062c52 55%, #031e38 100%);
  background-attachment: fixed;
  color: var(--text);
}

#root {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

button {
  font-family: inherit;
}

.app {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 20px 40px;
}

.topbar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 4px;
}

.topbar-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.3px;
  background: linear-gradient(90deg, #7fd4ff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar-tag {
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 18px;
  align-items: start;
}

.col-right,
.col-left {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 45px rgba(0, 5, 20, 0.35);
}

/* ---------- search panel ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.logo {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(0, 180, 216, 0.35));
}

.brand h1 {
  margin: 0;
  font-size: 26px;
  color: #f0f8ff;
  letter-spacing: 0.2px;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(6, 26, 51, 0.85);
  border: 1px solid rgba(92, 185, 255, 0.28);
  border-radius: 12px;
  padding: 6px 8px 6px 12px;
  transition: border-color 0.15s;
}

.searchbox:focus-within {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

.sc-icon {
  width: 20px;
  height: 20px;
  color: var(--muted);
  flex-shrink: 0;
}

.searchbox input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #eaf6ff;
  font-size: 16px;
  padding: 8px 0;
  min-width: 0;
}

.searchbox input::placeholder {
  color: #6d8fab;
}

.grow-btn {
  background: linear-gradient(135deg, var(--accent), var(--coral));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
  white-space: nowrap;
}

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

.grow-btn:active {
  transform: scale(0.97);
}

.suggestions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}

.suggestions button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 180, 216, 0.06);
  border: 1px solid rgba(92, 185, 255, 0.12);
  color: var(--text);
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
}

.suggestions button:hover {
  background: rgba(0, 180, 216, 0.14);
}

.suggestions svg {
  width: 14px;
  height: 14px;
  color: var(--accent-2);
  flex-shrink: 0;
}

.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.categories button {
  background: rgba(127, 212, 255, 0.06);
  border: 1px solid rgba(127, 212, 255, 0.18);
  color: #9ecbe6;
  font-size: 12.5px;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.categories button:hover {
  background: rgba(127, 212, 255, 0.18);
  color: #fff;
}

.searching {
  margin-top: 20px;
  color: var(--accent-2);
  font-size: 14px;
  animation: pulse 1.2s ease-in-out infinite;
}

.toast {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(0, 180, 216, 0.14);
  border: 1px solid rgba(0, 180, 216, 0.35);
  color: #b7ecff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  animation: pop 0.3s ease;
}

.hint {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13.5px;
}

[hidden] {
  display: none !important;
}

.countline {
  margin: 18px 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.countline b {
  color: #fff;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result {
  border: 1px solid rgba(92, 185, 255, 0.14);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  padding: 13px 15px;
  transition: border-color 0.15s, transform 0.15s;
  animation: slidein 0.35s ease both;
}

.result:hover {
  border-color: rgba(0, 180, 216, 0.4);
  transform: translateY(-1px);
}

.result .badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #ffb3a6;
  background: rgba(255, 127, 110, 0.12);
  border-radius: 6px;
  padding: 2px 7px;
}

.result h3 {
  margin: 6px 0 4px;
  font-size: 15.5px;
  color: #eaf6ff;
}

.result p {
  margin: 0;
  font-size: 13.5px;
  color: #9db8d0;
}

.result mark {
  background: rgba(0, 180, 216, 0.35);
  color: #fff;
  border-radius: 3px;
  padding: 0 2px;
}

/* ---------- reef / stats ---------- */

.reef-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.reef-head h2 {
  margin: 0;
  font-size: 18px;
  color: #eff9ff;
}

.reef-head p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.count-pill {
  background: rgba(255, 107, 138, 0.14);
  border: 1px solid rgba(255, 107, 138, 0.3);
  color: #ffbdc9;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  white-space: nowrap;
}

.scene-wrap {
  position: relative;
}

.depth {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 11px;
  letter-spacing: 1px;
  color: rgba(202, 240, 248, 0.65);
  z-index: 2;
}

.scene {
  width: 100%;
  height: auto;
  border-radius: 14px;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(92, 185, 255, 0.2);
}

.coral {
  filter: drop-shadow(0 2px 6px rgba(255, 127, 110, 0.25));
}

.coral.grow {
  animation: grow 1.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes grow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

.scene:hover .coral {
  filter: drop-shadow(0 0 8px rgba(255, 127, 110, 0.45));
}

@keyframes sway {
  0%,
  100% {
    transform: rotate(-2deg);
    transform-origin: bottom;
  }
  50% {
    transform: rotate(3deg);
  }
}

.seaweed {
  animation: sway 4s ease-in-out infinite;
  transform-origin: bottom;
}

@keyframes swim {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(14px);
  }
}

.fish {
  animation: swim 6s ease-in-out infinite;
}

.scene-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.seed-progress {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(127, 212, 255, 0.12);
  overflow: hidden;
  display: block;
}

.seed-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), #48cae4);
  border-radius: 999px;
  transition: width 0.5s ease;
}

.scene-foot small {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.scene-foot b {
  color: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(92, 185, 255, 0.12);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}

.stat b {
  display: block;
  font-size: 20px;
  color: #fff;
}

.stat span {
  font-size: 11.5px;
  color: var(--muted);
}

.impact {
  margin-top: 18px;
}

.impact h4,
.lb-head h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #bcd8ee;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.impact ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.impact li {
  font-size: 13.5px;
  color: #a7c3db;
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.impact .mark {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 6px;
  color: #ffd9d2;
  flex-shrink: 0;
}

.mark.seed,
.mark.reef {
  background: linear-gradient(135deg, #ff7f6e, #ff6b8a);
  color: #fff;
}

.mark.fish {
  background: rgba(0, 180, 216, 0.25);
  color: #8fe3ff;
}

.mark.wave {
  background: rgba(127, 212, 255, 0.2);
  color: #a8dcff;
}

.leaderboard {
  margin-top: 18px;
}

.lb-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.lb-head span {
  font-size: 11.5px;
  color: var(--muted);
}

.leaderboard ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(92, 185, 255, 0.1);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
}

.leaderboard li.you {
  border-color: rgba(255, 127, 110, 0.5);
  background: rgba(255, 127, 110, 0.08);
}

.rank {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  background: rgba(127, 212, 255, 0.12);
  color: #7fd4ff;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

li.you .rank {
  background: rgba(255, 127, 110, 0.22);
  color: #ff9d8c;
}

.pname {
  flex: 1;
  color: #cfe3f3;
}

.leaderboard li b {
  color: #fff;
  font-size: 13px;
}

.rank-info {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.ghost {
  margin-top: 16px;
  width: 100%;
  background: none;
  border: 1px dashed rgba(127, 212, 255, 0.3);
  color: var(--muted);
  border-radius: 10px;
  padding: 9px;
  font-size: 13px;
  cursor: pointer;
}

.ghost:hover {
  color: #fff;
  border-color: rgba(127, 212, 255, 0.6);
}

footer {
  text-align: center;
  color: #6d8fab;
  font-size: 12px;
  padding: 6px 0 10px;
}

@keyframes pop {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

@keyframes slidein {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
  }
}