:root {
  --navy: #1b1f40;
  --teal: #008ca8;
  --red: #ec2f23;
  --gold: #d4920a;
  --bg: #edf1f8;
  --surface: #ffffff;
  --border: #d8dce8;
  --text: #1b1f40;
  --muted: #687798;
  --ok: #0d8a64;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  margin: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(circle at 10% 0%, #f7f8fc 0, #edf1f8 40%, #e8edf7 100%);
  color: var(--text);
  font-family: Cairo, sans-serif;
}

.mode-fade-enter-active,
.mode-fade-leave-active {
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.mode-fade-enter-from,
.mode-fade-leave-to {
  opacity: 0;
  transform: translateY(8px);
}

.app-shell {
  min-height: 100vh;
}

.hidden-file-input {
  display: none;
}

.masthead {
  position: relative;
  background: linear-gradient(120deg, rgba(27, 31, 64, 0.05) 0%, rgba(0, 140, 168, 0.04) 100%), var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 12px 24px rgba(27, 31, 64, 0.08);
}

.masthead::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--navy) 0 33%, var(--teal) 33% 66%, var(--red) 66% 100%);
}

.masthead-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 24px 28px 26px;
}

.masthead-brand {
  display: grid;
  gap: 8px;
}

.masthead-logo {
  display: block;
  width: min(420px, 68vw);
  height: auto;
  object-fit: contain;
}

.masthead-title {
  margin: 0;
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: 0.6px;
}

.masthead-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.masthead-controls {
  display: grid;
  gap: 10px;
  justify-items: end;
  min-width: 360px;
}

.controls-grid {
  display: grid;
  gap: 8px;
}

.controls-popup-anchor {
  position: relative;
  width: fit-content;
}

.control-toggle-row {
  display: flex;
  justify-content: flex-end;
}

.control-toggle-btn {
  border: 1px solid #cfd6e7;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
  border-radius: 12px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #445478;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(27, 31, 64, 0.08);
}

.control-toggle-btn:hover {
  background: linear-gradient(180deg, #f0f6ff 0%, #e6f0ff 100%);
}

.control-toggle-meta {
  font-family: "IBM Plex Mono", monospace;
  color: #6c7a97;
  font-size: 11px;
}

.controls-popover {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 270px;
  z-index: 30;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 14px 28px rgba(27, 31, 64, 0.12);
}

.controls-reveal-enter-active,
.controls-reveal-leave-active {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.controls-reveal-enter-from,
.controls-reveal-leave-to {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
}

.control-box {
  display: grid;
  gap: 4px;
}

.control-label {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: #6b7a99;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.language-switcher {
  display: inline-flex;
  border: 1px solid #cfd6e7;
  background: #f2f6fc;
  border-radius: 12px;
  padding: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.lang-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 13px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.lang-btn.active {
  background: var(--navy);
  color: #fff;
}

.live-badge {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--red);
  font-size: 12px;
}

.server-time {
  color: var(--muted);
  font-size: 12px;
}

.tab-bar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(140px, 1fr);
  overflow-x: auto;
  background: var(--navy);
  box-shadow: 0 8px 18px rgba(27, 31, 64, 0.25);
  margin-bottom: 12px;
}

.tab-btn {
  border: 0;
  border-inline-end: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: rgba(255, 255, 255, 0.64);
  padding: 16px 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.tab-btn.active {
  color: #fff;
  background: rgba(236, 47, 35, 0.2);
  box-shadow: inset 0 -3px 0 var(--red);
}

.mode-switcher .lang-btn {
  min-width: 88px;
}

.page-content {
  padding: 24px;
}

.panel {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 20px rgba(27, 31, 64, 0.08);
  animation: panel-fade-in 0.28s ease;
}

.panel-heading h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 800;
}

.panel-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  margin-bottom: 14px;
}

.panel-actions.compact {
  margin-top: 10px;
  margin-bottom: 10px;
}

.admin-head-panel {
  margin-bottom: 12px;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-head h2 {
  margin: 0;
}

.admin-head .muted {
  margin-top: 6px;
}

.admin-settings-row {
  margin-top: 10px;
}

.live-settings-card {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  padding: 12px;
}

.live-settings-head h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.live-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.live-settings-row {
  margin-top: 10px;
}

.inline-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
}

.switch-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.admin-tab-bar {
  margin-bottom: 12px;
}

