* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --red: #ffa600;
  --red2: #e74c3c;
  --gold: #e8a020;
  --gold2: #f0b429;
  --bg: #0d0d0d;
  --bg2: #161616;
  --bg3: #1e1e1e;
  --bg4: #252525;
  --text: #f5f0e8;
  --text2: #c8b99a;
  --text3: #8a7a66;
  --border: #2e2e2e;
  --border2: #3a3a3a;
  --topbar-bg: #0a0a0a;
  transition: background 0.25s, color 0.25s;
}

/* ── Tema Navy Kontras ── */
:root.navy-contrast {
  --red: #75c5f0;
  --red2: #2aa3df;
  --gold: #a0d8f5;
  --gold2: #c5e8fa;
  --bg: #0d1b2a;
  --bg2: #12273c;
  --bg3: #183045;
  --bg4: #1f3e58;
  --text: #ffffff;
  --text2: #c0ddf0;
  --text3: #7aadca;
  --border: #1e3550;
  --border2: #284868;
  --topbar-bg: #08111a;
  
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  min-height: 100vh;
  padding: 0;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--topbar-bg);
  border-bottom: 2px solid var(--red);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.topbar-sub {
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 1px;
}

/* ── Language Toggle ── */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text2);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.1s;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

.lang-toggle:hover {
  border-color: var(--red);
  color: var(--text);
  background: var(--bg4);
}

.lang-toggle:active {
  transform: scale(0.95);
}

.lang-flag {
  font-size: 14px;
  line-height: 1;
}

.lang-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--red);
}

.tab-bar {
  display: flex;
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text3);
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: 0.15s;
}

.tab-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.tab-btn:hover:not(.active) {
  border-color: var(--text3);
  color: var(--text2);
}

.week-nav {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  overflow-x: auto;
  white-space: nowrap;
}

.week-nav-inner {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
}

.week-dot-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: 0.15s;
  background: transparent;
  border: none;
}

.week-dot-btn:hover .wlabel { color: var(--text2); }
.week-dot-btn.active .wlabel { color: var(--red); }
.week-dot-btn.active .wdot { background: var(--red); }

.wlabel {
  font-size: 10px;
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border2);
  transition: 0.15s;
}

.week-connector {
  width: 28px;
  height: 1px;
  background: var(--border);
  align-self: flex-end;
  margin-bottom: 8px;
}

.main-panel {
  display: flex;
  flex: 1;
  gap: 0;
  overflow: hidden;
}

.schedule-panel,
.standings-panel,
.playoff-panel {
  overflow-y: auto;
}

.schedule-panel {
  flex: 1;
  min-width: 0;
  border-right: 1px solid var(--border);
  max-height: calc(100vh - 110px);
}

.standings-panel {
  flex: 1.4;
  min-width: 0;
  max-height: calc(100vh - 110px);
}

.playoff-panel {
  width: 100%;
  border-top: 2px solid var(--red);
  overflow-x: auto;
}

.panel-header {
  background: var(--bg2);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 5;
}

.panel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.act-btn {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text3);
  padding: 5px 12px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.act-btn:hover {
  border-color: var(--text2);
  color: var(--text);
}

.act-btn.danger {
  border-color: #6b1a1a;
  color: #c0392b;
}

.act-btn.danger:hover {
  background: var(--red);
  color: #fff;
}

.dl-btn {
  border-color: #1a3a1a;
  color: var(--red);
  font-size: 11px;
  padding: 5px 11px;
  gap: 2px;
  transition: border-color 0.15s, background 0.15s, color 0.15s, opacity 0.15s;
}

.dl-btn:hover {
  border-color: var(--red);
  background: rgba(111,207,58,0.1);
  color: var(--red);
}

.dl-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
.dl-spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid rgba(111,207,58,0.25);
  border-top-color: #6fcf3a;
  border-radius: 50%;
  animation: dl-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 5px;
  flex-shrink: 0;
}

@keyframes dl-spin {
  to { transform: rotate(360deg); }
}

