:root{
  --bg:#0b1020;
  --card:#121a33;
  --muted:#9fb0ff;
  --text:#eef1ff;
  --soft:#1a2450;
  --accent:#6aa7ff;
  --accent2:#63f3c7;
  --danger:#ff5e7a;
  --border: rgba(255,255,255,.10);
  --shadow: 0 12px 40px rgba(0,0,0,.45);
  --radius: 16px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 700px at 20% -10%, rgba(106,167,255,.25), transparent 60%),
              radial-gradient(900px 600px at 90% 0%, rgba(99,243,199,.18), transparent 55%),
              var(--bg);
  color:var(--text);
}

.container{
  width:min(1100px, 94vw);
  margin:0 auto;
  padding:18px 0;
}

.header{
  position:sticky;
  top:0;
  z-index:10;
  background: rgba(11,16,32,.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

h1{
  margin:10px 0 6px;
  font-size: clamp(22px, 3vw, 34px);
}
.sub{
  margin:0 0 8px;
  color: rgba(238,241,255,.80);
}

.toolbar{
  display:flex;
  gap:10px;
  padding:10px 0 8px;
  flex-wrap:wrap;
}

.grid{
  display:grid;
  gap:14px;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  padding: 16px 0 26px;
}

.card{
  background: linear-gradient(180deg, rgba(18,26,51,.95), rgba(18,26,51,.75));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 14px 16px;
}

.card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom: 10px;
}

.name{
  font-size: 20px;
  font-weight: 750;
  letter-spacing: .2px;
}

.badge{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: rgba(238,241,255,.85);
  user-select:none;
}

.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 10px 10px;
  background: rgba(255,255,255,.05);
  border:1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
}

.row label{
  display:flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  user-select:none;
}

.checkbox{
  width:20px;
  height:20px;
  accent-color: var(--accent2);
}

.days{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:8px;
}

.day{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;
  border-radius: 12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
  cursor:pointer;
  user-select:none;
  transition: transform .06s ease, background .12s ease;
}

.day:hover{
  background: rgba(255,255,255,.07);
}
.day:active{
  transform: scale(.99);
}

.day span{
  font-size: 12px;
  color: rgba(238,241,255,.86);
}

.btn{
  border:1px solid var(--border);
  border-radius: 12px;
  padding:10px 12px;
  cursor:pointer;
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.btn:hover{ background: rgba(255,255,255,.10); }

.btn-primary{
  background: rgba(106,167,255,.20);
  border-color: rgba(106,167,255,.40);
}
.btn-primary:hover{
  background: rgba(106,167,255,.28);
}

.btn-ghost{
  background: transparent;
}
.btn-ghost:hover{ background: rgba(255,255,255,.08); }

.modal-overlay{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,.55);
  padding: 16px;
  z-index: 100;
}

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

.modal{
  width: min(520px, 96vw);
  background: rgba(18,26,51,.95);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.modal-wide{
  width: min(820px, 96vw);
}

.modal-text{
  margin: 10px 0 14px;
  color: rgba(238,241,255,.85);
}

.modal-actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
}

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

.icon-btn{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  cursor:pointer;
}
.icon-btn:hover{ background: rgba(255,255,255,.10); }

video{
  width:100%;
  max-height: 60vh;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #000;
}

.hint{
  margin: 10px 0 0;
  font-size: 12px;
  color: rgba(238,241,255,.65);
}

img#imagePlayer{
  width:100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.25);
}

#pdfFrame{
  width: 100%;
  height: min(70vh, 820px);
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.25);
}

.pdf-actions{
  margin-top: 10px;
  display:flex;
  justify-content:flex-end;
}

/* --- PDF header: mobile-friendly layout --- */
#pdfTitle{
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

/* Кнопки в шапке PDF */
.pdf-top-actions{
  display:flex;
  gap:10px;
  align-items:center;
}

/* На мобилке: заголовок сверху, кнопки ниже и ровно */
@media (max-width: 520px){
  /* шапку модалки делаем “колонкой” */
  #pdfOverlay .modal-head{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  /* уменьшаем заголовок, чтобы не занимал пол-экрана */
  #pdfTitle{
    font-size: 16px;
    line-height: 1.1;
  }

  /* кнопки в одну линию: 30 и 2 мин одинаково, крестик справа */
  .pdf-top-actions{
    width: 100%;
    justify-content: flex-end;
    gap: 8px;
  }

  .pdf-top-actions .btn{
    flex: 1 1 0;
    padding: 10px 8px;
    font-size: 13px;
    white-space: nowrap;
  }

  .pdf-top-actions .icon-btn{
    flex: 0 0 38px;
  }
}

/* если совсем узкие экраны */
@media (max-width: 360px){
  .pdf-top-actions .btn{
    font-size: 12px;
    padding: 9px 6px;
  }
}



/* Timer */
.timer-modal{
  width: min(680px, 96vw);
}

.timer-big{
  width: 100%;
  text-align: center;
  font-weight: 800;
  letter-spacing: 2px;
  font-size: clamp(56px, 8vw, 120px);
  padding: 18px 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  margin-top: 8px;
}

.timer-controls{
  display:flex;
  justify-content:center;
  gap:12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.statham-quote{
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(106,167,255,.18), rgba(99,243,199,.12));
  font-weight: 600;
  font-size: 14px;
  line-height: 1.5;
}

.statham-quote span{
  display:block;
  margin-top:6px;
  font-weight:700;
  opacity:.9;
}


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

.meta-field{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.meta-field label{
  font-size: 11px;
  opacity: .8;
}

.meta-field input,
.meta-field select{
  width: 100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  color: var(--text);
  outline: none;
}

.meta-field input::placeholder{
  color: rgba(238,241,255,.55);
}

@media (max-width: 520px){
  .participant-meta{
    grid-template-columns: 1fr;
  }
}

/* Leaderboard */
.leaderboard{
  margin: 10px 0 14px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.leaderboard-title{
  font-weight: 800;
  font-size: 14px;
  opacity: .95;
  display:flex;
  align-items:center;
  gap: 8px;
}

.leaderboard-items{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items:center;
}

.lb-item{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  font-size: 13px;
  white-space: nowrap;
}

.lb-rank{
  font-weight: 900;
  opacity: .9;
}

.lb-name{
  font-weight: 700;
}

.lb-score{
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(106,167,255,.18);
  border: 1px solid rgba(106,167,255,.35);
}