:root{
  --white:#f5fbff;
  --muted:#bfd3ff;
  --line:rgba(255,255,255,.10);
  --card1:rgba(18,18,66,.78);
  --card2:rgba(15,17,54,.84);
  --success:#19c37d;
  --danger:#ff5d73;
  --shadow:0 20px 60px rgba(0,0,0,.35);
  --radius:24px;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
html{scroll-behavior:smooth}

body{
  min-height:100vh;
  font-family:Arial, Helvetica, sans-serif;
  color:var(--white);
  background:
    radial-gradient(circle at 50% 26%, rgba(36,228,255,.55), rgba(36,228,255,.08) 18%, transparent 40%),
    radial-gradient(circle at 22% 88%, rgba(255,53,203,.30), transparent 23%),
    radial-gradient(circle at 88% 78%, rgba(123,44,255,.28), transparent 20%),
    linear-gradient(135deg, #0ad1e3 0%, #11236d 18%, #18085a 54%, #28074d 100%);
  overflow-x:hidden;
  position:relative;
  -webkit-text-size-adjust:100%;
}

body::before,
body::after{
  content:"";
  position:fixed;
  pointer-events:none;
  z-index:0;
}

body::before{
  width:420px;
  height:420px;
  left:-110px;
  bottom:-120px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(255,0,170,.42), rgba(0,0,0,0) 68%);
  filter:blur(10px);
}

body::after{
  width:420px;
  height:420px;
  right:-120px;
  top:120px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(0,220,255,.30), rgba(0,0,0,0) 70%);
  filter:blur(10px);
}

.decor{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:0;
  overflow:hidden;
}

.tri{
  position:absolute;
  width:120px;
  height:120px;
  clip-path:polygon(50% 0, 0 100%, 100% 100%);
  background:linear-gradient(180deg, rgba(0,255,255,.75), rgba(61,74,255,.25));
  filter:drop-shadow(0 0 18px rgba(78,111,255,.55));
  opacity:.8;
}

.tri.t1{left:30px; top:160px; transform:rotate(-18deg)}
.tri.t2{left:95px; top:230px; width:100px; height:100px; transform:rotate(-8deg)}
.tri.t3{left:250px; top:86px; width:70px; height:70px; transform:rotate(48deg)}
.tri.t4{left:306px; top:120px; width:56px; height:56px; transform:rotate(16deg)}
.tri.t5{right:48px; top:302px; width:148px; height:148px; transform:rotate(18deg)}

.dots{
  position:absolute;
  display:grid;
  grid-template-columns:repeat(5, 14px);
  gap:14px;
}

.dots span{
  width:12px;
  height:12px;
  border-radius:50%;
  background:rgba(255,65,214,.88);
  box-shadow:0 0 10px rgba(255,65,214,.45);
}

.dots.d1{left:150px; bottom:54px}
.dots.d2{right:140px; top:74px}
.dots.d2 span{background:rgba(89,115,255,.78)}

.stage{
  position:relative;
  z-index:1;
  width:min(1400px, 100%);
  margin:0 auto;
  padding:18px;
}

.shell{
  background:linear-gradient(180deg, rgba(8,10,50,.42), rgba(19,8,68,.38));
  border:1px solid rgba(255,255,255,.08);
  border-radius:32px;
  box-shadow:0 24px 70px rgba(0,0,0,.35);
  backdrop-filter:blur(8px);
  overflow:hidden;
  min-width:0;
}

header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:18px 22px;
  border-bottom:1px solid rgba(255,255,255,.08);
  background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  min-width:0;
}

.brand{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
  flex:1 1 auto;
}

.brand img{
  width:56px;
  height:56px;
  object-fit:contain;
  border-radius:16px;
  background:rgba(255,255,255,.10);
  padding:6px;
  border:1px solid rgba(255,255,255,.12);
  box-shadow:0 10px 25px rgba(0,0,0,.25);
  flex:0 0 auto;
}

.brand-text{
  min-width:0;
}