.schedule-content {
  padding: 12px;
}

.day-section { margin-bottom: 20px; }

.day-header {
  padding: 6px 12px;
  margin-bottom: 8px;
  border-left: 3px solid var(--red);
  background: transparent;
}

.day-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.match-card {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.match-teams {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.team-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  padding: 4px 10px 4px 6px;
  border-radius: 3px;
  min-width: 0;
  flex-shrink: 1;
}

.team-chip img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 50%;
  background: transparent;
  padding: 1px;
  flex-shrink: 0;
}

.team-chip span {
  font-weight: 700;
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vs-badge {
  font-size: 10px;
  font-weight: 800;
  color: var(--red);
  background: transparent;
  padding: 2px 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.score-wrap { flex-shrink: 0; }

.score-sel {
  background: #1e1e1e;
  border: 1px solid var(--gold2);
  color: var(--gold2);
  font-weight: 800;
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-family: monospace;
  width: 76px;
  text-align: center;
}

.score-sel:hover,
.score-sel:focus {
  border-color: var(--red);
  color: var(--red);
  outline: none;
}

.score-sel option {
  background: #1e1e1e;
  color: var(--gold);
}

.standings-content { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

thead tr {
  background: var(--bg2);
  border-bottom: 2px solid var(--red);
}

th {
  padding: 12px 10px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text);
  font-weight: 700;
}

th:nth-child(2) { text-align: left; }

td {
  padding: 8px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

td:nth-child(2) { text-align: left; }

tbody tr:hover { background: rgba(255,255,255,0.03); }

.rank-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 12px;
  background: var(--bg4);
  color: var(--text3);
}

.rank-cell.r1 { background: var(--gold); color: #1a1000; }
.rank-cell.r2 { background: #4a4a4a; color: #ddd; }
.rank-cell.r3 { background: #3d2a10; color: #c8944a; }

.team-cell-inner {
  display: flex;
  align-items: center;
  gap: 6px;
}

.team-cell-inner img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--bg4);
  padding: 2px;
}

.team-name-s { font-weight: 700; font-size: 12px; }
.mp-val { font-weight: 800; color: var(--red); font-size: 14px; }
.ng-pos { color: #ffa600; font-weight: 700; }
.ng-neg { color: var(--red); font-weight: 700; }
.top-row { background: rgba(74,222,128,0.04); }
.bot-row { background: rgba(192,57,43,0.06); }

th:first-child,
td:first-child {
  width: 40px;
  padding-left: 6px;
  padding-right: 6px;
}

th:nth-child(2),
td:nth-child(2) { padding-left: 4px; }

.week-group-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 12px;
  background: #1a0606;
  border: 1px solid #3a1010;
  border-radius: 3px;
  margin-bottom: 8px;
  display: inline-block;
}

#teamFilter {
  background: var(--bg3);
  color: var(--red);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 4px;
  outline: none;
  font-size: 12px;
}

#teamFilter option {
  background: var(--bg3);
  color: var(--red);
}

.current-week {
  background: linear-gradient(90deg, #ffa600, #ff7b00);
  color: #000;
  border-color: #ffa600;
  box-shadow: 0 0 0 1px rgba(255,166,0,0.4);
}

.current-badge {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 2px 6px;
  margin-left: 6px;
  border-radius: 3px;
  background: #000;
  color: #ffa600;
  border: 1px solid rgba(255,166,0,0.4);
  vertical-align: middle;
}

.nav-current .wdot {
  background: #ffa600;
  box-shadow: 0 0 6px rgba(255,166,0,0.6);
}

.nav-current-badge {
  font-size: 7px;
  margin-left: 4px;
  padding: 1px 4px;
  border-radius: 2px;
  background: #ffa600;
  color: #000;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.chance-bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 90px;
}

.chance-bar-bg {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border2);
  overflow: hidden;
}

.chance-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.chance-pct {
  font-size: 11px;
  font-weight: 700;
  min-width: 34px;
  text-align: right;
}

/* ══════════════════════════════════════════════════════════
   SCHEDULE DOWNLOAD MODAL
══════════════════════════════════════════════════════════ */

.sched-dl-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sched-dl-modal.visible {
  opacity: 1;
  pointer-events: all;
}

.sched-dl-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-top: 2px solid var(--red);
  border-radius: 10px;
  width: 420px;
  max-width: calc(100vw - 32px);
  padding: 0;
  overflow: hidden;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 166, 0, 0.08);
}

