*{box-sizing:border-box}body{margin:0;font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;background:#f5f7fb;color:#172033}nav{height:68px;background:#fff;border-bottom:1px solid #e6eaf0;display:flex;align-items:center;justify-content:space-between;padding:0 5%;position:sticky;top:0;z-index:5}.brand{font-weight:800}.navright{display:flex;gap:18px;align-items:center}.navright a{color:#334155;text-decoration:none}.logout{color:#b91c1c!important}main{max-width:1180px;margin:30px auto;padding:0 18px}.hero{background:linear-gradient(135deg,#182b55,#3659a8);color:#fff;border-radius:26px;padding:42px;display:flex;justify-content:space-between;align-items:center;box-shadow:0 20px 50px #233d7a22}.eyebrow{font-size:12px;letter-spacing:2px;opacity:.8}.hero h1{font-size:40px;margin:10px 0}.hero p{max-width:700px;line-height:1.7;opacity:.9}.heroicon{font-size:48px;line-height:1.3;text-align:center}.stats{display:grid;grid-template-columns:repeat(5,1fr);gap:14px;margin:18px 0}.stats div,.card{background:#fff;border:1px solid #e8ebf2;border-radius:18px;padding:20px;box-shadow:0 8px 30px #1b29420a}.stats b{display:block;font-size:28px}.stats small,.muted{color:#64748b}.toolbar{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-bottom:14px}.toolbar label{font-weight:700;font-size:13px}.toolbar select,input,textarea{display:block;width:100%;margin-top:7px;border:1px solid #dbe1ea;border-radius:12px;padding:12px;background:#fff;font:inherit}.chat{height:390px;overflow:auto;background:#f7f9fc;border-radius:16px;padding:18px}.bubble{max-width:78%;padding:14px 16px;border-radius:16px;margin:10px 0;line-height:1.55}.bubble.ai{background:#fff;border:1px solid #e3e8f0}.bubble.user{background:#e9f0ff;margin-left:auto}.bubble p{margin:6px 0}.composer{margin-top:16px}.buttons{display:flex;gap:10px;margin-top:8px}.buttons button,.button,button{border:0;border-radius:11px;padding:12px 18px;background:#2457d6;color:#fff;font-weight:700;cursor:pointer}.buttons .mic{background:#111827}.speak{background:#eef2ff;color:#23439b;padding:8px 12px}.error{background:#fee2e2;color:#991b1b;padding:10px;border-radius:10px;margin:12px 0}.scoregrid{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin:14px 0}.scoregrid div{background:#f8fafc;padding:12px;border-radius:12px;text-align:center}.scoregrid b{display:block;font-size:22px}.correction{background:#fff7ed;border-left:4px solid #f59e0b;padding:14px;border-radius:10px}.good{background:#ecfdf5;border-left:4px solid #10b981;padding:14px;border-radius:10px;margin-top:10px}.tip{background:#fff7ed;border-left:4px solid #f59e0b;padding:14px;border-radius:10px;margin-top:10px}.agentinfo{background:#f1f5ff;border-radius:12px;padding:10px 14px;margin-bottom:14px}.sectiontitle{display:flex;justify-content:space-between;align-items:center}.sectiontitle h2{margin:0 0 4px}.exercise{margin-top:20px}.exercisebox{background:#f8fafc;border:1px solid #e2e8f0;border-radius:16px;padding:20px;margin-top:16px}.exerciseprogress{font-size:12px;font-weight:800;color:#64748b;text-transform:uppercase}.exercisebox h3{font-size:22px;line-height:1.5}.translation{background:#fff;padding:10px;border-radius:10px}.options{display:grid;gap:10px;margin-top:16px}.option{text-align:left;background:#fff;color:#172033;border:1px solid #dbe1ea}.option:hover{background:#eef4ff}.submitanswer{margin-top:10px}.exercisebox input{max-width:650px}.tablewrap{overflow:auto}table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:12px;border-bottom:1px solid #edf0f5}th{font-size:12px;text-transform:uppercase;color:#64748b}.pagehead{display:flex;justify-content:space-between;align-items:center}.auth{display:grid;place-items:center;min-height:100vh;background:#eef2ff}.authbox{width:min(420px,92%);background:#fff;padding:32px;border-radius:22px;box-shadow:0 20px 60px #11182718}.authbox h1{text-align:center}.authbox form{display:grid;gap:8px}.authbox button{margin-top:8px}.authbox a{color:#2457d6}@media(max-width:800px){.stats{grid-template-columns:repeat(2,1fr)}.hero h1{font-size:30px}.heroicon{display:none}.toolbar{grid-template-columns:1fr}.scoregrid{grid-template-columns:repeat(2,1fr)}nav{padding:0 15px}.navright{gap:8px}.navright span{display:none}.bubble{max-width:92%}}

.option{display:flex!important;align-items:center;justify-content:space-between;gap:10px}
.option .speak{flex:0 0 auto;margin-left:auto}
.optionTranslation{color:#64748b;font-weight:500}
.smallhint{margin-top:10px;font-size:13px}


/* ============================================================
   Responsive / mobile
   ============================================================ */
html{scroll-behavior:smooth}
body{overflow-x:hidden}
button,select,input,textarea{touch-action:manipulation}
button:disabled{opacity:.65;cursor:not-allowed}
.chat{scroll-behavior:smooth}
.exercisebox{min-width:0}
.exercisebox h3{overflow-wrap:anywhere}
.option{min-width:0;word-break:break-word;cursor:pointer}
.option>span:first-child{min-width:0}
.optionTranslation{display:inline}
#exerciseArea .buttons{flex-wrap:wrap}
#exerciseArea .speak{white-space:nowrap}
#startExercise{min-height:44px}

@media(max-width:800px){
  main{margin:16px auto;padding:0 12px}
  nav{height:auto;min-height:60px;padding:10px 12px}
  .brand{font-size:14px}
  .navright{gap:10px;flex-wrap:wrap;justify-content:flex-end}
  .hero{padding:24px 20px;border-radius:20px}
  .hero h1{font-size:28px;line-height:1.2}
  .hero p{font-size:14px}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .stats div,.card{padding:15px;border-radius:16px}
  .stats b{font-size:24px}
  .toolbar{gap:10px}
  .chat{height:48vh;min-height:300px;padding:12px}
  .bubble{max-width:94%;padding:12px}
  .composer textarea{min-height:90px}
  .buttons{flex-wrap:wrap}
  .buttons button{flex:1 1 130px;min-height:44px}
  .exercisebox{padding:14px;margin-top:12px}
  .exercisebox h3{font-size:19px}
  .options{gap:8px}
  .option{width:100%;padding:12px!important;line-height:1.45}
  .option .speak{flex:0 0 auto;min-width:42px}
  .optionTranslation{font-size:13px}
  .sectiontitle{align-items:flex-start}
  table{min-width:680px}
}

@media(max-width:480px){
  .hero h1{font-size:24px}
  .heroicon{display:none}
  .stats{grid-template-columns:1fr 1fr}
  .stats b{font-size:21px}
  .stats small{font-size:11px}
  .chat{min-height:260px;height:45vh}
  .bubble{max-width:96%;font-size:14px}
  .speak{padding:8px 10px}
  .exercisebox h3{font-size:18px}
  #exerciseArea .option{font-size:14px}
  .pagehead{align-items:flex-start;gap:10px;flex-direction:column}
}

@media(prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  *{scroll-behavior:auto!important}
}

.reply-translation {
  margin-top: .35rem;
  opacity: .88;
  font-size: .95em;
}


/* ============================================================
   AI-YANA 2-column conversation + mobile layout
   ============================================================ */
.homeactions{display:flex;gap:10px;flex-wrap:wrap;margin-top:20px}
.button.secondary{background:#eef2ff;color:#23439b}
.homecards{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:18px}
.homecard{display:flex;gap:14px;align-items:flex-start;padding:20px;background:#fff;border:1px solid #e8ebf2;border-radius:18px;text-decoration:none;color:inherit}
.homecard>span{font-size:30px}.homecard h2{margin:0 0 5px}.homecard p{margin:0;color:#64748b;line-height:1.5}
.conversation-layout{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(340px,.8fr);gap:18px;align-items:start}
.conversation-main{min-width:0}
.result-panel{position:sticky;top:86px;max-height:calc(100vh - 104px);overflow:auto}
.result-header{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;border-bottom:1px solid #edf0f5;padding-bottom:12px;margin-bottom:12px}
.result-header h2{margin:0 0 4px}.result-header p{margin:0}
.empty-result{padding:28px 16px;text-align:center;color:#64748b;line-height:1.6;background:#f8fafc;border-radius:14px}
.empty-result small{display:block;margin-top:8px}
.result-card{background:#fff}
.exercise-page{margin-top:18px}
.username{font-weight:700;color:#334155;white-space:nowrap}

@media(max-width:1050px){
 .conversation-layout{grid-template-columns:1fr}
 .result-panel{position:static;max-height:none}
}
@media(max-width:800px){
 .homecards{grid-template-columns:1fr}
 .conversation-layout{gap:12px}
 .result-panel{order:2}
 .conversation-main{order:1}
 .username{display:none}
 .homeactions .button{flex:1 1 180px;text-align:center}
}
@media(max-width:480px){
 .homeactions{display:grid}
 .homeactions .button{width:100%}
 .result-header{display:block}
 .result-header #resultStatus{display:block;margin-top:6px}
}


/* ============================================================
   Conversation / exercise refinement
   ============================================================ */
.conversation-layout{grid-template-columns:minmax(0,1.55fr) minmax(360px,.75fr)}
.conversation-main,.result-panel,.result-card,#result{min-width:0;max-width:100%}
.conversation-main{overflow:hidden}
.chat{height:clamp(520px,calc(100vh - 330px),700px);min-height:520px}
.result-panel{overflow-x:hidden;overflow-y:auto}
.result-card,.result-card p,.result-card li,.result-card h3,.result-card details,.result-card summary,.result-card div,.result-card span{max-width:100%;overflow-wrap:anywhere;word-break:break-word}
.result-card ul{padding-left:20px}
.result-card .scoregrid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.result-card .scoregrid div{min-width:0}
.exercise-finished{margin-top:16px}
.print-exercise{margin-top:8px;background:#172033}

@media(max-width:1050px){
 .conversation-layout{grid-template-columns:1fr}
 .result-panel{overflow:visible}
 .chat{height:560px}
}
@media(max-width:800px){
 .chat{height:58vh;min-height:340px;max-height:none}
 .result-card .scoregrid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:480px){
 .chat{height:52vh;min-height:300px}
 .result-card .scoregrid{grid-template-columns:1fr 1fr}
 .print-exercise{width:100%}
}

/* ============================================================
   Profile + history refinements
   ============================================================ */
.profile-card{max-width:900px;margin:18px auto}.profile-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.profile-grid label{font-weight:700;font-size:13px}.profile-grid .full{grid-column:1/-1}.profile-note{margin-top:16px;padding:12px 14px;background:#f8fafc;border-radius:12px;color:#64748b;line-height:1.5}.history-search{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:10px;margin-bottom:12px}.history-search input{margin-top:0}.history-meta{display:flex;justify-content:space-between;gap:10px;color:#64748b;font-size:13px;margin:10px 0}.center{text-align:center}.pagination{display:flex;justify-content:center;align-items:center;gap:6px;margin-top:18px;flex-wrap:wrap}.pagination a,.pagination span{min-width:38px;height:38px;padding:8px 11px;border-radius:10px;text-align:center;text-decoration:none;color:#334155;background:#f1f5f9}.pagination a.active{background:#2457d6;color:#fff;font-weight:800}.pagination span{background:transparent;min-width:auto}.history-card .tablewrap{overflow-x:auto}
@media(max-width:800px){.profile-grid{grid-template-columns:1fr}.profile-grid .full{grid-column:auto}.history-search{grid-template-columns:1fr}.history-search button,.history-search .button{width:100%;text-align:center}.history-meta{font-size:12px}.pagination{gap:4px}.pagination a,.pagination span{min-width:34px;height:34px;padding:7px 9px}}


/* Exercise answer speaker: keep it small and truly beside the answer.
   The option itself is a div so the speaker is not an invalid nested button. */
.option{display:flex!important;align-items:center;justify-content:space-between;gap:10px}
.option>span:first-child{flex:1 1 auto;min-width:0}
.option>.speak{flex:0 0 34px;width:34px;height:34px;padding:0!important;margin:0 0 0 auto!important;display:inline-flex;align-items:center;justify-content:center;border-radius:9px;font-size:14px}
.option:focus{outline:2px solid #2457d6;outline-offset:1px}
.result-panel,.result-card,#result{overflow-x:hidden;min-width:0;max-width:100%}
.result-card p,.result-card li,.result-card details{overflow-wrap:anywhere;word-break:break-word}
