/* ==========================================================================
   Spades Bid Trainer — Best-of-Breed Styles
   Sources: Team A (color system, layout, card hover, suit spacers),
            Team C (dark verdict card, factor pills),
            Team D (spin-button hiding, 768px breakpoint)
   ========================================================================== */

/* --- Reset & Variables --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Tinted neutrals from brand hue (Team A) */
  --brand: hsl(145, 45%, 28%);
  --brand-accent: hsl(145, 30%, 95%);
  --brand-alt: hsl(145, 35%, 82%);
  --brand-alt-accent: hsl(145, 40%, 42%);
  --contrast: hsl(145, 20%, 12%);
  --contrast-accent: hsl(145, 10%, 88%);
  --base: #FFFFFF;
  --base-accent: hsl(145, 10%, 48%);
  --tint: hsl(145, 15%, 97%);
  --border-base: hsl(145, 15%, 82%);
  --border-contrast: hsl(145, 20%, 55%);

  /* Verdict colors */
  --verdict-right: hsl(145, 55%, 38%);
  --verdict-close: hsl(45, 80%, 45%);
  --verdict-off: hsl(0, 60%, 48%);

  /* Card colors */
  --card-red: hsl(0, 72%, 48%);
  --card-black: hsl(0, 0%, 8%);
  --card-face: hsl(45, 30%, 97%);

  /* Felt */
  --felt: hsl(145, 48%, 22%);
  --felt-border: hsl(145, 40%, 16%);

  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  color: var(--contrast);
  background-color: var(--felt);
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Header
   ========================================================================== */

.app-header {
  background-color: var(--contrast);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--base);
  letter-spacing: 0.02em;
}

/* ==========================================================================
   Game Container
   ========================================================================== */

.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 40px;
  gap: 24px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* ==========================================================================
   Table Section — four seats (Team A grid layout)
   ========================================================================== */

.table-section {
  width: 100%;
}

.table-felt {
  background-color: var(--brand);
  border: 3px solid var(--felt-border);
  border-radius: 6px;
  position: relative;
  padding: 20px;
  min-height: 260px;
  display: grid;
  grid-template-areas:
    ". north ."
    "west . east"
    ". south .";
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  align-items: center;
  justify-items: center;
}

.seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.seat-north { grid-area: north; }
.seat-west { grid-area: west; }
.seat-east { grid-area: east; }
.seat-south { grid-area: south; }

.seat-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-alt);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.seat-bid {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--base);
  background-color: var(--brand-alt-accent);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seat-south .seat-label {
  color: var(--base);
}

/* ==========================================================================
   Bid Controls
   ========================================================================== */

.bid-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

#bid-input {
  width: 60px;
  height: 48px;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  border: 2px solid var(--border-base);
  border-radius: 6px;
  background: var(--base);
  color: var(--contrast);
  font-family: 'DM Sans', sans-serif;
  outline: none;
  -moz-appearance: textfield;
}

/* Hide spin buttons (from Team D) */
#bid-input::-webkit-outer-spin-button,
#bid-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#bid-input:focus {
  border-color: var(--base);
  box-shadow: 0 0 0 3px hsla(145, 50%, 60%, 0.4);
}

#bid-input::placeholder {
  color: var(--base-accent);
}

#bid-input:disabled {
  opacity: 0.5;
}

#submit-bid {
  height: 48px;
  padding: 0 20px;
  font-size: 0.875rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  background-color: var(--base);
  color: var(--brand);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: opacity 0.15s;
}

#submit-bid:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#submit-bid:not(:disabled):hover {
  opacity: 0.9;
}

/* ==========================================================================
   Hand Section — your 13 cards (Team A layout with suit spacers)
   ========================================================================== */

.hand-section {
  width: 100%;
}

.section-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--base);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hand-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.loading-text {
  color: var(--brand-alt);
  font-size: 0.875rem;
}

/* Individual card (Team A styling with hover) */
.card {
  width: 58px;
  height: 84px;
  background: var(--card-face);
  border: 1px solid var(--border-base);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 1px 3px hsla(0, 0%, 0%, 0.15);
  transition: transform 0.15s;
  user-select: none;
}

