/* Pig — Race to 100. Visual language matches the Game On Family brand. */

:root {
  --gof-primary-dark: #157623;
  --gof-primary: #9bca3e;
  --gof-bg-light: #dde5ed;
  --gof-bg-mint: #defff0;
  --gof-accent: #ffb920;
  --gof-warm: #de6739;
  --text-primary: #2f2c28;
  --text-secondary: #5e5c5e;
  --card-bg: #ffffff;
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: 'Arimo', sans-serif;
  color: var(--text-primary);
  background: linear-gradient(180deg, var(--gof-bg-light) 0%, var(--gof-bg-mint) 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app {
  flex: 1;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

/* ===== Screens ===== */
.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.screen[hidden] {
  display: none;
}

/* ===== Game header (setup screen) ===== */
.game-header {
  text-align: center;
  margin-bottom: 0.5rem;
}

.game-title {
  font-family: 'League Spartan', sans-serif;
  font-size: 3rem;
  font-weight: 800;
  color: var(--gof-primary-dark);
  line-height: 1;
}

.game-tagline {
  font-family: 'Trocchi', Georgia, serif;
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-top: 0.5rem;
}

/* ===== Setup card ===== */
.setup-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.setup-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.setup-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.player-count-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.count-btn {
  flex: 1;
  min-width: 48px;
  min-height: 48px;
  font-family: 'Arimo', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  background: white;
  color: var(--text-primary);
  border: 2px solid var(--gof-primary);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.count-btn:hover {
  background: var(--gof-bg-mint);
}

.count-btn[aria-pressed="true"] {
  background: var(--gof-primary-dark);
  color: white;
  border-color: var(--gof-primary-dark);
}

.count-btn:active {
  transform: scale(0.96);
}

.player-name-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.player-name-input {
  font-family: 'Arimo', sans-serif;
  font-size: 1rem;
  padding: 0.75rem 0.875rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  background: white;
  color: var(--text-primary);
  min-height: 44px;
}

.player-name-input:focus {
  outline: none;
  border-color: var(--gof-primary);
  box-shadow: 0 0 0 3px rgba(155, 202, 62, 0.25);
}

/* ===== Buttons ===== */
.primary-btn {
  font-family: 'Arimo', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.875rem 1.5rem;
  min-height: 48px;
  background: var(--gof-primary-dark);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.primary-btn:hover:not(:disabled) {
  background: #0f5a1b;
}

.primary-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-btn {
  font-family: 'Arimo', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.875rem 1.5rem;
  min-height: 48px;
  background: white;
  color: var(--gof-primary-dark);
  border: 2px solid var(--gof-primary-dark);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.secondary-btn:hover:not(:disabled) {
  background: var(--gof-bg-mint);
}

.secondary-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.secondary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.start-btn {
  font-size: 1.15rem;
  padding: 1rem 1.5rem;
}

/* ===== Game blurb (top of setup card) ===== */
.game-blurb {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text-primary);
  text-align: center;
}

.game-blurb p { margin: 0; }
.game-blurb p + p { margin-top: 0.625rem; }

.goal-line {
  font-family: 'League Spartan', sans-serif;
  font-weight: 700;
  color: var(--gof-primary-dark);
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

/* ===== Settings section (below Start Game, de-emphasized) ===== */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.settings-heading {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: 0.125rem;
}

.settings-section .setup-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.settings-section .count-btn {
  font-size: 1rem;
  min-height: 40px;
  border-width: 1.5px;
}

.settings-section .player-name-input {
  font-size: 0.95rem;
  padding: 0.625rem 0.875rem;
  min-height: 40px;
}

/* ===== Scoreboard (play screen) ===== */
.scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  width: 100%;
  max-width: 600px;
}

.score-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 0.625rem 0.75rem;
  box-shadow: var(--card-shadow);
  border: 2px solid transparent;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
}

.score-card.is-current {
  border-color: var(--gof-primary-dark);
  background: var(--gof-bg-mint);
  transform: translateY(-2px);
}

.score-card-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-card-total {
  font-family: 'League Spartan', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gof-primary-dark);
  line-height: 1.1;
}

.score-card-togo {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ===== Turn indicator ===== */
.turn-indicator {
  font-size: 1.125rem;
  text-align: center;
}

.turn-name {
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--gof-primary-dark);
}

/* ===== Dice area ===== */
.dice-area {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 140px;
  padding: 0.5rem 0;
}

.dice-tray-wrap {
  /* Pig uses one big die for drama. */
  --gof-dice-size: 120px;
  --gof-dice-tumble-ms: 900ms;
}

/* ===== Pot display ===== */
.pot-display {
  font-size: 1.125rem;
  text-align: center;
  background: white;
  border-radius: 10px;
  padding: 0.625rem 1.25rem;
  box-shadow: var(--card-shadow);
  display: inline-flex;
  gap: 0.5rem;
  align-items: baseline;
}

.pot-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.pot-value {
  font-family: 'League Spartan', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gof-warm);
}

/* ===== Message line ===== */
.message {
  min-height: 1.75rem;
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
  color: var(--text-primary);
}

.message.is-pig {
  color: var(--gof-warm);
  animation: pop-in 0.3s ease-out;
}

.message.is-banked {
  color: var(--gof-primary-dark);
  animation: pop-in 0.3s ease-out;
}

@keyframes pop-in {
  0% { transform: scale(0.85); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== Action buttons ===== */
.action-buttons {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  max-width: 360px;
}

.action-buttons .primary-btn,
.action-buttons .secondary-btn {
  flex: 1;
}

/* ===== Pass-over button ===== */
.passover {
  width: 100%;
  max-width: 360px;
}

.passover-btn {
  width: 100%;
  background: var(--gof-warm);
}

.passover-btn:hover:not(:disabled) {
  background: #c75529;
}

/* ===== Win screen ===== */
.win-screen {
  padding-top: 2rem;
  text-align: center;
}

.trophy {
  font-size: 4rem;
  animation: pop-in 0.5s ease-out;
}

.winner-title {
  font-family: 'League Spartan', sans-serif;
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--gof-primary-dark);
}

.winner-title #winnerName {
  color: var(--gof-warm);
}

.winner-score {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--gof-primary-dark);
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* ===== Mobile tweaks ===== */
@media (max-width: 480px) {
  .game-title {
    font-size: 2.25rem;
  }
  .scoreboard {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  }
  .score-card-total {
    font-size: 1.5rem;
  }
  .dice-tray-wrap {
    --gof-dice-size: 100px;
  }
  .turn-name {
    font-size: 1.25rem;
  }
}
