:root {
  color-scheme: light;
  --bg: #eef3f9;
  --paper: rgba(255, 255, 255, 0.78);
  --paper-strong: rgba(255, 255, 255, 0.94);
  --ink: #152033;
  --muted: #66758a;
  --line: rgba(117, 134, 160, 0.24);
  --blue: #236ff3;
  --cyan: #13d6d2;
  --blue-2: #6f85ff;
  --green: #0fa78d;
  --yellow: #f7bd3a;
  --red: #d13f3f;
  --shadow: 0 18px 42px rgba(34, 47, 68, 0.12);
  --shadow-soft: 0 8px 22px rgba(34, 47, 68, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(35, 111, 243, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 111, 243, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 18% 10%, rgba(35, 111, 243, 0.12), transparent 24%),
    radial-gradient(circle at 86% 18%, rgba(19, 214, 210, 0.14), transparent 22%),
    linear-gradient(135deg, #f8fcff 0%, #edf6ff 48%, #eaf2fa 100%);
  background-size: 24px 24px, 24px 24px, auto, auto, auto;
}

button,
input,
textarea,
select {
  font: inherit;
}

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

.app-shell {
  width: min(100%, 1220px);
  max-width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px calc(136px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(82px, auto) minmax(0, 1fr) minmax(82px, auto);
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(241, 247, 253, 0.78)),
    rgba(245, 249, 253, 0.86);
  box-shadow: 0 14px 34px rgba(34, 47, 68, 0.11);
  backdrop-filter: blur(22px);
}

.brand {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

.brand span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ghost-link {
  display: inline-grid;
  min-height: 38px;
  place-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.account-bar {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.ai-top-button {
  display: inline-grid;
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  place-items: center;
  padding: 0;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  color: #fff;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.82), transparent 20%),
    linear-gradient(135deg, #287bff, var(--cyan));
  box-shadow: 0 10px 24px rgba(35, 111, 243, 0.28);
  cursor: pointer;
}

.ai-face {
  position: relative;
  display: block;
  width: 30px;
  height: 23px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0b55ef, #12cad0);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.ai-face::before,
.ai-face::after {
  position: absolute;
  top: 8px;
  width: 5px;
  height: 5px;
  content: "";
  border-radius: 999px;
  background: #fff;
}

.ai-face::before {
  left: 8px;
}

.ai-face::after {
  right: 8px;
}

.profile-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 52px;
  max-width: 52px;
  min-height: 52px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 18px rgba(34, 47, 68, 0.1);
  cursor: pointer;
}

.profile-avatar,
.big-avatar {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--green)) center / cover;
  font-weight: 900;
}

.profile-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.96);
  box-shadow: 0 5px 14px rgba(34, 47, 68, 0.16);
  font-size: 14px;
}

.big-avatar {
  width: 74px;
  height: 74px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  font-size: 28px;
}

.user-badge {
  display: none;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.glass-panel {
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 252, 255, 0.76)),
    var(--paper);
  box-shadow: 0 18px 44px rgba(34, 47, 68, 0.1);
  backdrop-filter: blur(22px);
}

.auth-view {
  min-height: calc(100vh - 92px);
  display: grid;
  align-items: center;
}

.admin-shell {
  width: min(100%, 720px);
}

.admin-shell .topbar {
  grid-template-columns: minmax(0, 1fr) auto;
}

.admin-shell .brand {
  grid-column: 1;
  justify-content: flex-start;
}

.admin-main {
  min-height: calc(100vh - 104px);
  display: grid;
  align-items: center;
  padding-top: 18px;
}

.auth-panel {
  width: min(100%, 520px);
  display: grid;
  gap: 16px;
  margin: 0 auto;
  padding: 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(241, 246, 252, 0.78);
}

.auth-form,
.grid-form {
  display: grid;
  gap: 12px;
}

.auth-form h1,
.section-head h2,
.drawer-block h3,
.note-card h3,
.review-card h3 {
  margin: 0;
}

.auth-form h1 {
  font-size: 25px;
  line-height: 1.2;
}

.auth-form label,
.grid-form label {
  display: grid;
  gap: 7px;
  color: #536278;
  font-size: 13px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(127, 145, 170, 0.34);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
}

input,
select {
  min-height: 44px;
  padding: 0 13px;
}

textarea {
  padding: 12px 13px;
  resize: vertical;
  line-height: 1.65;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(35, 111, 243, 0.72);
  box-shadow: 0 0 0 4px rgba(35, 111, 243, 0.13);
}

.primary-button,
.ghost-button,
.logout-button,
.tab-button,
.mini-button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  padding: 0 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 14px 26px rgba(15, 167, 141, 0.22);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.ghost-button,
.logout-button {
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--line);
}

