:root {
  --gradient-start: #2a2a72;
  --gradient-end: #009ffd;
  --panel: rgba(15, 22, 40, .72);
  --panel-border: rgba(255, 255, 255, .12);
  --muted: rgba(225, 233, 255, .7);
  --text: #f5f7ff;
  --accent: #6ea8ff;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --br: 18px;
  --shadow: 0 18px 40px rgba(10, 20, 60, .35);
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 86px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: var(--text);
  font: 16px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", sans-serif;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 32px;
}

a {
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

.app-shell {
  width: min(1340px, 100%);
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: var(--shadow);
  display: flex;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  padding: 32px 22px;
  background: rgba(10, 16, 30, .55);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #7f5cff, #4f8cff);
  box-shadow: 0 0 22px rgba(127, 92, 255, .4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.sidebar-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .6px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu .tab {
  appearance: none;
  width: 100%;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 600;
  letter-spacing: .2px;
  transition: transform .2s ease, box-shadow .2s ease, background .3s ease, border-color .3s ease;
  position: relative;
  overflow: hidden;
}

.menu .tab i {
  font-size: 18px;
  width: 22px;
  text-align: center;
}

.menu .tab span {
  flex: 1;
  text-align: left;
}

.menu .tab::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--hover-x, 50%) var(--hover-y, 50%), rgba(255, 255, 255, .35) 0%, rgba(255, 255, 255, 0) 70%);
  opacity: 0;
  transition: opacity .35s ease;
}

.menu .tab:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, .25);
  box-shadow: 0 12px 32px rgba(10, 24, 48, .35);
}

.menu .tab:hover::after {
  opacity: .6;
}

.menu .tab[aria-selected="true"] {
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .35);
  box-shadow: 0 14px 36px rgba(10, 24, 48, .38);
}

.menu .tab.pulse {
  animation: tab-pop .3s ease;
}

@keyframes tab-pop {
  0% {
    transform: translateY(0) scale(1);
  }

  40% {
    transform: translateY(-2px) scale(1.04);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 18px;
  background: rgba(255, 255, 255, .05);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-note {
  font-weight: 600;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(4, 9, 22, .35);
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px 38px 24px;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, .04);
}

.main-header h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: .3px;
}

.main-header p {
  margin: 6px 0 0;
}

.today-pill {
  background: rgba(255, 255, 255, .1);
  border-radius: 18px;
  padding: 14px 20px;
  border: 1px solid rgba(255, 255, 255, .12);
  text-align: right;
  min-width: 160px;
  box-shadow: 0 10px 28px rgba(10, 24, 48, .25);
}

.today-pill strong {
  font-size: 26px;
  display: block;
  margin-top: 4px;
}

.content-area {
  flex: 1;
  padding: 32px 38px 36px;
  overflow-y: auto;
}

.content-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: 32px;
}

.grid {
  display: grid;
  gap: 16px
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--br);
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: transform .3s ease, box-shadow .3s ease;
}

.panel:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 45px rgba(10, 24, 48, .4);
}

.panel h2 {
  margin: 4px 0 12px 0;
  font-size: 18px
}

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

/* Learn card */
.learn-wrap {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 16px
}

@media (max-width:960px) {
  .learn-wrap {
    grid-template-columns: 1fr
  }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 320px;
  justify-content: space-between;
  background: rgba(12, 19, 38, .74);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform .3s ease, box-shadow .3s ease;
}



.question-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.q {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: .2px
}

.hint {
  color: var(--muted);
  font-size: 14px;
  margin-top: -6px
}

.example {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text);
}

.example .muted {
  font-size: inherit;
  color: var(--muted);
}

.answer-row {
  display: flex;
  gap: 10px
}

.input {
  flex: 1;
  appearance: none;
  background: rgba(6, 12, 28, .6);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 16px;
  outline: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color .2s ease, box-shadow .2s ease;
}

.select {
  appearance: none;
  background: rgba(6, 12, 28, .6);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 15px;
  min-width: 200px;
  min-height: 120px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.select:focus {
  outline: none;
  border-color: rgba(110, 168, 255, .8);
  box-shadow: 0 0 0 1px rgba(110, 168, 255, .4);
}

.select option {
  padding: 6px 8px;
  background: rgba(8, 12, 28, .95);
  color: var(--text);
}

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .3);
  box-shadow: 0 14px 28px rgba(10, 24, 48, .35);
}

.icon-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
  font-size: 18px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.icon-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .3);
}

.icon-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: linear-gradient(135deg, #7f5cff, #4f8cff);
  border-color: rgba(127, 92, 255, .7);
  box-shadow: 0 16px 34px rgba(79, 140, 255, .4);
}

.btn.primary:hover {
  box-shadow: 0 20px 42px rgba(79, 140, 255, .45);
}

.btn.success {
  background: rgba(34, 197, 94, .18);
  border-color: rgba(34, 197, 94, .4);
}

.btn.danger {
  background: rgba(239, 68, 68, .16);
  border-color: rgba(239, 68, 68, .4);
}

.btn.ghost {
  background: rgba(12, 18, 34, .65);
  border-color: rgba(255, 255, 255, .12);
}

