:root{
  --bg: #0b1020;
  --bg2: #0e1430;
  --text: #e7eaf6;
  --muted: #a8b0cf;
  --card: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.12);
  --primary: #7aa2ff;
  --primary-ink:#06122c;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

.light{
  --bg: #f3f6ff;
  --bg2: #e9eeff;
  --text: #161d2e;
  --muted: #4f5b7a;
  --card: rgba(255,255,255,0.9);
  --border: rgba(15,23,42,0.08);
  --primary: #335cff;
  --primary-ink:#ffffff;
  --shadow: 0 10px 25px rgba(25,35,70,.15);
}

*{ box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji','Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  background: radial-gradient(1200px 800px at 10% 10%, var(--bg2), var(--bg));
  color: var(--text);
  line-height: 1.55;
}

.page{
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card{
  width: 100%;
  max-width: 860px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  padding: 20px 20px 14px;
}

.card__header, .card__footer{
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card__footer{
  border-top: 1px dashed var(--border);
  margin-top: 18px;
  padding-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.brand{
  display: flex; gap: 10px; align-items:center;
  font-size: clamp(18px, 2.4vw, 22px);
}
.brand__logo{ filter: saturate(1.2); }

.search{
  display:flex;
  flex-wrap: wrap;
  gap:12px;
  margin-top: 14px;
}

.search__field{
  position: relative;
  flex: 1 1 520px;
  display:flex;
  align-items:center;
}

.search__icon{
  position:absolute; left:12px; width:20px; height:20px; opacity:.6;
  fill: currentColor;
}

.search__input{
  width:100%;
  height:48px;
  padding: 0 44px 0 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.15);
  color: var(--text);
  outline: none;
  font-size: 16px;
}
.light .search__input{ background: white; }

.search__input::placeholder{ color: var(--muted); }
.search__clear{
  position:absolute; right:6px;
  height:34px; width:34px;
  border-radius: 10px; border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  opacity: .8;
}
.search__clear:disabled{ opacity:.3; cursor: default; }

.btn{
  height:48px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--border); cursor: pointer;
  font-weight: 600;
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.btn--primary{
  background: linear-gradient(180deg, var(--primary), #5f85ff);
  color: var(--primary-ink);
  border-color: transparent;
}
.btn--ghost{ background: transparent; }
.btn--icon{ width:44px; height:44px; border-radius: 10px; }
.btn--sm{ height: 34px; padding: 0 10px; font-size: 12px; }

.hint{
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 14px;
}

.status{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  font-size: 14px;
  color: var(--muted);
  display:none;
}
.status.show{ display:block; }

.result{
  margin-top: 16px;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

.result__header{
  display:flex; justify-content: space-between; align-items: center; gap: 12px;
}

.result__title{
  display:flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.word{ font-size: clamp(22px, 4vw, 30px); margin: 0; }
.phonetic{ color: var(--muted); font-size: 16px; }

.defs{
  list-style: none;
  padding:0; margin: 14px 0 0 0;
  display: grid; gap: 12px;
}

.def{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(0,0,0,.08);
}
.light .def{ background: white; }
.pos{
  display:inline-block;
  font-size: 12px; letter-spacing: .4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  margin-bottom: 6px;
}
.def__text{ margin: 4px 0 0; font-weight: 500; }
.def__example{
  margin: 8px 0 0;
  font-style: italic;
  color: var(--muted);
}

.chips{ margin-top: 12px; }
.chips__title{ margin: 0 0 8px 0; font-size: 14px; color: var(--muted); }
.chips__wrap{ display: flex; gap: 8px; flex-wrap: wrap; }
.chip{
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,255,255,.06);
  cursor:pointer;
}
.chip:disabled{ opacity:.4; cursor: default; }

.history{
  margin-top: 14px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}
.history__header{
  display:flex; align-items:center; justify-content: space-between;
  margin-bottom: 8px;
}

@media (max-width: 520px){
  .btn{ flex: 1 1 auto; }
}