.tab-button {
  color: var(--muted);
  background: transparent;
}

.tab-button.is-active {
  color: var(--blue);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.danger {
  color: var(--red);
}

.form-state {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.muted-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.app-view,
.record-view,
.review-view,
.mine-view {
  display: grid;
  gap: 16px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.profile-drawer {
  display: grid;
  gap: 18px;
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 20px;
  overflow: hidden;
}

.profile-drawer > .section-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.profile-drawer .grid-form {
  grid-template-columns: 156px minmax(0, 1fr);
  align-items: end;
  gap: 14px 18px;
}

.profile-drawer .grid-form .primary-button,
.profile-drawer .grid-form .form-state {
  grid-column: 2;
}

.avatar-editor {
  display: grid;
  align-items: center;
  justify-items: center;
  gap: 12px;
  grid-row: span 2;
  min-height: 156px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
}

.upload-button {
  display: inline-grid !important;
  place-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink) !important;
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
}

.upload-button input {
  display: none;
}

.drawer-block {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.drawer-logout {
  width: 100%;
}

.composer,
.records-panel,
.detail-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 14px;
}

.composer textarea {
  min-height: 250px;
  border: 0;
  padding: 10px 4px 12px;
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 34px, rgba(35, 111, 243, 0.09) 35px),
    transparent;
  font-size: 21px;
  line-height: 35px;
}

.composer textarea:focus {
  box-shadow: none;
}

.composer-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0 16px;
}

.composer-hints span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #66758a;
  background: rgba(255, 255, 255, 0.66);
  font-size: 14px;
  font-weight: 800;
}

.composer-hints span::before {
  color: var(--blue);
  content: "✦";
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.section-head h2 {
  font-size: 22px;
  line-height: 1.2;
}

.records-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-input {
  flex: 0 1 190px;
  max-width: 190px;
}

.category-chips {
  display: flex;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 14px 0 2px;
  scrollbar-width: none;
}

.category-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #5d6d83;
  background: rgba(255, 255, 255, 0.74);
  cursor: pointer;
  font-weight: 850;
}

.chip.is-active {
  color: var(--blue);
  border-color: rgba(35, 111, 243, 0.34);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
}

.category-manager {
  display: grid;
  gap: 8px;
}

.category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
}

.category-row span {
  min-width: 0;
  overflow: hidden;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-row div {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.mini-button {
  min-height: 30px;
  padding: 0 9px;
  color: #58677d;
  background: rgba(255, 255, 255, 0.86);
  border-color: var(--line);
  font-size: 12px;
}

.icon-button {
  min-height: 28px;
  padding: 0 8px;
  color: #58677d;
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--line);
  font-size: 12px;
}

.note-list {
  display: grid;
  gap: 18px;
  padding-top: 20px;
}

.load-more-button {
  justify-self: center;
  margin-top: 16px;
}

.note-card,
.review-card {
  position: relative;
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 253, 255, 0.8)),
    rgba(255, 255, 255, 0.74);
  cursor: pointer;
  text-decoration: none;
}

.note-card {
  padding-right: 128px;
}

.review-card {
  padding-right: 24px;
}

.note-card::before {
  display: none;
  content: "";
}

.note-card:hover {
  border-color: rgba(35, 111, 243, 0.32);
  box-shadow: var(--shadow-soft);
}

.note-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.note-card-tools,
.detail-actions,
.ai-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.note-card-tools {
  position: absolute;
  top: 22px;
  right: 22px;
  justify-content: flex-end;
  max-width: 110px;
}

