:root {
  --bg: #0e1a14;
  --bg-2: #15251c;
  --card: #1c3127;
  --border: #2a4836;
  --text: #e4ecdf;
  --muted: #8aa395;
  --gold: #d4af37;
  --green: #4caf6a;
  --red: #d05050;
  --amber: #d8a23a;
  --blue: #4a90c2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.topbar h1 {
  margin: 0 0 0.25rem 0;
  color: var(--gold);
  font-size: 1.6rem;
  letter-spacing: 0.5px;
}

.topbar nav {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.topbar nav a.active,
.topbar nav a:hover {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.1);
}

.disclaimer {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.card h2 {
  margin-top: 0;
  color: var(--gold);
  font-size: 1.15rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input, select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.65rem;
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: inherit;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--gold);
}

small {
  color: var(--muted);
  font-size: 0.7rem;
}

code {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
}

.actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
}

button {
  background: var(--gold);
  color: #1a1a1a;
  border: none;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95rem;
}

button:hover { filter: brightness(1.1); }

button.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

button.secondary:hover {
  color: var(--text);
  border-color: var(--gold);
}

button:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Result panel */
.recommendation {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.action-badge {
  font-size: 2.2rem;
  font-weight: 700;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  text-align: center;
  min-width: 160px;
}

.action-FOLD  { background: rgba(208, 80, 80, 0.15); color: var(--red); border: 2px solid var(--red); }
.action-CHECK { background: rgba(138, 163, 149, 0.15); color: var(--muted); border: 2px solid var(--muted); }
.action-CALL  { background: rgba(74, 144, 194, 0.15); color: var(--blue); border: 2px solid var(--blue); }
.action-BET   { background: rgba(216, 162, 58, 0.15); color: var(--amber); border: 2px solid var(--amber); }
.action-RAISE { background: rgba(76, 175, 106, 0.15); color: var(--green); border: 2px solid var(--green); }

.confidence-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--gold));
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.metric {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
}

.metric-label {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 0.2rem;
}

.explanation {
  background: var(--bg);
  border-left: 3px solid var(--gold);
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.error-msg {
  color: var(--red);
  background: rgba(208, 80, 80, 0.1);
  border: 1px solid var(--red);
  padding: 0.75rem;
  border-radius: 4px;
}

/* Dashboard */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--gold);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  .recommendation { grid-template-columns: 1fr; text-align: center; }
  .action-badge { font-size: 1.8rem; }
}

/* V2 additions */
.opponent-block {
  margin-top: 1rem;
  padding: 0.75rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.15);
}

.opponent-block legend {
  color: var(--gold);
  font-size: 0.85rem;
  padding: 0 0.4rem;
  letter-spacing: 0.5px;
}

.checkbox-label {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
  flex-wrap: wrap;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.checkbox-label small {
  flex-basis: 100%;
}

.mode-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mode-range {
  background: rgba(76, 175, 106, 0.2);
  color: var(--green);
  border: 1px solid var(--green);
}

.mode-random {
  background: rgba(138, 163, 149, 0.2);
  color: var(--muted);
  border: 1px solid var(--muted);
}

.sizing-advice {
  background: rgba(212, 175, 55, 0.08);
  border-left: 3px solid var(--gold);
  padding: 0.6rem 0.9rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  border-radius: 0 4px 4px 0;
}

.exploit-note {
  background: rgba(74, 144, 194, 0.1);
  border-left: 3px solid var(--blue);
  padding: 0.6rem 0.9rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text);
  border-radius: 0 4px 4px 0;
}

/* V3 additions */
.v3-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--gold);
  color: #1a1a1a;
  border-radius: 3px;
  vertical-align: middle;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.learned-profile {
  background: rgba(155, 89, 182, 0.08);
  border-left: 3px solid #9b59b6;
  padding: 0.6rem 0.9rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  border-radius: 0 4px 4px 0;
}

.profile-class {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(155, 89, 182, 0.2);
  color: #b88be0;
  border: 1px solid #9b59b6;
}

.profile-class-calling_station { background: rgba(76, 175, 106, 0.2); color: var(--green); border-color: var(--green); }
.profile-class-bluffy           { background: rgba(231, 76, 60, 0.2);  color: #e74c3c; border-color: #e74c3c; }
.profile-class-tight            { background: rgba(95, 95, 95, 0.3);  color: #aaa;    border-color: #888; }
.profile-class-passive          { background: rgba(95, 95, 95, 0.3);  color: #aaa;    border-color: #888; }
.profile-class-aggressive       { background: rgba(212, 175, 55, 0.2); color: var(--gold); border-color: var(--gold); }
.profile-class-loose            { background: rgba(74, 144, 194, 0.2); color: var(--blue); border-color: var(--blue); }

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.adj-list {
  margin: 0.4rem 0 0 1.2rem;
  padding: 0;
}

.adj-list li {
  margin: 0.15rem 0;
  font-size: 0.85rem;
}

.result-form-row td {
  background: rgba(0, 0, 0, 0.25);
  padding: 1rem;
}

.result-form .grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.result-form .actions {
  margin-top: 0.75rem;
}

button.small {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

.form-status {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--green);
}

/* V4: dynamic seat read */
.dynamic-seat {
  background: rgba(76, 175, 106, 0.08);
  border-left: 3px solid var(--green);
  padding: 0.6rem 0.9rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  border-radius: 0 4px 4px 0;
}

/* V4: extra profile-class colors so we cover dynamic types */
.profile-class-tight_passive    { background: rgba(95, 95, 95, 0.3);  color: #aaa;    border-color: #888; }
.profile-class-loose_passive    { background: rgba(74, 144, 194, 0.2); color: var(--blue); border-color: var(--blue); }
.profile-class-loose_aggressive { background: rgba(212, 175, 55, 0.25); color: var(--gold); border-color: var(--gold); }
.profile-class-nit              { background: rgba(60, 60, 60, 0.5);  color: #888;    border-color: #555; }
.profile-class-unknown          { background: rgba(95, 95, 95, 0.2);  color: var(--muted); border-color: #555; }

/* V4: table state section */
.session-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.seats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}

.seat-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.seat-card.seat-inactive {
  opacity: 0.55;
  border-style: dashed;
}

.seat-no {
  font-weight: 700;
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.seat-label {
  font-size: 0.9rem;
}

.seat-actions {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.3rem;
  align-items: center;
}

.seat-actions input[type="text"] {
  flex: 1;
  font-size: 0.8rem;
  padding: 0.25rem 0.4rem;
}
