/* ==========================================================================
   Blackjack Card Counter - Design System & Custom Styles
   ========================================================================== */

/* Color Variables */
:root {
  --bg-main: radial-gradient(ellipse at 50% 20%, #0c3e2e 0%, #031e15 70%, #010d0a 100%);
  --bg-panel: rgba(10, 26, 20, 0.65);
  --bg-panel-hover: rgba(14, 36, 28, 0.75);
  --border-gold: rgba(234, 179, 8, 0.2);
  --border-gold-glow: rgba(234, 179, 8, 0.45);
  --border-light: rgba(255, 255, 255, 0.06);
  
  --gold: #f59e0b;
  --gold-light: #fbbf24;
  --emerald: #10b981;
  --emerald-light: #34d399;
  --rose: #f43f5e;
  --rose-light: #fb7185;
  --amber: #fb923c;
  --slate: #94a3b8;
  
  --low-card-color: #34d399;
  --neutral-card-color: #94a3b8;
  --high-card-color: #f43f5e;

  /* Strategy Colors */
  --strat-hit: rgba(30, 64, 175, 0.85);      /* Dark Blue */
  --strat-stand: rgba(153, 27, 27, 0.85);   /* Dark Red */
  --strat-double: rgba(180, 83, 9, 0.85);   /* Amber/Gold */
  --strat-split: rgba(13, 148, 136, 0.85);  /* Teal */
  
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Outfit', sans-serif;
}

/* Global Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-main);
  background-attachment: fixed;
  color: #f8fafc;
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-title);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.25rem;
  color: #f8fafc;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

h3 {
  font-size: 1.05rem;
  color: var(--slate);
  margin-bottom: 8px;
}

p {
  color: #cbd5e1;
  font-size: 0.95rem;
}

/* App Header */
.app-header {
  background: rgba(2, 15, 11, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
  padding: 15px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.logo-gold {
  color: var(--gold-light);
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

.logo-white {
  color: #ffffff;
}

.header-quick-stats {
  display: flex;
  gap: 16px;
}

.quick-stat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.q-lbl {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--slate);
  letter-spacing: 0.05em;
}

.q-val {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Navigation Tabs */
.app-nav {
  display: flex;
  justify-content: center;
  background: rgba(3, 20, 15, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 67px;
  z-index: 99;
}

.nav-tab {
  background: none;
  border: none;
  color: var(--slate);
  padding: 14px 20px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  outline: none;
}

.nav-tab:hover {
  color: #ffffff;
}

.nav-tab.active {
  color: var(--gold-light);
}

.nav-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--gold-light);
  transform: scaleX(0);
  transition: transform 0.3s ease;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.8);
}

.nav-tab.active::after {
  transform: scaleX(1);
}

.tab-icon {
  font-size: 1.1rem;
}

/* Main Container */
.app-container {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
}

/* SPA tab switching */
.tab-content {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Glassmorphic Panels */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
  border-color: var(--border-gold);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.panel-subtitle {
  color: var(--slate);
  font-size: 0.9rem;
  margin-top: -8px;
  margin-bottom: 16px;
}

/* Buttons */
.btn {
  background: var(--gold);
  border: none;
  color: #031e15;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover:not(:disabled) {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.08);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  width: 100%;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.35);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

/* Card History Stream */
.card-history-container {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 4px;
  min-height: 80px;
  align-items: center;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.card-history-container::-webkit-scrollbar {
  height: 6px;
}
.card-history-container::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.empty-history-text {
  color: var(--slate);
  font-style: italic;
  font-size: 0.9rem;
  width: 100%;
  text-align: center;
}

.history-card-tile {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  min-width: 50px;
  height: 65px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  animation: cardSlideIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes cardSlideIn {
  from { opacity: 0; transform: scale(0.7) translateX(15px); }
  to { opacity: 1; transform: scale(1) translateX(0); }
}

.history-card-tile.card-low {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.06);
}
.history-card-tile.card-low .history-card-name {
  color: var(--low-card-color);
}
.history-card-tile.card-low .history-card-val {
  background: var(--low-card-color);
}

.history-card-tile.card-neutral {
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.06);
}
.history-card-tile.card-neutral .history-card-name {
  color: var(--neutral-card-color);
}
.history-card-tile.card-neutral .history-card-val {
  background: var(--neutral-card-color);
}

.history-card-tile.card-high {
  border-color: rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.06);
}
.history-card-tile.card-high .history-card-name {
  color: var(--high-card-color);
}
.history-card-tile.card-high .history-card-val {
  background: var(--high-card-color);
}

.history-card-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.history-card-val {
  font-size: 0.7rem;
  font-weight: 800;
  color: #031e15;
  border-radius: 4px;
  padding: 1px 4px;
  margin-top: 4px;
  min-width: 20px;
  text-align: center;
}

/* Card Input Grid */
.input-panel {
  display: flex;
  flex-direction: column;
}

.input-panel-title {
  text-align: center;
  margin-bottom: 16px;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate);
}

.card-buttons-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.card-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  height: 90px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  outline: none;
}

.card-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

.card-btn:active {
  transform: translateY(1px) scale(0.96);
  background: rgba(255, 255, 255, 0.02);
}

.card-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
}

