/* =============================================
   T20 Cricket Squares — Global Styles
   ============================================= */

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

:root {
  --primary: #3d6b8e;
  --primary-light: #5a8fad;
  --primary-dark: #2c4f6b;
  --accent: #5a9a58;
  --accent-light: #7cb87a;
  --success: #22c55e;
  --danger: #ef4444;
  --bg: #f5f7f6;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #5e7282;
  --border: #dce4e0;
  --border-focus: #5a8fad;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);

  /* Derived / themeable colors */
  --accent-hover: #4a874a;
  --grid-border: #c5d0cc;
  --cell-hover: #eaf1ee;
  --cell-mine: #d5e4ed;
  --toggle-bg: #c5d0cc;
  --badge-active-bg: #d5e4ed;
  --badge-active-text: #2c4f6b;
  --focus-ring: rgba(61,107,142,0.15);

  /* Milestone colors */
  --milestone-pp: #22c55e;
  --milestone-mid: #3b82f6;
  --milestone-1st: #f59e0b;
  --milestone-final: #ef4444;
}

/* Classic (original) theme — toggle via JS */
:root.theme-classic {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --bg: #f8fafc;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --accent-hover: #d97706;
  --grid-border: #cbd5e1;
  --cell-hover: #eff6ff;
  --cell-mine: #dbeafe;
  --toggle-bg: #cbd5e1;
  --badge-active-bg: #dbeafe;
  --badge-active-text: #1e40af;
  --focus-ring: rgba(59,130,246,0.15);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary-light);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* --- Layout --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding: 2rem 0;
}

/* --- Header --- */
.site-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 0.4rem 0;
  box-shadow: var(--shadow);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.site-header h1 a {
  color: #fff;
  text-decoration: none;
}

.site-header h1 span {
  color: var(--accent-light);
}

.site-logo {
  height: 40px;
  vertical-align: middle;
  margin-right: 0.5rem;
  border-radius: 4px;
  padding: 2px;
  transform: scale(1.65);
  transform-origin: center;
}

/* --- Header Buttons --- */
.header-btn {
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  background: transparent;
  font-size: 0.78rem;
}

.header-btn:hover {
  background: rgba(255,255,255,0.15);
}

.bmc-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.4);
  font-weight: 600;
}

.bmc-btn:hover {
  background: rgba(255,255,255,0.22);
  color: #fff;
  text-decoration: none;
}

.bmc-nudge {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* --- Footer --- */
.site-footer {
  text-align: center;
  padding: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.site-footer .footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-legal {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.8;
}

.footer-legal a {
  color: var(--text-muted);
  text-decoration: underline;
}

.footer-legal a:hover {
  color: var(--primary);
}

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.theme-toggle-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 1rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #16a34a;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 0.75rem 1.75rem;
  font-size: 1.1rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.form-group .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-input::placeholder {
  color: #94a3b8;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* Toggle switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--toggle-bg);
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

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

/* --- Landing Page --- */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.hero h2 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
}

.action-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 700px;
  margin: 2rem auto 0;
}

.action-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.action-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-lg);
}

.action-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.action-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.join-input-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.join-input-row .form-input {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  text-align: center;
}

/* --- Rules Section --- */
.rules-section {
  max-width: 700px;
  margin: 2.5rem auto 0;
}

.rules-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.rule-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}

.rule-item .rule-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* --- Create Page --- */
.create-form {
  max-width: 600px;
  margin: 0 auto;
}

.create-form .card {
  margin-bottom: 1.25rem;
}

.create-form .card h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--primary-dark);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.team-axis-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  margin-top: 0.5rem;
}

/* --- Success Modal / Share Screen --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.modal h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.game-code-display {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--primary);
  background: #f1f5f9;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  display: inline-block;
  margin: 0.75rem 0;
  font-family: 'Courier New', monospace;
}

.share-url {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  word-break: break-all;
  margin: 0.75rem 0;
}

.modal .btn + .btn {
  margin-left: 0.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* --- Game Board Page --- */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.game-header h2 {
  font-size: 1.3rem;
  color: var(--primary-dark);
}

.game-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.game-meta .badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
}

.badge-open {
  background: #dcfce7;
  color: #166534;
}

.badge-locked {
  background: #fef3c7;
  color: #92400e;
}

.badge-active {
  background: var(--badge-active-bg);
  color: var(--badge-active-text);
}

.badge-completed {
  background: #f1f5f9;
  color: #475569;
}

/* --- Join Form --- */
.join-section {
  max-width: 400px;
  margin: 0 auto 1.5rem;
}

/* --- Grid Board --- */
.grid-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -1rem;
  padding: 0 1rem;
}

.grid-container {
  display: inline-block;
  min-width: fit-content;
}

.grid-team-label-top {
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 0.25rem;
  padding-left: 60px;
}

.grid-team-label-left {
  writing-mode: vertical-lr;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
}

.board-layout {
  display: flex;
  gap: 0;
}

