:root {
  --color-bg: #0a0a0a;
  --color-surface: #111111;
  --color-border: #2a2a2a;
  --color-primary: #00e385;
  --color-text: #ffffff;
  --color-text-muted: #888888;
  --color-danger: #ff5555;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 1000px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

/* Scrollbars only inside containers */
.entries-input textarea,
.advanced-stats-section,
.deviation-chart,
.history-section ul {
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.entries-input textarea::-webkit-scrollbar,
.advanced-stats-section::-webkit-scrollbar,
.deviation-chart::-webkit-scrollbar,
.history-section ul::-webkit-scrollbar {
  width: 4px;
}

.entries-input textarea::-webkit-scrollbar-thumb,
.advanced-stats-section::-webkit-scrollbar-thumb,
.deviation-chart::-webkit-scrollbar-thumb,
.history-section ul::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 2px;
}

body {
  font-family: "Inter", sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  padding: var(--space-xl);
  background-image: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, #202020 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.55;
  pointer-events: none;
  z-index: -1;
}

::selection {
  background-color: var(--color-primary);
  color: var(--color-bg);
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.main-layout {
  max-width: 1600px;
  margin: 0 auto;
}

/* Top Section */
.top-section {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 48px;
  margin-bottom: 32px;
}

.wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  width: 100%;
  position: relative;
}

.wheel-wrapper {
  position: relative;
  width: 680px;
  height: 680px;
  max-width: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
  filter: drop-shadow(0 10px 40px rgba(0, 0, 0, 0.5));
}

#wheel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #0f0f0f;
  cursor: pointer;
}

.pointer {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 24px solid transparent;
  border-right: 24px solid transparent;
  border-top: 50px solid var(--color-primary);
  z-index: 10;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
  transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pointer.tick {
  transform: translateX(-50%) scale(1.15) translateY(-2px);
}

.result-display {
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  padding: 16px 40px;
  border-radius: var(--radius-full);
  min-width: 240px;
  text-align: center;
}

.result-display span {
  font-size: 28px;
  color: var(--color-primary);
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Side Panel */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.entries-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.entries-section:focus-within {
  border-color: var(--color-primary);
}

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

.entries-header h2 {
  font-size: 15px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.entries-header h2 span {
  background: #222;
  color: var(--color-primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.entry-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: rgba(0, 227, 133, 0.1);
  border-color: rgba(0, 227, 133, 0.3);
  color: var(--color-primary);
}

.icon-btn:active {
  transform: scale(0.96);
}

.entries-input {
  flex: 1;
  display: flex;
  position: relative;
}

.entries-input textarea {
  width: 100%;
  height: 100%;
  min-height: 380px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  color: var(--color-text);
  font-family: inherit;
  font-size: 16px;
  resize: none;
  line-height: 1.6;
}

.entries-input textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: rgba(0, 0, 0, 0.4);
}

.entries-input textarea::placeholder {
  color: #444;
}

.side-panel-buttons {
  display: flex;
  gap: 12px;
}

.side-panel-buttons button {
  flex: 1;
  padding: 16px;
  font-size: 13px;
  height: 50px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: transform 0.1s;
}

#resetButton {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

#resetButton:hover {
  background: #1a1a1a;
  border-color: #ff5555;
  color: #ff5555;
}

.secondary-btn {
  background: rgba(0, 227, 133, 0.1);
  border: 1px solid rgba(0, 227, 133, 0.2);
  color: var(--color-primary);
}

.secondary-btn:hover {
  background: rgba(0, 227, 133, 0.15);
  border-color: var(--color-primary);
}

/* Bottom Section Grid */
.bottom-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "stats options"
    "analytics history";
  gap: 24px;
  /* Default align-items is stretch, which ensures equal height for row items */
}

.options-section {
  grid-area: options;
}
.stats-section {
  grid-area: stats;
}
.advanced-stats-section {
  grid-area: analytics;
}
.history-section {
  grid-area: history;
}

/* Common Section Styles */
.options-section,
.stats-section,
.advanced-stats-section,
.history-section,
.faq-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.options-section h3,
.stats-section h3,
.advanced-stats-section h3,
.history-section h3 {
  font-size: 14px;
  color: var(--color-primary);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Options */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.option-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}

.option-group label:first-child {
  font-size: 15px;
  color: #ccc;
  font-weight: 500;
}

.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #2a2a2a;
  border-radius: 99px;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: #888;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle input:checked + .toggle-slider {
  background: rgba(0, 227, 133, 0.2);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: var(--color-primary);
}

