:root{
  --bg:#edf4f8;
  --card:#fff;
  --line:#d8e3ed;
  --ink:#173149;
  --muted:#6d8193;
  --purple:#871a61;
  --green:#18b779;
  --orange:#f59f00;
  --blue:#1971c2;
}

*{
  box-sizing:border-box;
}

html,body{
  margin:0;
  padding:0;
  background:var(--bg);
  color:var(--ink);
  font-family:system-ui,-apple-system,"Segoe UI",Tahoma,Arial,sans-serif;
}

body{
  display:flex;
  justify-content:center;
}

main{
  width:100%;
  max-width:430px;
  min-height:100vh;
  background:#f7fbff;
  padding:10px 10px 120px;
}

.app{
  display:block;
}

.top{
  display:flex;
  align-items:center;
  gap:10px;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  padding:11px;
  margin-bottom:10px;
  box-shadow:0 8px 22px rgba(23,49,73,.08);
}

.top-logo{
  width:48px;
  height:48px;
  border-radius:14px;
  background:#fff4bf;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:28px;
  overflow:hidden;
  flex:0 0 auto;
}

.top-logo img{
  width:100%;
  height:100%;
  object-fit:contain;
  padding:5px;
}

.top-text{
  flex:1;
  text-align:center;
  min-width:0;
}

.top-text h1{
  margin:0;
  font-size:18px;
  font-weight:900;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.top-text p{
  margin:4px 0 0;
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.champion{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  padding:12px;
  margin-bottom:10px;
  box-shadow:0 8px 22px rgba(23,49,73,.08);
}

.section-title{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
}

.section-title > span{
  width:42px;
  height:42px;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#ffd95c;
  font-size:24px;
}

.section-title h2{
  margin:0;
  font-size:20px;
}

.section-title p{
  margin:3px 0 0;
  color:var(--muted);
  font-size:12px;
}

.champion-list{
  display:flex;
  gap:8px;
  overflow-x:auto;
  padding-bottom:3px;
}

.champion-list::-webkit-scrollbar{
  display:none;
}

.champion-item{
  position:relative;
  flex:0 0 72px;
  height:74px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap:5px;
}

.champion-item input{
  position:absolute;
  opacity:0;
}

.champion-item em{
  width:34px;
  height:34px;
  border-radius:11px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#f1f4f7;
  font-style:normal;
  font-size:22px;
}

.champion-item b{
  width:64px;
  font-size:10px;
  text-align:center;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.champion-item:has(input:checked){
  border-color:var(--purple);
  background:#fff3fa;
  box-shadow:0 0 0 3px rgba(135,26,97,.12);
}

.alert{
  padding:10px 12px;
  border-radius:13px;
  margin-bottom:10px;
  font-weight:800;
  font-size:13px;
}

.alert.ok{
  background:#e6fcf3;
  color:#087f5b;
}

.alert.bad{
  background:#fff0f6;
  color:#c2255c;
}

.day{
  margin-bottom:13px;
}

.day h3{
  margin:8px 0 8px;
  font-size:16px;
  text-align:center;
}

.match{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:17px;
  padding:10px;
  margin-bottom:9px;
  box-shadow:0 7px 18px rgba(23,49,73,.07);
}

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

.match-head span{
  font-size:12px;
  color:var(--muted);
  font-weight:800;
}

.match-head strong{
  font-size:10px;
  padding:5px 8px;
  border-radius:999px;
}

.match-head strong.open{
  background:#dff8ed;
  color:#087f5b;
}

.match-head strong.closed,
.match-head strong.pending_result{
  background:#fff2cc;
  color:#c06b00;
}

.match-head strong.finished{
  background:#e7f2ff;
  color:#1864ab;
}

.match-main{
  display:grid;
  grid-template-columns:1fr 104px 1fr;
  align-items:center;
  gap:6px;
}

.team{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:5px;
  min-width:0;
}

.flag{
  width:38px;
  height:38px;
  border-radius:12px;
  background:#f1f4f7;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:23px;
}

.team b{
  max-width:100%;
  font-size:12px;
  line-height:1.25;
  text-align:center;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.score{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:5px;
}

.score input{
  width:44px;
  height:40px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fbfdff;
  color:var(--ink);
  text-align:center;
  font-size:18px;
  font-weight:900;
}

.score input:disabled{
  background:#f4f6f8;
  color:#777;
}

.score span{
  font-weight:900;
  color:#555;
}

.match-time{
  display:flex;
  justify-content:space-between;
  gap:6px;
  margin-top:8px;
  font-size:10px;
  color:var(--muted);
}

.empty{
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  padding:24px;
  text-align:center;
}

.empty div{
  font-size:40px;
}

.empty h3{
  margin:8px 0 4px;
}

.empty p{
  margin:0;
  color:var(--muted);
}

.save-bar{
  position:fixed;
  left:50%;
  bottom:0;
  transform:translateX(-50%);
  width:100%;
  max-width:430px;
  background:rgba(237,244,248,.97);
  border-top:1px solid var(--line);
  padding:9px 10px 10px;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  z-index:80;
}

.save-bar input{
  width:100%;
  height:42px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  padding:0 11px;
  font:inherit;
}

.save-bar button{
  grid-column:1/-1;
  height:44px;
  border:0;
  border-radius:12px;
  background:var(--purple);
  color:#fff;
  font-weight:900;
  font-size:15px;
}

/* Admin */
.admin-nav{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:10px;
}

.admin-nav a{
  background:#fff;
  border:1px solid var(--line);
  border-radius:10px;
  padding:8px 10px;
  color:#1864ab;
  text-decoration:none;
  font-weight:800;
}

.panel{
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
  margin-bottom:10px;
}

.form{
  display:grid;
  gap:10px;
}

.form label{
  display:grid;
  gap:5px;
}

.table-wrap{
  overflow:auto;
}

table{
  min-width:760px;
  width:100%;
  border-collapse:collapse;
}

th,td{
  border-bottom:1px solid var(--line);
  padding:8px;
  text-align:right;
}

@media(max-width:360px){
  main{
    padding-left:7px;
    padding-right:7px;
  }

  .match-main{
    grid-template-columns:1fr 96px 1fr;
  }

  .score input{
    width:40px;
  }

  .champion-item{
    flex-basis:68px;
  }
}
