:root{
  --bg: #0b1020;
  --card: rgba(255,255,255,.08);
  --stroke: rgba(255,255,255,.14);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.65);
  --good: #2bff64;
  --bad: #ff4d6d;
  --accent: #6d5cff;
  --shadow: 0 18px 60px rgba(0,0,0,.55);
  --r: 18px;
  --r2: 24px;
  --maxw: 980px;

  --pad: clamp(12px, 2.4vw, 18px);
  --gap: clamp(10px, 1.8vw, 14px);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; margin:0; }

body{
  overflow: hidden;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: var(--text);
  background:
    radial-gradient(1000px 600px at 15% 10%, rgba(109,92,255,.25), transparent 60%),
    radial-gradient(900px 600px at 80% 0%, rgba(43,212,255,.18), transparent 55%),
    radial-gradient(1000px 800px at 50% 110%, rgba(255,77,109,.10), transparent 60%),
    var(--bg);
}

.app{
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--pad);
  display:flex;
  flex-direction: column;
  gap: var(--gap);
}

.card{
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--stroke);
  border-radius: var(--r2);
  background: rgba(255,255,255,.06);
  box-shadow: var(--shadow);
  padding: 14px;
  backdrop-filter: blur(10px);

  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topbar{
  flex: 0 0 auto;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;

  padding: 0 0 10px 0;
  border: 0;
  border-bottom: 1px solid var(--stroke);
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  min-height: auto;
}

.title{ min-width:0; display:flex; flex-direction:column; gap:2px; }
.title h1{
  margin:0;
  font-size: 16px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.title p{ margin:0; color: var(--muted); font-size: 12px; }

.stats{ display:flex; gap:10px; align-items:center; flex-shrink:0; }
.pill{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
  display:flex;
  gap: 8px;
  align-items:center;
  white-space: nowrap;
}
.pill .ok{ color: var(--good); font-weight: 900; }
.pill .ko{ color: var(--bad); font-weight: 900; }
.pill .sep{ color: var(--muted); padding: 0 4px; }

.qmedia{
  aspect-ratio: 16 / 9;
  max-height: clamp(240px, 44dvh, 520px);
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.28);
  border-radius: 16px;
}

.qmedia__img{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 50%;
}

.qhead{
  flex: 0 0 auto;
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 10px;
}

.qindex{
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.question{
  margin:0;
  font-size: 18px;
  line-height: 1.35;
}

.hint{
  flex: 0 0 auto;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.field{
  flex: 0 0 auto;
  min-height: 0;
  display:flex;
  flex-direction: column;
  gap: 8px;
}

label{ font-size: 13px; color: var(--muted); }

textarea{
  width: 100%;
  flex: 0 0 auto;
  height: clamp(110px, 18dvh, 180px);
  resize: none;
  border-radius: var(--r);
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.25);
  color: var(--text);
  padding: 12px;
  outline: none;
  font-size: 15px;
  line-height: 1.4;
}

textarea:focus{
  border-color: rgba(109,92,255,.7);
  box-shadow: 0 0 0 4px rgba(109,92,255,.18);
}

.card.has-feedback textarea{
  height: clamp(70px, 10dvh, 110px);
}

.actions{
  flex: 0 0 auto;
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.is-hidden{ display: none !important; }

.btn{
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.08);
  color: var(--text);
  padding: 11px 12px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
  user-select: none;
}

.btn:active{ transform: translateY(1px); }
.btn:disabled{ opacity: .55; cursor:not-allowed; }

.btn--primary{
  background: linear-gradient(135deg, rgba(109,92,255,.95), rgba(43,212,255,.55));
  border-color: rgba(109,92,255,.55);
}

.btn--ghost{ background: rgba(255,255,255,.05); }

.btn--danger{
  background: rgba(255,77,109,.12);
  border-color: rgba(255,77,109,.35);
}

.feedback{
  flex: 0 0 auto;
  border-radius: var(--r);
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  padding: 12px;
  display:none;
  max-height: none;
  overflow: visible;
}

.feedback.is-show{ display:block; }
.feedback.is-ok .feedback__title{ color: var(--good); }
.feedback.is-ko .feedback__title{ color: var(--bad); }

.feedback__title{
  margin: 0 0 6px;
  font-weight: 900;
  font-size: 14px;
}

.feedback__text{
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
  white-space: pre-wrap;
}

@media (max-width: 520px){
  .question{ font-size: 17px; }
}

@media (max-height: 720px){
  .card{ padding: 12px; gap: 8px; }
  .topbar{ padding-bottom: 8px; }
  .hint{ display:none; }

  .qmedia{ max-height: clamp(200px, 40dvh, 380px); }

  textarea{ height: clamp(90px, 14dvh, 140px); }
  .btn{ padding: 10px 11px; }
}