.option-group select {
  background: #1a1a1a;
  border: 1px solid var(--color-border);
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.stats > div {
  background: var(--color-bg);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--color-border);
  position: relative;
  overflow: hidden;
}

.stats > div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-primary);
}

.stats > div > span:first-child {
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.stats > div > span:last-child {
  font-size: 28px;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* Advanced Stats */
.advanced-stats-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 700px;
  overflow-y: auto;
}

.streaks-container {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.streak-card {
  flex: 1;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border);
}

.streak-card.hot {
  border-bottom: 3px solid #ff6b6b;
}
.streak-card.cold {
  border-bottom: 3px solid #45b7d1;
}

.streak-info {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  width: 100%;
  align-items: center;
}

.streak-label {
  grid-column: 1;
  grid-row: 1;
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.streak-value {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
  font-size: 36px;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  font-weight: 700;
  margin-bottom: 4px;
}

.streak-card.hot .streak-value {
  color: #ff6b6b;
}
.streak-card.cold .streak-value {
  color: #45b7d1;
}

.streak-detail {
  grid-column: 1;
  grid-row: 2;
  font-size: 13px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deviation-chart {
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 20px;
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  min-height: 300px;
}

.deviation-chart h4 {
  font-size: 13px;
  color: var(--color-primary);
  margin-bottom: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.chart-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-muted);
  font-size: 14px;
  padding: 40px;
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--color-text-muted);
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 12px;
}

.chart-legend .spins-count {
  margin-left: auto;
  color: var(--color-text);
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-dot.expected {
  background: #444;
}
.legend-dot.actual {
  background: var(--color-primary);
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.chart-bar-label {
  width: 140px;
  font-size: 14px;
  color: #ccc;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  font-weight: 500;
  flex-shrink: 0;
}

.chart-bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.chart-bar-track {
  height: 10px;
  background: #222;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 2px;
}

.chart-bar-fill.expected {
  background: #444;
}
.chart-bar-fill.actual {
  background: var(--color-primary);
}

.chart-bar-value {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 70px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Win History */
.history-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  max-height: 700px;
}

.history-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.history-section li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: 1px solid transparent;
}

.history-section li:hover {
  border-color: #333;
}

.history-section li .winner-index {
  color: #555;
  font-size: 11px;
  min-width: 30px;
}

.history-section li .winner-name {
  color: var(--color-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  margin: 0 12px;
}

.history-section li .winner-time {
  color: #666;
  font-size: 12px;
}

.history-section .empty-history {
  color: var(--color-text-muted);
  text-align: center;
  padding: 40px;
  font-style: italic;
  display: block !important; /* Override flex */
}

/* Recalculate Hint */
.chart-stale {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  gap: 16px;
  min-height: 180px;
}

.chart-stale p {
  color: #888;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  max-width: 280px;
}

.recalculate-btn {
  background: rgba(0, 227, 133, 0.1);
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  padding: 14px 32px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recalculate-btn:hover {
  background: rgba(0, 227, 133, 0.2);
  border-color: var(--color-primary);
}

.recalculate-btn:active {
  transform: scale(0.96);
}

/* Modals - Consistent styling, no blur */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.modal.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal.closing {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 40px 50px;
  text-align: center;
  width: 90%;
  max-width: 420px;
  position: relative;
  transform: scale(0.92) translateY(16px);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show .modal-content {
  transform: scale(1) translateY(0);
}

.modal.closing .modal-content {
  transform: scale(0.92) translateY(16px);
}

.modal-content h2 {
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
}

.modal-content #winnerName {
  font-size: 40px;
  color: var(--color-primary);
  margin-bottom: 32px;
  font-weight: 700;
  word-break: break-word;
  line-height: 1.2;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-actions button {
  padding: 14px 24px;
  font-size: 14px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-actions button:active {
  transform: scale(0.98);
}

#spinAgainBtn {
  background: var(--color-primary);
  color: #000;
  border-color: var(--color-primary);
}

#spinAgainBtn:hover {
  background: #00ff94;
}

#removeWinnerBtn {
  background: transparent;
  color: #ff5555;
  border: 1px solid rgba(255, 85, 85, 0.3);
}

#removeWinnerBtn:hover {
  background: rgba(255, 85, 85, 0.1);
  border-color: #ff5555;
}

#closeModalBtn {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

#closeModalBtn:hover {
  color: var(--color-text);
  border-color: #444;
}

/* Confirm Modal - consistent with winner modal */
.confirm-modal {
  padding: 32px 40px;
}

.confirm-modal h2 {
  font-size: 14px;
  margin-bottom: 12px;
}

.confirm-modal p {
  font-size: 16px;
  color: var(--color-text);
  margin-bottom: 28px;
  font-weight: 400;
}

.confirm-actions {
  flex-direction: row !important;
  justify-content: center;
  gap: 12px;
}

.confirm-yes {
  background: transparent !important;
  border: 1px solid var(--color-danger) !important;
  color: var(--color-danger) !important;
  flex: 1;
  max-width: 140px;
}

.confirm-yes:hover {
  background: rgba(255, 85, 85, 0.1) !important;
}

.confirm-no {
  background: transparent !important;
  border: 1px solid var(--color-border) !important;
  color: var(--color-text-muted) !important;
  flex: 1;
  max-width: 140px;
}

.confirm-no:hover {
  background: #1a1a1a !important;
  color: #fff !important;
  border-color: #666 !important;
}

/* Simulation Toast - consistent with other modals, no blur */
.simulation-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 40px));
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 20px 32px;
  z-index: 1001;
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease;
  text-align: center;
  pointer-events: none;
  opacity: 0;
}

