@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap");

/* ===========================================================================
   Moby's Games — nautical / deep-sea theme
   =========================================================================== */

:root {
  --abyss: #02141f;
  --deep: #07293c;
  --sea: #0d4e6e;
  --teal: #3fb6da;
  --foam: #eaf7fb;
  --brass: #c8a86a;
  --brass-dark: #8a6f3b;
  --brass-light: #f0d9a6;
  --coral: #ff6b5e;
  --live: #ff3b46;
  --ink: #cfe9f2;
  --muted: #7fa6b8;

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 50% -10%, #0a3a54 0%, transparent 55%),
    linear-gradient(180deg, #063047 0%, var(--deep) 35%, var(--abyss) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* --- Ocean + waves -------------------------------------------------------- */
.ocean {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38vh;
  z-index: 0;
  pointer-events: none;
}

.wave {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 200%;
  height: 100%;
  background-repeat: repeat-x;
  background-position: bottom;
  background-size: 50% 100%;
}

.wave1 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0 50 C150 90 350 10 600 50 C850 90 1050 10 1200 50 L1200 120 L0 120 Z' fill='%230d4e6e'/%3E%3C/svg%3E");
  opacity: 0.55;
  animation: drift 18s linear infinite;
}
.wave2 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0 60 C200 20 400 100 600 60 C800 20 1000 100 1200 60 L1200 120 L0 120 Z' fill='%23093a54'/%3E%3C/svg%3E");
  opacity: 0.7;
  animation: drift 26s linear infinite reverse;
  height: 85%;
}
.wave3 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0 70 C150 50 350 95 600 70 C850 45 1050 95 1200 70 L1200 120 L0 120 Z' fill='%2305273a'/%3E%3C/svg%3E");
  opacity: 0.9;
  animation: drift 34s linear infinite;
  height: 70%;
}

@keyframes drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* --- Bubbles -------------------------------------------------------------- */
.bubbles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bubble {
  position: absolute;
  bottom: -40px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.7), rgba(120, 200, 230, 0.12));
  box-shadow: 0 0 6px rgba(180, 230, 245, 0.25);
  animation-name: rise;
  animation-timing-function: ease-in;
  animation-iteration-count: infinite;
  opacity: 0;
}
@keyframes rise {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.5;
  }
  100% {
    transform: translateY(-105vh) translateX(20px);
    opacity: 0;
  }
}

/* --- Top bar -------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(3, 18, 28, 0.55);
  border-bottom: 1px solid rgba(127, 166, 184, 0.14);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem clamp(1rem, 4vw, 2rem);
}

/* --- Layout --------------------------------------------------------------- */
.deck {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-height: calc(100vh - 60px);
  padding: 1.75rem clamp(1rem, 4vw, 2rem) 3rem;
}

/* Hidden pages stay mounted (so the live video keeps playing) but collapse. */
.page {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.page.hidden {
  display: none;
}

/* --- Brand (in top bar) --------------------------------------------------- */
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.005em;
  color: var(--foam);
  white-space: nowrap;
}

/* --- Top navigation ------------------------------------------------------- */
.topnav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.navlink {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 9px;
  padding: 0.45rem 0.9rem;
  transition: color 0.15s ease, background 0.15s ease;
}
.navlink:hover {
  color: var(--foam);
  background: rgba(127, 166, 184, 0.1);
}
.navlink.active {
  color: var(--foam);
  background: rgba(63, 182, 218, 0.14);
}
.nav-text {
  line-height: 1;
}
/* Tiny live pip next to the Stream link. */
.nav-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.45;
  flex: 0 0 auto;
  transition: opacity 0.15s ease;
}
.nav-live.live {
  background: var(--live);
  opacity: 1;
  animation: pulse 1.6s ease-out infinite;
}