.card-count-indicator {
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
  min-width: 32px;
  text-align: center;
}

/* Color codes for input buttons */
.card-btn-low {
  border-color: rgba(16, 185, 129, 0.2);
}
.card-btn-low:hover {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.15);
}
.card-btn-low .card-count-indicator {
  background: rgba(16, 185, 129, 0.15);
  color: var(--low-card-color);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.card-btn-neutral {
  border-color: rgba(148, 163, 184, 0.2);
}
.card-btn-neutral:hover {
  border-color: rgba(148, 163, 184, 0.5);
  box-shadow: 0 6px 16px rgba(148, 163, 184, 0.15);
}
.card-btn-neutral .card-count-indicator {
  background: rgba(148, 163, 184, 0.15);
  color: var(--neutral-card-color);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.card-btn-high {
  border-color: rgba(244, 63, 94, 0.2);
}
.card-btn-high:hover {
  border-color: rgba(244, 63, 94, 0.5);
  box-shadow: 0 6px 16px rgba(244, 63, 94, 0.15);
}
.card-btn-high .card-count-indicator {
  background: rgba(244, 63, 94, 0.15);
  color: var(--high-card-color);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.metric-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
  position: relative;
  overflow: hidden;
}

.metric-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--slate);
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 2.2rem;
  font-weight: 800;
  margin: 10px 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.metric-footer {
  font-size: 0.75rem;
  color: var(--slate);
}

/* Text glow / colors */
.text-emerald { color: var(--emerald-light) !important; }
.text-rose { color: var(--rose-light) !important; }
.text-amber { color: var(--amber) !important; }

.text-emerald-glow {
  color: var(--emerald-light) !important;
  text-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

/* Progress Bars */
.progress-bar-container {
  background: rgba(255, 255, 255, 0.08);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease, background-color 0.4s ease;
}

.bg-emerald { background-color: var(--emerald) !important; }
.bg-rose { background-color: var(--rose) !important; }
.bg-amber { background-color: var(--gold) !important; }

/* Deck Slider Panel */
.deck-slider-panel {
  display: flex;
  flex-direction: column;
}

.slider-row {
  display: grid;
  grid-template-columns: 140px 1fr 140px;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.slider-lbl {
  font-size: 0.9rem;
  color: #ffffff;
}

.slider-lbl strong {
  color: var(--gold-light);
}

.slider-container {
  display: flex;
  flex-direction: column;
}

.slider-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--slate);
}

/* Custom HTML5 Range Slider Styling */
.app-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
  transition: background 0.3s;
}

.app-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold-light);
  border: 2px solid #031e15;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
  cursor: pointer;
  transition: transform 0.1s;
}

.app-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Tooltips */
.tooltip-trigger {
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  color: var(--slate);
  font-size: 0.65rem;
  font-weight: 700;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.tooltip-trigger:hover {
  background: var(--gold-light);
  color: #031e15;
}

/* Shoe Composition Progress Bars */
.comp-bars-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.comp-bar-row {
  display: flex;
  flex-direction: column;
}

.comp-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.comp-lbl-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.text-low-color { color: var(--low-card-color); }
.text-neutral-color { color: var(--neutral-card-color); }
.text-high-color { color: var(--high-card-color); }

.comp-progress-bg {
  background: rgba(255, 255, 255, 0.05);
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.comp-progress-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.bg-low { background-color: var(--low-card-color); }
.bg-neutral { background-color: var(--neutral-card-color); }
.bg-high { background-color: var(--high-card-color); }

.comp-effect {
  font-size: 0.75rem;
  color: var(--slate);
  margin-top: 4px;
  font-style: italic;
}

/* Chart Canvas Container */
.chart-container {
  width: 100%;
  height: 150px;
  margin-top: 12px;
  position: relative;
}

#count-history-chart {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Interactive Strategy Selectors */
.selectors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.select-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.select-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate);
}

