:root{
  --bg: #ffffff;
  --panel: #ffffff;
  --text: #111111;
  --muted: #666666;
  --border: #e6e6e6;
  --shadow: 0 8px 20px rgba(0,0,0,.06);
  --radius: 14px;
  --pad: 16px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  font-weight:400;
}

.hidden{ display:none !important; }
.muted{ color:var(--muted); }

.header{
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.header__inner{
  max-width:1100px;
  margin:0 auto;
  padding:14px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.brand__title{
  font-weight:800;
  font-size:22px;
}
.brand__subtitle{
  margin-top:2px;
  color:var(--muted);
  font-size:13px;
}
.header__actions{
  display:flex;
  gap:10px;
}

.container{
  max-width:1100px;
  margin:18px auto 40px;
  padding:0 18px;
  display:flex;
  flex-direction:column;
  gap:16px;
}

.card{
  background: var(--panel);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--pad);
}
.card__title{
  font-weight:700;
  margin-bottom:12px;
}

.textarea{
  width:100%;
  min-height:180px;
  resize:vertical;
  border-radius: 12px;
  border:1px solid var(--border);
  background: #fff;
  color:var(--text);
  padding:14px;
  font-size:15px;
  line-height:1.55;
  outline:none;
  font-weight:400;
}
.textarea:focus{
  border-color: #cfcfcf;
}

.inputMeta{
  display:flex;
  justify-content:space-between;
  margin-top:10px;
  gap:10px;
  font-size:13px;
}

.toolbar{
  margin-top:14px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.toolbar__spacer{ flex:1; }

.btn{
  border:1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding:10px 14px;
  border-radius: 999px;
  cursor:pointer;
  transition: background .15s ease, border-color .15s ease;
}
.btn:hover{ background: #f6f6f6; }
.btn:disabled{ opacity:.6; cursor:not-allowed; }

.btn--primary{
  background: #111;
  color: #fff;
  border-color: #111;
}
.btn--primary:hover{ background: #000; }

.btn--ghost{
  background: #fff;
}

.btn--sm{
  padding:8px 12px;
  font-size:13px;
}

.statusBar{
  margin-top:12px;
  font-size:13px;
  color: var(--muted);
}
.statusBar .error{ color: #c00000; }
.statusBar .ok{ color: #0a7a2f; }

.empty{
  padding:14px;
  border:1px dashed #d8d8d8;
  border-radius: 12px;
  background: #fafafa;
  color: var(--muted);
}

.panel{ display:flex; flex-direction:column; gap:12px; }

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
@media (max-width: 720px){
  .grid2{ grid-template-columns: 1fr; }
}

.stat{
  border:1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}
.stat__label{
  color: var(--muted);
  font-size:13px;
}
.stat__value{
  margin-top:6px;
  font-size:26px;
  font-weight:800;
}

.subTitle{
  margin-top:6px;
  font-weight:700;
  font-size:14px;
}

.bucketCounts{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.pill{
  border:1px solid var(--border);
  border-radius:999px;
  padding:8px 12px;
  background: #fff;
  font-size:13px;
}
.pill strong{ font-weight:800; }

.bucketGrid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:12px;
}
.bucket--wide{
  grid-column: span 2;
}
@media (max-width: 900px){
  .bucketGrid{ grid-template-columns: 1fr; }
  .bucket--wide{ grid-column: span 1; }
}

.bucket{
  border:1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow:hidden;
}
.bucket__title{
  padding:10px 12px;
  font-weight:800;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.bucket__body{
  padding:10px 12px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  min-height: 56px;
}
.wordChip{
  font-size:13px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: #fff;
  font-weight:400;
}

.sentenceTop{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.pager{
  display:flex;
  align-items:center;
  gap:10px;
}
.pager__info{
  font-size:13px;
  color: var(--muted);
  min-width: 70px;
  text-align:center;
}

.sentenceList{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.sentenceCard{
  border:1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  display:flex;
  gap:12px;
  align-items:flex-start;
}
.levelTag{
  flex:0 0 auto;
  border:1px solid var(--border);
  border-radius: 999px;
  padding:6px 10px;
  font-size:13px;
  background: #fafafa;
  min-width: 64px;
  text-align:center;
  font-weight:800;
}
.sentenceText{
  line-height:1.6;
  font-size:15px;
  word-break: break-word;
  font-weight:400;
}

.gradePager{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:14px;
}

.gradePager__label{
  min-width:72px;
  text-align:center;
  font-weight:700;
  font-size:18px;
}

.gradeSummary{
  margin-bottom:16px;
  font-size:15px;
  line-height:1.6;
}

.articleView{
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  padding:16px;
  line-height:2.1;
  font-size:18px;
  min-height:120px;
}

.tokenPlain{
  display:inline;
}

.tokenEasy{
  display:inline-block;
  padding:1px 4px;
  border-radius:4px;
}

.tokenHard{
  display:inline-block;
  padding:1px 4px;
  border-radius:4px;
  background:#dff3fb;
}

.tokenVeryHard{
  display:inline-block;
  padding:1px 4px;
  border-radius:4px;
  background:#111;
  color:#fff;
}

.tokenDropdownWrap{
  display:inline-block;
  margin:0 2px;
}

.tokenSelect{
  display:inline-block;
  padding:2px 6px;
  border:1px solid #cfcfcf;
  border-radius:6px;
  background:#fff;
  font-size:16px;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  padding: 18px;
}

.modal-content {
  background-color: #fff;
  padding: 20px;
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: popIn 0.2s ease-out;
}

@keyframes popIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.close {
  float: right;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  color: #333;
  line-height: 1;
  user-select: none;
}

.close:hover {
  color: #000;
}