:root{
  --primary-1:#17233C;
  --primary-2:#0E2356;
  --primary-3:#123D89;
  --bg:#F7F8FA;
  --card:#FFFFFF;
  --border:#E5E7EB;
  --text:#111827;
  --muted:#6B7280;
  --success:#22C55E;
  --warning:#F59E0B;
  --error:#EF4444;
  --info:#3B82F6;
  --nav-h:72px;
  --header-h:64px;
  --radius:16px;
  --shadow:0 8px 22px rgba(17,24,39,.08);
  font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Arial,sans-serif;
}

*{box-sizing:border-box}
html{height:100%;background:var(--bg)}
body{
  margin:0;
  min-height:100%;
  background:var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
img{max-width:100%;display:block}

.app{
  min-height:100vh;
  padding-bottom:calc(var(--nav-h) + env(safe-area-inset-bottom));
}

.view{
  padding:16px;
  padding-bottom:90px;
  max-width:1120px;
  margin:0 auto;
}

/* Splash */
.splash,
#splash{
  position:fixed;
  inset:0;
  background:var(--primary-1);
  color:white;
  z-index:9999;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:24px;
  gap:18px;
}

.splash__logo{
  width:220px;
  max-width:70vw;
  height:auto;
  object-fit:contain;
}

.splash__title{
  color:white;
  font-size:24px;
  font-weight:800;
  line-height:1.3;
  margin:0;
}

.loader{
  width:32px;
  height:32px;
  border:3px solid rgba(255,255,255,.25);
  border-top-color:white;
  border-radius:50%;
  animation:spin .9s linear infinite;
}

@keyframes spin{to{transform:rotate(360deg)}}

#splash.hidden,
#splash[hidden],
.splash.hidden{
  display:none!important;
}

/* Header */
.home-header{
  position:sticky;
  top:0;
  z-index:20;
  height:var(--header-h);
  padding:8px 14px;
  background:var(--primary-1);
  display:flex;
  align-items:center;
  justify-content:space-between;
  box-shadow:0 2px 16px rgba(0,0,0,.15);
}

.home-header__logo{
  height:48px;
  width:auto;
  object-fit:contain;
}

.header-button{
  background:rgba(255,255,255,.12);
  color:white;
  border:1px solid rgba(255,255,255,.22);
  border-radius:999px;
  padding:8px 14px;
  font-weight:700;
}

/* Common */
.section{margin:0 0 22px}
.section__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.section h2{
  font-size:1.08rem;
  margin:0;
  color:var(--primary-1);
}
.muted{color:var(--muted)}
.empty{
  background:white;
  border:1px dashed var(--border);
  border-radius:var(--radius);
  padding:20px;
  text-align:center;
  color:var(--muted);
}
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
  margin:10px 0;
}
.accent-card{border-left:5px solid var(--primary-3)}
.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border-radius:999px;
  padding:5px 9px;
  background:#EEF2FF;
  color:var(--primary-2);
  font-size:.78rem;
  font-weight:700;
}
.badge{
  display:inline-block;
  border-radius:999px;
  background:var(--primary-3);
  color:white;
  padding:4px 8px;
  font-size:.76rem;
  font-weight:800;
}
.button{
  border:0;
  border-radius:12px;
  background:var(--primary-3);
  color:white;
  padding:11px 14px;
  font-weight:800;
}
.button.secondary{background:var(--primary-2)}
.button.ghost{
  background:white;
  color:var(--primary-2);
  border:1px solid var(--border);
}

/* Forms */
.tabs{
  display:flex;
  gap:8px;
  overflow:auto;
  margin:8px 0 14px;
  padding-bottom:2px;
}
.tab{
  border:1px solid var(--border);
  background:white;
  color:var(--primary-1);
  border-radius:999px;
  padding:9px 14px;
  white-space:nowrap;
}
.tab.active{
  background:var(--primary-2);
  color:white;
  border-color:var(--primary-2);
}
.filters{
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
  margin-bottom:12px;
}
.field{
  display:flex;
  flex-direction:column;
  gap:5px;
}
.field label{
  font-size:.78rem;
  font-weight:700;
  color:var(--muted);
}
.field input,
.field select,
.field textarea{
  width:100%;
  border:1px solid var(--border);
  border-radius:12px;
  background:white;
  padding:11px 12px;
  color:var(--text);
}