.app-select {
  background: rgba(3, 20, 15, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
}

.app-select:focus {
  border-color: var(--gold-light);
}

.app-select optgroup {
  background: #061c14;
  color: #ffffff;
  font-family: var(--font-body);
}

.app-select option {
  background: #061c14;
  color: #ffffff;
}

/* Strategy Advice result card */
.advice-placeholder {
  border: 2px dashed rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  color: var(--slate);
  font-size: 0.9rem;
  font-style: italic;
}

.advice-card-result {
  border-radius: 12px;
  padding: 20px;
  border-left: 6px solid var(--slate);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: fadeIn 0.3s ease;
}

.advice-action-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.advice-action-description {
  font-size: 0.9rem;
  color: #e2e8f0;
  margin-top: 4px;
}

.standard-rule-footer {
  font-size: 0.75rem;
  color: var(--slate);
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 8px;
}

.deviation-warning-banner {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.warning-icon {
  font-size: 1.3rem;
}

.warning-text {
  font-size: 0.82rem;
  color: var(--gold-light);
  font-weight: 500;
}

/* Colors for specific advice actions */
.advice-hit {
  background: rgba(30, 64, 175, 0.12);
  border-color: rgba(30, 64, 175, 0.85);
}
.advice-hit .advice-action-title {
  color: #60a5fa;
}

.advice-stand {
  background: rgba(153, 27, 27, 0.12);
  border-color: rgba(153, 27, 27, 0.85);
}
.advice-stand .advice-action-title {
  color: #f87171;
}

.advice-double {
  background: rgba(180, 83, 9, 0.12);
  border-color: rgba(180, 83, 9, 0.85);
}
.advice-double .advice-action-title {
  color: #fbbf24;
}

.advice-split {
  background: rgba(13, 148, 136, 0.12);
  border-color: rgba(13, 148, 136, 0.85);
}
.advice-split .advice-action-title {
  color: #2dd4bf;
}

.has-deviation {
  border-color: var(--gold-light);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.15);
}

/* Strategy Table Matrix */
.strategy-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.legend-item {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--slate);
}

.legend-box {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 4px;
  color: #ffffff;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  margin-top: 10px;
  scrollbar-width: thin;
}

.strategy-matrix {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 0.82rem;
  color: #ffffff;
}

.strategy-matrix th, .strategy-matrix td {
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 6px;
  min-width: 28px;
  height: 28px;
}

.strategy-matrix th {
  background: rgba(2, 15, 11, 0.9);
  color: var(--gold-light);
  font-weight: 700;
  font-size: 0.85rem;
}

.strategy-matrix tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

.strategy-matrix .hand-label {
  background: rgba(2, 15, 11, 0.8);
  font-weight: 700;
  text-align: left;
  padding-left: 10px;
  color: #ffffff;
  min-width: 90px;
}

/* Styling strategy cells */
.strategy-cell {
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
  transition: filter 0.1s;
}

.strategy-cell:hover {
  filter: brightness(1.2);
}

.act-hit { background-color: var(--strat-hit); }
.act-stand { background-color: var(--strat-stand); }
.act-double { background-color: var(--strat-double); }
.act-split { background-color: var(--strat-split); }

.strategy-section {
  margin-top: 20px;
}

.strategy-section h3 {
  font-size: 0.95rem;
  color: #ffffff;
  margin-bottom: 8px;
  border-left: 3px solid var(--gold);
  padding-left: 8px;
}

.active-row {
  background: rgba(251, 191, 36, 0.05) !important;
}

.active-row .hand-label {
  color: var(--gold-light);
  box-shadow: inset 3px 0 0 var(--gold-light);
}

.highlighted-cell {
  outline: 2px solid var(--gold-light) !important;
  outline-offset: -1px;
  animation: cellGlow 1.5s infinite alternate;
  font-size: 0.9rem;
  box-shadow: 0 0 10px var(--gold);
}

@keyframes cellGlow {
  from { box-shadow: 0 0 4px rgba(251, 191, 36, 0.4); }
  to { box-shadow: 0 0 12px rgba(251, 191, 36, 0.8); }
}

/* Deviations Tab (Illustrious 18) */
.deviations-grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.deviation-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s ease;
  opacity: 0.65;
}

.deviation-card.active {
  background: rgba(16, 185, 129, 0.04);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
  transform: translateY(-2px);
  opacity: 1;
}