.brand h1{
  margin:0;
  font-size:clamp(20px, 3.2vw, 28px);
  line-height:1.2;
  word-break:break-word;
}

.brand p{
  margin:4px 0 0;
  color:var(--muted);
  font-size:14px;
  line-height:1.5;
  word-break:break-word;
}

.top-nav{
  display:flex;
  gap:10px;
  overflow-x:auto;
  overflow-y:hidden;
  white-space:nowrap;
  padding-bottom:4px;
  scrollbar-width:thin;
  -webkit-overflow-scrolling:touch;
  max-width:100%;
  min-width:0;
  flex:0 1 auto;
}

.top-nav::-webkit-scrollbar,
.horizontal-scroll::-webkit-scrollbar{
  height:8px;
}

.top-nav::-webkit-scrollbar-thumb,
.horizontal-scroll::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.18);
  border-radius:999px;
}

.menu-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  color:#fff;
  padding:11px 18px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.07);
  transition:.2s ease;
  flex:0 0 auto;
}

.menu-btn:hover{
  transform:translateY(-1px);
  background:rgba(255,255,255,.11);
  border-color:rgba(255,255,255,.22);
}

.top-group-bar{
  padding:14px 16px 0;
}

.horizontal-scroll{
  display:flex;
  flex-wrap:nowrap;
  gap:10px;
  overflow-x:auto;
  overflow-y:hidden;
  padding-bottom:8px;
  scrollbar-width:thin;
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x proximity;
  min-width:0;
}

.tab{
  padding:10px 16px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.05);
  color:#dce8ff;
  cursor:pointer;
  transition:.2s ease;
  font-size:14px;
  white-space:nowrap;
  flex:0 0 auto;
  scroll-snap-align:start;
}

.tab:hover{
  transform:translateY(-1px);
  border-color:rgba(255,255,255,.22);
  background:rgba(255,255,255,.09);
}

.tab.active{
  background:linear-gradient(90deg, rgba(255,54,206,.34), rgba(36,228,255,.24));
  border-color:rgba(36,228,255,.52);
  box-shadow:0 10px 25px rgba(36,228,255,.18);
  color:#fff;
}

.content{
  display:grid;
  grid-template-columns:minmax(0, 1fr) 320px;
  gap:18px;
  padding:18px;
  min-width:0;
}

.main-col,
.right-col{
  display:grid;
  gap:18px;
  min-width:0;
}

.right-col{
  align-content:start;
}

.card{
  background:linear-gradient(180deg, var(--card1), var(--card2));
  border:1px solid rgba(255,255,255,.08);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:18px;
  backdrop-filter:blur(10px);
  min-width:0;
  overflow:hidden;
}

.title{
  margin:0 0 8px;
  font-size:22px;
  line-height:1.3;
  word-break:break-word;
}

.muted{
  color:var(--muted);
  line-height:1.6;
  word-break:break-word;
}

.set-row-title{
  font-size:14px;
  color:var(--muted);
  margin-bottom:12px;
}

.hero{
  position:relative;
  overflow:hidden;
  min-height:150px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(36,228,255,.36), transparent 40%),
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
}

.hero::before{
  content:"";
  position:absolute;
  width:200px;
  height:200px;
  border-radius:50%;
  right:40px;
  bottom:-70px;
  background:radial-gradient(circle, rgba(122,48,255,.44), rgba(122,48,255,0) 65%);
  pointer-events:none;
}

.hero h2{
  margin:0;
  font-size:clamp(24px, 4vw, 38px);
  line-height:1.15;
  word-break:break-word;
}

.chip-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:8px;
  min-width:0;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:13px;
  padding:9px 13px;
  border-radius:999px;
  background:rgba(255,255,255,.07);
  color:#eef6ff;
  border:1px solid rgba(255,255,255,.10);
  max-width:100%;
  min-width:0;
  word-break:break-word;
}

.progress-wrap{
  display:grid;
  gap:10px;
}

