:root {
  --pink-light: #ffd7e9;
  --pink-dark: #b3125b;
  --blue: #2f6fb3;
  --cream: #fff6f1;
  --brown: #b98255;
  --brown-dark: #6b4a2f;
  --ink: #2a2130;
  --shadow: 0 18px 45px rgba(47, 30, 60, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Baloo 2", "Comic Sans MS", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, rgba(47, 111, 179, 0.18), transparent 45%),
    radial-gradient(circle at 85% 5%, rgba(179, 18, 91, 0.18), transparent 50%),
    linear-gradient(130deg, #ffe2ef 0%, #f7f0ff 38%, #e3f1ff 100%);
  min-height: 100vh;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 40px;
  display: grid;
  gap: 24px;
  min-height: 100vh;
  grid-template-rows: auto 1fr auto;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  background: var(--cream);
  border-radius: 28px;
  box-shadow: var(--shadow);
  border: 2px solid rgba(179, 18, 91, 0.12);
}

.title-block h1 {
  font-size: clamp(2rem, 3vw, 2.8rem);
  margin: 8px 0 4px;
  color: var(--pink-dark);
  letter-spacing: 0.5px;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 2px;
  margin: 0;
  color: var(--blue);
}

.subtitle {
  margin: 0;
  color: rgba(42, 33, 48, 0.8);
}

.capybara-sticker {
  width: 200px;
  height: 160px;
  background: radial-gradient(circle at 50% 40%, rgba(255, 215, 233, 0.9), transparent 60%);
  border-radius: 36px;
  padding: 8px;
}

.capybara-sticker svg {
  width: 100%;
  height: 100%;
  display: block;
}

.capybara-sticker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 28px;
}

.play-area {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  min-height: 0;
  --board-height: min(90vh, 640px);
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  height: var(--board-height);
  max-height: none;
  overflow-y: auto;
  align-content: start;
  padding-right: 4px;
}

.panel {
  background: #ffffffcc;
  border-radius: 22px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  border: 2px solid rgba(47, 111, 179, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-title {
  font-weight: 700;
  color: var(--pink-dark);
  font-size: 1.05rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
}

select,
button {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: 14px;
  border: 2px solid rgba(47, 111, 179, 0.25);
  background: white;
  color: var(--ink);
}

button {
  cursor: pointer;
  background: var(--pink-light);
  border-color: rgba(179, 18, 91, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

button:hover:enabled {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(179, 18, 91, 0.2);
}

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

button.primary {
  background: var(--pink-dark);
  color: white;
  border-color: var(--pink-dark);
}

.status-text {
  font-size: 1rem;
  font-weight: 600;
}

.config-note {
  font-size: 0.9rem;
  color: rgba(42, 33, 48, 0.7);
}

.scoreboard .player-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 14px;
  border: 2px dashed rgba(47, 111, 179, 0.2);
  background: #ffffff;
  gap: 10px;
}

.player-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-badge {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--brown);
  border: 2px solid var(--brown-dark);
}

.player-name {
  font-weight: 600;
}

.player-score {
  font-size: 1rem;
  font-weight: 700;
}

.player-meta {
  font-size: 0.85rem;
  color: rgba(42, 33, 48, 0.7);
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.action-buttons button.selected {
  outline: 3px solid var(--blue);
}

.action-footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.board-wrap {
  background: #ffffffcc;
  border-radius: 28px;
  padding: 18px;
  box-shadow: var(--shadow);
  border: 2px solid rgba(179, 18, 91, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  position: relative;
  min-height: 520px;
  height: var(--board-height);
}

#board {
  width: 100%;
  height: 100%;
  min-height: 520px;
  max-width: 820px;
  max-height: 100%;
  display: block;
  border-radius: 18px;
  background: radial-gradient(circle at top, #fff0f7, #e8f3ff 70%);
}

.winner-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  background: rgba(179, 18, 91, 0.92);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 18px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 18px 35px rgba(179, 18, 91, 0.35);
  display: none;
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.winner-banner.show {
  display: block;
}

.play-again {
  position: absolute;
  top: calc(50% + 54px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
  padding: 10px 18px;
  border-radius: 18px;
  font-weight: 700;
  display: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.play-again.show {
  display: inline-flex;
}

.play-again:hover:enabled {
  transform: translateX(-50%);
  background: #3a7fd0;
  box-shadow: 0 10px 20px rgba(47, 111, 179, 0.25);
}

.status-tips {
  font-size: 0.9rem;
  color: rgba(42, 33, 48, 0.7);
}

.rules {
  border: 2px dashed rgba(47, 111, 179, 0.25);
  border-radius: 14px;
  padding: 8px 12px;
  background: #fff;
}

.rules summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--blue);
}

.rules ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: rgba(42, 33, 48, 0.8);
  font-size: 0.9rem;
}

.action-bar {
  height: 70px;
  width: 100%;
  max-width: none;
  justify-content: center;
}

@media (max-width: 760px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .capybara-sticker {
    width: 160px;
    height: 120px;
  }

  .action-footer {
    flex-direction: column;
  }

  .play-area {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 42vh;
    overflow-y: auto;
  }

  #board {
    max-height: 520px;
  }
}

@media (max-height: 720px) {
  .status-tips {
    display: none;
  }
}