.deviation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.deviation-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffffff;
}

.deviation-card.active .deviation-title {
  color: var(--emerald-light);
}

.deviation-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  color: var(--slate);
}

.deviation-card.active .deviation-badge {
  background: rgba(16, 185, 129, 0.25);
  color: var(--emerald-light);
}

.deviation-body {
  font-size: 0.82rem;
}

.deviation-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding-bottom: 4px;
}

.deviation-row .lbl {
  color: var(--slate);
}

.deviation-row .val {
  color: #ffffff;
}

.deviation-row .val.strike {
  text-decoration: line-through;
  color: rgba(255,255,255,0.4);
}

.deviation-card.active .active-rule {
  background: rgba(16, 185, 129, 0.08);
  padding: 4px;
  border-radius: 4px;
}

/* Settings Form */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-group label {
  font-weight: 600;
  color: #ffffff;
  font-size: 1rem;
}

.settings-desc {
  font-size: 0.8rem;
  color: var(--slate);
}

.app-input {
  background: rgba(3, 20, 15, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  max-width: 250px;
}

.app-input:focus {
  border-color: var(--gold-light);
}

/* Custom Checkbox */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--gold-light);
}

.checkbox-row label {
  cursor: pointer;
}

/* Guide tab styles */
.guide-panel {
  margin-top: 24px;
}

.guide-content h3 {
  color: #ffffff;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.guide-content p {
  margin-bottom: 12px;
}

.guide-content ul {
  padding-left: 20px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.guide-content li {
  margin-bottom: 6px;
}

.guide-values-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 16px 0;
}

.guide-val-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  position: relative;
  padding-top: 24px;
}

.g-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 10px;
  color: #031e15;
}

.guide-val-card.plus {
  border-color: rgba(16, 185, 129, 0.2);
}
.guide-val-card.plus .g-badge {
  background: var(--low-card-color);
}
.guide-val-card.plus strong {
  color: var(--low-card-color);
}

.guide-val-card.zero {
  border-color: rgba(148, 163, 184, 0.2);
}
.guide-val-card.zero .g-badge {
  background: var(--neutral-card-color);
}
.guide-val-card.zero strong {
  color: var(--neutral-card-color);
}

.guide-val-card.minus {
  border-color: rgba(244, 63, 94, 0.2);
}
.guide-val-card.minus .g-badge {
  background: var(--high-card-color);
}
.guide-val-card.minus strong {
  color: var(--high-card-color);
}

.guide-val-card p {
  font-size: 0.78rem;
  margin-top: 6px;
  color: var(--slate);
  margin-bottom: 0;
}

/* Footer styling */
.app-footer {
  text-align: center;
  padding: 24px;
  font-size: 0.75rem;
  color: var(--slate);
  border-top: 1px solid var(--border-light);
  background: rgba(2, 12, 9, 0.8);
  margin-top: auto;
}

/* Utility Helpers */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mr-8 { margin-right: 8px; }
.justify-between { justify-content: space-between; }
.flex { display: flex; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.text-right { text-align: right; }
.text-gold { color: var(--gold-light); }

/* Responsive adjustments */
@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 12px 16px;
  }
  .app-container {
    padding: 12px;
  }
  .nav-tab {
    padding: 12px 14px;
    font-size: 0.85rem;
  }
  .card-num {
    font-size: 1.25rem;
  }
  .card-btn {
    height: 75px;
  }
  .metrics-grid {
    gap: 12px;
  }
  .metric-value {
    font-size: 1.8rem;
  }
  .slider-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .slider-lbl.text-right {
    text-align: left;
  }
  .col-span-2-mobile {
    grid-column: span 2;
  }
  .guide-values-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 24px 0;
  }
  .selectors-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .card-buttons-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }
  .card-btn {
    height: 65px;
    border-radius: 8px;
    gap: 2px;
  }
  .card-num {
    font-size: 1rem;
  }
  .card-count-indicator {
    font-size: 0.65rem;
    padding: 1px 4px;
    min-width: 22px;
  }
  .nav-tab {
    padding: 10px 8px;
    font-size: 0.8rem;
    gap: 4px;
  }
  .tab-icon {
    font-size: 0.95rem;
  }
  .app-header {
    flex-direction: column;
    gap: 8px;
    align-items: center;
    text-align: center;
  }
  .header-quick-stats {
    width: 100%;
    justify-content: center;
  }
  .app-nav {
    top: 97px; /* Account for double-line header */
  }
}
