:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #17251f;
  background: #edf1eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: #edf1eb;
}

button, a { -webkit-tap-highlight-color: transparent; }

.notes-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 70px;
  padding: 10px max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid rgba(23, 37, 31, 0.16);
  background: rgba(250, 251, 247, 0.94);
  backdrop-filter: blur(14px);
}

.back-link, .home-link {
  color: #1d503d;
  font-weight: 850;
  text-decoration: none;
}

.back-link {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(23, 37, 31, 0.22);
  border-radius: 6px;
  font-size: 1.25rem;
}

.notes-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.notes-brand svg, .empty-state svg {
  width: 28px;
  height: 28px;
  flex: none;
  fill: none;
  stroke: #1d503d;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notes-book-mark,
.empty-book-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: #dce7df;
}

.notes-book-mark svg,
.empty-book-mark svg {
  width: 28px;
  height: 28px;
}

.notes-book-mark .bookmark {
  fill: #b8cba8;
}

.notes-brand div { display: grid; min-width: 0; }
.notes-brand strong { font-size: 0.94rem; }
.notes-brand span { color: #647069; font-size: 0.67rem; }
.home-link { font-size: 0.78rem; }

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.notes-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.notes-intro p {
  margin: 0 0 8px;
  color: #47705e;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.notes-intro h1 {
  max-width: 650px;
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 3.25rem);
  line-height: 1.02;
}

.cover-controls { display: flex; gap: 8px; }

.cover-controls button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid rgba(23, 37, 31, 0.28);
  border-radius: 6px;
  background: #fafbf7;
  color: #26382f;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 850;
  cursor: pointer;
}

.cover-controls button[aria-pressed="true"] {
  background: #1d503d;
  color: #fff;
}

.notes-table-shell {
  border: 1px solid rgba(23, 37, 31, 0.2);
  background: #fafbf7;
  box-shadow: 12px 12px 0 rgba(29, 80, 61, 0.11);
}

.notes-table-head, .note-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(190px, 1.1fr) 66px minmax(240px, 1.5fr) 38px;
}

.notes-table-head {
  border-bottom: 1px solid rgba(23, 37, 31, 0.18);
  background: #e3e9e1;
}

