:root {
  --sea: #138d9d;
  --sea-dark: #0d6b78;
  --sand: #fbeea6;
  --leaf: #7cc24a;
  --ink: #1d2b33;
  --action: #f2c200;
  --move: #ffffff;
  --white-piece: #eceae4;
  --black-piece: #26313b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Ubuntu", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 30% 20%, #2ab7c8, var(--sea-dark));
  min-height: 100vh;
}

a {
  color: var(--sea-dark);
}

button {
  font: inherit;
  border: 2px solid var(--ink);
  background: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
}
button:hover {
  filter: brightness(0.95);
}
button:active {
  transform: translateY(2px);
  box-shadow: none;
}
button.primary {
  background: var(--action);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}

.logo {
  font-family: "Impact", "Arial Black", sans-serif;
  letter-spacing: 3px;
  color: #0b5f69;
  text-shadow: 2px 2px 0 #fff;
  text-decoration: none;
}
.logo.small {
  font-size: 22px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}
.card h2,
.card h3 {
  margin: 0 0 8px 0;
  color: #0b5f69;
}
.hint {
  color: #5a6b73;
  font-size: 14px;
}

/* ---------------------------------------------------------------- lobby */

.lobby {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
}
.lobby .logo {
  font-size: 64px;
  text-align: center;
  margin: 10px 0 0 0;
}
.lobby .intro {
  color: #fff;
  text-align: center;
  font-size: 18px;
}
.formrow {
  margin: 6px 0;
}
.animal-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}
.animal-entry {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
}
.animal-entry img {
  width: 48px;
  height: 48px;
}
.rules p {
  margin: 6px 0;
}

/* ---------------------------------------------------------------- game layout */

.game {
  display: flex;
  gap: 16px;
  padding: 8px;
  justify-content: center;
  align-items: flex-start;
}
.board-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.side-column {
  width: 360px;
  flex-shrink: 0;
}
@media (max-width: 860px) {
  .game {
    flex-direction: column;
    align-items: center;
  }
  .side-column {
    width: 100%;
    max-width: 520px;
  }
}

.banner {
  font-weight: bold;
  font-size: 20px;
  padding: 8px 18px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  min-height: 42px;
}
.banner.mine {
  background: var(--action);
  animation: pulse 1.6s ease-in-out infinite;
}
.banner.win {
  background: #8fe07a;
}
.banner.lose {
  background: #f39a8b;
}
@keyframes pulse {
  50% {
    box-shadow: 0 0 0 6px rgba(242, 194, 0, 0.35);
  }
}

/* ---------------------------------------------------------------- board */

