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

:root {
  --bg:          #0f1923;
  --surface:     #1a2635;
  --surface-2:   #223044;
  --border:      rgba(255,255,255,0.09);
  --accent:      #2ecc71;
  --red:         #e74c3c;
  --yellow:      #f39c12;
  --text:        #ecf0f1;
  --muted:       #6c7a89;
  --card-bg:     #f8f9fa;
  --radius:      12px;
  --radius-sm:   7px;
}

html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

/* ── Header ─────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.header-logo { font-size: 22px; }

.app-header h1 {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.more-apps-link {
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.more-apps-link:hover { color: var(--text); }

.clear-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 0.15s, border-color 0.15s;
}
.clear-btn:active { color: var(--text); border-color: rgba(255,255,255,0.25); }

/* ── Main layout ─────────────────────────────────────── */
.app-main {
  max-width: 540px;
  margin: 0 auto;
  padding: 14px 14px 36px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ── Card sections ───────────────────────────────────── */
.card-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 14px 10px;
  border: 1px solid var(--border);
}

.hole-cards-row {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.community-cards-row {
  display: flex;
  gap: 7px;
  justify-content: center;
}

.community-labels {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 5px;
}

.community-labels span {
  width: 52px;
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ── Card slots ──────────────────────────────────────── */
.card-wrapper {
  position: relative;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.card-slot {
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  user-select: none;
  transition: transform 0.1s;
}

.card-slot.large  { width: 72px;  height: 100px; }
.card-slot.small  { width: 52px;  height: 74px;  }

.card-slot.empty {
  border: 2px dashed rgba(255,255,255,0.13);
  color: rgba(255,255,255,0.2);
  font-size: 24px;
  font-weight: 300;
}

.card-slot.filled {
  background: var(--card-bg);
  border: 1px solid #cdd5dd;
  box-shadow: 0 3px 8px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.3);
}

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

.card-slot.large  .card-rank { font-size: 22px; }
.card-slot.small  .card-rank { font-size: 16px; }

.card-suit {
  line-height: 1;
}

.card-slot.large  .card-suit { font-size: 18px; }
.card-slot.small  .card-suit { font-size: 13px; }

.card-wrapper:active .card-slot { transform: scale(0.94); }

.card-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  border: 2px solid var(--bg);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  z-index: 5;
  -webkit-tap-highlight-color: transparent;
}

/* ── Opponents stepper ───────────────────────────────── */
.opponents-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stepper { display: flex; align-items: center; gap: 14px; }

.stepper-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stepper-btn:active { opacity: 0.6; }

.stepper-value {
  font-size: 22px;
  font-weight: 700;
  min-width: 26px;
  text-align: center;
}

/* ── Results ─────────────────────────────────────────── */
.results-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
}

.results-panel { min-height: 80px; }

.hint {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 22px 0;
}

.hand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

.odds-bars { display: flex; flex-direction: column; gap: 9px; }

.odds-row { display: flex; align-items: center; gap: 10px; }

.odds-label {
  width: 34px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}

.odds-bar-container {
  flex: 1;
  height: 11px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  overflow: hidden;
}

.odds-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px;
}

.win-bar  { background: var(--accent); }
.tie-bar  { background: var(--yellow); }
.lose-bar { background: var(--red);    }

.odds-pct {
  width: 38px;
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  flex-shrink: 0;
}

.outs-info {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  line-height: 1.5;
}

.outs-count { color: var(--text); font-weight: 700; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 0;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pot odds ────────────────────────────────────────── */
.pot-odds-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.pot-inputs { display: flex; gap: 10px; }

.pot-inputs label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pot-inputs label span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.pot-inputs input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  padding: 10px 12px;
  width: 100%;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.pot-inputs input:focus { border-color: rgba(255,255,255,0.28); }

#pot-odds-result { margin-top: 12px; }

.pot-breakdown {
  display: flex;
  gap: 18px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 9px;
  flex-wrap: wrap;
}

.pot-breakdown strong { color: var(--text); font-weight: 700; }

.pot-decision {
  font-size: 15px;
  font-weight: 700;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  text-align: center;
  letter-spacing: 0.03em;
}

.pot-decision.profitable {
  background: rgba(46, 204, 113, 0.13);
  color: var(--accent);
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.pot-decision.fold {
  background: rgba(231, 76, 60, 0.13);
  color: var(--red);
  border: 1px solid rgba(231, 76, 60, 0.3);
}

/* ── Card Picker Modal ───────────────────────────────── */
.card-picker-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}

.card-picker-modal.open { display: flex; }

.picker-sheet {
  width: 100%;
  max-width: 540px;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.5);
}

.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  font-weight: 600;
  font-size: 15px;
}

.picker-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.picker-grid {
  overflow-y: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}

.picker-suits-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.picker-suit-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.picker-suit-header {
  font-size: 20px;
  font-weight: 700;
  padding: 3px 0 7px;
}

.picker-card {
  width: 100%;
  min-height: 42px;
  background: var(--card-bg);
  border: 1px solid #cdd5dd;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s, opacity 0.1s;
}

.picker-card:active:not(:disabled) { transform: scale(0.9); }

.picker-card:disabled {
  opacity: 0.2;
  cursor: default;
  background: var(--surface-2);
  border-color: transparent;
  color: var(--muted) !important;
}
