/* ============================================================
   jang.css — Jamoa jangi (2 jamoali bellashuv rejimi)
   Asosiy o'zgaruvchilar style.css'dan meros olinadi.
   ============================================================ */

:root{
  --team-a:      #2F6B4A;
  --team-a-lite: #6FA97F;
  --team-b:      #A33A38;
  --team-b-lite: #D9736F;
  --jz: 1;            /* shrift masshtabi (1 = oddiy), jang-ui.js o'zgartiradi */
}

.jang-body{
  margin: 0;
  min-height: 100vh; min-height: 100dvh;
  background: var(--field);
  color: var(--field-ink);
  font-family: 'IBM Plex Sans', sans-serif;
  overflow-x: hidden;
}

.jscreen{
  min-height: 100vh; min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 24px 60px;
}
.jscreen[hidden]{ display: none; }

/* Jang maydoni har doim bitta oynaga sig'adi; sahifa emas, faqat savol bloki ichida aylanadi */
#view-fight{
  height: 100vh; height: 100dvh; min-height: 0;
  padding: 0; overflow: hidden;
  flex-direction: column; align-items: stretch; justify-content: flex-start;
}
.jscreen:not(.jscreen-dark){
  background: var(--paper);
  color: var(--ink);
}

.jwrap{ width: 100%; max-width: 640px; }
.jwrap-narrow{ max-width: 560px; }

.jeyebrow{ font-size: .82rem; color: var(--ink-3); margin-bottom: 6px; }
.jtitle{
  font-family: 'Newsreader', serif; font-weight: 500;
  font-size: calc(clamp(2rem, 5vw, 2.7rem) * var(--jz)); margin-bottom: 14px; color: var(--ink);
}
.jlead{ color: var(--ink-2); max-width: 46ch; line-height: 1.55; }