.board {
  position: relative;
  overflow: hidden;
  background: var(--sea);
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  cursor: default;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.board-art {
  position: absolute;
  pointer-events: none;
}
.layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.piece {
  position: absolute;
  width: var(--cell);
  height: var(--cell);
  padding: calc(var(--cell) * 0.07);
  transition:
    left 0.33s ease-in-out,
    top 0.33s ease-in-out,
    opacity 0.3s ease-in 0.15s,
    transform 0.3s ease-in 0.15s;
}
.piece img {
  width: 100%;
  height: 100%;
  padding: calc(var(--cell) * 0.06);
  border-radius: calc(var(--cell) * 0.1);
  display: block;
}
.piece.white img {
  background: linear-gradient(145deg, #fafaf8, var(--white-piece));
  border: 2px solid #b9b5ab;
  box-shadow: 0 3px 0 #9e998d;
}
.piece.black img {
  background: linear-gradient(145deg, #34424e, var(--black-piece));
  border: 2px solid #0f161c;
  box-shadow: 0 3px 0 #0b1014;
}
.piece.selectable img {
  outline: 4px solid #ffd60a;
  outline-offset: 2px;
  animation: glow 1.2s ease-in-out infinite;
}
.piece.selected img {
  outline: 4px solid #ff6a00;
  outline-offset: 1px;
  transform: translateY(-3px);
}
.piece.used {
  filter: grayscale(0.7) brightness(0.85);
}
.piece.gone {
  opacity: 0;
}
.piece.gone.splash {
  transform: scale(0.4) rotate(40deg);
}
.piece.gone.stung {
  transform: scale(1.4);
}
/* Solid ring with a dark edge (readable on white and black tiles),
   plus a halo that pulses outwards */
@keyframes glow {
  0%,
  100% {
    box-shadow:
      0 3px 0 rgba(0, 0, 0, 0.35),
      0 0 0 8px #1d2b33,
      0 0 0 8px rgba(255, 214, 10, 0.9);
  }
  50% {
    box-shadow:
      0 3px 0 rgba(0, 0, 0, 0.35),
      0 0 0 8px #1d2b33,
      0 0 0 18px rgba(255, 214, 10, 0);
  }
}

.mark {
  position: absolute;
  width: var(--cell);
  height: var(--cell);
}
.mark.last-from {
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.45);
  border-radius: 8px;
}
.mark.last-to {
  background: rgba(255, 220, 80, 0.25);
  box-shadow: inset 0 0 0 3px rgba(255, 210, 60, 0.7);
  border-radius: 8px;
}
.mark.clicked {
  box-shadow: inset 0 0 0 4px #ff6a00;
  border-radius: 8px;
}
.mark.target {
  pointer-events: auto;
  cursor: pointer;
}
.mark.target::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.mark.target.move::after {
  width: 34%;
  height: 34%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 3px rgba(29, 43, 51, 0.6);
}
.mark.target.action::after {
  width: 86%;
  height: 86%;
  border: 5px solid var(--action);
  box-shadow: 0 0 10px rgba(242, 194, 0, 0.9);
}
.mark.target.water::after {
  width: 60%;
  height: 60%;
  border: 4px dashed #fff;
  background: rgba(255, 255, 255, 0.2);
}
.mark.target:hover {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 8px;
}

/* ---------------------------------------------------------------- side panel */

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.back-link {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: bold;
}
.player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 8px;
}
.player.active {
  background: #fff4c2;
}
.player .status {
  margin-left: auto;
  font-size: 13px;
  color: #5a6b73;
}
.player .status.online::before {
  content: "\25CF ";
  color: #3bb54a;
}
.player .status.offline::before {
  content: "\25CF ";
  color: #bbb;
}
.swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 2px solid var(--ink);
  vertical-align: middle;
  margin-right: 4px;
  flex-shrink: 0;
}
.swatch.white {
  background: var(--white-piece);
}
.swatch.black {
  background: var(--black-piece);
}
.player .status.bot::before {
  content: "\25CF ";
  color: #3b7bb5;
}
.bot-choice {
  margin-top: 8px;
}
.invite {
  margin-top: 8px;
  font-size: 14px;
}
.copy {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.copy-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  padding: 4px;
}
.warning {
  background: #fff1b8;
  font-weight: bold;
}
.error {
  background: #ffd6cf;
}
.selection .animal-head {
  display: flex;
  gap: 10px;
  align-items: center;
}
.selection .animal-head img {
  width: 54px;
  height: 54px;
}
.tagline {
  font-style: italic;
  color: #6f8c1e;
}
.action-text {
  margin: 8px 0;
  font-size: 14px;
}
.legend {
  font-size: 13px;
  color: #5a6b73;
  margin-bottom: 8px;
}
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
  margin: 0 3px 0 6px;
}
.dot.move {
  background: #fff;
  border: 2px solid var(--ink);
}
.dot.action {
  border: 3px solid var(--action);
}
.dot.water {
  border: 2px dashed var(--sea);
}
.choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 14px;
}
.options {
  font-size: 13px;
  margin-bottom: 8px;
}
.options ul {
  margin: 4px 0;
  padding-left: 18px;
}
.log ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  font-size: 14px;
}
.log li {
  padding: 2px 0;
  border-bottom: 1px solid #eef2f3;
}
.buttons {
  display: flex;
  gap: 8px;
}
.chat-form {
  display: flex;
  gap: 6px;
}
.chat-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 4px 6px;
}
.chat-list {
  max-height: 160px;
  overflow-y: auto;
  font-size: 14px;
  margin-top: 6px;
}
.chat-line.by-none {
  color: #5a6b73;
  font-style: italic;
}