.sched-dl-modal.visible .sched-dl-box {
  transform: translateY(0) scale(1);
}

.sched-dl-header {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg3);
}

.sched-dl-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 2px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sched-dl-title-icon {
  font-size: 16px;
  line-height: 1;
}

.sched-dl-week-tag {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(255, 166, 0, 0.15);
  color: var(--red);
  border: 1px solid rgba(255, 166, 0, 0.3);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sched-dl-close {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text3);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s;
  flex-shrink: 0;
  line-height: 1;
}

.sched-dl-close:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(255, 166, 0, 0.08);
}

.sched-dl-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sched-dl-subtitle {
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}

.sched-dl-opt-btn {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 7px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  text-align: left;
  color: var(--text);
}

.sched-dl-opt-btn:hover {
  border-color: var(--red);
  background: var(--bg4);
  transform: translateX(2px);
}

.sched-dl-opt-btn:active {
  transform: translateX(2px) scale(0.99);
}

.sched-dl-opt-btn:first-child {
  border-color: rgba(255, 166, 0, 0.35);
  background: rgba(255, 166, 0, 0.04);
}

.sched-dl-opt-btn:first-child:hover {
  border-color: var(--red);
  background: rgba(255, 166, 0, 0.1);
}

.sched-dl-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.sched-dl-opt-btn span:nth-child(2) {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.sched-dl-sub {
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   SCHEDULE DOWNLOAD LOADING OVERLAY
══════════════════════════════════════════════════════════ */

.sched-dl-loading {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  gap: 16px;
}

.sched-dl-loading.visible {
  opacity: 1;
  pointer-events: all;
}

.sched-dl-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 166, 0, 0.15);
  border-top-color: #ffa600;
  border-radius: 50%;
  animation: dl-spin 0.75s linear infinite;
}

.sched-dl-loading-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.sched-dl-loading-bar {
  width: 160px;
  height: 3px;
  background: var(--border2);
  border-radius: 2px;
  overflow: hidden;
}

.sched-dl-loading-bar-fill {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #ffa600, #ff7b00);
  border-radius: 2px;
  animation: sched-loading-pulse 1.2s ease-in-out infinite;
}

@keyframes sched-loading-pulse {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ══════════════════════════════════════════════════════════
   TUTORIAL MODAL
══════════════════════════════════════════════════════════ */

.tutorial-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.6);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:9999;
}

.tutorial-box{
  background:var(--bg);
  padding:20px;
  border-radius:12px;
  width:340px;
  max-width:90%;
  border:2px solid var(--red);
}

.tutorial-box h3 {
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--red);
  letter-spacing: 1px;
}

.tutorial-box ul {
  padding-left: 18px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tutorial-box li {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
}

.tutorial-box button{
  margin-top:10px;
  display:block;
  margin-left:auto;
  padding:6px 14px;
}

/* Mobile */
@media (max-width: 700px) {
  .main-panel {
    flex-direction: column;
  }

  .schedule-panel,
  .standings-panel {
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .schedule-panel.hidden,
  .standings-panel.hidden,
  .playoff-panel.hidden {
    display: none;
  }

  .topbar-title { font-size: 12px; }

  .dl-btn span:not(.dl-spinner) {
    display: none;
  }

  .sched-dl-opt-btn {
    padding: 10px 12px;
    gap: 10px;
  }
}

@media (min-width: 701px) {
  .tab-bar { display: none; }

  .schedule-panel,
  .standings-panel,
  .playoff-panel {
    display: block !important;
  }
}