/* ---------------- Test ro'yxati ---------------- */
.jtest-list{ margin-top: 26px; display: flex; flex-direction: column; gap: 12px; }
.jtest-item{
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--paper-3); padding: 20px 22px; cursor: pointer;
  border-radius: var(--r); box-shadow: var(--shadow-xs);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.jtest-item:hover{ transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.jtest-item h3{ font-family: 'Newsreader', serif; font-size: 1.08rem; font-weight: 500; margin-bottom: 4px; }
.jtest-item span{ font-size: .84rem; color: var(--ink-3); }
.jtest-item .jarrow{ flex: none; color: var(--chlorophyll); font-size: 1.2rem; }

/* ---------------- Jamoa sozlash ---------------- */
.jback{
  background: none; border: none; cursor: pointer; color: var(--ink-3);
  font-size: .88rem; margin-bottom: 26px; padding: 0;
}
.jback:hover{ color: var(--ink); }

.jteam-form{
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: end;
  margin: 34px 0 22px;
}
.jteam-field label{ display: block; font-size: .84rem; color: var(--ink-2); margin-bottom: 7px; }
.jteam-field input{
  width: 100%; padding: 13px 15px; border-radius: 3px;
  border: 2px solid var(--rule); background: var(--paper-3); font-size: 1rem;
  transition: border-color .15s;
}
.jteam-a input:focus{ border-color: var(--team-a); outline: none; }
.jteam-b input:focus{ border-color: var(--team-b); outline: none; }
.jvs{
  font-family: 'Newsreader', serif; font-style: italic; color: var(--ink-3);
  font-size: 1.3rem; padding-bottom: 13px;
}

.jhelp{ margin-top: 28px; border-top: 1px solid var(--rule); padding-top: 18px; }
.jhelp p{ font-size: .87rem; color: var(--ink-2); margin-bottom: 8px; }

/* ---------------- Tugmalar ---------------- */
.jbtn{
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--chlorophyll); color: #fff; border: none;
  padding: 14px 28px; border-radius: var(--r-sm); font-size: 1rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease-spring), background .15s, box-shadow .2s;
}
.jbtn:hover{ background: #275a3d; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.jbtn:active{ transform: translateY(0) scale(.98); }
.jbtn-lg{ padding: 17px 38px; font-size: 1.08rem; }
.jbtn-ghost{ background: transparent; border: 1px solid var(--field-rule); color: var(--field-ink2); }
.jbtn-ghost:hover{ background: rgba(255,255,255,.06); color: var(--field-ink); }

/* ---------------- Raund e'loni / yakun / final (qorong'i ekranlar) ---------------- */
.jscreen-dark{
  background:
    radial-gradient(circle at 20% 20%, rgba(47,107,74,.16), transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(163,58,56,.16), transparent 55%),
    var(--field);
}

.jround-splash{ text-align: center; max-width: 560px; }
.jround-of{ font-family: 'IBM Plex Mono', monospace; color: var(--field-ink2); font-size: calc(.95rem * var(--jz)); letter-spacing: .04em; margin-bottom: 14px; }
.jround-big{
  font-family: 'Newsreader', serif; font-weight: 600; font-style: italic;
  font-size: calc(clamp(3rem, 11vw, 6rem) * var(--jz)); line-height: 1;
  background: linear-gradient(135deg, var(--team-a-lite), var(--carotene) 55%, var(--team-b-lite));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 26px;
  animation: jpunch .5s var(--ease);
}
@keyframes jpunch{
  0%{ transform: scale(.6) rotate(-4deg); opacity: 0; }
  60%{ transform: scale(1.08) rotate(1deg); opacity: 1; }
  100%{ transform: scale(1) rotate(0); }
}
.jround-score{ font-family: 'IBM Plex Mono', monospace; font-size: calc(1.3rem * var(--jz)); color: var(--field-ink); margin-bottom: 20px; }
.jround-hint{ color: var(--field-ink2); font-size: .95rem; }

/* ---------------- HUD (jang maydoni ustki panel) ---------------- */
.jhud{
  position: relative; flex: none; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 18px;
  padding: 16px 26px;
  background: linear-gradient(to bottom, rgba(10,19,16,.92), transparent);
}
.jhud-team{ display: flex; flex-direction: column; gap: 3px; }
.jhud-a{ align-items: flex-start; }
.jhud-b{ align-items: flex-end; }
.jhud-name{ font-size: calc(.82rem * var(--jz)); color: var(--field-ink2); text-transform: uppercase; letter-spacing: .04em; }
.jhud-score{
  font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: calc(2rem * var(--jz)); line-height: 1;
  transition: transform .25s var(--ease);
}
.jhud-a .jhud-score{ color: var(--team-a-lite); }
.jhud-b .jhud-score{ color: var(--team-b-lite); }
.jhud-score.jbump{ transform: scale(1.35); }

.jhud-mid{ text-align: center; }
.jtimer{
  font-family: 'IBM Plex Mono', monospace; font-size: calc(1.5rem * var(--jz)); font-weight: 600;
  color: var(--field-ink); margin-bottom: 4px;
}
.jtimer.warn{ color: var(--carotene); }
.jtimer.crit{ color: var(--team-b-lite); animation: jpulse 1s infinite; }
@keyframes jpulse{ 50%{ opacity: .45; } }
.jround-tag{ font-size: calc(.78rem * var(--jz)); color: var(--field-ink2); }

/* ---------------- Navbat paneli ---------------- */
.jturn-bar{
  position: relative; flex: none; z-index: 15;
  text-align: center; padding: 0 12px 4px;
}
.jturn-bar span{
  display: inline-block; padding: 8px 22px; border-radius: 999px;
  font-family: 'IBM Plex Mono', monospace; font-size: calc(.82rem * var(--jz)); letter-spacing: .06em;
  border: 1px solid var(--field-rule); color: var(--field-ink2);
  transition: all .2s;
}
.jturn-bar.turn-a span{ color: var(--team-a-lite); border-color: var(--team-a); background: rgba(47,107,74,.14); }
.jturn-bar.turn-b span{ color: var(--team-b-lite); border-color: var(--team-b); background: rgba(163,58,56,.14); }

/* ---------------- Savol maydoni ---------------- */
.jq-stage{
  flex: 1 1 auto; min-height: 0; width: 100%; max-width: calc(760px * var(--jz)); margin: 0 auto;   /* katta shriftda blok kengayadi */
  padding: 8px 24px 52px;           /* pastda to'liq ekran/shrift tugmalari uchun joy */
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
}
.jq-text{
  font-family: 'Newsreader', serif; font-weight: 500;
  font-size: calc(clamp(1.4rem, 3vw, 1.9rem) * var(--jz)); line-height: 1.32;
  text-align: center; margin: auto 0 34px;   /* bo'sh joyni teng bo'lib, o'rtaga qo'yadi */
}
.jopts{ display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px){ .jopts{ grid-template-columns: 1fr; } }

.jopt{
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px; background: var(--field-2);
  border: 1px solid var(--field-rule); border-radius: var(--r-sm);
  box-shadow: var(--shadow-xs);
  cursor: pointer; text-align: left;
  transition: background .15s, border-color .15s, transform .15s var(--ease-spring), box-shadow .15s;
}
.jopt:hover:not(:disabled){ transform: translateY(-2px); }
.jopt:hover:not(:disabled){ background: var(--field-3); border-color: var(--field-ink2); }
.jopt:active:not(:disabled){ transform: scale(.98); }
.jopt .jkey{
  flex: none; width: calc(30px * var(--jz)); height: calc(30px * var(--jz)); border-radius: 50%;
  display: grid; place-items: center; font-family: 'IBM Plex Mono', monospace;
  font-size: calc(.85rem * var(--jz)); border: 1px solid var(--field-rule); color: var(--field-ink2);
}
.jopt .jtxt{ font-size: calc(1rem * var(--jz)); }

.jopt.correct{ background: rgba(47,107,74,.3); border-color: var(--team-a-lite); animation: jbloom .5s var(--ease); }
.jopt.correct .jkey{ background: var(--team-a-lite); border-color: var(--team-a-lite); color: var(--field); }
.jopt.wrong{ background: rgba(163,58,56,.28); border-color: var(--team-b-lite); animation: jshake .35s var(--ease); }
.jopt.wrong .jkey{ background: var(--team-b-lite); border-color: var(--team-b-lite); color: #fff; }
@keyframes jbloom{ 0%{ transform: scale(.98); } 55%{ transform: scale(1.02); } 100%{ transform: scale(1); } }
@keyframes jshake{ 0%,100%{ transform: translateX(0); } 25%{ transform: translateX(-6px); } 75%{ transform: translateX(6px); } }

.jfeedback{
  margin: 24px 0 auto; min-height: 2.6em; text-align: center; font-family: 'IBM Plex Mono', monospace;
  font-size: calc(1.1rem * var(--jz)); letter-spacing: .03em; animation: jrise .3s var(--ease);
}
@media (max-width: 640px){ .jfeedback{ min-height: 3.6em; } }   /* tor ekranda javob 2 qatorga o'tadi */
.jfeedback[hidden]{ display: block; visibility: hidden; }   /* joy oldindan band: javob chiqqanda maket sakramaydi */
.jfeedback.ok{ color: var(--team-a-lite); }
.jfeedback.no{ color: var(--team-b-lite); }
@keyframes jrise{ from{ opacity: 0; transform: translateY(8px); } to{ opacity: 1; transform: none; } }

/* ---------------- Raund yakuni / Final ---------------- */
.jsum-score{ display: flex; align-items: center; justify-content: center; gap: 30px; margin: 20px 0; }
.jsum-team{ display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 120px; }
.jsum-name{ font-size: calc(.9rem * var(--jz)); color: var(--field-ink2); }
.jsum-pts{ font-family: 'IBM Plex Mono', monospace; font-size: calc(2.6rem * var(--jz)); font-weight: 600; }
.jsum-a .jsum-pts{ color: var(--team-a-lite); }
.jsum-b .jsum-pts{ color: var(--team-b-lite); }
.jsum-vs{ font-family: 'Newsreader', serif; font-style: italic; color: var(--field-ink2); font-size: 1.2rem; }

.jround-winner{ font-family: 'Newsreader', serif; font-weight: 500; font-size: calc(1.6rem * var(--jz)); margin: 12px 0 6px; }
.jround-total{ color: var(--field-ink2); font-size: calc(.92rem * var(--jz)); margin-bottom: 30px; }

.jfinal-winner{
  font-family: 'Newsreader', serif; font-weight: 600; font-style: italic;
  font-size: calc(clamp(2.4rem, 8vw, 4rem) * var(--jz));
  background: linear-gradient(135deg, var(--carotene), #fff 50%, var(--carotene));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 10px;
  animation: jglow 1.8s ease-in-out infinite alternate;
}
@keyframes jglow{ from{ filter: drop-shadow(0 0 6px rgba(192,120,23,.25)); } to{ filter: drop-shadow(0 0 22px rgba(192,120,23,.55)); } }

.jfinal-rounds{ display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.jfinal-rounds .jrbadge{
  font-family: 'IBM Plex Mono', monospace; font-size: calc(.8rem * var(--jz)); padding: 6px 12px;
  border-radius: 999px; border: 1px solid var(--field-rule); color: var(--field-ink2);
}

@media (prefers-reduced-motion: reduce){
  .jround-big, .jfinal-winner, .jhud-score, .jopt.correct, .jopt.wrong, .jfeedback{ animation: none !important; }
}


/* ============================================================
   Uzun jamoa nomlari taymer bilan aralashib ketmasin
   ============================================================ */
.jhud-team{ min-width: 0; max-width: 100%; }
.jhud-name{ max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   Telefon YOTIQ (albom) holati — past ekran: hammasi ixchamroq.
   ============================================================ */
@media (orientation: landscape) and (max-height: 640px){
  .jhud{ padding: 8px 20px 2px; gap: 12px; background: none; }
  .jhud-name{ font-size: calc(.68rem * var(--jz)); }
  .jhud-score{ font-size: calc(1.5rem * var(--jz)); }
  .jtimer{ font-size: calc(1.3rem * var(--jz)); margin-bottom: 0; }
  .jround-tag{ font-size: calc(.68rem * var(--jz)); }
  .jturn-bar{ padding: 2px 12px 6px; }
  .jturn-bar span{ padding: 3px 16px; font-size: calc(.7rem * var(--jz)); }

  .jq-stage{ max-width: calc(920px * var(--jz)); padding: 0 20px 6px; }
  .jq-text{
    font-size: calc(clamp(.92rem, 4.6vh, 1.35rem) * var(--jz)); line-height: 1.25;
    margin-bottom: clamp(6px, 2.4vh, 14px);
  }
  .jopts{ grid-template-columns: 1fr 1fr; gap: clamp(6px, 2vh, 10px); }
  .jopt{ padding: clamp(6px, 2.2vh, 12px) 12px; gap: 10px; }
  .jopt .jtxt{ font-size: calc(clamp(.8rem, 3.8vh, .98rem) * var(--jz)); line-height: 1.2; }
  .jopt .jkey{ width: calc(24px * var(--jz)); height: calc(24px * var(--jz)); font-size: calc(.75rem * var(--jz)); }
  .jopt:hover:not(:disabled){ transform: none; }

  /* Javob satri pastki qatorda; o'ng burchakda tugmalar turadi, shuning uchun yon tomondan bo'sh joy */
  .jfeedback{
    margin: clamp(4px, 1.6vh, 8px) 84px 0; font-size: calc(.9rem * var(--jz)); min-height: 0;
    height: 30px; line-height: 30px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; animation: none;
  }

  /* Qolgan qorong'i ekranlar */
  .jscreen-dark:not(#view-fight){ padding: 14px 24px; align-items: center; }
  .jround-of{ margin-bottom: 6px; font-size: calc(.85rem * var(--jz)); }
  .jround-big{ font-size: calc(clamp(2.2rem, 17vh, 4.2rem) * var(--jz)); margin-bottom: 10px; }
  .jround-score{ font-size: calc(1.05rem * var(--jz)); margin-bottom: 8px; }
  .jsum-score{ margin: 6px 0; gap: 22px; }
  .jsum-team{ min-width: 100px; gap: 2px; }
  .jsum-pts{ font-size: calc(2rem * var(--jz)); }
  .jround-winner{ font-size: calc(1.25rem * var(--jz)); margin: 6px 0 4px; }
  .jround-total{ margin-bottom: 12px; font-size: calc(.85rem * var(--jz)); }
  .jfinal-winner{ font-size: calc(clamp(1.9rem, 14vh, 3.2rem) * var(--jz)); margin-bottom: 4px; }
  .jfinal-rounds{ margin-top: 8px; gap: 6px; }
  #view-final .jround-splash > div:last-child{ margin-top: 12px !important; }
  .jbtn-lg{ padding: 11px 28px; font-size: 1rem; }

  /* Test tanlash va jamoa sozlash */
  .jscreen:not(.jscreen-dark){ padding: 20px 24px 28px; }
  .jback{ margin-bottom: 12px; }
  .jteam-form{ margin: 16px 0 14px; }
}

/* ============================================================
   To'liq ekran va shrift o'lchami tugmalari (jang-ui.js)
   ============================================================ */
.jtools{
  position: fixed; right: 10px; bottom: 10px; z-index: 60;
  display: flex; gap: 6px; align-items: center;
}
.jtools button{
  width: 36px; height: 36px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; gap: 1px;
  border: 1px solid rgba(255,255,255,.22); background: rgba(14,24,20,.82); color: #fff;
  font: 700 .95rem 'IBM Plex Sans', sans-serif; line-height: 1; cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  transition: background .15s, transform .15s;
}
.jtools button:hover:not(:disabled){ background: rgba(14,24,20,.96); transform: translateY(-1px); }
.jtools button:disabled{ opacity: .4; cursor: default; }
.jtools button:focus-visible{ outline: 2px solid var(--carotene, #C07817); outline-offset: 2px; }
.jtools .jA{ font-family: 'IBM Plex Sans', sans-serif; }
.jtools .jA-s{ font-size: .72rem; }
.jtools .jA-l{ font-size: 1.1rem; }
.jsizepanel{
  position: absolute; right: 0; bottom: 46px;
  display: flex; align-items: center; gap: 6px; padding: 6px;
  border-radius: 999px; background: rgba(14,24,20,.96);
  border: 1px solid rgba(255,255,255,.2); box-shadow: 0 6px 22px rgba(0,0,0,.35);
}
.jsizepanel[hidden]{ display: none; }
.jsizepanel .jpct{
  width: auto; min-width: 56px; padding: 0 8px; border-radius: 999px;
  font: 600 .82rem 'IBM Plex Mono', monospace; background: rgba(255,255,255,.08);
}
.jtoast{
  position: absolute; right: 0; bottom: 46px; width: min(300px, 78vw);
  padding: 10px 14px; border-radius: 14px; background: rgba(14,24,20,.96); color: #fff;
  border: 1px solid rgba(255,255,255,.2); font-size: .85rem; line-height: 1.35;
}
.jtoast[hidden]{ display: none; }

@media (orientation: landscape) and (max-height: 640px){
  .jtools{ right: 8px; bottom: 6px; gap: 5px; }
  .jtools button{ width: 30px; height: 30px; }
  .jtools .jA-s{ font-size: .62rem; } .jtools .jA-l{ font-size: .95rem; }
  .jtools svg{ width: 15px; height: 15px; }
  .jsizepanel, .jtoast{ bottom: 38px; }
}
@media (prefers-reduced-motion: reduce){ .jtools button{ transition: none; } }
