:root {
  --sea-deep: #0b3d4a;
  --sea: #146277;
  --sea-light: #2a8fa3;
  --foam: #e8f6f4;
  --sand: #f2e6c9;
  --ink: #10252c;
  --coral: #e05a3c;
  --leaf: #3d8b62;
  --ore: #6b7280;
  --wood: #5b8c4a;
  --fish: #3d9bb8;
  --panel: rgba(232, 246, 244, 0.92);
  --line: rgba(16, 37, 44, 0.12);
  --shadow: 0 18px 50px rgba(8, 40, 50, 0.28);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Nunito", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(42, 143, 163, 0.45), transparent 55%),
    radial-gradient(900px 500px at 90% 10%, rgba(61, 139, 98, 0.25), transparent 50%),
    linear-gradient(165deg, #0a2f38 0%, #146277 42%, #1a6b5c 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpath d='M0 40 Q20 20 40 40 T80 40' fill='none' stroke='%23e8f6f4' stroke-width='1'/%3E%3C/svg%3E");
}

#app {
  min-height: 100vh;
}

.screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.hero-card {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.35rem 1.5rem;
  animation: rise 0.45s ease both;
}

.panel {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.35rem 1.5rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.brand {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  line-height: 0.95;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
  color: var(--sea-deep);
}

.tagline {
  margin: 0 0 1.1rem;
  color: rgba(16, 37, 44, 0.72);
  font-weight: 700;
}

label {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 0.7rem;
  font-size: 0.85rem;
  font-weight: 800;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  border: 1px solid rgba(16, 37, 44, 0.18);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: #fff;
}

.row {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

button {
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 8px 20px rgba(224, 90, 60, 0.35);
}

.btn-sea {
  background: var(--sea);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(16, 37, 44, 0.2);
  color: var(--ink);
}

.error {
  color: #a12f1c;
  font-weight: 700;
  margin: 0.4rem 0 0.7rem;
  font-size: 0.9rem;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.tabs button {
  border-radius: 12px;
  background: rgba(20, 98, 119, 0.08);
}

.tabs button.on {
  background: var(--sea);
  color: #fff;
}

.lobby-layout {
  width: min(1100px, 100%);
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: start;
}

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

.seat {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  margin-bottom: 0.45rem;
}

.swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.swatch.crimson { background: #c43c3c; }
.swatch.azure { background: #2f7fd1; }
.swatch.amber { background: #d4a017; }
.swatch.emerald { background: #2f9e6a; }

.code-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  background: var(--sea-deep);
  color: var(--foam);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
}

.play-layout {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.6rem;
  padding: 0.75rem;
}

.topbar,
.bottombar,
.side {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  flex-wrap: wrap;
}

.board-wrap {
  display: grid;
  place-items: center;
  min-height: 420px;
}

.board-svg {
  width: min(620px, 96vw);
  height: auto;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.25));
  animation: floaty 4s ease-in-out infinite;
}

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

.hex {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 2;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.hex:hover {
  filter: brightness(1.08);
}

.hex.wood { fill: #4f8a45; }
.hex.fish { fill: #2f8fad; }
.hex.ore { fill: #7a8494; }
.hex.raider {
  stroke: #1a1a1a;
  stroke-width: 4;
}

.hut {
  stroke: #fff;
  stroke-width: 2;
  cursor: pointer;
}

.hut.legal {
  fill: rgba(255, 255, 255, 0.55);
  animation: pulse 1.2s ease infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform-box: fill-box;
    transform-origin: center;
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

.road {
  stroke-width: 8;
  stroke-linecap: round;
  cursor: pointer;
  opacity: 0.95;
}

.road.legal {
  stroke: rgba(255, 255, 255, 0.55);
  stroke-dasharray: 6 6;
}

.bottombar {
  display: grid;
  gap: 0.65rem;
  padding: 0.8rem;
}

.hand {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.card {
  min-width: 72px;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  color: #fff;
  font-weight: 800;
  text-align: center;
}

.card.wood { background: var(--wood); }
.card.fish { background: var(--fish); }
.card.ore { background: var(--ore); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.log {
  max-height: 120px;
  overflow: auto;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
}

.log p {
  margin: 0.15rem 0;
}

.players {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.pchip {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #fff;
  border: 2px solid transparent;
  font-size: 0.82rem;
  font-weight: 800;
}

.pchip.active {
  border-color: var(--coral);
}

.auth-chip .linkish,
.linkish {
  background: none;
  border: none;
  color: var(--sea);
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
  font-weight: 800;
  padding: 0;
}

.lobby-layout .panel {
  width: auto;
}

.win-banner {
  text-align: center;
  padding: 1rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--sea-deep);
}