/* --- Page headings -------------------------------------------------------- */
.page-title {
  font-family: var(--font-display);
  margin: 0;
  font-size: clamp(1.4rem, 3.5vw, 2.1rem);
  letter-spacing: 0.04em;
  color: var(--foam);
  text-shadow: 0 2px 0 #00131d, 0 0 18px rgba(63, 182, 218, 0.4);
}
.page-sub {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* --- Masthead ------------------------------------------------------------- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.whale {
  display: block;
}
.whale svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.whale-logo {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.45));
  animation: bob 5s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-6px) rotate(1.5deg);
  }
}
.spout {
  animation: spout 4s ease-in-out infinite;
  transform-origin: 27px 14px;
}
@keyframes spout {
  0%, 70%, 100% {
    opacity: 0.15;
    transform: translateY(3px) scale(0.85);
  }
  82% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
/* --- Live buoy ------------------------------------------------------------ */
.buoy {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(3, 22, 33, 0.65);
  border: 1px solid rgba(127, 166, 184, 0.35);
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
}
.buoy-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0 rgba(255, 59, 70, 0);
}
.buoy-label {
  color: var(--muted);
}
.buoy.live .buoy-dot {
  background: var(--live);
  animation: pulse 1.6s ease-out infinite;
}
.buoy.live .buoy-label {
  color: var(--foam);
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 59, 70, 0.6);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(255, 59, 70, 0);
  }
}

/* --- Player / porthole ---------------------------------------------------- */
.player-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.porthole {
  position: relative;
  width: min(100%, 920px);
  aspect-ratio: 16 / 9;
  border-radius: 28px;
  padding: 18px;
  background:
    linear-gradient(145deg, var(--brass-light), var(--brass) 40%, var(--brass-dark) 100%);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.55),
    inset 0 2px 4px rgba(255, 255, 255, 0.5),
    inset 0 -6px 14px rgba(0, 0, 0, 0.35);
}

/* rivets around the brass frame */
.porthole::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 22px;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(60, 40, 10, 0.85) 0 2px, transparent 3px);
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  background-position: top left, bottom left, left top, right top;
  background-size: 46px 8px, 46px 8px, 8px 46px, 8px 46px;
  opacity: 0.8;
}

.glass {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: radial-gradient(120% 120% at 50% 0%, #0a3247, #010d15 80%);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.7), inset 0 0 0 3px rgba(0, 0, 0, 0.4);
}

/* glass glare */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.16) 0%, transparent 38%);
  border-radius: 16px;
}

.stream {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #010d15;
}

.ring {
  position: absolute;
  inset: 10px;
  border-radius: 20px;
  pointer-events: none;
  border: 2px solid rgba(255, 255, 255, 0.18);
}

/* --- Overlay -------------------------------------------------------------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-align: center;
  padding: 1.5rem;
  background: radial-gradient(120% 120% at 50% 40%, rgba(2, 18, 28, 0.45), rgba(1, 13, 21, 0.82));
  backdrop-filter: blur(2px);
}
.overlay-msg {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: var(--foam);
}
.overlay-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.overlay-msg.err {
  color: var(--coral);
  font-family: var(--font-body);
  font-size: 1rem;
  max-width: 32ch;
}
.overlay.calm .whale-idle {
  width: 140px;
  height: 140px;
  margin-bottom: 0.4rem;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5));
  animation: bob 5s ease-in-out infinite;
}

.dive {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  color: #06222f;
  cursor: pointer;
  padding: 0.85rem 2.1rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brass-light), var(--brass) 60%, var(--brass-dark));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.6);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.dive:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.08);
}
.dive:active {
  transform: translateY(0) scale(0.99);
}
.anchor {
  margin-right: 0.2rem;
}

/* spinner */
.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4px solid rgba(63, 182, 218, 0.25);
  border-top-color: var(--teal);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Controls ------------------------------------------------------------- */
.controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}
.ctrl {
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--foam);
  background: rgba(8, 45, 64, 0.8);
  border: 1px solid rgba(63, 182, 218, 0.4);
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  transition: background 0.12s ease, transform 0.12s ease;
}
.ctrl:hover {
  background: rgba(13, 78, 110, 0.95);
  transform: translateY(-1px);
}

