:root{
  --bg:#030817;
  --panel:#0b1936;
  --blue:#4da3ff;
  --violet:#7657ff;
  --gold:#f4c96b;
  --text:#f4f7ff;
  --muted:#a9b6d3;
  --border:rgba(115,169,255,.18);
  --success:#a8ffd0;
  --danger:#ffb5b5;
}

*{box-sizing:border-box}

html{scroll-behavior:smooth}

body{
  margin:0;
  min-height:100vh;
  font-family:Arial,Helvetica,sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 15% 10%,rgba(40,77,220,.22),transparent 30%),
    radial-gradient(circle at 85% 25%,rgba(112,63,255,.18),transparent 30%),
    radial-gradient(circle at 50% 90%,rgba(0,170,255,.10),transparent 35%),
    linear-gradient(160deg,#020611,#06132c 50%,#020817);
  background-attachment:fixed;
}

body:before{
  content:"";
  position:fixed;
  inset:0;
  z-index:-1;
  pointer-events:none;
  opacity:.15;
  background-image:
    radial-gradient(circle,rgba(255,255,255,.8) 1px,transparent 1px),
    radial-gradient(circle,rgba(90,180,255,.55) 1px,transparent 1px);
  background-size:75px 75px,120px 120px;
}

button,input,select{font:inherit}
button{cursor:pointer}

header{
  position:sticky;
  top:0;
  z-index:40;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:16px 18px;
  background:rgba(2,8,24,.88);
  backdrop-filter:blur(18px);
  border-bottom:1px solid var(--border);
}