.admin-login-panel {
  max-width: 560px;
}

.admin-login-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-top: 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 0.8fr auto;
  gap: 8px;
  margin-top: 14px;
  margin-bottom: 14px;
}

.group-setup-form {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.admin-summary-grid {
  margin-top: 14px;
  margin-bottom: 8px;
}

.action-stack {
  display: grid;
  gap: 8px;
}

.btn {
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

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

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

.btn-danger {
  background: #fff6f5;
  color: var(--red);
  border-color: var(--red);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: #c5ccdd;
}

.btn.light {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.btn.light.active {
  background: #fff;
  border-color: #fff;
  color: #0f1a41;
}

.btn-success {
  background: #eefaf6;
  border-color: var(--ok);
  color: var(--ok);
}

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

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

.btn-xs {
  padding: 6px 8px;
  font-size: 11px;
  border-radius: 8px;
}

.btn-ai {
  background: linear-gradient(135deg, #111a4a 0%, #1b4f9c 50%, #00a4c3 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 14px rgba(0, 88, 168, 0.25);
}

.hint-box {
  margin-bottom: 16px;
  background: #f3fbfe;
  border-inline-start: 4px solid var(--teal);
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 600;
  color: #18455a;
}

.hint-box.danger {
  background: #fff5f5;
  border-inline-start-color: var(--red);
  color: #6f1f1a;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.summary-card h3 {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.summary-value {
  margin: 4px 0;
  font-size: 36px;
  font-family: "Bebas Neue", sans-serif;
}

.summary-status {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.summary-status.ok {
  color: var(--ok);
}

.summary-status.warn {
  color: var(--red);
}

.view-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.view-group-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(27, 31, 64, 0.06);
  animation: fade-up 0.26s ease both;
}

.view-group-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #e7ebf4;
  background: linear-gradient(180deg, #f8fbff 0%, #f1f6ff 100%);
}

.view-group-card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.group-a {
  border-top: 4px solid var(--navy);
}

.group-b {
  border-top: 4px solid var(--teal);
}

.group-c {
  border-top: 4px solid var(--red);
}

.group-d {
  border-top: 4px solid var(--gold);
}

.group-u {
  border-top: 4px solid #9aa6c2;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
}

.score-table thead th {
  background: var(--navy);
  color: #d9e8ff;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 12px 10px;
}

.score-table td {
  border-top: 1px solid #e8ecf5;
  padding: 11px 10px;
  text-align: center;
  white-space: nowrap;
}

.row-group-a {
  background: rgba(27, 31, 64, 0.04);
}

.row-group-b {
  background: rgba(0, 140, 168, 0.04);
}

.row-group-c {
  background: rgba(236, 47, 35, 0.04);
}

.row-group-d {
  background: rgba(212, 146, 10, 0.05);
}

.row-group-empty {
  background: rgba(154, 166, 194, 0.08);
}

.score-group-row {
  background: linear-gradient(90deg, var(--score-group-soft, rgba(127, 140, 168, 0.08)) 0%, rgba(255, 255, 255, 0) 100%);
}

.score-group-row td:first-child {
  box-shadow: inset 4px 0 0 var(--score-group-accent, #7f8ca8);
  font-weight: 800;
}

.qualified-row {
  background: linear-gradient(90deg, rgba(0, 140, 168, 0.09), rgba(0, 140, 168, 0.02));
}

.podium-row {
  background: linear-gradient(90deg, rgba(212, 146, 10, 0.12), rgba(212, 146, 10, 0.03));
}

.competitor-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: start;
}

.competitor-cell.compact .competitor-image {
  width: 42px;
  height: 42px;
}

.competitor-image {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #d2dbef;
  background: #eef2f8;
}

.competitor-image.clickable {
  cursor: pointer;
}

.name-edit-grid {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 6px;
}

.name-edit-grid.vertical {
  flex-direction: column;
  align-items: stretch;
}

.players-tools {
  display: grid;
  grid-template-columns: 1.2fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

.players-tools-elevated {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 6px 14px rgba(27, 31, 64, 0.06);
  margin-top: 8px;
  margin-bottom: 14px;
}

.pm-config-card,
.pm-composer-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  box-shadow: 0 8px 16px rgba(27, 31, 64, 0.06);
  padding: 12px;
  margin-bottom: 12px;
}

.pm-config-top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.pm-config-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.pm-composer-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 0.8fr auto;
  gap: 8px;
}

.pm-composer-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.players-sort-box {
  display: grid;
  gap: 4px;
}

.group-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 14px;
}

.group-player-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(27, 31, 64, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.group-player-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(27, 31, 64, 0.1);
}

.group-player-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #e7ebf4;
  background: linear-gradient(180deg, #f8fbff 0%, #f1f6ff 100%);
}

.group-player-card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.pm-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #d5deef;
  color: #344161;
  font-size: 12px;
  font-weight: 700;
}

.group-player-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.group-player-row {
  border: 1px solid #e2e8f5;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  padding: 12px;
}

.group-player-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.group-player-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.name-convert-row {
  margin-top: 10px;
  margin-bottom: 0;
}

.name-convert-row .btn {
  flex: 1;
}

.name-input {
  border: 1px solid #c8d1e5;
  border-radius: 8px;
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
}

select.name-input {
  cursor: pointer;
  background: #fff;
}

.name-input.ar {
  direction: rtl;
}

.name-main {
  margin: 0;
  font-weight: 700;
}

.name-sub {
  margin: 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.group-select {
  border: 1px solid #c8d1e5;
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
}

.stage-filter-bar {
  margin-bottom: 10px;
}

.score-input {
  width: 88px;
  min-height: 40px;
  border: 1px solid #c8d1e5;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  font-size: 16px;
  color: #125773;
  background: #f0fbff;
}

.score-input:focus {
  outline: 2px solid rgba(0, 140, 168, 0.45);
  border-color: #1a9bb4;
}

.score-input:disabled {
  background: #e7ecf5;
  color: #7d87a1;
}

.proof-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.proof-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #c8d1e5;
  cursor: pointer;
}

.proof-mini {
  margin-inline-start: 6px;
  border: 1px solid #c8d1e5;
  background: #fff;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  padding: 0;
  vertical-align: middle;
  cursor: pointer;
}

.proof-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
}