/* Home emblem strip */
.emblem-strip{
  overflow:hidden;
  background:white;
  border-radius:var(--radius);
  border:1px solid var(--border);
  box-shadow:var(--shadow);
  padding:12px;
}
.emblem-track{
  display:flex;
  gap:18px;
  min-width:max-content;
  animation:marquee 42s linear infinite;
}
.team-emblem-item{
  width:68px;
  height:68px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:0;
  background:transparent;
}
.team-emblem-item .emblem{
  width:64px;
  height:64px;
  object-fit:contain;
  background:transparent;
  border:0;
  border-radius:0;
  margin:0;
}
@keyframes marquee{
  from{transform:translateX(0)}
  to{transform:translateX(-50%)}
}

/* Match card */
.match-card{
  display:grid;
  gap:14px;
}

.match-meta{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  color:var(--muted);
  font-size:.86rem;
}

.match-body{
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:20px;
}

.team-side{
  min-width:0;
  border:0;
  background:transparent;
  box-shadow:none;
  padding:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  cursor:pointer;
}

.team-side:hover,
.team-side:focus,
.team-side:active{
  background:transparent;
  box-shadow:none;
  outline:0;
}

.match-card .team-side .emblem{
  width:96px;
  height:96px;
  object-fit:contain;
  background:transparent;
  border:0;
  border-radius:0;
  margin:0 auto 10px;
  box-shadow:none;
}

.team-info{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
  margin-top:4px;
}

.team-side .team-info{
  flex-direction:column;
  gap:5px;
}

.team-info strong,
.team-side .name{
  color:var(--primary-1);
  font-size:1rem;
  font-weight:800;
  line-height:1.3;
  text-align:center;
}

.team-side .country{
  display:none!important;
}

.vs,
.score{
  font-weight:900;
  color:var(--primary-3);
  font-size:1.35rem;
  white-space:nowrap;
}

.score{
  font-size:1.5rem;
}

.ft{
  background:var(--primary-1);
  color:white;
  border-radius:7px;
  padding:3px 6px;
  font-size:.72rem;
  font-weight:900;
}

/* Goal scorers */
.team-goals{
  margin-top:8px;
  display:flex;
  flex-direction:column;
  gap:4px;
  align-items:center;
}

.team-goals .goal-row{
  display:flex;
  gap:6px;
  justify-content:center;
  align-items:flex-start;
  font-size:.76rem;
  color:var(--muted);
}

.goal-time{
  font-weight:800;
  color:var(--primary-3);
  white-space:nowrap;
}

.goal-player{
  font-size:.74rem;
  line-height:1.25;
}

/* Team cards */
.team-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
.team-card{
  text-align:center;
  margin:0;
}
.team-card .emblem,
.profile-head .emblem{
  width:92px;
  height:92px;
  object-fit:contain;
  background:transparent;
  border:0;
  border-radius:0;
  margin:0 auto 10px;
}
.team-card h3{
  font-size:.95rem;
  margin:8px 0 3px;
  color:var(--primary-1);
}
.team-card p{
  margin:0;
  color:var(--muted);
  font-size:.78rem;
}
.profile-head{text-align:center}

/* Standings */
.standings{
  width:100%;
  border-collapse:collapse;
  background:white;
  border-radius:12px;
  overflow:hidden;
  font-size:.82rem;
}
.standings th,
.standings td{
  padding:9px 7px;
  border-bottom:1px solid var(--border);
  text-align:center;
}
.standings th{
  background:var(--primary-1);
  color:white;
}
.standings td:nth-child(2),
.standings th:nth-child(2){
  text-align:left;
}
.ranking-criteria{
  margin:12px 0 0;
  font-size:.82rem;
}

/* Lists */
.list{
  display:grid;
  gap:10px;
}
.notice-item,
.schedule-list-item{
  display:block;
  text-align:left;
  width:100%;
  border:1px solid var(--border);
  background:white;
  border-radius:14px;
  padding:14px;
  box-shadow:var(--shadow);
}
.notice-item strong{
  display:block;
  color:var(--primary-1);
  margin:5px 0;
}

