html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #f0c040;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* Navbar brand accent */
.navbar-brand {
  letter-spacing: 0.02em;
}

/* Footer */
.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  line-height: 60px;
}

/* ============================================================
   CardSelector — generic playing-card picker
   Manual entry + visual grid, mobile tap-friendly.
   (used by the Equity Calculator and any future card tools)
   ============================================================ */
.card-selector {
  position: relative;
  margin-bottom: 0.5rem;
  --cs-red: #d2342b;
  --cs-black: #1a1a2e;
  --cs-felt: #1a7f37;
}

.cs-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 0.5rem;
  letter-spacing: 0.01em;
}

/* --- input bar: manual text entry + pick button --- */
.cs-bar {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.cs-text {
  flex: 1 1 auto;
  min-width: 0;
  height: 52px;
  padding: 0 1rem;
  border: 2px solid #d0d0d0;
  border-radius: 10px;
  background: #fafafa;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  color: #1a1a2e;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cs-text::placeholder {
  color: #b8b8b8;
  font-family: "Roboto", system-ui, sans-serif;
  letter-spacing: normal;
  font-size: 0.95rem;
}

.cs-text:focus {
  outline: none;
  border-color: #1a1a2e;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.12);
}

.cs-pick-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 52px;
  padding: 0 1.1rem;
  border: 2px solid #1a1a2e;
  border-radius: 10px;
  background: #1a1a2e;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background 0.15s ease, transform 0.05s ease;
  letter-spacing: 0.01em;
}

.cs-pick-btn:hover { background: #2e2e50; border-color: #2e2e50; }
.cs-pick-btn:active { transform: scale(0.97); }
.cs-pick-btn.is-open { background: #5a5a6a; border-color: #5a5a6a; }
.cs-pick-icon { font-size: 1.1rem; line-height: 1; }

/* --- selected cards shown as real mini playing cards --- */
.cs-tokens {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  min-height: 36px;
  margin-top: 0.75rem;
}

.cs-empty {
  color: #b0b0b0;
  font-size: 0.88rem;
  font-style: italic;
}

.cs-token {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 70px;
  padding: 6px 5px 4px;
  border: 1.5px solid #d0d0d0;
  border-radius: 9px;
  background: linear-gradient(170deg, #ffffff 0%, #f4f4f4 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0,0,0,0.08);
  font-family: "Roboto", system-ui, sans-serif;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  gap: 4px;
}

.cs-token:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22); }

.cs-token-rank { font-size: 1rem; }
.cs-token-suit { font-size: 1.7rem; line-height: 1; }

.cs-token-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e0e0e0;
  color: #555;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: background 0.1s ease, color 0.1s ease;
}

.cs-token:hover .cs-token-remove { background: var(--cs-red); color: #fff; }

.cs-red { color: var(--cs-red); }
.cs-black { color: var(--cs-black); }

.cs-help {
  font-size: 0.78rem;
  color: #9a9a9a;
  margin-top: 0.5rem;
}

/* --- picker panel --- */
.cs-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: transparent;
}

.cs-panel {
  position: absolute;
  z-index: 1201;
  top: calc(100% + 10px);
  left: 0;
  width: min(500px, 96vw);
  background: #fff;
  border: 1px solid #c8c8c8;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0,0,0,0.1);
  padding: 1rem;
}

.cs-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.cs-panel-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #444;
}

.cs-panel-count {
  margin-left: 0.4rem;
  font-variant-numeric: tabular-nums;
  color: #9a9a9a;
  font-weight: 400;
}

.cs-panel-actions { display: flex; gap: 1rem; }

.cs-link {
  border: none;
  background: none;
  padding: 0.3rem 0.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6a6a6a;
  cursor: pointer;
  touch-action: manipulation;
}
.cs-link:hover { text-decoration: underline; }
.cs-link.cs-done { color: var(--cs-felt); }

/* 13-rank x 4-suit grid of mini cards */
.cs-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 5px;
}

.cs-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 5 / 7;
  min-height: 44px;
  padding: 2px 0;
  border: 1.5px solid #dcdcdc;
  border-radius: 7px;
  background: linear-gradient(160deg, #ffffff 0%, #f5f5f5 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-family: "Roboto", system-ui, sans-serif;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.08s ease;
}

.cs-cell-rank { font-size: clamp(0.65rem, 2.2vw, 0.88rem); }
.cs-cell-suit { font-size: clamp(0.75rem, 2.6vw, 1rem); margin-top: 2px; }

.cs-cell:hover:not(.is-disabled):not(.is-selected) {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.18);
  border-color: #888;
}

.cs-cell.is-selected {
  border-color: var(--cs-felt);
  background: linear-gradient(160deg, #eafbf0 0%, #d4f5e2 100%);
  box-shadow: 0 0 0 2px var(--cs-felt), 0 3px 8px rgba(0, 0, 0, 0.15);
}

.cs-cell.is-selected::after {
  content: "✓";
  position: absolute;
  top: -7px;
  right: -7px;
  width: 17px;
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--cs-felt);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.cs-cell.is-disabled {
  cursor: not-allowed;
  opacity: 0.25;
  background: #f1f1f1;
  box-shadow: none;
}

/* --- mobile: full-width centered sheet with scrim, bigger taps --- */
@media (max-width: 560px) {
  .cs-backdrop { background: rgba(0, 0, 0, 0.45); }

  .cs-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 82vh;
    overflow-y: auto;
    border-radius: 18px 18px 0 0;
    padding: 1.1rem 0.9rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35);
  }

  .cs-text { height: 52px; font-size: 1.05rem; }
  .cs-pick-btn { height: 52px; }
  .cs-grid { gap: 5px; }
  .cs-cell { min-height: 48px; border-radius: 7px; }
  .cs-cell-rank { font-size: 0.88rem; }
  .cs-cell-suit { font-size: 1.05rem; }
  .cs-link { padding: 0.5rem 0.4rem; font-size: 0.92rem; }
  .cs-panel-title { font-size: 0.92rem; }
}