.strong {
  font-weight: 700;
}

.rank {
  font-size: 20px;
  color: var(--gold);
}

.badge.success {
  background: rgba(13, 138, 100, 0.12);
  border: 1px solid rgba(13, 138, 100, 0.4);
  color: var(--ok);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.center {
  text-align: center;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.sub-heading {
  margin: 0 0 10px;
  font-size: 20px;
}

.group-stage {
  margin-top: 12px;
}

.tie-group {
  margin-top: 18px;
}

.tie-score {
  font-size: 12px;
  border: 1px solid rgba(236, 47, 35, 0.4);
  background: rgba(236, 47, 35, 0.08);
  color: var(--red);
  border-radius: 999px;
  padding: 3px 8px;
}

.mt-32 {
  margin-top: 32px;
}

.live-panel {
  background: radial-gradient(circle at 15% 10%, #1a2653 0%, #101736 55%, #0b1026 100%);
  color: #fff;
  min-height: 70vh;
  position: relative;
  padding-top: 72px;
}

.live-corner {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  z-index: 2;
}

.live-title {
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  color: #f1cf7a;
}

.live-subtitle {
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
  margin: 8px 0 18px;
}

.group-select {
  border: 1px solid #c8d1e5;
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--text);
}

.live-top-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 8px;
  backdrop-filter: blur(5px);
}

.live-group-select {
  min-width: 130px;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
}

.live-group-select option {
  color: #0f1a41;
}

.live-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.live-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px;
  animation: fade-up 0.4s ease;
}

.live-image {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 3px solid #3ec8e0;
  object-fit: cover;
}

.live-number {
  margin: 0;
  color: #84e4f7;
  font-family: "IBM Plex Mono", monospace;
}

.live-name-primary {
  margin: 4px 0 2px;
  font-weight: 800;
  font-size: 20px;
}

.live-name-secondary {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.live-progress {
  margin-top: 16px;
  height: 5px;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red), #f66f67);
  animation: progress-5s linear;
}

.empty-state {
  text-align: center;
  padding: 30px 10px;
  color: var(--muted);
  font-weight: 700;
}

.empty-state.good {
  color: var(--ok);
}

