/*
 * TABLE OF CONTENTS
 * =================
 * 
 * 1. CSS CUSTOM PROPERTIES
 *    - Color tokens and design system variables
 * 
 * 2. RESET & BASE STYLES
 *    - Universal reset, body, typography
 * 
 * 3. LAYOUT COMPONENTS
 *    - Wrapper, hero, grid system
 * 
 * 4. GAME BOARD
 *    - Cards, board, cells, labels
 * 
 * 5. FORM ELEMENTS
 *    - Inputs, buttons, interactive elements
 * 
 * 6. UI COMPONENTS
 *    - Pills, hints, stats, utilities
 * 
 * 7. INFO SECTIONS
 *    - Toggles, content panels, objective info
 * 
 * 8. MONTE CARLO ANALYSIS
 *    - Progress bars, results tables, summaries
 * 
 * 9. RESPONSIVE DESIGN
 *    - Media queries for mobile/tablet
 */

/* ===== 1. CSS CUSTOM PROPERTIES ===== */
:root { 
  --bg:#0b1020; 
  --card:#161b2e; 
  --ink:#eaf0ff; 
  --muted:#aab3d9; 
  --accent:#7aa2ff; 
  --good:#59d38c; 
  --warn:#ffc857; 
  --bad:#ff6b6b; 
}

/* ===== 2. RESET & BASE STYLES ===== */
* { 
  box-sizing: border-box; 
}

html {
  margin: 0;
  padding: 0;
  background: #0b1020;
}

body { 
  margin: 0; 
  padding: 0;
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji"; 
  background: linear-gradient(180deg,#0b1020,#101736 45%,#0b1020); 
  color: var(--ink); 
}

h1 { 
  font-weight: 800; 
  letter-spacing: .2px; 
  margin: 0; 
}

p { 
  color: var(--muted); 
}

/* ===== 3. LAYOUT COMPONENTS ===== */
.wrap { 
  max-width: 980px; 
  margin: 32px auto; 
  padding: 0 16px; 
}

.hero { 
  display: grid; 
  gap: 8px; 
  margin: 32px auto 20px auto; 
  padding: 0 16px;
  max-width: 980px;
  width: auto;
}

.hero p {
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
  font-size: 18px;
}

.game-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  width: 100%;
}

.info-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.game-info .pill {
  width: 100%;
  justify-content: center;
}

.info-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: auto;
}

.info-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.01);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.grid { 
  display: grid; 
  grid-template-columns: auto auto auto; 
  gap: 14px; 
  justify-content: center;
}

.footer {
  text-align: center;
  padding: 20px;
  margin-top: 40px;
  border-top: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  font-size: 14px;
}

/* ===== 4. GAME BOARD ===== */
.card { 
  background: linear-gradient(145deg, rgba(22, 27, 46, 0.8), rgba(15, 20, 42, 0.6)); 
  border: 1px solid rgba(122, 162, 255, 0.15); 
  border-radius: 20px; 
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2); 
  padding: 20px;
}

.card h2 {
  color: var(--ink);
  margin-bottom: 16px;
  font-size: 1.3em;
  font-weight: 700;
}