.progress-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.progress{
  height:14px;
  border-radius:999px;
  background:rgba(0,0,0,.28);
  border:1px solid rgba(255,255,255,.08);
  overflow:hidden;
}

.progress-bar{
  height:100%;
  width:0%;
  background:linear-gradient(90deg, #ff35cb 0%, #5d73ff 52%, #29f1ff 100%);
  transition:width .25s ease;
  box-shadow:0 0 18px rgba(36,228,255,.22);
}

.question-card{
  min-height:430px;
  display:flex;
  flex-direction:column;
  gap:16px;
  min-width:0;
}

.question-meta{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  min-width:0;
}

.question-meta-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:52px;
  height:52px;
  padding:0 16px;
  border-radius:999px;
  font-weight:bold;
  background:linear-gradient(180deg, rgba(255,53,203,.36), rgba(36,228,255,.18));
  border:1px solid rgba(36,228,255,.35);
  box-shadow:0 10px 30px rgba(0,0,0,.24);
  flex:0 0 auto;
}

.question-text{
  font-size:clamp(20px, 3.1vw, 27px);
  line-height:1.65;
  white-space:pre-wrap;
  padding-top:2px;
  word-break:break-word;
  overflow-wrap:anywhere;
}

.options{
  display:grid;
  gap:12px;
  margin-top:2px;
  min-width:0;
}

.option{
  width:100%;
  display:flex;
  gap:12px;
  align-items:flex-start;
  text-align:left;
  padding:16px;
  border-radius:18px;
  cursor:pointer;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.05);
  color:#fff;
  font-size:16px;
  line-height:1.6;
  transition:.2s ease;
  min-width:0;
}

.option:hover{
  transform:translateY(-1px);
  border-color:rgba(36,228,255,.34);
  background:rgba(255,255,255,.07);
  box-shadow:0 10px 24px rgba(0,0,0,.20);
}

.option .letter{
  width:36px;
  height:36px;
  flex:0 0 36px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.10);
  font-weight:bold;
  margin-top:1px;
}

.option > span:last-child{
  min-width:0;
  word-break:break-word;
  overflow-wrap:anywhere;
}

.option.correct{
  border-color:rgba(25,195,125,.62);
  background:rgba(25,195,125,.14);
}

.option.wrong{
  border-color:rgba(255,93,115,.62);
  background:rgba(255,93,115,.14);
}

.option.dim{
  opacity:.72;
}

.answer-info{
  min-height:56px;
  display:flex;
  align-items:center;
  padding:12px 14px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.04);
  line-height:1.6;
  word-break:break-word;
  overflow-wrap:anywhere;
}

.answer-info.success{
  border-color:rgba(25,195,125,.45);
  background:rgba(25,195,125,.13);
  color:#dbffef;
}

.answer-info.error{
  border-color:rgba(255,93,115,.45);
  background:rgba(255,93,115,.13);
  color:#ffe4e8;
}

.btn{
  border:none;
  outline:none;
  padding:12px 18px;
  border-radius:16px;
  color:#fff;
  cursor:pointer;
  font-size:14px;
  background:linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.08));
  border:1px solid rgba(255,255,255,.12);
  transition:.2s ease;
  min-height:46px;
}

.btn:hover{
  transform:translateY(-1px);
  filter:brightness(1.06);
}

.btn.primary{
  background:linear-gradient(90deg, #ff35cb, #596cff, #29f1ff);
  color:#fff;
  border:none;
}

.btn.full{
  width:100%;
}

.summary-action{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.stat-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
  min-width:0;
}

.stat{
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
  border-radius:18px;
  padding:14px;
  min-width:0;
}

.stat b{
  display:block;
  font-size:24px;
  margin-bottom:5px;
  word-break:break-word;
}

.stat span{
  display:block;
  word-break:break-word;
}

.help-list{
  margin:10px 0 0 18px;
  padding:0;
  color:var(--muted);
  line-height:1.8;
}

.help-list li{
  margin-bottom:4px;
  word-break:break-word;
}

.summary{
  display:grid;
  gap:14px;
}

.summary-grid{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:12px;
}

.summary-box{
  padding:16px;
  border-radius:18px;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.08);
  min-width:0;
}