.live-mode-shell {
  position: relative;
  min-height: 72vh;
  border-radius: 18px;
  overflow: hidden;
  background-image: url('/bg_live.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 16px 38px rgba(7, 19, 42, 0.24);
}

.live-mode-overlay {
  min-height: 72vh;
  padding: 16px;
  background: linear-gradient(135deg, rgba(7, 18, 43, 0.72) 0%, rgba(9, 27, 56, 0.6) 45%, rgba(12, 30, 68, 0.66) 100%);
}

.live-mode-header h2 {
  margin: 0;
  color: #f8d78b;
  font-size: clamp(22px, 3vw, 34px);
}

.live-mode-header p {
  margin: 6px 0 12px;
  color: rgba(240, 248, 255, 0.84);
  font-weight: 600;
}

.live-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.live-mode-grid.single {
  grid-template-columns: 1fr;
}

.live-screen-card {
  border: 1px solid rgba(200, 223, 255, 0.28);
  border-radius: 14px;
  background: rgba(8, 16, 38, 0.62);
  box-shadow: 0 8px 18px rgba(7, 19, 42, 0.18);
  backdrop-filter: blur(3px);
  padding: 10px;
  animation: fade-up 0.32s ease both;
}

.live-screen-card.wide {
  grid-column: span 2;
}

.live-swap-block {
  display: grid;
  gap: 10px;
}

.live-focus-banner {
  border: 1px solid rgba(168, 205, 242, 0.4);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(16, 32, 72, 0.86) 0%, rgba(11, 27, 60, 0.84) 100%);
  padding: 10px 14px;
  display: grid;
  gap: 2px;
  text-align: center;
  box-shadow: 0 8px 18px rgba(7, 19, 42, 0.28);
}

.live-focus-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.9px;
  color: rgba(201, 224, 248, 0.82);
  text-transform: uppercase;
}

.live-focus-title {
  font-family: "Bebas Neue", "Cairo", sans-serif;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 0.95;
  letter-spacing: 1.2px;
  color: #f6d68a;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.live-focus-banner.focus-a .live-focus-title {
  color: #98c4ff;
}

.live-focus-banner.focus-b .live-focus-title {
  color: #8de6ff;
}

.live-focus-banner.focus-c .live-focus-title {
  color: #ffad9d;
}

.live-focus-banner.focus-d .live-focus-title {
  color: #ffd98f;
}

.live-focus-banner.focus-u .live-focus-title {
  color: #d9e3f2;
}

.live-focus-banner.focus-final .live-focus-title {
  color: #f9e3a1;
}

.live-screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.live-head-selection {
  margin-bottom: 10px;
}

.live-screen-head h3 {
  margin: 0;
  color: #eaf4ff;
  font-size: 17px;
}

.live-chip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.live-chip {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(130, 187, 230, 0.38);
  background: rgba(27, 39, 75, 0.72);
  color: #cae9ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.live-chip.strong {
  border-color: rgba(255, 214, 124, 0.4);
  color: #ffd67c;
}

.live-swap-enter-active,
.live-swap-leave-active {
  transition: opacity 0.34s ease, transform 0.34s ease, filter 0.34s ease;
}

.live-swap-enter-from {
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  filter: blur(2px);
}

.live-swap-leave-to {
  opacity: 0;
  transform: translateY(-8px) scale(0.99);
  filter: blur(1px);
}

.multi-round-cell {
  min-width: 98px;
}

.score-input-compact {
  width: 84px;
  min-height: 36px;
  padding: 7px 8px;
  font-size: 14px;
}

.mobile-round-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}

.mobile-round-item {
  display: grid;
  gap: 4px;
}

.mobile-total-line {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.verify-round-cell {
  min-width: 210px;
  vertical-align: top;
}

.verify-round-list {
  display: grid;
  gap: 6px;
}

.verify-round-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
}

.verify-round-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.mobile-verify-block {
  margin-top: 10px;
  border-top: 1px dashed #d8e1f2;
  padding-top: 8px;
}