/* Volume slider — brass thumb on a deep-sea track. */
.vol {
  -webkit-appearance: none;
  appearance: none;
  width: 130px;
  height: 6px;
  margin: 0 0.25rem;
  align-self: center;
  border-radius: 999px;
  background: rgba(2, 18, 28, 0.8);
  border: 1px solid rgba(63, 182, 218, 0.4);
  cursor: pointer;
  outline: none;
}
.vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--brass-light), var(--brass) 60%, var(--brass-dark));
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.6);
  border: none;
  transition: transform 0.12s ease;
}
.vol::-webkit-slider-thumb:hover {
  transform: scale(1.12);
}
.vol::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--brass-light), var(--brass) 60%, var(--brass-dark));
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.6);
  border: none;
  cursor: pointer;
}
.vol:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(63, 182, 218, 0.35);
}

/* --- Footer --------------------------------------------------------------- */
.hull {
  margin-top: auto;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  padding-top: 1rem;
  border-top: 1px solid rgba(127, 166, 184, 0.18);
}
.hull p {
  margin: 0;
}

/* --- Servers page --------------------------------------------------------- */
.server-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.server-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 16px;
  background: rgba(7, 41, 60, 0.7);
  border: 1px solid rgba(127, 166, 184, 0.25);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.2s ease, transform 0.12s ease;
}
.server-card:hover {
  transform: translateY(-2px);
}
.server-card.online {
  border-color: rgba(63, 218, 152, 0.5);
}
.server-card.offline {
  border-color: rgba(127, 166, 184, 0.25);
  opacity: 0.85;
}

.server-glyph {
  font-size: 1.8rem;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: radial-gradient(120% 120% at 50% 0%, #0a3247, #021019 85%);
  border: 1px solid rgba(63, 182, 218, 0.25);
  flex: 0 0 auto;
}

.server-info {
  flex: 1 1 auto;
  min-width: 0;
}
.server-name {
  font-family: var(--font-display);
  margin: 0;
  font-size: 1.2rem;
  color: var(--foam);
  letter-spacing: 0.03em;
}
.server-meta {
  margin: 0.2rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  align-items: baseline;
}
.server-game {
  color: var(--teal);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.server-addr {
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9rem;
  background: rgba(2, 18, 28, 0.6);
  padding: 0.1rem 0.5rem;
  border-radius: 6px;
}

.server-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(2, 18, 28, 0.6);
  border: 1px solid rgba(127, 166, 184, 0.25);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}
.status-label {
  color: var(--muted);
}
.server-card.online .status-dot {
  background: #3fda98;
  box-shadow: 0 0 0 0 rgba(63, 218, 152, 0.6);
  animation: pulse-ok 1.8s ease-out infinite;
}
.server-card.online .status-label {
  color: var(--foam);
}
.server-card.checking .status-dot {
  background: var(--teal);
  animation: blink 1s ease-in-out infinite;
}
.server-card.checking .status-label {
  color: var(--teal);
}
@keyframes pulse-ok {
  0% {
    box-shadow: 0 0 0 0 rgba(63, 218, 152, 0.6);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(63, 218, 152, 0);
  }
}
@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.server-note {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0.5rem 0 0;
}
.note-whale {
  width: 34px;
  height: 28px;
  flex: 0 0 auto;
  opacity: 0.7;
}

/* --- Motion-reduction ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .wave1, .wave2, .wave3, .bubble, .whale-logo, .spout, .buoy.live .buoy-dot,
  .overlay.calm .whale-idle, .spinner, .nav-live.live, .server-card.online .status-dot,
  .server-card.checking .status-dot {
    animation: none !important;
  }
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 760px) {
  .deck {
    min-height: 0;
  }
}

@media (max-width: 540px) {
  .topbar-inner {
    padding: 0.5rem 1rem;
  }
  .navlink {
    padding: 0.4rem 0.65rem;
  }
  .masthead {
    justify-content: center;
    text-align: center;
  }
  .server-card {
    flex-wrap: wrap;
  }
}