.notes-table-head span {
  padding: 11px 14px;
  color: #526158;
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.note-row {
  position: relative;
  min-height: 92px;
  border-bottom: 1px solid rgba(23, 37, 31, 0.12);
}

.note-row:last-child { border-bottom: 0; }

.language-cell, .sound-button, .remove-button {
  border: 0;
  border-right: 1px solid rgba(23, 37, 31, 0.1);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.language-cell {
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 14px;
  text-align: left;
}

.language-cell span { font-size: 0.96rem; font-weight: 850; }
.language-cell small { color: #6d776f; font-size: 0.64rem; }

.language-cell.is-covered span {
  color: inherit;
  filter: blur(7px);
  opacity: 0.62;
  user-select: none;
}

.language-cell.is-covered small::after {
  content: none;
}

.language-cell.is-covered small { color: #647069; }

.sound-button {
  display: grid;
  place-items: center;
}

.sound-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #1d503d;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-button.is-speaking { background: #e2ede6; }

.note-copy {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px;
}

.note-copy strong { color: #3d584b; font-size: 0.72rem; }
.note-copy p { margin: 0; color: #59655e; font-size: 0.75rem; line-height: 1.45; }

.remove-button {
  border-right: 0;
  color: #7b554f;
  font-size: 0.7rem;
  font-weight: 850;
}

.remove-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 70px 20px;
  text-align: center;
}

/* V17: recall cards use blur, clear actions and quiet tonal blocks. */
.notes-header {
  border-bottom: 0;
  box-shadow: 0 5px 18px rgba(23, 37, 31, 0.06);
}

.back-link,
.cover-controls button,
.notes-table-shell,
.note-row {
  border: 0;
}

.cover-controls button {
  background: #dfe8e2;
}

.notes-table-shell {
  background: #f5f7f4;
  box-shadow: 0 14px 38px rgba(23, 37, 31, 0.08);
}

.notes-table-head,
.note-row {
  grid-template-columns: minmax(150px, 0.9fr) minmax(190px, 1.1fr) 66px minmax(240px, 1.5fr) minmax(150px, 0.7fr);
}

.notes-table-head {
  border-bottom: 0;
  background: #dfe7e1;
}

.notes-list {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.note-row {
  min-height: 92px;
  overflow: hidden;
  border-radius: 6px;
  background: #fbfcfa;
}

.language-cell,
.sound-button,
.remove-button {
  border: 0;
}

.language-cell {
  background: #f7f9f6;
}

.sound-button {
  background: #edf2ee;
}

.note-copy {
  background: #f1f4f1;
}

.remove-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: #f3ebe7;
}

.language-cell.is-covered {
  background: #e9efeb;
}

.language-cell.is-covered span {
  background: transparent;
  text-shadow: 0 0 9px rgba(23, 37, 31, 0.42);
}

@media (max-width: 760px) {
  .notes-header {
    gap: 10px;
    padding-inline: 10px;
  }

  .notes-brand {
    gap: 8px;
  }

  .notes-brand span:not(.notes-book-mark) {
    display: none;
  }

  .notes-book-mark {
    width: 34px;
    height: 34px;
  }

  .notes-intro h1 {
    font-size: clamp(1.55rem, 7vw, 2.15rem);
    line-height: 1.08;
  }

  .cover-controls button {
    min-height: 44px;
    border: 0;
  }

  .notes-table-shell {
    box-shadow: none;
  }

  .notes-list {
    gap: 12px;
    padding: 0;
  }

  .note-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 52px;
    border: 0;
    border-radius: 6px;
    box-shadow: 0 9px 24px rgba(23, 37, 31, 0.07);
  }

  .language-cell,
  .sound-button {
    border: 0;
  }

  .note-copy,
  .remove-button {
    grid-column: 1 / -1;
    border: 0;
  }

  .note-copy {
    padding: 13px;
  }

  .remove-button {
    min-height: 44px;
  }
}

.empty-state[hidden] { display: none; }
.empty-state strong { font-size: 1.15rem; }
.empty-state p { max-width: 480px; margin: 0; color: #68736c; line-height: 1.5; }
.empty-state a { margin-top: 8px; padding: 11px 16px; border-radius: 6px; background: #1d503d; color: #fff; font-weight: 850; text-decoration: none; }

@media (max-width: 760px) {
  main { width: min(100% - 20px, 620px); padding-top: 24px; }
  .notes-header { grid-template-columns: 40px minmax(0, 1fr); }
  .home-link { display: none; }
  .notes-intro { align-items: stretch; flex-direction: column; gap: 16px; }
  .cover-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .notes-table-head { display: none; }
  .notes-table-shell { border: 0; background: transparent; box-shadow: none; }
  .notes-list { display: grid; gap: 10px; }
  .note-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 52px 34px;
    min-height: 0;
    border: 1px solid rgba(23, 37, 31, 0.18);
    border-radius: 6px;
    background: #fafbf7;
    overflow: hidden;
  }
  .note-copy { grid-column: 1 / -1; border-top: 1px solid rgba(23, 37, 31, 0.1); }
  .language-cell { min-height: 76px; padding: 11px; }
  .language-cell span { font-size: 0.84rem; overflow-wrap: anywhere; }
  .sound-button { border-right: 1px solid rgba(23, 37, 31, 0.1); }
}

/* Keep the V17 phone card contract after all legacy rules. */
@media (max-width: 760px) {
  .notes-table-shell {
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .notes-list {
    gap: 12px;
    padding: 0;
  }

  .note-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 52px;
    border: 0;
    border-radius: 6px;
    background: #fbfcfa;
    box-shadow: 0 9px 24px rgba(23, 37, 31, 0.07);
  }

  .language-cell,
  .sound-button,
  .note-copy,
  .remove-button {
    border: 0;
  }

  .note-copy,
  .remove-button {
    grid-column: 1 / -1;
  }

  .remove-button {
    min-height: 44px;
  }
}
