:root {
  --bg: #0f172a; /* slate-900 */
  --card-bg: #111827; /* gray-900 */
  --text: #e5e7eb; /* gray-200 */
  --muted: #9ca3af; /* gray-400 */
  --accent: #22c55e; /* green-500 */
  --accent-2: #3b82f6; /* blue-500 */
  --danger: #ef4444; /* red-500 */
  --tie: #f59e0b; /* amber-500 */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }

.app-header { text-align: center; padding: 16px 8px; }
.app-header h1 { margin: 0; font-size: 20px; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.container { max-width: 960px; margin: 0 auto; padding: 8px; display: grid; grid-template-columns: 1fr; gap: 12px; }

.controls { background: var(--card-bg); border-radius: 12px; padding: 12px; display: grid; gap: 12px; }
.hand-section h2, .board-section h2, .deck h2, .result h2 { margin: 0 0 8px; font-size: 16px; }

.slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.hand-section .slots { grid-template-columns: repeat(2, 1fr); }

.slot { display: inline-flex; align-items: center; justify-content: center; height: 52px; border-radius: 12px; border: 1px dashed #334155; background: #0b1220; color: var(--muted); font-size: 16px; cursor: pointer; }
.slot.filled { border-style: solid; color: #fff; }
.slot.active { border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(59,130,246,0.35) inset; }
.slot .card-text { font-weight: 600; }

.players-section { display: grid; gap: 8px; }
.players-header { display: flex; gap: 8px; align-items: center; }
.players-section input { width: 72px; padding: 6px 8px; border-radius: 8px; border: 1px solid #334155; background: #0b1220; color: var(--text); }
.auto-label { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.players-container { display: grid; grid-template-columns: 1fr; gap: 6px; }
.player-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 8px; }
.player-name { color: var(--muted); font-size: 12px; }
.player-slots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.primary { background: var(--accent-2); color: white; border: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.primary[disabled] { opacity: 0.6; cursor: not-allowed; }
.secondary { background: #0b1220; color: var(--text); border: 1px solid #334155; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.status { color: var(--muted); font-size: 12px; }
.iter-label { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.iter-label input { width: 100px; padding: 6px 8px; border-radius: 8px; border: 1px solid #334155; background: #0b1220; color: var(--text); }
.iter-label #seed { width: 140px; }

.deck { background: var(--card-bg); border-radius: 12px; padding: 12px; }
.deck-grid { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 6px; }
.card-tile { height: 44px; border-radius: 8px; background: #0b1220; display: flex; align-items: center; justify-content: center; font-weight: 700; cursor: pointer; border: 1px solid #334155; }
.card-tile.spade { color: #93c5fd; }
.card-tile.heart { color: #fca5a5; }
.card-tile.diamond { color: #fcd34d; }
.card-tile.club { color: #86efac; }
.card-tile.selected { opacity: 0.35; cursor: not-allowed; }
.card-tile.best { outline: 2px solid var(--accent); }

.result { background: var(--card-bg); border-radius: 12px; padding: 12px; }
.hand-info { display: grid; gap: 6px; margin-bottom: 10px; }
.best5 { display: flex; gap: 6px; flex-wrap: wrap; }
.best-chip { padding: 6px 10px; border-radius: 999px; border: 1px solid #334155; background:#0b1220; font-weight:600; }

.equity-bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 100px 1fr 60px; gap: 8px; align-items: center; }
.bar { height: 14px; background: #0b1220; border: 1px solid #334155; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.2s ease; }
.bar-fill.tie { background: var(--tie); }
.bar-fill.lose { background: var(--danger); }
.bar-text { text-align: right; font-feature-settings: "tnum"; }
.hint { color: var(--muted); font-size: 12px; }

.results-list { display: grid; gap: 10px; }
.result-card { background: var(--card-bg); border: 1px solid #334155; border-radius: 12px; padding: 10px; display: grid; gap: 6px; }
.result-title { font-weight: 600; }
.advice { color: var(--muted); font-size: 12px; }

.app-footer { text-align: center; color: var(--muted); padding: 16px; }

@media (max-width: 640px) {
  .deck-grid { grid-template-columns: repeat(8, 1fr); }
  .card-tile { height: 48px; font-size: 16px; }
  .bar-row { grid-template-columns: 80px 1fr 60px; }
}
.mini-actions { display: flex; gap: 8px; margin-top: 8px; }
.mini-actions.right { margin-left: auto; }