:root{
  font-family:system-ui,-apple-system,Segoe UI,sans-serif;
  color:#1b2440;
  background:#fff7d6;
}
*{box-sizing:border-box}
body{
  margin:0;
  background:
    radial-gradient(circle at 12% 10%, #ffcf70 0 120px, transparent 121px),
    radial-gradient(circle at 86% 0%, #7dd3fc 0 160px, transparent 161px),
    linear-gradient(135deg,#fff7d6 0%,#fef3c7 36%,#dbeafe 100%);
}
.wrap{max-width:1120px;margin:auto;padding:28px}
.hero{
  display:grid;
  grid-template-columns:minmax(0,1fr) 300px;
  gap:18px;
  align-items:stretch;
  margin-bottom:20px;
}
.hero h1{font-size:52px;line-height:1;margin:0 0 10px;color:#6d28d9}
.hero p{font-size:18px;color:#475569;margin:0}
.eyebrow{
  margin:0 0 6px;
  color:#db2777;
  font-size:13px;
  font-weight:850;
  letter-spacing:0;
  text-transform:uppercase;
}
.card,.trophy-card{
  background:#fffdfa;
  border:2px solid #ffffff;
  border-radius:18px;
  box-shadow:0 16px 35px #7c3aed20;
}
.card{padding:22px;margin-bottom:18px}
.trophy-card{
  display:flex;
  align-items:center;
  gap:14px;
  padding:20px;
  background:linear-gradient(135deg,#fef08a,#fdba74);
}
.trophy-icon{font-size:48px}
.trophy-card strong{display:block;font-size:21px;color:#7c2d12}
.trophy-card span{color:#854d0e;font-weight:700}
.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:14px;
}
label,h2{font-weight:850}
h2{margin:0;color:#1d4ed8}
textarea{
  width:100%;
  min-height:185px;
  margin-top:10px;
  border:2px solid #bfdbfe;
  border-radius:14px;
  padding:16px;
  font-size:17px;
  line-height:1.55;
  resize:vertical;
  background:#f8fbff;
  color:#1b2440;
}
textarea:focus{outline:3px solid #f9a8d4;border-color:#ec4899}
.pill,.live-state{
  border-radius:999px;
  padding:7px 11px;
  font-size:13px;
  font-weight:850;
  white-space:nowrap;
}
.pill{background:#e0f2fe;color:#075985}
.stage-strip{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}
.stage-dot{
  width:42px;
  height:42px;
  padding:0;
  border:2px solid #bfdbfe;
  border-radius:14px;
  background:#eff6ff;
  color:#1d4ed8;
  font-weight:900;
}
.stage-dot.is-current{background:#7c3aed;color:white;border-color:#7c3aed}
.stage-dot.is-done{background:#fde68a;border-color:#f59e0b}
.practice-card{border-color:#fde68a}
.poem-field{position:relative}
.current-fragment{
  min-height:210px;
  margin:0;
  border:2px solid #f9a8d4;
  border-radius:16px;
  background:#fff1f7;
  padding:18px;
  white-space:pre-wrap;
  font-family:inherit;
  font-size:23px;
  font-weight:800;
  line-height:1.65;
  color:#831843;
}
.practice-cover{
  position:absolute;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:10px;
  border:2px solid #a78bfa;
  border-radius:16px;
  background:#f5f3ff;
  text-align:center;
  color:#3b0764;
  padding:22px;
}
.practice-cover strong{font-size:27px}
.practice-cover span{max-width:430px;color:#6b21a8;font-weight:750}
.practice-cover pre{
  max-width:100%;
  max-height:150px;
  margin:0;
  overflow:auto;
  white-space:pre-wrap;
  text-align:left;
  font-family:inherit;
  font-size:24px;
  font-weight:900;
  line-height:1.7;
}
.poem-field.is-hidden .current-fragment{color:transparent;user-select:none}
.poem-field.is-hidden .practice-cover{display:flex}
.learn-modes{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  margin-top:16px;
}
.mode-card{
  display:grid;
  grid-template-columns:auto 1fr;
  column-gap:10px;
  row-gap:3px;
  align-items:center;
  min-height:98px;
  text-align:left;
  border:2px solid #e9d5ff;
  border-radius:16px;
  background:#ffffff;
  color:#1b2440;
  padding:12px;
  box-shadow:none;
}
.mode-card strong{font-size:15px}
.mode-card small{
  grid-column:2;
  color:#64748b;
  font-weight:700;
  line-height:1.35;
}
.mode-card.is-selected{border-color:#8b5cf6;background:#f5f3ff}
.mode-mark{
  display:flex;
  align-items:center;
  justify-content:center;
  width:38px;
  height:38px;
  border-radius:13px;
  background:#f97316;
  color:#fff;
  font-weight:950;
}
.actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:16px}
button{
  border:0;
  border-radius:14px;
  padding:13px 18px;
  font-weight:850;
  cursor:pointer;
  background:#2563eb;
  color:white;
}
button:hover:not(:disabled){filter:brightness(1.05);transform:translateY(-1px)}
button:disabled{opacity:.45;cursor:not-allowed;transform:none}
#stopBtn{background:#dc2626}
#nextStageBtn{background:#16a34a}
#demoBtn{background:#fef3c7;color:#92400e}
.status{color:#475569;font-weight:750}
.medal-board{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.medal{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:30px;
  height:30px;
  border-radius:999px;
  background:#e2e8f0;
  color:#94a3b8;
  font-weight:900;
}
.medal.is-earned{background:#fef08a;color:#a16207}
.live-state{background:#e2e8f0;color:#475569}
.live-state.is-active{background:#bbf7d0;color:#166534}
.live-state.is-warning{background:#fed7aa;color:#9a3412}
.live-box{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:16px}
.mini-label{
  margin-bottom:8px;
  color:#475569;
  font-size:13px;
  font-weight:850;
  text-transform:uppercase;
}
.live-words{
  min-height:96px;
  border:2px solid #bae6fd;
  border-radius:16px;
  background:#f0f9ff;
  padding:14px;
  line-height:2.45;
}
.live-word{
  display:inline-block;
  margin:0 6px 6px 0;
  padding:2px 9px;
  border-radius:11px;
  background:#e2e8f0;
  font-weight:800;
}
.live-word.ok{background:#bbf7d0;color:#166534}
.live-word.near{background:#fef08a;color:#854d0e}
.live-word.wrong{background:#fecaca;color:#991b1b}
.live-word.filler{background:#ddd6fe;color:#5b21b6}
.hint-box{
  border:2px solid #fed7aa;
  border-radius:16px;
  background:#fff7ed;
  padding:14px;
}
.next-hint{
  min-height:54px;
  display:flex;
  align-items:center;
  font-size:34px;
  font-weight:950;
  color:#ea580c;
  overflow-wrap:anywhere;
}
.next-hint:not(.is-visible){color:#9ca3af;font-size:25px}
.helper-note{margin:12px 0 0;color:#64748b;font-size:14px;font-weight:650}
.grid{display:grid;grid-template-columns:1fr 320px;gap:18px}
.score{font-size:46px;font-weight:950;color:#7c3aed}
.transcript{line-height:1.6;color:#334155}
.wordmap{display:flex;gap:8px;flex-wrap:wrap;line-height:2.4}
.word{
  padding:4px 9px;
  border-radius:10px;
  background:#e2e8f0;
  font-weight:750;
}
.ok{background:#bbf7d0}
.near{background:#fef08a}
.wrong,.missing{background:#fecaca}
.errors{font-size:14px;color:#475569}
.err{padding:8px 0;border-bottom:1px solid #e2e8f0}
@media(max-width:800px){
  .wrap{padding:16px}
  .hero,.grid,.live-box,.learn-modes{grid-template-columns:1fr}
  .hero h1{font-size:40px}
  .panel-head{align-items:flex-start;flex-direction:column}
  .pill,.live-state{white-space:normal}
  .current-fragment{font-size:20px}
  .next-hint{font-size:28px}
  .medal-board{justify-content:flex-start}
}

.account-card input{
  width:100%;
  border:2px solid #bfdbfe;
  border-radius:12px;
  padding:12px 14px;
  font-size:16px;
  background:#f8fbff;
  color:#1b2440;
}
.auth-box{
  display:grid;
  grid-template-columns:1fr 1fr auto auto;
  gap:10px;
  margin-bottom:16px;
}
.user-box{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background:#ecfeff;
  border:2px solid #a5f3fc;
  border-radius:14px;
  padding:12px 14px;
  margin-bottom:16px;
}
.is-hidden{display:none!important}
.library-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(280px,420px);
  gap:18px;
  align-items:start;
}
#poemTitle{margin-top:10px}
.mini-actions{margin-top:10px}
.poem-list{
  min-height:78px;
  margin-top:10px;
  border:2px dashed #bfdbfe;
  border-radius:14px;
  padding:10px;
  background:#f8fbff;
  color:#475569;
}
.poem-list-item{
  display:grid;
  grid-template-columns:1fr auto;
  gap:8px;
  align-items:center;
  padding:8px 0;
  border-bottom:1px solid #dbeafe;
}
.poem-list-item:last-child{border-bottom:0}
.poem-load{
  text-align:left;
  background:#fff;
  color:#1b2440;
  border:1px solid #dbeafe;
  border-radius:12px;
  padding:10px 12px;
  box-shadow:none;
}
.poem-load strong{display:block;font-size:15px}
.poem-load small{display:block;color:#64748b;margin-top:3px}
.poem-delete{
  background:#fee2e2;
  color:#991b1b;
  box-shadow:none;
  padding:9px 11px;
}
button:disabled{opacity:.55;cursor:not-allowed}

@media (max-width: 840px){
  .auth-box,.library-grid{grid-template-columns:1fr}
}