/* Timeline */
.timeline-wrap{
  overflow:auto;
  border:1px solid var(--border);
  border-radius:16px;
  background:white;
  box-shadow:var(--shadow);
  position:relative;
}
.timeline{
  min-width:960px;
  display:grid;
}
.timeline-header,
.timeline-row{
  display:grid;
  grid-template-columns:140px repeat(var(--cols),80px);
}
.timeline-header{
  position:sticky;
  top:0;
  z-index:3;
  background:var(--primary-1);
  color:white;
}
.timeline-cell{
  border-right:1px solid rgba(255,255,255,.15);
  border-bottom:1px solid var(--border);
  padding:8px;
  font-size:.78rem;
  min-height:44px;
}
.timeline-team{
  position:sticky;
  left:0;
  z-index:2;
  background:var(--primary-1);
  color:white;
  display:flex;
  align-items:center;
  gap:8px;
}
.timeline-team img{
  width:28px;
  height:28px;
  object-fit:contain;
  background:white;
  border-radius:50%;
}
.timeline-lane{
  position:relative;
  grid-column:2 / -1;
  min-height:56px;

  border-bottom:1px solid #E5E7EB;

  background:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 79px,
      rgba(0,0,0,.05) 80px
    );
}
.timeline-row:nth-child(even) .timeline-lane{
  background:
    repeating-linear-gradient(
      to right,
      #FCFCFD 0,
      #FCFCFD 79px,
      rgba(0,0,0,.05) 80px
    );
}

.timeline-row:nth-child(odd) .timeline-lane{
  background:
    repeating-linear-gradient(
      to right,
      #F7F8FA 0,
      #F7F8FA 79px,
      rgba(0,0,0,.05) 80px
    );
}

.schedule-block{
  position:absolute;
  top:8px;
  height:40px;
  border-radius:8px;
  padding:6px 8px;
  color:white;
  font-weight:800;
  font-size:.75rem;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  border:1px solid rgba(0,0,0,.08);
}
.now-line{
  position:absolute;
  top:0;
  bottom:0;
  width:2px;
  background:var(--error);
  z-index:4;
}

/* Modal */
.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.48);
  z-index:200;
  display:flex;
  align-items:flex-end;
  justify-content:center;
}
.modal{
  background:white;
  width:100%;
  max-width:640px;
  max-height:88vh;
  overflow:auto;
  border-radius:22px 22px 0 0;
  padding:18px;
  box-shadow:0 -12px 40px rgba(0,0,0,.18);
}
.modal__close{
  float:right;
  border:0;
  background:#F3F4F6;
  border-radius:50%;
  width:34px;
  height:34px;
  font-size:22px;
}
.modal__content{clear:both}

/* Bottom navigation */
.bottom-nav{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  height:calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding:8px 10px calc(8px + env(safe-area-inset-bottom));
  background:white;
  border-top:1px solid var(--border);
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:6px;
  z-index:9999;
}
.nav-item{
  border:0;
  background:transparent;
  color:var(--primary-1);
  border-radius:14px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  min-height:52px;
  width:100%;
  height:100%;
  user-select:none;
  -webkit-tap-highlight-color:transparent;
}
.nav-item span,
.nav-item strong{
  color:var(--primary-1);
}
.nav-item span{
  font-size:1.15rem;
}
.nav-item strong{
  font-size:.73rem;
}
.nav-item.active{
  background:var(--primary-3);
  color:white;
}
.nav-item.active span,
.nav-item.active strong{
  color:white;
}

.hidden{display:none!important}

.notice-content{
  line-height:1.8;
  white-space:normal;
}

.notice-content strong{
  color:#17233C;
  font-weight:800;
}

.team-meta{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px;
  margin-top:8px;
}

.instagram-link{
  display:flex;
  align-items:center;
  justify-content:center;
  width:32px;
  height:32px;
  border-radius:50%;
  background:white;
  color:#E1306C;
  border:1px solid #E5E7EB;
  text-decoration:none;
}

.instagram-link:hover{
  transform:scale(1.06);
}

/* Admin / form page bottom spacing */
.modal{
  padding-bottom:calc(120px + env(safe-area-inset-bottom));
}

.form-actions{
  margin-top:16px;
  padding-bottom:calc(120px + env(safe-area-inset-bottom));
}

.admin-actions{
  padding-bottom:calc(120px + env(safe-area-inset-bottom));
}

.form-actions .button{
  width:100%;
}