.board { 
  display:grid; 
  grid-template-columns: repeat(3, 1fr); 
  grid-template-rows: auto repeat(3, 80px); 
  gap: 12px; 
  align-items:center; 
  justify-items: center;
  max-width: 320px;
  margin: 0 auto;
  padding: 16px;
  background: linear-gradient(145deg, rgba(22, 27, 46, 0.4), rgba(11, 16, 32, 0.6));
  border-radius: 16px;
  border: 1px solid rgba(122, 162, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.colLabel { 
  font-size: 14px; 
  color: var(--accent); 
  letter-spacing: 0.2px; 
  text-align: center;
  padding: 8px 4px;
  font-weight: 600;
}

.cell { 
  width: 80px; 
  height: 64px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-size: 28px; 
  border-radius: 12px; 
  border: 2px solid transparent;
  background: linear-gradient(145deg, rgba(22, 27, 46, 0.6), rgba(15, 20, 42, 0.8));
  position: relative;
  transition: all 0.2s ease;
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cell:empty {
  border: 2px dashed rgba(122, 162, 255, 0.3);
  background: linear-gradient(145deg, rgba(22, 27, 46, 0.3), rgba(15, 20, 42, 0.4));
}

.cell:empty:hover {
  border-color: var(--accent);
  background: linear-gradient(145deg, rgba(122, 162, 255, 0.1), rgba(122, 162, 255, 0.05));
}

.cell:not(:empty) {
  border: 2px solid var(--accent);
  background: linear-gradient(145deg, rgba(122, 162, 255, 0.15), rgba(122, 162, 255, 0.05));
  animation: cell-fill 0.3s ease-out;
}

@keyframes cell-fill {
  0% { 
    transform: scale(0.9);
    opacity: 0.5;
  }
  100% { 
    transform: scale(1);
    opacity: 1;
  }
}

.cell.optimal-suggestion {
  border: 3px solid var(--good);
  background: linear-gradient(145deg, rgba(89, 211, 140, 0.25), rgba(89, 211, 140, 0.1));
  box-shadow: 
    0 0 25px rgba(89, 211, 140, 0.4),
    0 8px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  animation: pulse-optimal 2s infinite;
  transform: translateY(-3px) scale(1.05);
}

@keyframes pulse-optimal {
  0%, 100% { 
    box-shadow: 
      0 0 25px rgba(89, 211, 140, 0.4),
      0 8px 20px rgba(0, 0, 0, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }
  50% { 
    box-shadow: 
      0 0 35px rgba(89, 211, 140, 0.6),
      0 12px 30px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
}

.cell::after { 
  content: attr(data-place); 
  position:absolute; 
  bottom:6px; 
  right:8px; 
  font-size: 11px; 
  color: var(--muted); 
}

/* ===== 5. FORM ELEMENTS ===== */
input[type=number] { 
  width: 90px; 
  height: 48px; 
  border-radius: 12px; 
  border: 1px solid rgba(255,255,255,.15); 
  background: #0f142a; 
  color: var(--ink); 
  font-size: 18px; 
  padding: 0 12px; 
}

button { 
  height: 48px; 
  padding: 0 16px; 
  border-radius: 12px; 
  border: 0; 
  background: linear-gradient(145deg, var(--accent), rgba(122, 162, 255, 0.8)); 
  color: #081226; 
  font-weight: 700; 
  cursor: pointer; 
  box-shadow: 
    0 4px 12px rgba(122, 162, 255, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2); 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 120px;
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

button:hover {
  background: linear-gradient(145deg, rgba(122, 162, 255, 1), var(--accent));
  box-shadow: 
    0 6px 20px rgba(122, 162, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-2px) scale(1.02);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(122,162,255,.2);
}

button.secondary { 
  background: rgba(255,255,255,.06); 
  color: var(--ink); 
  box-shadow: 0 2px 8px rgba(0,0,0,.15); 
  border: 1px solid rgba(255,255,255,.12); 
}

button.secondary:hover {
  background: rgba(255,255,255,.1);
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  transform: scale(1.05);
}

.mc-run-btn {
  background: #4CAF50 !important;
  color: white !important;
  font-weight: 600 !important;
}

.mc-run-btn.mc-abort-state {
  background: #f44336 !important;
}

.mc-download-btn {
  background: #2196F3 !important;
  color: white !important;
  font-weight: 600 !important;
}

.dice-button {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  padding: 0 !important;
  font-size: 22px !important;
  background: linear-gradient(145deg, rgba(122, 162, 255, 0.2), rgba(122, 162, 255, 0.1)) !important;
  border: 2px solid rgba(122, 162, 255, 0.3) !important;
  color: var(--ink) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  box-shadow: 
    0 4px 12px rgba(122, 162, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.dice-button:hover:not(.rolling) {
  background: linear-gradient(145deg, rgba(122, 162, 255, 0.3), rgba(122, 162, 255, 0.15)) !important;
  border-color: rgba(122, 162, 255, 0.5) !important;
  transform: translateY(-2px) scale(1.05) !important;
  box-shadow: 
    0 8px 20px rgba(122, 162, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.dice-button:active:not(.rolling) {
  transform: translateY(0) scale(0.95) !important;
  box-shadow: 
    0 2px 8px rgba(122, 162, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.dice-button.rolling {
  animation: diceRoll 0.4s ease-in-out !important;
  pointer-events: none !important;
  background: linear-gradient(145deg, rgba(89, 211, 140, 0.3), rgba(89, 211, 140, 0.1)) !important;
  border-color: rgba(89, 211, 140, 0.5) !important;
}

@keyframes diceRoll {
  0% { 
    transform: rotate(0deg); 
  }
  25% {
    transform: rotate(90deg);
  }
  50% { 
    transform: rotate(180deg);
  }
  75% {
    transform: rotate(270deg);
  }
  100% { 
    transform: rotate(360deg);
  }
}

/* ===== 6. UI COMPONENTS ===== */
.stack { 
  display:flex; 
  align-items:center; 
  gap: 10px; 
}

.input-dice-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill { 
  display:inline-flex; 
  align-items:center; 
  gap:8px; 
  padding:8px 12px; 
  border-radius:999px; 
  font-size:14px; 
  border:1px solid rgba(255,255,255,.14); 
  background: rgba(255,255,255,.05); 
}

.hint { 
  font-weight:700; 
}

.hint.good { 
  color: var(--good); 
}

.hint.warn { 
  color: var(--warn); 
}

.hint.bad { 
  color: var(--bad); 
}

.stats { 
  display:grid; 
  grid-template-columns: repeat(2, 1fr); 
  gap: 12px; 
}

/* ===== COLORFUL RESULTS PANEL ===== */
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  margin: 8px 0;
  background: linear-gradient(135deg, var(--card) 0%, rgba(122, 162, 255, 0.05) 100%);
  border-radius: 8px;
  border-left: 4px solid var(--accent);
  transition: all 0.3s ease;
}

.result-row:hover {
  background: linear-gradient(135deg, var(--card) 0%, rgba(122, 162, 255, 0.1) 100%);
  box-shadow: 0 4px 12px rgba(122, 162, 255, 0.15);
}

.result-label {
  color: var(--muted);
  font-weight: 500;
}

.result-value {
  font-weight: 700;
  font-size: 1.1em;
  color: var(--ink);
}

.result-sum {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(122, 162, 255, 0.3);
}

.result-gap {
  padding: 4px 12px;
  border-radius: 16px;
  background: var(--warn);
  color: var(--bg);
  font-weight: 900;
}

/* Dynamic gap coloring based on performance */
.result-gap.excellent {
  background: linear-gradient(135deg, var(--good), #4ade80);
  box-shadow: 0 0 12px rgba(89, 211, 140, 0.4);
}

.result-gap.good {
  background: linear-gradient(135deg, #10d6a0, var(--good));
  box-shadow: 0 0 8px rgba(89, 211, 140, 0.3);
}

.result-gap.okay {
  background: linear-gradient(135deg, #fbbf24, var(--warn));
  box-shadow: 0 0 8px rgba(255, 200, 87, 0.3);
}

.result-gap.bad {
  background: linear-gradient(135deg, var(--bad), #ef4444);
  box-shadow: 0 0 8px rgba(255, 107, 107, 0.4);
}

.mono { 
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 
}

.foot { 
  margin-top: 18px; 
  font-size: 13px; 
  color: var(--muted); 
}

.tests { 
  margin-top: 20px; 
  font-size: 13px; 
  color: var(--muted); 
}

.tests .ok { 
  color: var(--good); 
  font-weight: 700; 
}

.tests .fail { 
  color: var(--bad); 
  font-weight: 700; 
}

.error-warning {
  color: #ffc857;
  font-weight: 700;
}

.error-danger {
  color: #ff6b6b;
  font-weight: 700;
}

/* ===== 7. INFO SECTIONS ===== */
.objective-info { 
  margin-top: 12px; 
}

.info-toggle { 
  width: 100%; 
  background: rgba(255,255,255,.03); 
  border: 1px solid rgba(255,255,255,.1); 
  border-radius: 8px; 
  padding: 10px 12px; 
  color: var(--muted); 
  font-size: 13px; 
  cursor: pointer; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  transition: all 0.2s ease; 
  box-shadow: none;
}

.info-toggle:hover { 
  background: rgba(255,255,255,.06); 
  border-color: rgba(255,255,255,.15); 
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.info-arrow { 
  font-size: 10px; 
  transition: transform 0.2s ease; 
}

.info-arrow.rotated { 
  transform: rotate(180deg); 
}

.info-content { 
  max-height: 0; 
  overflow: hidden; 
  transition: max-height 0.3s ease-out; 
  background: rgba(255,255,255,.01); 
  border: 1px solid rgba(255,255,255,.06); 
  border-top: none; 
  border-radius: 0 0 8px 8px; 
}

.info-content.expanded { 
  max-height: 1000px; 
  overflow: visible; 
}

.info-section { 
  padding: 12px; 
  border-bottom: 1px solid rgba(255,255,255,.05); 
}

.info-section:last-child { 
  border-bottom: none; 
}

.info-section h4 { 
  margin: 0 0 6px 0; 
  font-size: 13px; 
  font-weight: 600; 
  color: var(--accent); 
}

.info-section p { 
  margin: 0; 
  font-size: 12px; 
  line-height: 1.4; 
  color: var(--muted); 
}

/* ===== 8. MONTE CARLO ANALYSIS ===== */
.mc-progress-container {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  height: 8px;
  position: relative;
}

.mc-progress-bar {
  background: var(--good);
  height: 100%;
  transition: width 0.2s ease-out;
  border-radius: 4px;
}

.mc-progress-text {
  font-size: 12px;
  text-align: center;
  margin-top: 5px;
  color: var(--muted);
}

.mc-results-title {
  margin-bottom: 20px;
  color: var(--good);
}

.mc-results-subtitle {
  margin-bottom: 15px;
  color: var(--ink);
}

.mc-performance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 25px;
  border-radius: 8px;
  overflow: hidden;
}

.mc-performance-table thead tr {
  background: rgba(76, 175, 80, 0.2);
}

.mc-performance-table th {
  padding: 12px;
  border: 1px solid var(--good);
  text-align: center;
}

.mc-performance-table th:first-child {
  text-align: left;
}

.mc-performance-table td {
  padding: 12px;
  border: 1px solid #444;
  text-align: center;
}

.mc-performance-table td:first-child {
  text-align: left;
}

.mc-best-strategy {
  background: rgba(76, 175, 80, 0.15);
  border-left: 4px solid var(--good);
}

.mc-best-strategy .mc-best-rate {
  font-weight: bold;
  color: var(--good);
}

.mc-placement-section {
  margin-top: 30px;
  margin-bottom: 15px;
  color: var(--ink);
}

.mc-placement-description {
  margin-bottom: 20px;
  opacity: 0.8;
  font-style: italic;
}

.mc-strategy-container {
  margin-bottom: 25px;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #444;
}

.mc-strategy-container.mc-best {
  border: 2px solid var(--good);
  background: rgba(76, 175, 80, 0.05);
}

.mc-strategy-title {
  margin-bottom: 12px;
  color: var(--ink);
}

.mc-strategy-title.mc-best {
  color: var(--good);
}

.mc-placement-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.mc-placement-table thead tr {
  background: rgba(255, 255, 255, 0.1);
}

.mc-placement-table th,
.mc-placement-table td {
  padding: 8px;
  border: 1px solid #444;
  text-align: center;
}

.mc-placement-table .mc-dice-value {
  font-weight: bold;
}

.mc-placement-highlight {
  background: #59d38cb4;
  color: #000;
  font-weight: bold;
}

.mc-placement-total {
  opacity: 0.7;
}

/* ===============================
   7. Monte Carlo Display States
   =============================== */
.mc-progress-hidden {
  display: none !important;
}

.mc-results-hidden {
  display: none !important;
}

.mc-download-hidden {
  display: none !important;
}

.mc-summary-container {
  margin-top: 30px;
  padding: 20px;
  border-radius: 8px;
  background: rgba(76, 175, 80, 0.1);
  border: 2px solid var(--good);
}

.mc-summary-title {
  margin-bottom: 15px;
  color: var(--good);
}

.mc-summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mc-summary-list li {
  margin-bottom: 8px;
}

.mc-summary-highlight {
  color: var(--good);
  font-weight: bold;
}

.mc-footer {
  margin-top: 20px;
  font-size: 12px;
  opacity: 0.6;
  text-align: center;
}

/* Form styling */
.controls-form {
  margin: 0;
}

.controls-group {
  flex-wrap: wrap;
  gap: 12px 10px;
}

.objective-controls {
  gap: 6px;
  align-items: center;
}

.k-value-input {
  width: 70px;
}

.sequence-input {
  width: 320px;
}

.monte-carlo-controls {
  flex-wrap: wrap;
  gap: 12px 15px;
  align-items: flex-start;
  margin-bottom: 15px;
}

.mc-simulations-select {
  width: 100px;
}

.mc-k-input {
  width: 70px;
}

.results-actions {
  margin-top: 10px;
}

.compare-controls {
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: flex-start;
}

.compare-output {
  margin-top: 10px;
  font-size: 14px;
}

.monte-carlo-section {
  margin-top: 20px;
}

.monte-carlo-description {
  font-size: 14px;
  margin-bottom: 15px;
  color: rgba(255,255,255,0.8);
}

.compare-table-container {
  overflow: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
}

.compare-table th {
  padding: 6px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}

.compare-table th.text-left { text-align: left; }
.compare-table th.text-right { text-align: right; }
.compare-table th.text-center { text-align: center; }

.compare-table td {
  padding: 6px;
}

.compare-table td.text-left { text-align: left; }
.compare-table td.text-right { text-align: right; }
.compare-table td.text-center { text-align: center; }

.compare-table td.no-wrap { white-space: nowrap; }

.compare-optimal-row {
  border-top: 2px solid #4CAF50;
  background: rgba(76,175,80,0.1);
}

/* ===== 9. INFO MODAL ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.info-modal-hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: auto;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: none;
}

.modal-body {
  padding: 20px 24px 24px;
}

.modal-body h3 {
  margin: 16px 0 8px 0;
  font-size: 16px;
  color: var(--accent);
}

.modal-body h3:first-child {
  margin-top: 0;
}

.modal-body p {
  margin: 8px 0;
  line-height: 1.6;
}

.modal-body ol {
  margin: 8px 0;
  padding-left: 24px;
}

.modal-body ul {
  margin: 8px 0;
  padding-left: 24px;
}

.modal-body li {
  margin: 6px 0;
  line-height: 1.6;
}

/* ===== 10. RESPONSIVE DESIGN ===== */

/* Force single column at 1100px to prevent overflow */
@media (max-width: 1065px) {
  .grid { 
    grid-template-columns: 1fr; 
    gap: 12px; 
    justify-content: center;
    align-items: center;
  }
  
  .card {
    max-width: 100%;
    margin: 0 auto;
  }
}

/* Mobile: max 768px */
@media (max-width: 768px) {
  .grid { 
    grid-template-columns: 1fr; 
    gap: 12px; 
    justify-content: center;
    align-items: center;
  }
  
  .card {
    max-width: 100%;
    margin: 0 auto;
    overflow-x: auto;
  }
  
  .wrap {
    padding: 0 12px;
    text-align: center;
    max-width: 100%;
  }
  
  .hero {
    padding: 0 12px;
    text-align: center;
    max-width: 100%;
    width: 100%;
  }
  
  .stack {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px !important;
  }
  
  .input-dice-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
  }
  
  input[type=text] {
    width: 100% !important;
    max-width: none !important;
  }
  
  button {
    width: 100%;
    min-width: unset;
  }
  
  .mc-performance-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* Safari mobile landscape - narrower content with proper background and safe areas */
@supports (-webkit-touch-callout: none) {
  @media screen and (orientation: landscape) {
    body {
      padding-top: max(env(safe-area-inset-top), 8px);
      padding-right: max(env(safe-area-inset-right), 8px);
      padding-bottom: max(env(safe-area-inset-bottom), 8px);
      padding-left: max(env(safe-area-inset-left), 8px);
    }
    
    .wrap {
      max-width: 800px;
      margin: 16px auto;
    }
    
    .hero {
      max-width: 800px;
      margin: 16px auto;
    }
  }
}