/* Molty Blackjack — dark, stream-friendly */

:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --gold: #d29922;
  --radius: 8px;
  --font: "JetBrains Mono", "Fira Code", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.layout {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.bankroll-wrap {
  margin-left: auto;
  text-align: right;
}

.bankroll-wrap .label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bankroll {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gold);
}

.meta {
  display: flex;
  gap: 1rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.count-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.count-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  min-width: 4rem;
}

.count-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pen-bar {
  width: 120px;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.pen-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.table {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.dealer-area,
.player-area {
  margin-bottom: 1rem;
}

.dealer-area:last-child,
.player-area:last-child {
  margin-bottom: 0;
}

.area-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 2rem;
}

.card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 3.2rem;
  padding: 0 0.4rem;
  background: #fff;
  color: #111;
  border-radius: 4px;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  animation: cardIn 0.25s ease;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.card.hole {
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
  color: rgba(255,255,255,0.9);
}

.hands {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hand-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hand-group .cards {
  margin-bottom: 0.25rem;
}

.total {
  font-size: 0.9rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.action-badge {
  margin-top: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  min-height: 1.5rem;
}

.action-badge.win { color: var(--green); }
.action-badge.loss { color: var(--red); }

.stats {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.stats h2,
.log-section h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dim);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem 1rem;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.stat span:last-child {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.log-section {
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.decision-log {
  max-height: 280px;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.decision-log::-webkit-scrollbar {
  width: 8px;
}

.decision-log::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 4px;
}

.decision-log::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.log-entry {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.log-entry:last-child {
  border-bottom: none;
}

.log-entry .reason {
  color: var(--text-dim);
  margin-top: 0.25rem;
}

#counts.hidden {
  display: none;
}

.bankroll.up { color: var(--green); }
.bankroll.down { color: var(--red); }

/* Start overlay — no auto-start */
.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}
.start-overlay--hidden {
  display: none;
}
.start-overlay__box {
  text-align: center;
  padding: 2rem 3rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.start-overlay__title {
  margin: 0 0 0.5rem 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}
.start-overlay__sub {
  margin: 0 0 1.5rem 0;
  font-size: 0.95rem;
  color: var(--text-dim);
}
.start-overlay__btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #388bfd 100%);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(56, 139, 253, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.start-overlay__btn:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(56, 139, 253, 0.5);
}
.start-overlay__btn:active {
  transform: scale(0.98);
}