/* Desktop */
@media (min-width:720px){
  .view{padding:24px;padding-bottom:90px}
  .filters{grid-template-columns:repeat(3,1fr)}
  .team-grid{grid-template-columns:repeat(4,1fr)}
  .modal-backdrop{align-items:center}
  .modal{border-radius:22px}
  .match-card{grid-template-columns:160px 1fr}
  .match-meta{display:block}
  .home-header{padding-inline:24px}
}

.standings-table{
  table-layout:fixed;
}

.standings-table th:nth-child(1),
.standings-table td:nth-child(1){
  width:44px;
}

.standings-table th:nth-child(2),
.standings-table td:nth-child(2){
  width:34%;
}

.standings-table th:nth-child(n+3),
.standings-table td:nth-child(n+3){
  width:7%;
}

.scorers-table{
  table-layout:fixed;
  width:100%;
}

.scorers-table th:nth-child(1),
.scorers-table td:nth-child(1){
  width:60px;
}

.scorers-table th:nth-child(2),
.scorers-table td:nth-child(2){
  width:42%;
}

.scorers-table th:nth-child(3),
.scorers-table td:nth-child(3){
  width:34%;
}

.scorers-table th:nth-child(4),
.scorers-table td:nth-child(4){
  width:70px;
}

.scorers-table td{
  word-break:keep-all;
}

.cards-table{
  table-layout:auto;
}

.cards-table td:nth-child(3),
.cards-table td:nth-child(4),
.cards-table th:nth-child(3),
.cards-table th:nth-child(4){
  width:60px;
}

.cards-table td:last-child,
.cards-table th:last-child{
  width:110px;
}

/* =========================================
   Uniform Colors
========================================= */

/* Match Card */

.match-card .team-side{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  min-width:0;
  width:100%;
}

.match-card .team-side-main{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  width:100%;
  min-width:0;
  padding:0;
  border:0;
  background:transparent;
  color:inherit;
  font:inherit;
  text-align:center;
  cursor:pointer;
}

.match-card .team-side-main .team-info{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:5px;
}

/* Uniform Colors */

.match-uniform-colors{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  gap:8px;
  margin-top:8px;
}

.kit-color-row{
  display:flex;
  align-items:center;
  gap:5px;
}

.kit-color-label{
  font-size:9px;
  font-weight:700;
  color:var(--muted);
  white-space:nowrap;
}

.kit-color-swatches{
  display:flex;
  align-items:center;
  gap:3px;
}

.kit-color-swatch{
  display:inline-block;
  width:12px;
  height:12px;
  min-width:12px;
  min-height:12px;
  flex:0 0 12px;

  padding:0;
  margin:0;

  border:1px solid rgba(23,35,60,.18);
  border-radius:2px;

  box-sizing:border-box;
  background-repeat:no-repeat;
  background-size:100% 100%;
  vertical-align:middle;
}

.kit-color-swatches{
  display:inline-flex;
  align-items:center;
  gap:3px;
}

.kit-color-swatch--empty{
  background:transparent;
  border:1px dashed #D5D9E1;
}

/* Team Profile */

.team-uniform-section{
  margin:20px 0;
}

.team-uniform-section h3{
  margin-bottom:12px;
}

.team-uniform-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}

.team-uniform-card{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  padding:12px 8px;
  border:1px solid var(--border);
  border-radius:12px;
}

.team-uniform-card > strong{
  font-size:12px;
  color:var(--primary-1,#17233C);
}

.team-uniform-card .kit-color-row{
  width:100%;
  justify-content:center;
}

.team-uniform-card .kit-color-label{
  width:35px;
}

.team-uniform-card .kit-color-swatch{
  width:15px;
  height:15px;
  flex-basis:15px;
}

/* Mobile */

@media(max-width:600px){
  .match-uniform-colors{
    gap:5px;
    margin-top:6px;
  }

  .match-uniform-colors .kit-color-label{
    font-size:8px;
  }

  .match-uniform-colors .kit-color-row{
    gap:3px;
  }

  .match-uniform-colors .kit-color-swatches{
    gap:2px;
  }

  .match-uniform-colors .kit-color-swatch{
    width:8px;
    height:8px;
    flex-basis:8px;
  }

  .team-uniform-card{
    padding:10px 5px;
  }
}