.card:hover {
  transform: translateY(-4px);
}

.card-rank {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
}

.card-suit {
  font-size: 1.3rem;
  line-height: 1;
}

.card.suit-spades .card-rank,
.card.suit-spades .card-suit,
.card.suit-clubs .card-rank,
.card.suit-clubs .card-suit {
  color: var(--card-black);
}

.card.suit-hearts .card-rank,
.card.suit-hearts .card-suit,
.card.suit-diamonds .card-rank,
.card.suit-diamonds .card-suit {
  color: var(--card-red);
}

/* Suit separator */
.suit-spacer {
  width: 6px;
  height: 84px;
  flex-shrink: 0;
}

/* ==========================================================================
   Verdict Section (Team C's dark card + Team A's bid comparison)
   ========================================================================== */

.verdict-section {
  width: 100%;
}

.verdict-section[hidden] {
  display: none;
}

.verdict-card {
  background: var(--contrast);
  border-radius: 8px;
  overflow: hidden;
  animation: slideUp 0.35s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.verdict-header {
  padding: 16px 20px;
  text-align: center;
}

.verdict-label {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--base);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.verdict-header.verdict-just-right {
  background-color: var(--verdict-right);
}

.verdict-header.verdict-close {
  background-color: var(--verdict-close);
  color: var(--contrast);
}

.verdict-header.verdict-close .verdict-label {
  color: var(--contrast);
}

.verdict-header.verdict-off {
  background-color: var(--verdict-off);
}

/* Bid Comparison (Team A layout) */
.verdict-bids {
  padding: 20px;
}

.bid-comparison {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.bid-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.bid-box-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: hsla(0, 0%, 100%, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bid-box-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--base);
}

.bid-arrow {
  font-size: 1rem;
  font-weight: 400;
  color: hsla(0, 0%, 100%, 0.4);
}

/* Factor pills (Team C) */
.verdict-factors {
  padding: 0 20px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.factor-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  background: hsla(145, 30%, 30%, 0.5);
  color: hsla(0, 0%, 100%, 0.85);
}

.factor-value {
  font-weight: 800;
}

/* Explanation */
.verdict-explanation {
  padding: 16px 20px 24px;
  border-top: 1px solid hsla(0, 0%, 100%, 0.1);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.65;
  color: hsla(0, 0%, 100%, 0.9);
}

/* ==========================================================================
   Deal Button
   ========================================================================== */

.deal-controls {
  display: flex;
  justify-content: center;
}

.deal-btn {
  padding: 14px 40px;
  font-size: 1rem;
  font-weight: 700;
  border: 2px solid var(--base);
  border-radius: 6px;
  background: transparent;
  color: var(--base);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0.02em;
  transition: background-color 0.15s, color 0.15s;
}

.deal-btn:hover {
  background-color: var(--base);
  color: var(--brand);
}

/* ==========================================================================
   Responsive (Mobile-first, then scale up)
   ========================================================================== */

@media (max-width: 420px) {
  .game-container {
    padding: 16px 12px 32px;
    gap: 20px;
  }

  .table-felt {
    min-height: 220px;
    padding: 16px;
  }

  .seat-bid {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
  }

  .card {
    width: 50px;
    height: 72px;
  }

  .card-rank {
    font-size: 0.95rem;
  }

  .card-suit {
    font-size: 1.1rem;
  }

  .suit-spacer {
    width: 4px;
    height: 72px;
  }
}

@media (min-width: 421px) and (max-width: 767px) {
  .card {
    width: 54px;
    height: 78px;
  }
}

/* Tablet and up (from Team D: 768px breakpoint) */
@media (min-width: 768px) {
  .app-header {
    height: 70px;
  }

  .app-title {
    font-size: 1.5rem;
  }

  .game-container {
    padding: 32px 24px 60px;
    gap: 32px;
  }

  .card {
    width: 66px;
    height: 94px;
  }

  .card-rank {
    font-size: 1.25rem;
  }

  .card-suit {
    font-size: 1.375rem;
  }

  .table-felt {
    min-height: 280px;
    padding: 28px;
  }
}
