:root{
  --bg1:#0b1020;
  --bg2:#1a1240;
  --bg3:#102a4a;

  --glass: rgba(255,255,255,.10);
  --glass2: rgba(255,255,255,.06);
  --stroke: rgba(255,255,255,.18);

  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.70);

  --ok: #35d07f;
  --bad:#ff5a6a;

  --accent:#7c5cff;
  --accent2:#2dd4ff;

  --shadow: 0 18px 60px rgba(0,0,0,.35);
  --radius: 18px;
}

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

body{
  margin:0;
  color:var(--text);
  font-family: ui-rounded, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1000px 600px at 10% 10%, rgba(124,92,255,.25), transparent 60%),
    radial-gradient(900px 600px at 90% 20%, rgba(45,212,255,.18), transparent 55%),
    linear-gradient(145deg, var(--bg1), var(--bg2) 45%, var(--bg3));
  overflow-x:hidden;
}

.bg-orbs{ position:fixed; inset:0; pointer-events:none; }
.orb{
  position:absolute;
  width:520px; height:520px;
  border-radius:999px;
  filter: blur(40px);
  opacity:.55;
}
.orb-a{ left:-140px; top:-120px; background: radial-gradient(circle, rgba(124,92,255,.9), transparent 60%); }
.orb-b{ right:-180px; top:120px; background: radial-gradient(circle, rgba(45,212,255,.8), transparent 60%); }
.orb-c{ left:25%; bottom:-220px; background: radial-gradient(circle, rgba(255,90,106,.45), transparent 60%); }

.page{
  min-height:100vh;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding: 28px 16px;
}

.card{
  width:min(1100px, 100%);
  background: linear-gradient(180deg, var(--glass), var(--glass2));
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.card-header{
  padding: 18px 18px 14px;
  display:flex;
  gap:14px;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(90deg, rgba(124,92,255,.16), rgba(45,212,255,.10));
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.title-wrap h1{
  margin:0 0 6px;
  font-size: 26px;
  letter-spacing:.2px;
}
.subtitle{
  margin:0;
  color:var(--muted);
  font-size: 14px;
}

.header-actions{
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.progress{
  min-width: 280px;
  max-width: 360px;
}
.progress-top{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:baseline;
}
.progress-label{
  font-size: 12px;
  color: var(--muted);
}
.progress-text{
  font-size: 12px;
  color: var(--text);
  font-weight: 650;
}
.progress-bar{
  margin-top:8px;
  height:10px;
  border-radius:999px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  overflow:hidden;
}
.progress-fill{
  height:100%;
  width:0%;
  border-radius:999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .25s ease;
}

.btn{
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 800;
  letter-spacing:.2px;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
  user-select:none;
}
.btn:hover{
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.26);
}
.btn:active{ transform: translateY(1px) scale(.99); }

.btn-primary{
  background: linear-gradient(90deg, rgba(124,92,255,.95), rgba(45,212,255,.85));
  border-color: transparent;
  color: #08101f;
}
.btn-primary:hover{ filter: brightness(1.05); }

/* browser scroll only */
.table-wrap{
  padding: 14px;
  overflow: visible;
  max-height: none;
}

.words-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width: 980px; /* desktop table width */
}

.words-table thead th{
  text-align:left;
  padding: 12px 10px;
  font-size: 13px;
  color: rgba(255,255,255,.90);
  background: rgba(20, 18, 45, .72);
  border-bottom: 1px solid rgba(255,255,255,.14);
}
.words-table thead th:first-child{ border-top-left-radius: 14px; }
.words-table thead th:last-child{ border-top-right-radius: 14px; }

.words-table tbody tr{
  background: rgba(255,255,255,.05);
}
.words-table tbody tr:nth-child(2n){
  background: rgba(255,255,255,.035);
}
.words-table tbody td{
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  vertical-align: middle;
}

.col-num{ width:50px; }
.col-audio{ width:100px; }
.col-check{ width:100px; }
.col-result{ width:90px; }
.col-msg{ width: 320px; }

.word-input{
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(8,12,25,.35);
  color: var(--text);
  outline: none;
  font-size: 14px;
}
.word-input:focus{
  border-color: rgba(45,212,255,.55);
  box-shadow: 0 0 0 3px rgba(45,212,255,.12);
}
.word-input::placeholder{ color: rgba(255,255,255,.42); }

.result-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 40px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
}
.result-pill.ok{
  background: rgba(53,208,127,.18);
  border-color: rgba(53,208,127,.35);
  color: var(--ok);
}
.result-pill.bad{
  background: rgba(255,90,106,.18);
  border-color: rgba(255,90,106,.35);
  color: var(--bad);
}