.simulation-toast.show {
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  opacity: 1;
}

.simulation-toast.closing {
  transform: translateX(-50%) translateY(calc(100% + 40px));
  opacity: 0;
  pointer-events: none;
}

.simulation-toast h4 {
  font-size: 13px;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

.simulation-toast #simulationMessage {
  font-size: 13px;
  color: var(--color-text-muted);
}

.simulation-toast .toast-stats {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-top: 12px;
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
}

.simulation-toast .toast-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.simulation-toast .toast-stat-value {
  color: var(--color-primary);
  font-size: 20px;
  font-weight: 700;
}

.simulation-toast .toast-stat-label {
  color: var(--color-text-muted);
  font-size: 10px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* FAQ */
.faq-section {
  margin-top: 40px;
}

.faq-section h2 {
  font-size: 24px;
  color: var(--color-primary);
  margin-bottom: 24px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.faq-item {
  margin-bottom: 24px;
}
.faq-item h3 {
  color: #eee;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.faq-item h3::before {
  content: "";
  width: 4px;
  height: 4px;
  background: var(--color-primary);
  border-radius: 50%;
}
.faq-item p {
  color: #999;
  line-height: 1.6;
  font-size: 14px;
  margin-left: 12px;
}
.faq-highlight {
  background: rgba(255, 255, 255, 0.03);
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
  border: 1px dashed #333;
}

/* Responsive */
@media (max-width: 1200px) {
  body {
    padding: var(--space-md);
  }
  .top-section {
    grid-template-columns: 1fr;
  }
  .wheel-wrapper {
    width: 500px;
    height: 500px;
  }
  .bottom-section {
    grid-template-columns: 1fr;
    grid-template-areas: "stats" "options" "analytics" "history";
    gap: var(--space-md);
  }
  .history-section {
    height: 400px;
  }
  .side-panel {
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
  }
  .entries-input textarea {
    min-height: 250px;
  }
}

@media (max-width: 768px) {
  body {
    padding: var(--space-sm);
  }
  .top-section {
    gap: var(--space-md);
    margin-bottom: var(--space-md);
  }
  .wheel-container {
    gap: var(--space-md);
  }
  .wheel-wrapper {
    width: 100%;
    max-width: 450px;
    height: auto;
  }
  .entries-section {
    padding: var(--space-md);
  }
  .entries-header {
    margin-bottom: var(--space-sm);
  }
  .entries-input textarea {
    min-height: 200px;
    padding: var(--space-sm);
    font-size: 14px;
  }
  .side-panel-buttons {
    gap: var(--space-sm);
  }
  .side-panel-buttons button {
    padding: var(--space-sm) var(--space-md);
    font-size: 12px;
  }
  .options-section,
  .stats-section,
  .advanced-stats-section,
  .history-section {
    padding: var(--space-md);
  }
  .bottom-section {
    gap: var(--space-md);
  }
  .options-grid {
    gap: var(--space-sm);
  }
  .option-group {
    padding: var(--space-sm) var(--space-md);
  }
  .stats {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
  .stats > div {
    padding: var(--space-sm) var(--space-md);
  }
  .streaks-container {
    flex-direction: column;
    gap: var(--space-sm);
  }
  .streak-card {
    padding: var(--space-sm) var(--space-md);
  }
  .deviation-chart {
    padding: var(--space-sm);
    min-height: 200px;
  }
  .deviation-chart h4 {
    margin-bottom: 10px;
  }
  .chart-container {
    gap: 6px;
  }
  .chart-bar-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 2px 8px;
    padding: 4px 0;
  }
  .chart-bar-label {
    width: auto;
    font-size: 13px;
    grid-column: 1;
    grid-row: 1;
  }
  .chart-bar-value {
    min-width: auto;
    font-size: 12px;
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }
  .chart-bar-wrapper {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .chart-bar-track {
    height: 8px;
  }
  .modal-content {
    padding: var(--space-lg);
    width: 95%;
  }
  .modal-content #winnerName {
    font-size: 28px;
    margin-bottom: var(--space-lg);
  }
  .result-display {
    padding: var(--space-sm) var(--space-lg);
    min-width: 180px;
  }
  .result-display span {
    font-size: 18px;
  }
  .history-section {
    max-height: 350px;
  }
  .advanced-stats-section {
    max-height: 700px;
  }
  .faq-section {
    margin-top: var(--space-md);
  }
  /* Toast mobile */
  .simulation-toast {
    bottom: 16px;
    left: 16px;
    right: 16px;
    transform: translateX(0) translateY(calc(100% + 40px));
    width: auto;
    padding: 16px 20px;
  }
  .simulation-toast.show {
    transform: translateX(0) translateY(0);
  }
  .simulation-toast.closing {
    transform: translateX(0) translateY(calc(100% + 40px));
  }
  .simulation-toast .toast-stats {
    gap: 16px;
  }
  .simulation-toast .toast-stat-value {
    font-size: 16px;
  }
  /* Chart stale mobile */
  .chart-stale {
    padding: 24px 16px;
    min-height: 140px;
  }
  .chart-stale p {
    font-size: 14px;
  }
  .recalculate-btn {
    padding: 12px 24px;
    font-size: 13px;
  }
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Confetti */
.confetti-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  top: -10px;
  animation: confetti-fall 2s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(400px) rotate(720deg);
    opacity: 0;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