.board-grid {
  display: grid;
  grid-template-columns: 60px repeat(10, 1fr);
  grid-template-rows: 40px repeat(10, 1fr);
  gap: 1px;
  background: var(--grid-border);
  border: 2px solid var(--grid-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.grid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  min-width: 55px;
  min-height: 55px;
  font-size: 0.75rem;
  text-align: center;
  padding: 2px;
  position: relative;
  user-select: none;
  transition: background 0.15s;
}

.grid-cell-header {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  min-height: 40px;
}

.grid-cell-corner {
  background: var(--primary-dark);
  min-height: 40px;
}

.grid-cell-row-header {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.grid-cell-empty {
  cursor: pointer;
}

.grid-cell-empty:hover {
  background: var(--cell-hover);
}

.grid-cell-claimed {
  background: #f1f5f9;
  cursor: default;
}

.grid-cell-mine {
  background: var(--cell-mine);
  border: 2px solid var(--primary-light);
}

.grid-cell-winner {
  font-weight: 700;
  color: #fff;
  animation: pulse-winner 1.5s ease-in-out 2;
}

@keyframes pulse-winner {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.cell-player-name {
  font-size: 0.65rem;
  line-height: 1.2;
  word-break: break-word;
  max-height: 100%;
  overflow: hidden;
}

.cell-winner-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 3px;
  color: #fff;
}

/* --- Host Controls --- */
.host-controls {
  margin-bottom: 1.5rem;
}

.host-controls .card {
  border-left: 4px solid var(--accent);
}

.host-controls h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--primary-dark);
}

/* --- Milestone Scoring Panel --- */
.milestone-panel {
  margin-top: 1.5rem;
}

.milestone-card {
  border-left: 4px solid var(--border);
  margin-bottom: 0.75rem;
  padding: 1rem 1.25rem;
}

.milestone-card.completed {
  opacity: 0.85;
}

.milestone-card h4 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.milestone-card h4 .milestone-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.milestone-score-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.milestone-score-row .form-group {
  flex: 1;
  min-width: 120px;
  margin-bottom: 0;
}

.milestone-result {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
}

/* --- Player Stats --- */
.player-stats {
  margin-top: 1.5rem;
}

.player-stats h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.player-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
}

.player-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.player-chip-count {
  background: var(--primary);
  color: #fff;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* --- Results Table --- */
.results-section {
  margin-top: 1.5rem;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.results-table th,
.results-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.results-table th {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.results-table .winner-cell {
  font-weight: 700;
  color: var(--primary);
}

/* --- Toast Notification --- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  background: var(--text);
  color: #fff;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  z-index: 200;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  white-space: nowrap;
}

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

.toast-success {
  background: #166534;
}

.toast-error {
  background: var(--danger);
}

/* --- Loading Spinner --- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-dark {
  border-color: rgba(0,0,0,0.1);
  border-top-color: var(--primary);
}

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

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero h2 {
    font-size: 1.5rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .action-cards {
    grid-template-columns: 1fr;
  }

  .matches-grid {
    grid-template-columns: 1fr;
  }

  .rules-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .game-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .grid-cell {
    min-width: 44px;
    min-height: 44px;
    font-size: 0.65rem;
  }

  .grid-cell-header,
  .grid-cell-row-header {
    font-size: 0.8rem;
  }

  .board-grid {
    grid-template-columns: 44px repeat(10, 1fr);
    grid-template-rows: 34px repeat(10, 1fr);
  }

  .modal {
    padding: 1.5rem;
  }

  .game-code-display {
    font-size: 1.75rem;
  }

  .milestone-score-row {
    flex-direction: column;
  }

  .milestone-score-row .form-group {
    min-width: 100%;
  }

  .player-list {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Percentage Total Display --- */
.pct-total {
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: #f1f5f9;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.75rem;
}

.pct-total.pct-exact {
  background: #dcfce7;
  color: #166534;
}

.pct-total.pct-over {
  background: #fef2f2;
  color: #991b1b;
}

/* --- Winnings Summary --- */
.winnings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.winnings-row:last-child {
  border-bottom: none;
}

.winnings-name {
  font-weight: 600;
}

.winnings-amount {
  font-weight: 700;
  color: var(--success);
  font-size: 1.05rem;
}

/* --- Matches Section (Landing Page) --- */
.matches-section {
  max-width: 700px;
  margin: 2rem auto 0;
}

.matches-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.matches-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  transition: box-shadow 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.match-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.match-card-live {
  border-left: 4px solid var(--danger);
}

.match-card-result {
  opacity: 0.75;
}

.match-card-header {
  display: flex;
  justify-content: flex-end;
}

.match-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.match-status-badge.badge-live {
  background: var(--danger);
  color: #fff;
  animation: pulse-live 1.5s ease-in-out infinite;
}

.match-status-badge.badge-upcoming {
  background: #dcfce7;
  color: #166534;
  text-transform: none;
  font-weight: 600;
}

.match-status-badge.badge-result {
  background: #f1f5f9;
  color: #64748b;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.match-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.match-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.match-team-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.match-team-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}

.match-vs {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.match-score {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}

.match-status-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}

.match-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  align-self: center;
}

.match-action:hover {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}

/* --- Legal Pages --- */
.legal-page {
  max-width: 720px;
  margin: 0 auto;
}

.legal-page h2 {
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin-bottom: 0.25rem;
}

.legal-page .legal-updated {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.legal-page h3 {
  font-size: 1rem;
  color: var(--primary-dark);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.legal-page p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.legal-page ul {
  margin: 0.5rem 0 0.75rem 1.5rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
}

.legal-page ul li {
  margin-bottom: 0.35rem;
}

.legal-page a {
  color: var(--primary-light);
}

/* --- Feedback Modal --- */
.modal textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.modal .form-group {
  text-align: left;
}

@media (max-width: 480px) {
  .container {
    padding: 0 0.75rem;
  }

  .card {
    padding: 1rem;
  }

  .grid-cell {
    min-width: 38px;
    min-height: 38px;
  }

  .board-grid {
    grid-template-columns: 38px repeat(10, 1fr);
    grid-template-rows: 30px repeat(10, 1fr);
  }

  .cell-player-name {
    font-size: 0.55rem;
  }

  .player-list {
    grid-template-columns: 1fr;
  }
}
