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

body {
  font-family: "Calibri", "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(135deg, #1a3a4a 0%, #2d6a7a 50%, #1a5060 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  color: white;
  text-align: center;
  font-size: 2em;
  margin-bottom: 4px;
}

.subtitle {
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  font-size: 1.1em;
  margin-bottom: 20px;
}

.card {
  background-color: floralwhite;
  border: 3px solid lightskyblue;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

/* Landing page join error */
.join-error {
  color: #dc3545;
  font-weight: bold;
  margin-top: 8px;
  min-height: 1.2em;
}

/* Admin PIN banner — big so players can read it off a projector */
.pin-banner {
  background-color: floralwhite;
  border: 3px solid #f1c40f;
  border-radius: 8px;
  padding: 12px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 16px;
}

.pin-banner-label {
  font-size: 1.1em;
  color: #2d6a7a;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.pin-banner-value {
  font-size: 3em;
  font-weight: bold;
  letter-spacing: 0.25em;
  color: #2d6a7a;
  font-variant-numeric: tabular-nums;
}

.card h2 {
  color: #2d6a7a;
  margin-bottom: 12px;
  font-size: 1.3em;
}

/* Join form */
label {
  display: block;
  font-weight: bold;
  margin-bottom: 4px;
  color: #555;
}

input[type="text"],
input[type="number"],
input[type="password"] {
  width: 100%;
  padding: 10px;
  border: 2px solid lightskyblue;
  border-radius: 4px;
  font-size: 1em;
  margin-bottom: 12px;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: #2d6a7a;
}

button {
  padding: 10px 24px;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
}

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

button:not(:disabled):hover {
  filter: brightness(1.1);
}

/* Join button */
.card > button {
  background-color: #2d6a7a;
  color: white;
  width: 100%;
}

/* Fish choice buttons */
.choice-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}

.choice-btn {
  background-color: #3498db;
  color: white;
  font-size: 1.5em;
  width: 80px;
  height: 60px;
  border-radius: 8px;
}

.choice-btn:hover {
  background-color: #2980b9;
}

/* Game layout */
.game-layout {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.choice-card {
  flex: 1;
}

.info-card {
  flex: 1;
}

@media (max-width: 650px) {
  .game-layout {
    flex-direction: column;
  }
}

/* Round header */
.round-header h2 {
  color: white;
  text-align: center;
  font-size: 1.5em;
  margin-bottom: 16px;
}

/* Tables */
.params-table,
.history-table {
  width: 100%;
  border-collapse: collapse;
}

.params-table th,
.params-table td,
.history-table th,
.history-table td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid #ddd;
}

.params-table th,
.history-table th {
  background-color: rgba(45, 106, 122, 0.1);
  font-weight: bold;
  color: #2d6a7a;
}

.history-table .highlight {
  background-color: rgba(52, 152, 219, 0.15);
  font-weight: bold;
}

/* Player stats */
.player-stats p {
  margin-bottom: 6px;
  font-size: 1.05em;
}

/* Waiting message */
.waiting {
  text-align: center;
  color: #888;
  font-style: italic;
  padding: 16px;
}

/* Alert (level up) */
.alert {
  background-color: #d4edda;
  border: 2px solid #28a745;
  border-radius: 8px;
  padding: 12px 20px;
  margin-bottom: 16px;
  text-align: center;
  font-weight: bold;
  color: #155724;
}

/* Player list in lobby */
.player-list {
  list-style: none;
  padding: 0;
}

.player-list li {
  padding: 6px 12px;
  border-bottom: 1px solid #eee;
}

.hint {
  color: #888;
  font-style: italic;
  margin-top: 12px;
}

/* Admin */
.phase-badge {
  display: inline-block;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 0.9em;
  margin-bottom: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.btn-start {
  background-color: #28a745;
  color: white;
  margin-right: 8px;
  margin-bottom: 8px;
}

.btn-force {
  background-color: #ffc107;
  color: #333;
  margin-right: 8px;
  margin-bottom: 8px;
}

.btn-reset {
  background-color: #dc3545;
  color: white;
  margin-bottom: 8px;
}

/* Admin sound toggle */
.admin-controls {
  text-align: center;
  margin-bottom: 16px;
}

.btn-sound {
  background-color: #2d6a7a;
  color: white;
}

/* Connection dots */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.dot-green {
  background-color: #28a745;
}

.dot-red {
  background-color: #dc3545;
}

/* Catch buttons */
.catch-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}

.btn-catch {
  background-color: #3498db;
  color: white;
  font-size: 1.5em;
  width: 80px;
  height: 60px;
  border-radius: 8px;
  border: 3px solid transparent;
  opacity: 0.65;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-catch:hover {
  opacity: 0.85;
}

.btn-catch--selected {
  opacity: 1;
  border-color: #f1c40f;
  box-shadow: 0 0 0 2px rgba(241, 196, 15, 0.35), 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.stat {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.85em;
  color: #888;
  margin-bottom: 2px;
}

.stat-value {
  display: block;
  font-size: 1.4em;
  font-weight: bold;
  color: #2d6a7a;
}

.submitted-msg {
  text-align: center;
  color: #28a745;
  font-weight: bold;
  padding: 12px;
}

/* Transient "You chose N" confirmation toast */
.catch-toast {
  position: fixed;
  top: 28%;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: rgba(45, 106, 122, 0.96);
  color: #fff;
  font-size: 1.7em;
  font-weight: bold;
  padding: 16px 36px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  z-index: 50;
}

.catch-toast--show {
  animation: catch-toast-fade 1.5s ease forwards;
}

@keyframes catch-toast-fade {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.8); }
  15%  { opacity: 1; transform: translateX(-50%) scale(1); }
  50%  { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1); }
}

/* Level card — gamification artwork + flavour text */
.level-card {
  text-align: center;
}

.level-image {
  width: 100%;
  max-width: 420px;
  height: auto;
  border-radius: 10px;
  display: block;
  margin: 0 auto 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.level-meta {
  margin-top: 4px;
}

.level-number {
  display: block;
  font-size: 1.3em;
  font-weight: bold;
  color: #2d6a7a;
}

.level-reward {
  margin: 4px 0 0;
  color: #555;
  font-style: italic;
}

.level-up-banner--hidden {
  visibility: hidden;
}

.level-up-banner {
  background: linear-gradient(90deg, #f1c40f, #f39c12);
  color: #fff;
  font-weight: bold;
  font-size: 1.15em;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 12px;
  animation: level-up-pop 0.5s ease;
}

@keyframes level-up-pop {
  0%   { transform: scale(0.8); opacity: 0; }
  60%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

/* Ambient fish — CSS-animated, server heartbeat proves liveness.
   The container is fixed full-screen so child fish (absolute) stay
   within its influence for filter/opacity cascading. */
.ambient-fish-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  transition: filter 0.5s, opacity 0.5s;
}

.ambient-fish {
  position: absolute;
  font-size: 3em;
  opacity: 0.35;
  animation: swim 25s linear infinite, bob 3s ease-in-out infinite;
  animation-play-state: inherit;
}

@keyframes swim {
  0%   { left: -5%; }
  100% { left: 105%; }
}

@keyframes bob {
  0%, 100% { transform: scaleX(-1) translateY(0); }
  50%      { transform: scaleX(-1) translateY(-12px); }
}

.ambient-fish--stale {
  animation-play-state: paused;
  filter: grayscale(1) blur(1px);
  opacity: 0.3;
}

/* Details/summary for history */
details {
  margin-top: 8px;
}

summary {
  cursor: pointer;
  font-weight: bold;
  color: #2d6a7a;
  margin-bottom: 8px;
}