.summary-box b{
  display:block;
  font-size:28px;
  margin-bottom:6px;
  word-break:break-word;
}

.review-list{
  display:grid;
  gap:12px;
  margin-top:6px;
  min-width:0;
}

.review-item{
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.08);
  border-radius:18px;
  padding:14px;
  min-width:0;
}

.review-item .q{
  font-size:16px;
  line-height:1.6;
  margin-bottom:10px;
  white-space:pre-wrap;
  word-break:break-word;
  overflow-wrap:anywhere;
}

.mini{
  font-size:13px;
  color:var(--muted);
  line-height:1.7;
  word-break:break-word;
  overflow-wrap:anywhere;
}

.history-box{
  display:none;
  margin-top:14px;
  border-top:1px solid rgba(255,255,255,.08);
  padding-top:14px;
}

.history-box.show{
  display:block;
}

.history-empty{
  color:var(--muted);
  font-size:14px;
  line-height:1.6;
}

.history-list{
  display:grid;
  gap:10px;
}

.history-item{
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.08);
  border-radius:16px;
  padding:12px;
}

.history-item .top{
  display:flex;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:6px;
}

.history-item .score{
  font-weight:bold;
  color:#fff;
}

.hide{display:none !important}

body.quiz-mode header,
body.quiz-mode .top-group-bar,
body.quiz-mode .right-col,
body.quiz-mode .main-col > section:not(#quizPanel){
  display:none !important;
}

body.quiz-mode .content{
  grid-template-columns:1fr !important;
  padding:24px;
}

body.quiz-mode .main-col{
  display:block;
  width:100%;
  max-width:900px;
  margin:0 auto;
}

body.quiz-mode #quizPanel{
  display:flex !important;
  min-height:70vh;
}

@media (max-width:1100px){
  .content{
    grid-template-columns:minmax(0, 1fr);
  }
  .right-col{
    order:2;
  }
  .summary-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}

@media (max-width:860px){
  header{
    flex-direction:column;
    align-items:flex-start;
  }

  .top-nav{
    width:100%;
  }

  .menu-btn{
    padding:10px 16px;
  }
}

@media (max-width:700px){
  .stage{
    padding:10px;
  }

  .shell{
    border-radius:22px;
  }

  header{
    padding:14px;
  }

  .brand{
    align-items:flex-start;
  }

  .brand img{
    width:48px;
    height:48px;
    border-radius:14px;
  }

  .top-group-bar{
    padding:12px 12px 0;
  }

  .content{
    padding:12px;
    gap:12px;
  }

  .card{
    padding:14px;
    border-radius:18px;
  }

  .question-card{
    min-height:auto;
  }

  .option{
    padding:14px;
    font-size:15px;
  }

  .option .letter{
    width:32px;
    height:32px;
    flex-basis:32px;
  }

  .summary-grid{
    grid-template-columns:1fr;
  }

  .summary-action .btn{
    width:100%;
  }

  body.quiz-mode .content{
    padding:12px;
  }
}

@media (max-width:520px){
  .stage{
    padding:8px;
  }

  .shell{
    border-radius:18px;
  }

  header{
    padding:12px;
  }

  .content{
    padding:10px;
  }

  .top-group-bar{
    padding:10px 10px 0;
  }

  .card{
    padding:12px;
    border-radius:16px;
  }

  .chip-row{
    gap:8px;
  }

  .chip{
    width:100%;
    justify-content:flex-start;
    border-radius:14px;
  }

  .question-meta{
    align-items:flex-start;
  }

  .badge{
    min-width:48px;
    height:48px;
  }

  .stat-grid{
    grid-template-columns:1fr;
  }

  .progress-top{
    flex-direction:column;
    align-items:flex-start;
  }

  .summary-box b{
    font-size:24px;
  }

  .brand p{
    font-size:13px;
  }

  body.quiz-mode .content{
    padding:10px;
  }
}
