:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: #171b22;
  --panel-soft: #202632;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f3f6fa;
  --muted: #aeb7c5;
  --dim: #7f8a9c;
  --accent: #e6c67a;
  --accent-2: #82d4c7;
  --danger: #ff8e8e;
  --shadow: 0 18px 70px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 0%, rgba(130, 212, 199, 0.1), transparent 26rem),
    #111318;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.58;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(17, 19, 24, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.topbar nav a {
  padding: 7px 4px;
}

.engine-shell {
  width: min(880px, calc(100% - 32px));
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 40px 0;
}

.engine-panel {
  width: 100%;
}

.engine-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  width: 100%;
}

.engine-box input {
  min-width: 0;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 20px;
  background: #0d1016;
  color: var(--text);
  outline: none;
  font-size: 18px;
}

.engine-box input::placeholder {
  color: transparent;
}

.engine-box input:focus {
  border-color: rgba(130, 212, 199, 0.72);
}

.engine-box button,
.reader-control button,
.reader-control select,
.filter,
.tab,
.listen-inline,
.icon-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
}

.engine-box button {
  min-width: 92px;
  height: 64px;
  background: var(--accent);
  color: #17130b;
  font-weight: 800;
}

.engine-message,
.message {
  margin: 14px 0 0;
  color: var(--muted);
}

.learn-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(24px, 4vw, 46px) 0 70px;
}

.movie-header,
.sentence-item,
.word-row,
.directory-header,
.material-row,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 27, 34, 0.88);
}

.movie-header {
  margin-bottom: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.compact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1;
  letter-spacing: 0;
}

.movie-header h1 {
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.08;
  max-width: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 16, 22, 0.58);
}

.reader-control select,
.reader-control button,
.filter,
.tab,
.listen-inline {
  min-height: 42px;
  padding: 0 14px;
}

.reader-control button:not(.ghost-control),
.listen-inline {
  background: rgba(230, 198, 122, 0.16);
  border-color: rgba(230, 198, 122, 0.48);
  color: var(--accent);
}

.reader-control button {
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.reader-control button:active,
.icon-btn:active,
.word-row:active,
.material-row:active {
  transform: scale(0.98);
}

.reader-control button.is-active {
  background: rgba(230, 198, 122, 0.28);
  border-color: rgba(230, 198, 122, 0.9);
  box-shadow: 0 0 0 4px rgba(230, 198, 122, 0.1);
}

.reader-control button.is-paused {
  background: rgba(130, 212, 199, 0.16);
  border-color: rgba(130, 212, 199, 0.6);
  color: var(--accent-2);
}

body.is-reading .reader-control {
  border-color: rgba(230, 198, 122, 0.42);
}

body.is-paused .reader-control {
  border-color: rgba(130, 212, 199, 0.42);
}

.reader-control select {
  min-width: 148px;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%),
    var(--panel-soft);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 12px) 18px,
    0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
}

.reader-control button {
  min-width: 46px;
  font-size: 16px;
  line-height: 1;
}

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

.tabs,
.sentence-toolbar {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  overflow-x: auto;
}

.sentence-toolbar {
  justify-content: space-between;
  align-items: center;
}

.sentence-filters {
  display: flex;
  gap: 8px;
}

.tab.active,
.filter.active {
  border-color: rgba(230, 198, 122, 0.8);
  background: rgba(230, 198, 122, 0.16);
  color: var(--accent);
}

.hidden {
  display: none !important;
}

.word-list {
  display: grid;
  gap: 10px;
}

.word-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 106px;
  padding: 16px;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.word-row:hover,
.material-row:hover,
.sentence-item:hover {
  border-color: rgba(130, 212, 199, 0.34);
  background: rgba(27, 33, 42, 0.94);
}

.word-row.is-current,
.sentence-item.is-current {
  border-color: rgba(230, 198, 122, 0.82);
  background: rgba(230, 198, 122, 0.08);
  box-shadow: inset 3px 0 0 rgba(230, 198, 122, 0.82);
}

