*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #29434e 0, #101820 40%, #05080b 100%);
  color: #f5f7fa;
}

.app {
  max-width: 960px;
  margin: 24px auto 48px;
  padding: 16px;
}

.app-header {
  text-align: center;
  margin-bottom: 16px;
}

.app-header h1 {
  margin: 0;
  font-size: 2.2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.subtitle {
  margin-top: 6px;
  color: #b0bec5;
  font-size: 0.95rem;
}

.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  justify-content: center;
}

.tab-button {
  border: 1px solid #455a64;
  background: #263238;
  color: #eceff1;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}

.tab-button:hover {
  background: #37474f;
  box-shadow: 0 0 0 1px rgba(0, 255, 136, 0.4);
}

.tab-button.active {
  background: linear-gradient(135deg, #00e676, #64ffda);
  color: #042016;
  border-color: transparent;
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.6);
  font-weight: 600;
}

.tab-container {
  background: rgba(3, 8, 15, 0.85);
  border-radius: 16px;
  padding: 18px 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(120, 144, 156, 0.4);
}

.tab-section {
  display: none;
}

.tab-section.active {
  display: block;
}

h2 {
  margin-top: 0;
}

h3 {
  margin-bottom: 4px;
}

ul {
  padding-left: 20px;
}

.highlight {
  padding: 8px 10px;
  background: rgba(0, 230, 118, 0.08);
  border-left: 3px solid #00e676;
  border-radius: 4px;
}

.hint {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #b0bec5;
}

/* Cards / panels */

.card {
  background: rgba(20, 33, 45, 0.95);
  border-radius: 12px;
  padding: 14px 12px;
  border: 1px solid rgba(84, 110, 122, 0.85);
  margin-top: 10px;
}

.form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  gap: 4px;
}

.form-row label {
  font-size: 0.9rem;
  color: #cfd8dc;
}

select,
input[type="number"] {
  background: #102027;
  color: #eceff1;
  border-radius: 8px;
  border: 1px solid #455a64;
  padding: 6px 8px;
  font-size: 0.95rem;
}

select:focus,
input[type="number"]:focus {
  outline: none;
  border-color: #00e676;
  box-shadow: 0 0 0 1px rgba(0, 230, 118, 0.6);
}

/* Buttons */

.primary-button,
.secondary-button {
  border-radius: 999px;
  border: 0;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.16s ease, filter 0.12s ease;
}

.primary-button {
  background: linear-gradient(135deg, #00e676, #1de9b6);
  color: #003320;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 230, 118, 0.6);
}

.primary-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

.secondary-button {
  background: #263238;
  color: #eceff1;
  border: 1px solid #455a64;
}

.secondary-button:hover {
  background: #37474f;
}

.secondary-button:disabled,
.primary-button:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

/* Results */

.result-box {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(13, 71, 46, 0.9);
  border: 1px solid rgba(0, 230, 118, 0.7);
  font-size: 0.95rem;
}

.result-box p {
  margin: 4px 0;
}

.explanation {
  font-size: 0.85rem;
  color: #c8e6c9;
}

/* Card counting */

.card-display {
  margin: 12px 0;
  text-align: center;
}

.card-display .label {
  font-size: 0.9rem;
  color: #b0bec5;
  margin-bottom: 4px;
}

.big-card {
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 8px;
}

.guess-area {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.guess-area label {
  font-size: 0.9rem;
}

/* Utility */

.hidden {
  display: none !important;
}

/* Responsive */

@media (max-width: 640px) {
  .app {
    padding: 8px;
  }

  .tab-container {
    padding: 14px 10px;
  }

  .big-card {
    font-size: 2rem;
  }
}

/* Running count + dealt cards panel */
#playCountBox {
  max-height: 220px;        /* keeps the box from getting too tall */
  overflow-y: auto;         /* scroll vertically if it gets long */
}

/* Container holding the "cards dealt" text + cards */
.play-count-cards {
  margin-top: 0.5rem;
}

/* Row of dealt cards: wrap onto new lines instead of overflowing */
.play-count-card-row {
  display: flex;
  flex-wrap: wrap;          /* <<< this is the key */
  gap: 0.25rem;             /* space between cards */
  align-items: center;
}

/* Make sure card chips behave nicely in a flex row */
.card-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 0.8rem;
  white-space: nowrap;      /* keeps each card (e.g. "10♣") together */
}

/* Running count + dealt cards panel */
#playCountBox {
  max-height: 220px;
  overflow-y: auto;
}

/* Container holding the "cards dealt" text + cards */
.play-count-cards {
  margin-top: 0.5rem;
}

/* Row of dealt cards: wrap onto new lines instead of overflowing */
.play-count-card-row {
  display: flex;
  flex-wrap: wrap;       /* key: wrap onto new lines */
  gap: 0.25rem;
  align-items: center;
}

/* Card chips */
.card-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Stats box on the right */
.play-stats-box {
  margin-top: 0.5rem;
  max-width: 280px;
  margin-left: auto;   /* push to the right side of the card */
}

#playCountBox {
  max-height: 220px;
  overflow-y: auto;
}

.play-count-cards {
  margin-top: 0.5rem;
}

.play-count-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.card-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 0.8rem;
  white-space: nowrap;
}

.play-stats-box {
  margin-top: 0.5rem;
  max-width: 280px;
  margin-left: auto;
}