.kbd {
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, .16);
  border-bottom-width: 2px;
  background: rgba(8, 14, 28, .8);
  padding: 3px 7px;
  border-radius: 8px;
  color: rgba(225, 233, 255, .8);
  font-size: 12px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap
}

.filters-row {
  align-items: flex-start;
  gap: 16px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-select {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#filterSummary {
  margin-top: 6px;
}

.space {
  height: 8px
}

/* Stats strip */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.chip {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 12px 32px rgba(10, 24, 48, .28);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform .3s ease, box-shadow .3s ease;
}



.chip b {
  font-size: 22px;
  display: block;
  margin-top: 6px;
}

/* Dictionary */
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

.dict-word {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dict-select {
  text-align: center;
}

.dict-word .icon-btn {
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.dict-editable {
  display: inline-block;
  flex: 1;
  min-width: 40px;
  min-height: 22px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.dict-editable:focus {
  outline: none;
  border-color: #384b70;
  background: rgba(56, 75, 112, .25);
}

.dict-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dict-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  min-width: 760px;
}

.th-filter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.th-filter span {
  font-size: 12px;
  display: block;
}

.select--compact {
  min-height: auto;
  min-width: 100px;
  padding: 6px 10px;
  font-size: 14px;
  width: 100%;
}

.dict-table th,
.dict-table td {
  padding: 12px 14px;
  text-align: left;
}

.dict-table thead th {
  font-size: 12px;
  color: #95a1b7;
  text-transform: uppercase;
  letter-spacing: .06em;
  vertical-align: top;
}

.dict-table tbody tr {
  background: #0f1423;
  border: 1px solid #1e2538;
}

.dict-table tbody td:first-child {
  border-radius: 12px 0 0 12px;
}

.dict-table tbody td:last-child {
  border-radius: 0 12px 12px 0;
}

@media (max-width: 1200px) {
  .dict-table {
    min-width: 700px;
  }
}

@media (max-width: 900px) {
  .dict-table {
    min-width: 620px;
  }
}

@media (max-width: 600px) {
  .dict-table {
    min-width: 520px;
  }
}

@media (max-width: 1200px) {
  body {
    padding: 24px;
  }

  .main-header {
    padding: 28px 32px 20px;
  }

  .content-area {
    padding: 28px 32px;
  }
}

@media (max-width: 1024px) {
  body {
    padding: 20px;
  }

  .sidebar {
    width: var(--sidebar-collapsed-width);
    padding: 28px 16px;
    align-items: center;
  }

  .sidebar-title,
  .menu .tab span,
  .sidebar-footer {
    display: none;
  }

  .menu {
    align-items: center;
  }

  .menu .tab {
    justify-content: center;
    padding: 12px;
  }

  .main-header {
    padding: 24px 28px 18px;
  }

  .today-pill {
    min-width: 140px;
  }

  .content-area {
    padding: 24px 28px;
  }
}

@media (max-width: 860px) {
  .today-pill {
    min-width: auto;
  }

  .main-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .today-pill {
    align-self: stretch;
    text-align: left;
  }
}

@media (max-width: 768px) {
  body {
    padding: 16px;
  }

  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: column;
    gap: 20px;
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
  }

  .sidebar-top {
    width: 100%;
  }

  .sidebar-title {
    display: flex;
  }

  .menu {
    flex-direction: row;
    overflow-x: auto;
    gap: 12px;
  }

  .menu .tab {
    flex: 1 0 auto;
    min-width: 120px;
  }

  .menu .tab span {
    display: none;
  }

  .sidebar-footer {
    display: flex;
    width: 100%;
    justify-content: space-between;
  }

  .content-area {
    padding: 22px 20px 28px;
  }

  .content-inner {
    gap: 24px;
  }

  .learn-wrap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  body {
    padding: 12px;
  }

  .today-pill {
    width: 100%;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dict-example {
  white-space: pre-wrap;
}


.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #2a3552;
  background: #10172b;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: #a8b3c8
}

.tag::before {
  content: "#";
  opacity: .6
}

.panel-title {
  margin: 0 0 12px 0;
  font-size: 17px;
}

.table-wrap {
  overflow-x: auto;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 14px;
}

.stats-table th,
.stats-table td {
  border-bottom: 1px solid #1f2535;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}

.stats-table tbody tr:nth-child(odd) {
  background: rgba(24, 30, 44, .45);
}

.empty {
  padding: 14px;
  border: 1px dashed #253249;
  border-radius: 12px;
  text-align: center;
}

/* Import */
.import-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px
}

@media (max-width:960px) {
  .import-grid {
    grid-template-columns: 1fr
  }
}

textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  appearance: none;
  background: #0b1120;
  border: 1px solid #23304d;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px
}

.drop {
  border: 2px dashed #2b3550;
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  color: #aab3c8
}

/* Toast */
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #0e1524;
  border: 1px solid #243055;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: .2s
}

.toast.show {
  opacity: 1;
  transform: translateY(0)
}

.hidden {
  display: none
}

tbody td:last-child {
  display: flex;
  flex-direction: column;
  gap: 6px;
}