.logo{
  font-size:21px;
  font-weight:900;
  background:linear-gradient(90deg,#fff,#7ccfff,#b2a1ff);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
}

.header-actions{
  display:flex;
  align-items:center;
  gap:8px;
}

.text-btn{
  border:0;
  background:none;
  color:#dce9ff;
  padding:9px;
  font-weight:700;
}

.primary,.small-primary{
  border:0;
  color:white;
  font-weight:800;
  background:linear-gradient(135deg,#237dff,#7657ff);
  box-shadow:0 8px 28px rgba(57,104,255,.28);
}

.primary{
  padding:14px 24px;
  border-radius:28px;
}

.small-primary{
  padding:9px 15px;
  border-radius:22px;
}

.secondary{
  padding:13px 22px;
  border-radius:28px;
  border:1px solid rgba(108,176,255,.45);
  background:rgba(23,55,105,.28);
  color:#d9ebff;
  font-weight:800;
}

.full{width:100%}

.hero{
  text-align:center;
  padding:72px 22px 50px;
}

.om{
  font-size:72px;
  color:var(--gold);
  text-shadow:0 0 20px rgba(244,201,107,.5);
}

.hero h1{
  max-width:680px;
  margin:12px auto;
  line-height:1.06;
  font-size:clamp(40px,8vw,58px);
  background:linear-gradient(110deg,#fff,#9dd6ff,#c0b4ff);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
}

.hero p{
  max-width:600px;
  margin:18px auto 24px;
  color:var(--muted);
  line-height:1.7;
}

.container{
  width:min(960px,100%);
  margin:auto;
}

.section{
  padding:32px 18px;
}

.section-title{
  margin:0 0 6px;
  font-size:28px;
}

.section-sub{
  color:var(--muted);
  line-height:1.55;
}

.cards{
  display:grid;
  grid-template-columns:1fr;
  gap:15px;
  margin-top:20px;
}

.card{
  padding:21px;
  border-radius:21px;
  border:1px solid var(--border);
  background:linear-gradient(145deg,rgba(18,42,83,.76),rgba(7,20,48,.76));
  box-shadow:0 14px 40px rgba(0,0,0,.22);
}

.card p{
  color:var(--muted);
  line-height:1.55;
}

.card-icon{font-size:35px}

.clickable{
  cursor:pointer;
  transition:.2s;
}

.clickable:hover{
  transform:translateY(-2px);
  border-color:rgba(108,180,255,.45);
}

.clickable:active{transform:scale(.98)}

.ai-box{
  margin:18px 18px 40px;
  padding:29px;
  border-radius:25px;
  border:1px solid rgba(130,181,255,.28);
  background:linear-gradient(135deg,rgba(29,79,164,.65),rgba(76,44,151,.53));
}

.ai-box p{color:#cad9f3}

.ai-box button{
  border:0;
  padding:13px 21px;
  border-radius:25px;
  background:white;
  color:#102a59;
  font-weight:800;
}

/* MODAL */

.modal{
  display:none;
  position:fixed;
  inset:0;
  z-index:100;
  padding:15px;
  overflow:auto;
  background:rgba(0,3,12,.82);
  backdrop-filter:blur(9px);
}

.modal.active{
  display:flex;
  justify-content:center;
  align-items:center;
}

.modal-box{
  position:relative;
  width:min(500px,100%);
  max-height:92vh;
  overflow:auto;
  padding:25px;
  border-radius:25px;
  background:linear-gradient(145deg,#0b1b39,#061126);
  border:1px solid rgba(105,169,255,.27);
}

.detail-box{
  width:min(650px,100%);
}

.close{
  position:absolute;
  right:15px;
  top:10px;
  border:0;
  background:none;
  color:white;
  font-size:28px;
}

.field{margin:15px 0}

.field label{
  display:block;
  margin-bottom:7px;
  color:#dbe7fa;
  font-weight:800;
}

.field input,
.field select,
.search-input{
  width:100%;
  padding:13px;
  border-radius:12px;
  border:1px solid rgba(111,166,255,.25);
  background:#07142d;
  color:white;
  outline:none;
}

.tabs{
  display:flex;
  padding:4px;
  margin:20px 0;
  border-radius:12px;
  background:#07132b;
}

.tab{
  width:50%;
  border:0;
  padding:10px;
  border-radius:9px;
  background:none;
  color:#9fb1cf;
  font-weight:800;
}

.tab.active{
  color:white;
  background:linear-gradient(135deg,#1e6ed7,#5742b9);
}

.message{
  display:none;
  margin:10px 0;
  padding:11px;
  border-radius:10px;
}

.success{
  display:block;
  color:var(--success);
  background:rgba(31,154,94,.15);
}

.error{
  display:block;
  color:var(--danger);
  background:rgba(188,55,55,.15);
}

.warning{
  padding:14px;
  border-radius:13px;
  background:rgba(197,150,54,.11);
  border:1px solid rgba(244,201,107,.22);
  color:#e8d9b8;
  font-size:13px;
  line-height:1.55;
}

/* DASHBOARD */

#dashboard,
#practiceSession,
#aiChatPage,
.library{
  display:none;
}

.welcome{
  margin:21px 18px;
  padding:26px;
  border-radius:23px;
  background:linear-gradient(135deg,rgba(31,94,190,.72),rgba(75,49,150,.70));
  border:1px solid rgba(121,181,255,.25);
}

.stats{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:9px;
  margin-top:17px;
}

.stat{
  padding:13px 6px;
  text-align:center;
  border-radius:14px;
  background:rgba(255,255,255,.08);
}

.stat strong{
  display:block;
  font-size:20px;
}

.stat small{color:#c5d2e8}

.plan-item{
  display:flex;
  align-items:center;
  gap:13px;
  padding:16px;
  margin:11px 0;
  border-radius:17px;
  background:rgba(12,29,62,.74);
  border:1px solid var(--border);
}

.plan-emoji{font-size:29px}
.plan-info{flex:1}
.plan-info strong{display:block}
.plan-info small{color:var(--muted)}

.today-status{
  display:none;
  margin-top:12px;
  padding:12px;
  border-radius:13px;
  color:var(--success);
  background:rgba(31,154,94,.14);
}

.progress-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:11px;
  margin-top:16px;
}

.progress-card{
  padding:18px;
  text-align:center;
  border-radius:18px;
  background:rgba(12,29,62,.74);
  border:1px solid var(--border);
}

.progress-card strong{
  display:block;
  font-size:26px;
}

.progress-card small{color:var(--muted)}

.history-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:13px 0;
  border-bottom:1px solid rgba(115,169,255,.12);
}

.history-meta{
  color:var(--muted);
  font-size:13px;
  text-align:right;
}

/* PRACTICE SESSION */

.session-page{
  min-height:calc(100vh - 70px);
  padding:22px 18px 100px;
}

.session-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:20px;
}

.session-exit{
  border:0;
  background:none;
  color:#9fcaff;
  font-weight:800;
}

.session-count{
  color:var(--muted);
  font-size:14px;
}

.session-progress{
  width:100%;
  height:8px;
  border-radius:999px;
  overflow:hidden;
  background:rgba(255,255,255,.08);
  margin-bottom:30px;
}

.session-progress-bar{
  height:100%;
  width:0%;
  background:linear-gradient(90deg,#237dff,#7657ff);
  transition:.3s;
}

.session-card{
  max-width:650px;
  margin:auto;
  padding:30px 22px;
  text-align:center;
  border-radius:28px;
  border:1px solid rgba(121,181,255,.26);
  background:
    linear-gradient(145deg,rgba(18,42,83,.88),rgba(7,20,48,.88));
  box-shadow:0 20px 60px rgba(0,0,0,.30);
}

.session-symbol{
  font-size:60px;
}

.session-card h1{
  margin:10px 0 4px;
}

.session-english{
  color:#8ccfff;
  font-weight:700;
}

.session-type{
  margin-top:12px;
  color:var(--muted);
}

.session-time{
  margin:25px auto 10px;
  font-size:42px;
  font-weight:900;
  color:white;
}

.session-instruction{
  max-width:520px;
  margin:15px auto;
  color:#c5d2e6;
  line-height:1.65;
}

.session-controls{
  max-width:650px;
  margin:18px auto 0;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

.session-controls .full-row{
  grid-column:1 / -1;
}

.session-finish{
  background:linear-gradient(135deg,#17a46a,#147b62);
}

.session-disabled{
  opacity:.42;
  pointer-events:none;
}

/* AI CHAT */

.ai-chat-page{
  min-height:calc(100vh - 70px);
  padding:22px 16px 110px;
}

.ai-chat-shell{
  width:min(760px,100%);
  margin:auto;
}

.ai-chat-head{
  padding:22px;
  border-radius:24px;
  border:1px solid var(--border);
  background:linear-gradient(135deg,rgba(31,94,190,.55),rgba(75,49,150,.52));
  margin-bottom:14px;
}

.ai-chat-head h2{
  margin:0 0 6px;
}

.ai-chat-head p{
  margin:0;
  color:#c5d2e8;
  line-height:1.55;
}

.ai-chat-messages{
  min-height:360px;
  max-height:58vh;
  overflow:auto;
  padding:16px 4px;
  scroll-behavior:smooth;
}

.chat-row{
  display:flex;
  margin:10px 0;
}

.chat-row.user{
  justify-content:flex-end;
}

.chat-row.assistant{
  justify-content:flex-start;
}

.chat-bubble{
  max-width:86%;
  padding:13px 15px;
  border-radius:18px;
  line-height:1.6;
  white-space:pre-wrap;
  word-wrap:break-word;
  border:1px solid var(--border);
}

.chat-row.user .chat-bubble{
  background:linear-gradient(135deg,#237dff,#7657ff);
  color:white;
  border-bottom-right-radius:6px;
}

.chat-row.assistant .chat-bubble{
  background:rgba(12,29,62,.82);
  color:#e8f0ff;
  border-bottom-left-radius:6px;
}

.ai-thinking{
  opacity:.72;
  font-style:italic;
}

.ai-chat-input-wrap{
  position:sticky;
  bottom:72px;
  display:flex;
  gap:9px;
  padding:10px;
  border-radius:18px;
  background:rgba(3,10,27,.94);
  backdrop-filter:blur(14px);
  border:1px solid var(--border);
}

.ai-chat-input{
  flex:1;
  min-width:0;
  resize:none;
  height:50px;
  max-height:130px;
  padding:13px;
  border-radius:14px;
  border:1px solid rgba(111,166,255,.25);
  background:#07142d;
  color:white;
  outline:none;
}

.ai-send-btn{
  min-width:76px;
  border:0;
  border-radius:14px;
  color:white;
  font-weight:800;
  background:linear-gradient(135deg,#237dff,#7657ff);
}

.ai-quick-row{
  display:flex;
  gap:8px;
  overflow-x:auto;
  padding:4px 0 12px;
}

.ai-quick{
  flex:0 0 auto;
  border:1px solid var(--border);
  background:rgba(12,29,62,.72);
  color:#c6d8f6;
  border-radius:999px;
  padding:8px 11px;
  font-size:12px;
  font-weight:700;
}

/* LIBRARY */

.back-btn{
  border:0;
  background:none;
  color:#7fc3ff;
  font-weight:800;
  padding:9px 0;
}

.library-toolbar{margin:18px 0}

.filter-row{
  display:flex;
  gap:8px;
  overflow-x:auto;
  padding:10px 0;
}

.filter-chip{
  flex:0 0 auto;
  border:1px solid var(--border);
  border-radius:999px;
  padding:8px 12px;
  background:rgba(13,33,70,.72);
  color:#b8c8e3;
  font-size:12px;
  font-weight:800;
}

.filter-chip.active{
  color:white;
  border-color:transparent;
  background:linear-gradient(135deg,#237dff,#7657ff);
}

.practice-card{
  margin-bottom:12px;
}

.practice-name{
  font-size:19px;
  font-weight:800;
}

.practice-english{
  margin-top:4px;
  color:#86caff;
  font-size:13px;
  font-weight:800;
}

.badges{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:10px;
}

.badge{
  padding:5px 8px;
  border-radius:999px;
  background:rgba(77,163,255,.12);
  color:#badcff;
  font-size:11px;
}

.practice-focus{
  margin-top:10px;
  color:var(--muted);
  font-size:13px;
}

.result-count{
  margin-top:7px;
  color:#7f91ad;
  font-size:13px;
}

/* DETAIL */

.detail-symbol{
  font-size:48px;
  text-align:center;
}

.detail-title{
  text-align:center;
  margin-bottom:5px;
}

.detail-sub{
  text-align:center;
  color:#85caff;
  font-weight:700;
}

.detail-section{
  margin-top:22px;
}

.detail-list{
  padding-left:20px;
  color:#c0cee5;
  line-height:1.65;
}

.detail-note{
  padding:13px;
  border-radius:13px;
  background:rgba(237,169,72,.10);
  border:1px solid rgba(237,169,72,.22);
  color:#e7d2ad;
  line-height:1.55;
}

.profile-box{text-align:center}

.avatar{
  width:78px;
  height:78px;
  margin:auto;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  font-size:36px;
  background:linear-gradient(135deg,rgba(48,122,255,.30),rgba(118,79,255,.30));
}

.bottom-nav{
  display:none;
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  z-index:45;
  padding:7px 3px;
  background:rgba(3,10,27,.94);
  border-top:1px solid var(--border);
}

.bottom-nav button{
  width:20%;
  border:0;
  background:none;
  color:#9fb0ca;
  padding:6px 2px;
  font-size:12px;
}

.bottom-nav span{
  display:block;
  font-size:21px;
}

footer{
  padding:32px 15px 90px;
  text-align:center;
  color:#71809b;
  font-size:13px;
}

@media(min-width:700px){
  .cards{
    grid-template-columns:repeat(3,1fr);
  }
}

/* GUIDED AI PLAN BUILDER */

.ai-choice-wrap{
  display:flex;
  flex-wrap:wrap;
  gap:9px;
  margin:10px 0 16px 42px;
}

.ai-choice-btn{
  border:1px solid rgba(112,181,255,.32);
  background:rgba(16,42,86,.85);
  color:#eaf4ff;
  padding:10px 13px;
  border-radius:999px;
  font-weight:800;
  font-size:13px;
}

.ai-choice-btn:hover{
  border-color:#68b7ff;
  transform:translateY(-1px);
}

.ai-plan-preview{
  margin:10px 0 18px 42px;
  padding:16px;
  border-radius:18px;
  border:1px solid rgba(113,184,255,.24);
  background:linear-gradient(145deg,rgba(14,37,79,.92),rgba(7,20,48,.92));
}

.ai-plan-preview h3{
  margin:0 0 5px;
}

.ai-plan-meta{
  color:#93a9cc;
  font-size:12px;
  margin-bottom:12px;
}

.ai-plan-practice{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 0;
  border-bottom:1px solid rgba(115,169,255,.10);
}

.ai-plan-practice:last-of-type{
  border-bottom:0;
}

.ai-plan-practice .name{
  flex:1;
}

.ai-plan-practice .name strong{
  display:block;
}

.ai-plan-practice .name small{
  color:#8fa3c5;
}

.ai-mini-link{
  border:0;
  background:none;
  color:#80c7ff;
  font-weight:800;
  padding:5px;
}

.ai-plan-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin-top:14px;
}

@media(max-width:520px){
  .ai-choice-wrap,
  .ai-plan-preview{
    margin-left:0;
  }
}