.mobile-verify-title {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.verify-round-list.mobile .verify-round-item {
  grid-template-columns: 1fr;
  justify-items: stretch;
}

.verify-round-list.mobile .btn,
.verify-round-list.mobile .proof-thumb {
  width: 100%;
}

.verify-round-list.mobile .proof-thumb {
  height: auto;
  aspect-ratio: 16 / 10;
}

.live-score-table thead th {
  background: linear-gradient(90deg, #11254a 0%, #124665 100%);
}

.live-screen-card .score-table td {
  color: #f2f8ff;
  border-top-color: rgba(158, 186, 216, 0.22);
}

.live-screen-card .name-sub,
.live-screen-card .muted {
  color: rgba(213, 232, 255, 0.72);
}

.live-screen-card .table-wrap {
  border-color: rgba(158, 186, 216, 0.28);
  background: rgba(11, 24, 49, 0.65);
}

.live-screen-card .qualified-row {
  background: linear-gradient(90deg, rgba(16, 160, 194, 0.24), rgba(16, 160, 194, 0.06));
}

.live-podium {
  margin-top: 60px;
  height: 390px;
}

.podium-live-card .podium-col {
  background: linear-gradient(180deg, rgba(12, 23, 52, 0.95) 0%, rgba(9, 19, 43, 0.95) 100%);
  border: 1px solid rgba(177, 205, 236, 0.26);
  box-shadow: 0 16px 30px rgba(2, 10, 25, 0.45);
  min-width: 0;
}

.podium-live-card .podium-col.pos-1 {
  border-top: 8px solid #e7c45f;
  background: linear-gradient(180deg, rgba(48, 38, 15, 0.95) 0%, rgba(18, 24, 48, 0.96) 100%);
  height: 330px;
}

.podium-live-card .podium-col.pos-2 {
  border-top: 8px solid #b8c3d7;
  background: linear-gradient(180deg, rgba(37, 44, 62, 0.95) 0%, rgba(12, 20, 43, 0.96) 100%);
  height: 260px;
}

.podium-live-card .podium-col.pos-3 {
  border-top: 8px solid #cf8b45;
  background: linear-gradient(180deg, rgba(59, 36, 23, 0.95) 0%, rgba(14, 22, 45, 0.96) 100%);
  height: 240px;
}

.podium-live-card .podium-name {
  color: #f2f8ff;
}

.podium-live-card .podium-name.empty {
  color: rgba(204, 220, 240, 0.78);
}

.podium-live-card .podium-score {
  background: rgba(255, 255, 255, 0.08);
  color: #ffd888;
  border-color: rgba(255, 255, 255, 0.18);
  margin-bottom: 0;
}

.podium-live-card .podium-medal-icon {
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}

.podium-panel {
  background: #f0f2f8;
}

.podium-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 380px;
  margin-top: 96px;
  gap: 14px;
  padding: 0 12px;
  direction: ltr;
}

.podium-col {
  flex: 1;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 10px 40px rgba(13, 27, 46, 0.1);
  transition: transform 0.25s ease;
}

.podium-col:hover {
  transform: translateY(-4px);
}

.podium-col.pos-1 {
  height: 320px;
  border-top: 8px solid #d4af37;
  background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
  z-index: 3;
  box-shadow: 0 15px 50px rgba(212, 175, 55, 0.2);
}

.podium-col.pos-2 {
  height: 240px;
  border-top: 8px solid #c0c0c0;
  background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
  z-index: 2;
}

.podium-col.pos-3 {
  height: 180px;
  border-top: 8px solid #cd7f32;
  background: linear-gradient(180deg, #fff5e6 0%, #ffffff 100%);
  z-index: 1;
}

.podium-avatar-wrap {
  position: absolute;
  top: -65px;
  left: 50%;
  transform: translateX(-50%);
}

.podium-col.pos-1 .podium-avatar-wrap {
  top: -85px;
}

.podium-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  background: #f0f2f8;
}

.podium-col.pos-1 .podium-img {
  width: 160px;
  height: 160px;
  border: 6px solid #d4af37;
  box-shadow: 0 12px 30px rgba(212, 175, 55, 0.3);
}

.podium-col.pos-2 .podium-img {
  border-color: #c0c0c0;
}

.podium-col.pos-3 .podium-img {
  border-color: #cd7f32;
}

.podium-medal-icon {
  font-size: 46px;
  margin-top: 65px;
  line-height: 1;
}

.podium-col.pos-1 .podium-medal-icon {
  font-size: 64px;
  margin-top: 85px;
}

.podium-name {
  font-family: Cairo, sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--navy);
  margin-top: 10px;
  text-align: center;
  line-height: 1.2;
  padding: 0 10px;
}

.podium-col.pos-1 .podium-name {
  font-size: 28px;
}