.word-index {
  color: var(--dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.word-main {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.word-title-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.word-title-line h3,
.word-card h3 {
  margin-bottom: 0;
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.05;
}

.word-title-line span,
.translation,
.note,
.transfer,
.word-card-head p {
  color: var(--muted);
  font-size: 14px;
}

.translation-shell {
  display: grid;
  gap: 8px;
  align-items: start;
}

.translation-toggle {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  border: 0;
  border-bottom: 1px solid rgba(130, 212, 199, 0.34);
  border-radius: 0;
  padding: 2px 0 3px;
  background: transparent;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-align: left;
}

.translation-toggle:hover,
.translation-toggle:focus {
  border-bottom-color: rgba(130, 212, 199, 0.82);
  background: transparent;
  outline: none;
}

.translation-toggle-mark {
  display: none;
}

.translation-panel {
  display: none;
  margin: 0;
  padding: 8px 0 0;
  border-top: 1px solid rgba(130, 212, 199, 0.14);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.translation-shell.is-open .translation-panel {
  display: block;
}

.translation-shell.is-open .translation-toggle {
  border-bottom-color: rgba(230, 198, 122, 0.72);
  background: transparent;
  color: var(--accent);
}

.bubble-shell {
  gap: 6px;
}

.bubble-meaning {
  color: var(--accent);
}

.sentence-shell .translation-panel,
.bubble-shell .translation-panel {
  background: transparent;
}

.meaning {
  color: var(--text);
  font-weight: 650;
}

.transfer {
  margin-bottom: 0;
}

.icon-btn {
  min-width: 42px;
  min-height: 38px;
  padding: 0 10px;
  color: var(--accent);
}

.speaker-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 38px;
  padding: 0;
  font-size: 17px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.speaker-btn:hover,
.speaker-btn:focus {
  border-color: rgba(130, 212, 199, 0.5);
  background: rgba(130, 212, 199, 0.1);
  outline: none;
}

.directory-header {
  margin-bottom: 16px;
  padding: 22px;
}

.directory-header h1 {
  font-size: clamp(38px, 6vw, 72px);
}

.material-list {
  display: grid;
  gap: 10px;
}

.material-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 78px;
  padding: 16px;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.material-index {
  color: var(--dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.material-title {
  min-width: 0;
  display: grid;
  gap: 4px;
  color: var(--text);
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
}

.material-meta {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.sentence-list {
  display: grid;
  gap: 14px;
}

.sentence-item {
  padding: 18px;
}

.sentence-type {
  margin-bottom: 10px;
  color: var(--accent-2);
  font-size: 13px;
}

.sentence-text {
  margin-bottom: 8px;
  color: #f8fafc;
  font-size: clamp(19px, 3vw, 27px);
  line-height: 1.45;
}

.word-token {
  border: 0;
  border-bottom: 1px dashed rgba(130, 212, 199, 0.55);
  padding: 0 1px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.word-token:hover,
.word-token:focus {
  color: var(--accent-2);
  outline: none;
}

.word-bubble {
  position: absolute;
  z-index: 50;
  width: min(272px, calc(100vw - 24px));
  padding: 14px;
  border: 1px solid rgba(230, 198, 122, 0.42);
  border-radius: 8px;
  background: #111721;
  box-shadow: var(--shadow);
}

.bubble-head,
.word-card-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.word-bubble p {
  margin-bottom: 8px;
  color: var(--muted);
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.word-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 27, 34, 0.88);
  padding: 16px;
}

.empty-state {
  padding: 20px;
}

@media (max-width: 760px) {
  .topbar,
  .compact-header,
  .sentence-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .engine-box {
    grid-template-columns: 1fr;
  }

  .engine-box button {
    width: 100%;
  }

  .reader-control {
    width: 100%;
    justify-content: flex-start;
  }

  .reader-control select,
  .reader-control button,
  .listen-inline {
    flex: 1 1 auto;
  }

  .word-row {
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: start;
  }

  .word-row .icon-btn {
    grid-column: 2;
    width: 42px;
  }

  .material-row {
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: start;
  }

  .material-meta {
    grid-column: 2;
  }

  h1 {
    font-size: 38px;
  }

  .movie-header h1 {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
}

.engine-shell,
.learn-shell {
  width: min(1180px, calc(100% - 28px));
}

.engine-shell {
  display: block;
  min-height: calc(100vh - 76px);
  padding-top: 72px;
}

.engine-panel {
  max-width: 880px;
  margin: 0 auto;
}

.engine-panel,
.movie-header,
.directory-header,
.history-block {
  display: grid;
  gap: 16px;
}

.engine-copy h1,
.directory-header h1,
.movie-header h1 {
  margin: 0;
  line-height: 1.06;
  letter-spacing: 0;
}

.engine-copy h1 {
  font-size: clamp(30px, 4.2vw, 52px);
}

.header-note {
  margin: 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.history-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.history-strip-wide {
  display: grid;
  gap: 12px;
}

.history-chip {
  display: grid;
  gap: 4px;
  min-width: 168px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(23, 27, 34, 0.82);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.history-chip:hover {
  border-color: rgba(130, 212, 199, 0.34);
  transform: translateY(-1px);
  background: rgba(27, 33, 42, 0.92);
}

.history-name {
  min-width: 0;
  display: grid;
  gap: 3px;
  font-size: 15px;
  font-weight: 700;
}

.history-meta {
  color: var(--muted);
  font-size: 12px;
}

.history-chip-wide {
  width: 100%;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 12px;
}

.history-chip-wide .history-name-en {
  font-size: clamp(18px, 2vw, 22px);
}

.history-side {
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}

.movie-heading {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.movie-meta-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
}

.reader-control {
  position: relative;
  display: grid;
  grid-template-columns: minmax(104px, 1.25fr) minmax(72px, 0.8fr) minmax(72px, 0.8fr) minmax(112px, 1fr);
  align-items: flex-end;
  gap: 8px;
  padding: 8px;
  width: min(100%, 520px);
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(31, 37, 48, 0.94), rgba(17, 21, 28, 0.98));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.control-field {
  display: grid;
  gap: 6px;
  padding: 0 2px;
}

.control-label {
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.reader-control select {
  min-width: 104px;
  min-height: 40px;
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background-color: #222a37;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: #f6f7f9;
  font-size: 14px;
  font-weight: 600;
}

.reader-control button {
  min-height: 40px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.reader-control button:hover,
.reader-control select:hover {
  border-color: rgba(255, 255, 255, 0.24);
}

.reader-control button:hover {
  transform: translateY(-1px);
}

.playback-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 112px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(8, 11, 16, 0.42);
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.playback-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 14%, transparent);
  content: "";
  flex: 0 0 auto;
}

body.is-reading .playback-status {
  border-color: rgba(230, 198, 122, 0.36);
  color: var(--accent);
}

body.is-paused .playback-status {
  border-color: rgba(130, 212, 199, 0.36);
  color: var(--accent-2);
}

.tabs {
  gap: 10px;
}

.tab {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 700;
}

.word-list {
  display: grid;
  gap: 12px;
}

.word-row,
.material-row {
  border-radius: 12px;
}

.word-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 16px 18px;
}

.word-row .icon-btn {
  width: 40px;
  height: 40px;
}

.word-actions {
  align-self: stretch;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

.movie-header h1 {
  display: grid;
  gap: 6px;
}

.movie-title-en {
  display: block;
}

.movie-title-zh,
.material-title-zh,
.history-name-zh {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.word-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.word-title-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.word-title-stack {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.word-title-stack h3 {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.08;
}

.material-title-en,
.history-name-en {
  display: block;
  color: var(--text);
  font-weight: 800;
}

.word-phonetic,
.word-context,
.transfer,
.note,
.material-meta,
.material-time,
.material-difficulty,
.header-note {
  color: var(--muted);
  font-size: 13px;
}

.word-meaning {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.word-translation-shell {
  gap: 6px;
}

.word-translation-shell .translation-panel {
  padding-top: 9px;
  color: var(--text);
  font-weight: 600;
}

.word-context {
  margin: 0;
}

.difficulty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.difficulty-easy {
  background: rgba(130, 212, 199, 0.12);
  border-color: rgba(130, 212, 199, 0.24);
  color: #a8ece0;
}

.difficulty-mid {
  background: rgba(230, 198, 122, 0.12);
  border-color: rgba(230, 198, 122, 0.24);
  color: #f1d48b;
}

.difficulty-hard {
  background: rgba(255, 142, 142, 0.12);
  border-color: rgba(255, 142, 142, 0.24);
  color: #ffb0b0;
}

.sentence-list {
  display: grid;
  gap: 14px;
}

.sentence-item {
  padding: 18px;
  border-radius: 12px;
}

.sentence-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.sentence-type {
  color: var(--accent-2);
  font-size: 12px;
}

.sentence-text {
  margin-bottom: 12px;
  color: #f8fafc;
  font-size: clamp(17px, 2.4vw, 22px);
  line-height: 1.6;
}

.word-token {
  border: 0;
  border-bottom: 1px solid rgba(130, 212, 199, 0.45);
  padding: 0 2px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.word-token:hover,
.word-token:focus {
  color: var(--accent-2);
  outline: none;
}

.translation-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  border: 1px solid rgba(130, 212, 199, 0.28);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(130, 212, 199, 0.08);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
}

.translation-toggle:hover,
.translation-toggle:focus {
  border-color: rgba(130, 212, 199, 0.5);
  background: rgba(130, 212, 199, 0.12);
  outline: none;
}

.translation-shell.is-open .translation-toggle {
  border-color: rgba(230, 198, 122, 0.4);
  background: rgba(230, 198, 122, 0.12);
  color: var(--accent);
}

.translation-panel {
  display: none;
  margin: 0;
  padding: 12px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.translation-shell.is-open .translation-panel {
  display: block;
}

.bubble-shell {
  gap: 8px;
}

.word-bubble {
  position: absolute;
  z-index: 50;
  width: min(300px, calc(100vw - 24px));
  padding: 16px;
  border: 1px solid rgba(230, 198, 122, 0.28);
  border-radius: 12px;
  background: #111721;
  box-shadow: var(--shadow);
}

.bubble-head,
.section-head,
.word-title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bubble-head {
  margin-bottom: 6px;
}

.word-bubble p {
  margin-bottom: 8px;
  color: var(--muted);
}

.material-list {
  display: grid;
  gap: 12px;
}

.material-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(220px, auto);
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 16px 18px;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.material-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.material-title {
  min-width: 0;
  color: var(--text);
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 800;
  line-height: 1.08;
}

.material-details {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
}

.material-index {
  color: var(--dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.directory-header {
  padding: 22px;
}

.directory-header h1 {
  font-size: clamp(30px, 4vw, 44px);
}

.empty-state {
  padding: 20px;
}

body.is-reading .reader-control {
  border-color: rgba(230, 198, 122, 0.42);
}

body.is-paused .reader-control {
  border-color: rgba(130, 212, 199, 0.42);
}

.word-row.is-current,
.sentence-item.is-current {
  border-color: rgba(230, 198, 122, 0.82);
  background: rgba(230, 198, 122, 0.08);
  box-shadow: inset 3px 0 0 rgba(230, 198, 122, 0.82);
}

@media (max-width: 760px) {
  .engine-shell,
  .learn-shell {
    width: min(100%, calc(100% - 20px));
  }

  .engine-copy h1,
  .directory-header h1 {
    font-size: 30px;
  }

  .compact-header,
  .sentence-toolbar,
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .reader-control {
    width: 100%;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.8fr) minmax(0, 0.8fr) minmax(0, 1fr);
    margin-left: 0;
    align-items: stretch;
  }

  .reader-control select,
  .reader-control button,
  .playback-status,
  .listen-inline {
    width: 100%;
    min-width: 0;
  }

  .word-row {
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: start;
  }

  .word-row .icon-btn {
    grid-column: 2;
  }

  .word-actions {
    grid-column: 2;
    align-self: start;
    flex-direction: row;
    justify-content: flex-start;
  }

  .word-title-line,
  .sentence-topline,
  .section-head,
  .material-details {
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
  }

  .material-row {
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: start;
  }

  .material-details {
    grid-column: 2;
    justify-items: start;
  }

  .history-chip {
    min-width: calc(50% - 5px);
    flex: 1 1 calc(50% - 5px);
  }

  .history-chip-wide {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .history-side {
    justify-items: start;
    text-align: left;
  }
}
