:root {
  color-scheme: light;
  --bg: #f6f3ed;
  --ink: #17211d;
  --muted: #66706b;
  --line: #ddd6ca;
  --panel: #fffdf8;
  --panel-strong: #f0f7f4;
  --accent: #236c59;
  --accent-strong: #174f42;
  --warm: #b95832;
  --blue: #315d91;
  --shadow: 0 18px 48px rgba(35, 48, 42, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background:
    linear-gradient(135deg, rgba(35, 108, 89, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(185, 88, 50, 0.12), transparent 36%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(860px, calc(100% - 32px));
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 28px 0;
}

.study-panel {
  width: 100%;
  border: 1px solid rgba(221, 214, 202, 0.86);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.study-panel {
  border-radius: 8px;
  padding: clamp(20px, 4vw, 44px);
}

h2,
p {
  margin-top: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 16px;
}

.load-error {
  margin-bottom: 0;
  color: var(--warm);
}

.word-card {
  position: relative;
  min-height: 440px;
  padding: 8px 0 34px;
}

.filter-menu {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
}

.filter-button {
  min-height: 38px;
  border-radius: 6px;
  background: #efe7db;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 800;
}

.filter-panel {
  position: absolute;
  top: 46px;
  right: 0;
  width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 34px rgba(35, 48, 42, 0.18);
  padding: 14px;
}

.filter-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.filter-options {
  display: grid;
  gap: 8px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-size: 14px;
  font-weight: 700;
}

.filter-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

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

.word {
  margin: 34px 0 12px;
  overflow-wrap: anywhere;
  font-size: clamp(44px, 9vw, 92px);
  font-weight: 850;
  line-height: 0.95;
  letter-spacing: 0;
}

.relation,
.relation-from {
  min-height: 24px;
  font-size: 16px;
}

.relation-from {
  margin-top: 40px;
  color: var(--warm);
  font-weight: 800;
}

.meaning-block,
.phrase-block {
  margin-top: 26px;
}

.meaning-list,
.phrase-list {
  margin: 0;
  padding: 0;
}

.meaning-list,
.phrase-list {
  list-style: none;
  display: grid;
  gap: 10px;
}

.meaning-list li,
.phrase-list li {
  border-left: 4px solid var(--accent);
  background: var(--panel-strong);
  padding: 10px 12px;
}

.phrase-list li {
  border-left-color: var(--blue);
}

.type {
  color: var(--warm);
  font-weight: 800;
  margin-right: 8px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 6px;
  padding: 0 18px;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  background: #efe7db;
  color: var(--ink);
}

@media (max-width: 900px) {
  .app-shell {
    align-items: center;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

  .study-panel {
    padding: 18px;
  }

  .word-card {
    min-height: 420px;
    padding: 24px 0;
  }

  .filter-menu {
    top: 0;
  }

  .filter-panel {
    width: min(220px, calc(100vw - 56px));
  }
}