.podium-name.empty {
  color: #8896b0;
  font-weight: 600;
  font-size: 20px;
}

.podium-score {
  margin: 0;
  background: rgba(0, 0, 0, 0.04);
  padding: 8px 12px;
  border-radius: 20px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--red);
  border: 1px solid rgba(0, 0, 0, 0.05);
  max-width: 100%;
  width: fit-content;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
  line-height: 1.2;
}

.podium-score-wrap {
  margin-top: auto;
  margin-bottom: 12px;
  width: calc(100% - 16px);
  display: grid;
  gap: 4px;
  justify-items: center;
}

.podium-score-sub {
  margin: 0;
  max-width: 100%;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.podium-live-card .podium-score-sub {
  color: rgba(220, 234, 252, 0.86);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  background: #163f7d;
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  z-index: 20;
}

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

.toast.error {
  background: #9b2a22;
}

.toast.success {
  background: #146e57;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 30, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.auth-modal {
  width: min(92vw, 360px);
  background: #fff;
  border-radius: 14px;
  border-top: 6px solid var(--red);
  padding: 18px;
}

.auth-modal h3 {
  margin: 0 0 6px;
}

.auth-modal p {
  margin: 0 0 12px;
  color: var(--muted);
}

.auth-modal input {
  width: 100%;
  border: 1px solid #c8d1e5;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}

.auth-error {
  color: var(--red);
  font-weight: 700;
}

.auth-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.loading-state {
  min-height: 46vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(0, 140, 168, 0.2);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.desktop-score-table {
  display: block;
}

.mobile-score-cards {
  display: none;
}

.score-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  margin-bottom: 10px;
}

.score-group-card {
  border-color: var(--score-group-border, var(--border));
  background: linear-gradient(140deg, var(--score-group-soft, rgba(127, 140, 168, 0.08)) 0%, #ffffff 72%);
  box-shadow: 0 8px 18px rgba(27, 31, 64, 0.08);
}

.score-group-card .score-card-head {
  border-bottom: 1px dashed var(--score-group-border, #d2daec);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.score-group-card .score-card-meta {
  margin-top: 0;
}

.score-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.score-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0;
}

.score-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 5px;
}

.mobile-proof-actions {
  justify-content: flex-start;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 30, 0.55);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 16px;
}

.modal-card {
  width: min(95vw, 460px);
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 16px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.modal-head h3 {
  margin: 0;
}

.modal-title {
  margin: 0 0 8px;
}

.modal-text {
  margin: 0 0 10px;
  color: var(--text);
}

.modal-text.subtle {
  color: var(--muted);
  font-size: 13px;
}

.modal-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.proof-modal-card {
  width: min(96vw, 920px);
}

.proof-modal-image-wrap {
  margin-top: 10px;
  background: #111;
  border-radius: 10px;
  overflow: hidden;
  max-height: 75vh;
  display: grid;
  place-items: center;
}

.proof-modal-image {
  width: 100%;
  height: auto;
  max-height: 75vh;
  object-fit: contain;
}

.image-crop-modal {
  width: min(96vw, 520px);
}

.crop-canvas-wrap {
  position: relative;
  width: 340px;
  height: 340px;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #d8deec;
  background: #f2f4fb;
}

.crop-canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
  display: block;
  cursor: grab;
}

.crop-canvas:active {
  cursor: grabbing;
}

.crop-circle-guide {
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 999px rgba(10, 18, 44, 0.34);
  pointer-events: none;
}

.crop-controls {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.crop-controls label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.crop-controls input[type="range"] {
  width: 100%;
}

.modal-actions.split {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-advice-modal {
  width: min(98vw, 1100px);
  background: radial-gradient(circle at 15% 0%, #f8fbff 0, #ffffff 35%, #f2f8ff 100%);
}

.ai-advice-modal.compact {
  width: min(96vw, 760px);
}

.ai-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  margin-top: 8px;
}

.ai-modal-body.compact {
  grid-template-columns: minmax(0, 1fr) 290px;
}

.ai-image-wrap {
  position: relative;
  min-height: 320px;
  border: 1px solid #d8deec;
  border-radius: 12px;
  background: #111827;
  overflow: hidden;
}

.ai-modal-body.compact .ai-image-wrap {
  min-height: 250px;
  max-height: 300px;
}

.ai-proof-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ai-marker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ai-marker-dot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border: 2px solid rgba(0, 230, 255, 0.9);
  border-radius: 50%;
  background: rgba(0, 230, 255, 0.18);
  box-shadow: 0 0 12px rgba(0, 230, 255, 0.7);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-info-panel {
  border: 1px solid #d8deec;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  padding: 12px;
}

.ai-loading-state {
  min-height: 220px;
}

.ai-metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ai-metric-card {
  border: 1px solid #dde4f3;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.ai-metric-card.highlight {
  border-color: #67c3ff;
  box-shadow: inset 0 0 0 1px rgba(103, 195, 255, 0.35);
}

.ai-metric-card.single {
  margin-bottom: 8px;
}

.ai-label {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.ai-value {
  margin: 5px 0 0;
  font-size: 28px;
  color: #1d2c55;
}

.ai-confidence {
  margin: 10px 0 8px;
  font-size: 13px;
  color: #2a4d78;
}

.ai-summary {
  margin: 0;
  line-height: 1.45;
  font-size: 13px;
  color: #1b2d49;
}

.ai-model {
  margin: 10px 0 0;
  font-size: 11px;
  color: #6880aa;
}

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

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes panel-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes progress-5s {
  from {
    width: 0%;
  }
  to {
    width: 100%;
  }
}

@media (max-width: 1180px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .page-content {
    padding: 12px;
  }

  .panel {
    padding: 14px;
  }

  .masthead-main {
    flex-direction: column;
    padding: 16px;
  }

  .masthead-logo {
    width: min(360px, 86vw);
  }

  .masthead-controls {
    justify-items: start;
    min-width: 0;
    width: 100%;
  }

  .control-toggle-row {
    width: 100%;
    justify-content: flex-start;
  }

  .controls-popup-anchor {
    width: 100%;
  }

  .controls-popover {
    inset-inline-start: 0;
    inset-inline-end: auto;
    width: 100%;
    min-width: 0;
  }

  .control-toggle-btn {
    width: 100%;
    justify-content: space-between;
  }

  .tab-bar {
    grid-auto-columns: minmax(126px, 1fr);
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .admin-login-grid {
    grid-template-columns: 1fr;
  }

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

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

  .pm-config-top,
  .pm-config-input,
  .pm-composer-grid {
    grid-template-columns: 1fr;
  }

  .pm-composer-actions {
    flex-direction: column;
  }

  .players-tools {
    grid-template-columns: 1fr;
  }

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

  .live-settings-grid,
  .inline-settings {
    grid-template-columns: 1fr;
  }

  .view-group-grid {
    grid-template-columns: 1fr;
  }

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

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

  .live-mode-shell {
    border-radius: 12px;
    min-height: 0;
  }

  .live-mode-overlay {
    padding: 10px;
    min-height: 0;
  }

  .live-mode-grid {
    grid-template-columns: 1fr;
  }

  .live-screen-card.wide {
    grid-column: span 1;
  }

  .live-screen-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-row {
    justify-content: flex-start;
  }

  .live-corner {
    position: static;
    margin-bottom: 10px;
  }

  .live-top-controls {
    justify-content: stretch;
    width: 100%;
  }

  .live-top-controls .btn,
  .live-group-select {
    width: 100%;
  }

  .podium-wrapper {
    height: auto;
    margin-top: 16px;
    padding-top: 8px;
    flex-direction: column;
    align-items: stretch;
  }

  .podium-col {
    max-width: 100%;
    border-radius: 16px;
    min-height: 180px;
    height: auto !important;
    padding-top: 88px;
    padding-bottom: 16px;
  }

  .competitor-image {
    width: 56px;
    height: 56px;
  }

  .score-input {
    width: 100%;
  }

  .proof-actions {
    flex-direction: column;
  }

  .proof-actions .btn {
    width: 100%;
  }

  .modal-actions.split {
    grid-template-columns: 1fr;
  }

  .ai-modal-body {
    grid-template-columns: 1fr;
  }

  .ai-modal-body.compact .ai-image-wrap {
    min-height: 210px;
    max-height: 240px;
  }

  .crop-canvas-wrap {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .ai-marker-dot {
    width: 20px;
    height: 20px;
    font-size: 9px;
  }

  .desktop-score-table {
    display: none;
  }

  .mobile-score-cards {
    display: block;
  }
}