.note-card h3,
.review-card h3 {
  min-width: 0;
  font-size: 24px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.note-card p,
.review-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.note-card-head span,
.card-meta {
  flex: 0 0 auto;
  max-width: 46%;
  overflow: hidden;
  padding: 4px 8px;
  border-radius: 999px;
  color: #765407;
  background: rgba(247, 189, 58, 0.18);
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-card-tools span {
  max-width: none;
  min-width: max-content;
}

.pronunciation,
#reviewPronunciation {
  color: var(--green) !important;
  font-size: 13px;
  font-weight: 850;
}

.speak-button {
  width: fit-content;
  min-height: 32px;
  padding: 0 10px;
  color: var(--blue);
  font-size: 12px;
}

.empty-state {
  margin: 0;
  padding: 34px 0 26px;
  color: var(--muted);
  text-align: center;
}

.detail-view {
  display: grid;
  gap: 14px;
  padding-top: 18px;
}

.detail-nav {
  position: sticky;
  top: 86px;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0 2px;
  background: linear-gradient(180deg, rgba(237, 247, 255, 0.98), rgba(237, 247, 255, 0));
}

.detail-nav a {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.memory-card {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.memory-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.memory-card h1 {
  margin: 10px 0 0;
  font-size: 28px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.memory-card-body {
  display: grid;
  gap: 12px;
}

.memory-card-body section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.memory-card-body h3 {
  margin: 0 0 8px;
  color: #506176;
  font-size: 13px;
}

.memory-card-body p {
  margin: 0;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.ai-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.ai-prompt-field {
  display: grid;
  gap: 8px;
  color: #536278;
  font-size: 13px;
  font-weight: 800;
}

.ai-output {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.ai-output h3 {
  margin: 10px 0 2px;
  font-size: 17px;
}

.ai-output p,
.ai-output li {
  margin: 0;
  color: #536278;
  line-height: 1.72;
}

.ai-output ul {
  margin: 0;
  padding-left: 20px;
}

.bottom-nav {
  position: fixed;
  right: 14px;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 14px;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: min(calc(100% - 28px), 760px);
  margin: 0 auto;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 42px rgba(34, 47, 68, 0.12);
  backdrop-filter: blur(26px);
}

.bottom-nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  border-radius: 999px;
  color: #8a94a5;
  font-size: 15px;
  font-weight: 900;
  text-decoration: none;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.bottom-nav-item.is-active {
  color: var(--blue);
  background: #fff;
  box-shadow: 0 10px 24px rgba(35, 111, 243, 0.14);
}

.bottom-icon {
  display: inline-grid;
  position: relative;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: currentColor;
  font-size: 0;
}

.bottom-icon::before,
.bottom-icon::after {
  position: absolute;
  content: "";
}

.bottom-nav-item[data-tab="record"] .bottom-icon::before {
  width: 14px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 5px;
}

.bottom-nav-item[data-tab="record"] .bottom-icon::after {
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor;
}

.bottom-nav-item[data-tab="review"] .bottom-icon::before {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 5px;
  transform: rotate(45deg) scale(0.82);
}

.bottom-nav-item[data-tab="review"] .bottom-icon::after {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
}

.bottom-nav-item[data-tab="mine"] .bottom-icon::before {
  top: 3px;
  width: 7px;
  height: 7px;
  border: 2px solid currentColor;
  border-radius: 999px;
}

.bottom-nav-item[data-tab="mine"] .bottom-icon::after {
  bottom: 2px;
  width: 15px;
  height: 8px;
  border: 2px solid currentColor;
  border-top-left-radius: 999px;
  border-top-right-radius: 999px;
  border-bottom: 0;
}

.panel-kicker {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.review-hero,
.mine-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.review-hero h2,
.mine-hero h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.review-score {
  display: grid;
  min-width: 96px;
  padding: 12px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.review-score strong {
  font-size: 28px;
}

.review-score span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.review-empty {
  display: grid;
  gap: 8px;
  min-height: 220px;
  place-content: center;
  text-align: center;
}

.review-empty h3,
.review-card h2 {
  margin: 0;
}

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

.review-card-head > span:last-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.review-card h2 {
  font-size: 30px;
  line-height: 1.2;
}

.review-question {
  color: #526780;
  font-size: 17px;
}

.review-answer,
.review-help {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.review-answer h3,
.review-help h3 {
  margin: 0 0 4px;
}

.review-answer p,
.review-help p {
  margin: 0;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mine-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  justify-content: stretch;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(240, 248, 255, 0.78)),
    rgba(255, 255, 255, 0.72);
}

.mine-hero .big-avatar {
  width: 72px;
  height: 72px;
}

.mine-hero .ghost-button {
  margin-left: auto;
  min-width: 76px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.stat-card strong {
  font-size: 28px;
}

.category-stats,
.recent-notes {
  display: grid;
  gap: 10px;
  padding-top: 14px;
}

.category-stat-row {
  display: grid;
  gap: 8px;
}

.category-stat-row div,
.recent-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.category-stat-row span,
.recent-note span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.category-stat-row i {
  display: block;
  width: var(--size);
  min-width: 6px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
}

.recent-note {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  background: rgba(255, 255, 255, 0.62);
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 620px) {
  .app-shell {
    width: 100%;
    padding: 8px 8px calc(122px + env(safe-area-inset-bottom));
  }

  .topbar {
    top: 6px;
    grid-template-columns: 42px minmax(0, 1fr) 92px;
    gap: 6px;
    min-height: 54px;
    padding: 7px 8px;
    border-radius: 12px;
  }

  .brand {
    font-size: 22px;
    line-height: 1.15;
  }

  .admin-shell .brand {
    font-size: 15px;
  }

  .ghost-link {
    min-height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }

  .profile-button {
    width: 40px;
    max-width: 40px;
    min-height: 40px;
    padding: 2px;
  }

  .profile-avatar {
    width: 36px;
    height: 36px;
  }

  .ai-top-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .ai-face {
    width: 24px;
    height: 18px;
  }

  .user-badge {
    display: none;
  }

  .profile-drawer {
    padding: 14px;
  }

  .profile-drawer .grid-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-drawer .grid-form .primary-button,
  .profile-drawer .grid-form .form-state {
    grid-column: 1;
  }

  .avatar-editor {
    grid-row: auto;
    min-height: auto;
    grid-template-columns: auto minmax(0, 1fr);
    justify-items: start;
  }

  .composer,
  .records-panel,
  .detail-card {
    padding: 12px;
  }

  .composer textarea {
    min-height: 210px;
    font-size: 18px;
    line-height: 31px;
    background:
      repeating-linear-gradient(to bottom, transparent 0, transparent 30px, rgba(35, 111, 243, 0.09) 31px),
      transparent;
  }

  .section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(118px, 42%);
    align-items: start;
  }

  .search-input {
    width: 100%;
    max-width: none;
  }

  .composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .composer-actions .primary-button {
    width: 100%;
  }

  .composer-hints {
    gap: 8px;
  }

  .composer-hints span {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .note-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .note-card-head span,
  .card-meta {
    max-width: 40vw;
  }

  .detail-actions,
  .ai-actions,
  .review-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .memory-card {
    padding: 14px;
  }

  .memory-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .memory-card h1 {
    font-size: 24px;
  }

  .review-hero,
  .mine-hero {
    align-items: flex-start;
    padding: 14px;
  }

  .review-hero h2,
  .mine-hero h2 {
    font-size: 20px;
  }

  .review-score {
    min-width: 76px;
    padding: 10px;
  }

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

  .stat-card strong {
    font-size: 24px;
  }

  .bottom-nav {
    right: 8px;
    left: 8px;
    width: calc(100% - 16px);
    padding: 6px;
  }

  .bottom-nav-item {
    min-height: 44px;
    font-size: 14px;
  }

  .note-card,
  .review-card {
    padding: 18px 14px;
  }

  .note-card {
    padding-right: 94px;
  }

  .note-card-tools {
    top: 18px;
    right: 14px;
    max-width: 76px;
  }

  .note-card::before {
    display: none;
  }

  .mine-hero {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .mine-hero .ghost-button {
    grid-column: 1 / -1;
    width: 100%;
    margin-left: 0;
  }

  .detail-view {
    padding-top: 10px;
  }

  .detail-nav {
    top: 68px;
    padding-top: 8px;
  }
}

@media (min-width: 621px) {
  .app-shell {
    padding-top: 18px;
  }

  .record-view {
    gap: 18px;
  }

  .composer,
  .records-panel,
  .detail-card {
    padding: 18px;
  }

  .note-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 980px) {
  .app-shell {
    padding-top: 18px;
  }

  .note-list {
    grid-template-columns: minmax(0, 1fr);
  }
}