.msg{
  font-size: 13px;
  color: var(--muted);
}
.msg.ok{ color: rgba(53,208,127,.95); }
.msg.err{ color: rgba(255,90,106,.95); }

.row-ok{ animation: flashOk .35s ease; }
.row-bad{ animation: flashBad .35s ease, shake .22s ease; }

@keyframes flashOk{
  from{ box-shadow: inset 0 0 0 2px rgba(53,208,127,.55); }
  to{ box-shadow: inset 0 0 0 2px rgba(53,208,127,0); }
}
@keyframes flashBad{
  from{ box-shadow: inset 0 0 0 2px rgba(255,90,106,.55); }
  to{ box-shadow: inset 0 0 0 2px rgba(255,90,106,0); }
}
@keyframes shake{
  0%{ transform: translateX(0); }
  35%{ transform: translateX(-3px); }
  70%{ transform: translateX(3px); }
  100%{ transform: translateX(0); }
}

.summary{
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}
.hidden{ display:none; }

.summary-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap: 10px;
}
.summary-head h2{ margin: 0; font-size: 18px; }
.score{
  font-weight: 900;
  font-size: 18px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.summary-sub{ margin: 8px 0 10px; color: var(--muted); }
.incorrect-list li{ margin: 6px 0; }

.json-dump{
  margin-top: 12px;
  border-top: 1px dashed rgba(255,255,255,.18);
  padding-top: 10px;
}
pre{
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0,0,0,.40);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.92);
  padding: 10px;
  border-radius: 14px;
  overflow:auto;
}

.card-footer{
  padding: 10px 18px 14px;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,.10);
}

/* =========================
   ✅ MOBILE FRIENDLY LAYOUT
   Turn table rows into cards
   ========================= */
@media (max-width: 900px){
  .page{ padding: 18px 12px; }
  .card-header{ padding: 16px 14px 12px; }
  .title-wrap h1{ font-size: 20px; }
  .subtitle{ font-size: 13px; }
  .progress{ min-width: 240px; }

  /* remove forced wide table */
  .words-table{ min-width: 0; }

  /* hide header row (labels are shown per cell) */
  .words-table thead{ display:none; }

  /* each <tr> becomes a card */
  .words-table tbody tr{
    display:block;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 16px;
    overflow:hidden;
    margin: 10px 0;
    background: rgba(255,255,255,.06);
  }

  /* each <td> becomes a labeled row */
  .words-table tbody td{
    display:grid;
    grid-template-columns: 110px 1fr;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .words-table tbody td:last-child{
    border-bottom: 0;
  }

  .words-table tbody td::before{
    content: attr(data-label);
    color: rgba(255,255,255,.75);
    font-weight: 900;
    letter-spacing: .2px;
  }

  /* buttons look better full width on mobile */
  .btn{
    width: 100%;
    justify-self: start;
    text-align: center;
  }

  .result-pill{
    justify-self: start;
  }

  /* make message wrap nicely */
  .msg{
    line-height: 1.25;
  }

  /* summary on mobile spacing */
  .summary{ padding: 12px 14px 16px; }
}

