@font-face {
  font-family: Lato;
  src: url('/fonts/lato-regular-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Lato;
  src: url('/fonts/lato-bold-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
:root {
  --paper: #f5f2eb;
  --surface: #fffefa;
  --ink: #173c35;
  --muted: #738078;
  --line: #e5e3d9;
  --orange: #e5a46c;
  --mint: #dbeadf;
  --cream: #eee8d9;
  --shadow: 0 16px 45px #19392b0d;
}
* {
  box-sizing: border-box;
}
html {
  font-size: 16px;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Lato, system-ui, sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2,
h3,
.brand,
.boot {
  font-family: Lato, system-ui, sans-serif;
  font-weight: 700;
}
h1 {
  font-size: clamp(2.4rem, 4vw, 4.5rem);
  line-height: 1.06;
  letter-spacing: -0.055em;
}
h2 {
  font-size: 2rem;
  letter-spacing: -0.04em;
}
a {
  color: inherit;
}
.boot {
  display: grid;
  place-items: center;
  height: 100vh;
  font-size: 3rem;
}
.boot-dot,
.brand-dot {
  color: var(--orange);
}
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 246px 1fr;
}
.sidebar {
  padding: 33px 20px 22px 30px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 32px;
  background: #f8f6f0;
}
.brand {
  font-size: 2rem;
  letter-spacing: -0.07em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.brand-mark {
  width: 31px;
  height: 31px;
  background: var(--ink);
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font: 700 18px Lato;
  margin-right: 6px;
}
.side-label,
.eyebrow,
.tiny {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: #8d988f;
}
.side-label {
  margin: 0 12px 8px;
}
.nav {
  display: grid;
  gap: 5px;
}
.nav button {
  border: 0;
  background: transparent;
  color: #65776d;
  text-align: left;
  width: 100%;
  padding: 13px 15px;
  border-radius: 12px;
  display: flex;
  gap: 13px;
  align-items: center;
  font-weight: 600;
}
.nav button:hover,
.nav button.active {
  background: #e9eee8;
  color: var(--ink);
}
.nav svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.8;
}
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}
.sidebar-bottom strong {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
}
.main {
  min-width: 0;
  padding: 31px clamp(24px, 5vw, 80px) 80px;
  max-width: 1500px;
  width: 100%;
  margin: auto;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 54px;
  color: var(--muted);
  font-size: 0.83rem;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.topbar button {
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 700;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #dbebe0;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--ink);
}
.hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 28px;
  margin-bottom: 35px;
}
.hero h1 {
  margin: 8px 0 13px;
}
.hero p {
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}
.date-pill {
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 99px;
  white-space: nowrap;
  background: #faf9f5;
  color: var(--muted);
  font-size: 0.82rem;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 34px;
}
.stat {
  padding: 23px 25px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  min-height: 139px;
  box-shadow: var(--shadow);
}
.stat strong {
  display: block;
  font-family: Lato, system-ui, sans-serif;
  font-weight: 700;
  font-size: 2.3rem;
  line-height: 1;
  margin: 23px 0 5px;
  letter-spacing: -0.06em;
}
.stat small {
  color: var(--muted);
}
.stat-icon {
  float: right;
  font-size: 1.3rem;
  color: var(--orange);
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 16px;
}
.section-heading h2 {
  font-size: 1.5rem;
  margin: 0;
}
.text-action {
  background: transparent;
  border: 0;
  color: var(--ink);
  font-weight: 700;
  padding: 6px 0;
}
.deck-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.deck-card {
  position: relative;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 18px;
  padding: 25px;
  min-height: 187px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.deck-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 44px #19392b18;
}
.deck-card:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #df9b65;
  outline-offset: 2px;
}
.deck-card::after {
  content: '';
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  right: -54px;
  top: -68px;
  background: var(--tint, #e9eee7);
}
.deck-card > * {
  position: relative;
  z-index: 1;
}
.deck-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
}
.deck-icon {
  width: 41px;
  height: 41px;
  border-radius: 12px;
  background: var(--tint, #e9eee7);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
}
.deck-arrow {
  font-size: 1.2rem;
}
.deck-card h3 {
  font-size: 1.45rem;
  margin: 28px 0 6px;
  letter-spacing: -0.04em;
}
.deck-meta {
  font-size: 0.8rem;
  color: var(--muted);
}
.deck-count {
  color: var(--ink);
  font-weight: 700;
}
.empty {
  padding: 48px 30px;
  border: 1px dashed #cdd4c9;
  border-radius: 20px;
  text-align: center;
  color: var(--muted);
}
.empty h3 {
  color: var(--ink);
  font-size: 1.5rem;
}
.btn {
  border: 0;
  background: var(--ink);
  color: white;
  border-radius: 12px;
  padding: 13px 19px;
  font-weight: 700;
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
}
.btn:hover {
  background: #26594c;
}
.btn.secondary {
  background: #e7eee6;
  color: var(--ink);
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn.warn {
  background: #a95344;
}
.btn.warn:hover {
  background: #934537;
}
.btn.full {
  width: 100%;
}
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-art {
  background: var(--ink);
  color: #f7f5eb;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(35px, 6vw, 88px);
  overflow: hidden;
  position: relative;
}
.login-art::before,
.login-art::after {
  content: '';
  position: absolute;
  border: 1px solid #93b09b55;
  border-radius: 50%;
  width: 540px;
  height: 540px;
  right: -120px;
  bottom: -200px;
}
.login-art::after {
  width: 380px;
  height: 380px;
  right: -40px;
  bottom: -120px;
}
.login-art .brand-mark {
  background: #e1efe2;
  color: var(--ink);
}
.login-art h1 {
  position: relative;
  z-index: 1;
  max-width: 600px;
  font-size: clamp(3rem, 5vw, 5.5rem);
  margin-bottom: 18px;
}
.login-art p {
  position: relative;
  z-index: 1;
  color: #c5d8ca;
  max-width: 430px;
  line-height: 1.6;
}
.login-panel {
  display: grid;
  place-items: center;
  padding: 35px;
}
.login-box {
  width: min(410px, 100%);
}
.login-box h2 {
  font-size: 2.8rem;
  margin-bottom: 8px;
}
.login-box > p {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 34px;
}
.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}
.field label {
  font-size: 0.8rem;
  font-weight: 700;
}
.field input,
.field select,
.field textarea,
.search-input {
  width: 100%;
  border: 1px solid #dcded5;
  border-radius: 11px;
  padding: 13px 14px;
  background: #fffefa;
  color: var(--ink);
  outline: none;
}
.field textarea {
  min-height: 90px;
  resize: vertical;
}
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.83rem;
  color: var(--muted);
  margin: 5px 0 24px;
}
.check input {
  accent-color: var(--ink);
}
.separator {
  display: flex;
  align-items: center;
  gap: 15px;
  color: #a1aaa2;
  font-size: 0.75rem;
  margin: 22px 0;
}
.separator:before,
.separator:after {
  content: '';
  height: 1px;
  background: var(--line);
  flex: 1;
}
.login-note {
  font-size: 0.73rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 32px;
}
.study-wrap {
  max-width: 790px;
  margin: auto;
}
.study-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 27px;
  gap: 12px;
}
.study-head h1 {
  font-size: 2.2rem;
  margin: 6px 0 0;
}
.study-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  min-height: 400px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.study-card-top {
  padding: 23px 28px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.study-content {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px 35px;
  min-height: 285px;
}
.study-main {
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  line-height: 1.35;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.study-main img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
}
.study-main audio {
  max-width: 100%;
}
.study-main .field {
  display: block;
}
.study-answer {
  border-top: 1px solid var(--line);
  padding: 35px;
  text-align: center;
  font-size: 1.2rem;
  line-height: 1.5;
}
.study-answer img {
  max-width: 100%;
}
.study-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.grade {
  min-width: 112px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  color: var(--ink);
  font-weight: 700;
}
.grade small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  margin-top: 4px;
}
.grade:first-child {
  background: #f7e4df;
}
.grade:last-child {
  background: #e1eee1;
}
.study-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 27px;
  color: var(--muted);
  font-size: 0.85rem;
}
.study-footer button {
  border: 0;
  background: transparent;
  color: var(--muted);
}
.sound {
  border: 0;
  background: var(--mint);
  color: var(--ink);
  padding: 9px 14px;
  border-radius: 30px;
  font:
    600 0.8rem Lato,
    system-ui,
    sans-serif;
  vertical-align: middle;
  margin: 4px;
}
.search-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.search-row .search-input {
  flex: 1;
}
.results {
  display: grid;
  gap: 10px;
}
.result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 19px 21px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.result-main {
  min-width: 0;
}
.result-title {
  font-weight: 700;
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-sub {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 7px;
}
.result button {
  border: 0;
  background: #e9eee8;
  color: var(--ink);
  border-radius: 9px;
  padding: 9px 12px;
  font-weight: 700;
}
.toolbar {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.toolbar select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
  background: var(--surface);
}
.editor {
  max-width: 780px;
}
.editor-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 17px;
  padding: 27px;
  margin-top: 20px;
}
.setting-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 26px;
  margin: 16px 0;
}
.setting-card p {
  color: var(--muted);
  line-height: 1.5;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}
.hint {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}
.mobile-nav {
  display: none;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 30px);
  background: var(--ink);
  color: #fff;
  padding: 11px 19px;
  border-radius: 10px;
  box-shadow: 0 10px 35px #173c3540;
  opacity: 0;
  transition: 0.2s;
  z-index: 20;
  pointer-events: none;
  font-size: 0.87rem;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (max-width: 850px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .main {
    padding: 25px 23px 105px;
  }
  .topbar {
    margin-bottom: 35px;
  }
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fffefaeb;
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    z-index: 10;
    justify-content: space-around;
    padding: 9px 9px calc(9px + env(safe-area-inset-bottom));
  }
  .mobile-nav button {
    border: 0;
    background: none;
    color: var(--muted);
    display: grid;
    justify-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 65px;
    padding: 4px;
  }
  .mobile-nav button.active {
    color: var(--ink);
  }
  .mobile-nav svg {
    width: 21px;
    height: 21px;
  }
  .hero {
    align-items: start;
  }
  .login {
    grid-template-columns: 1fr;
  }
  .login-art {
    min-height: 250px;
    padding: 28px 30px;
  }
  .login-art h1 {
    font-size: 2.8rem;
    margin: 10px 0 0;
  }
  .login-art p {
    display: none;
  }
  .login-panel {
    padding: 38px 28px;
    align-items: start;
  }
  .login-box h2 {
    font-size: 2.3rem;
  }
}
@media (max-width: 600px) {
  .hero h1 {
    font-size: 2.8rem;
  }
  .date-pill {
    display: none;
  }
  .stats {
    gap: 8px;
  }
  .stat {
    padding: 15px;
    min-height: 113px;
  }
  .stat strong {
    font-size: 1.7rem;
    margin-top: 16px;
  }
  .stat small {
    font-size: 0.7rem;
  }
  .stat-icon {
    font-size: 1rem;
  }
  .deck-grid {
    grid-template-columns: 1fr;
  }
  .deck-card {
    min-height: 148px;
    padding: 20px;
  }
  .deck-card h3 {
    margin-top: 17px;
  }
  .study-card {
    min-height: 360px;
  }
  .study-content {
    padding: 30px 18px;
    min-height: 240px;
  }
  .study-card-top {
    padding: 18px;
  }
  .study-answer {
    padding: 25px;
  }
  .grade {
    min-width: 72px;
    flex: 1;
  }
  .study-actions {
    gap: 7px;
  }
  .topbar-right {
    gap: 10px;
  }
  .topbar button {
    font-size: 0.77rem;
  }
  .search-row {
    flex-wrap: wrap;
  }
  .result {
    padding: 16px;
  }
  .result-title {
    font-size: 0.93rem;
  }
}
.login {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.login-panel {
  display: block;
  padding: 0;
  width: min(390px, 100%);
}
.login-box {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px;
  box-shadow: var(--shadow);
}
.login-brand {
  font:
    700 1.1rem Lato,
    system-ui,
    sans-serif;
  letter-spacing: -0.03em;
  margin-bottom: 30px;
}
.login-box h2 {
  font:
    600 2rem Lato,
    system-ui,
    sans-serif;
  letter-spacing: -0.04em;
  margin: 0 0 27px;
}
.login-note {
  margin: 24px 0 0;
}
.main {
  max-width: 1300px;
}
.hero {
  margin-bottom: 27px;
}
.hero h1 {
  font:
    600 clamp(2rem, 3vw, 2.8rem) Lato,
    system-ui,
    sans-serif;
  letter-spacing: -0.04em;
  margin: 0 0 6px;
}
.stats {
  margin-bottom: 34px;
}
.stat {
  min-height: 105px;
}
.stat strong {
  font:
    600 2rem Lato,
    system-ui,
    sans-serif;
  letter-spacing: -0.04em;
  margin: 17px 0 0;
}
.deck-card h3 {
  font:
    600 1.25rem Lato,
    system-ui,
    sans-serif;
  letter-spacing: -0.02em;
}
.brand {
  font:
    700 1.5rem Lato,
    system-ui,
    sans-serif;
  letter-spacing: -0.04em;
}
.typed-answer {
  display: block;
  width: min(350px, 100%);
  margin: 18px auto 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
  background: #fff;
}
.typed-result {
  padding: 10px 0;
  font-size: 1rem;
  line-height: 1.7;
}
.study-main a.hint {
  font:
    600 0.82rem Lato,
    system-ui,
    sans-serif;
  color: var(--ink);
  border-bottom: 1px dashed var(--ink);
  cursor: pointer;
}
.study-main a.hint:hover {
  color: #357660;
}
.sidebar-bottom {
  font-size: 0.75rem;
}
@media (max-width: 850px) {
  .login {
    padding: 20px;
  }
  .login-panel {
    width: min(390px, 100%);
  }
  .login-box {
    padding: 27px;
  }
  .login-box h2 {
    font-size: 2rem;
  }
  .hero h1 {
    font-size: 2.2rem;
  }
}
.deck-list {
  display: grid;
  gap: 12px;
  width: 100%;
}
.deck-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.deck-row {
  display: flex;
  align-items: center;
  min-height: 72px;
}
.deck-open {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 15px 16px 15px 22px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  flex: 1;
}
.deck-open:hover .deck-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.deck-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deck-numbers {
  display: grid;
  justify-items: end;
  flex: none;
  font-size: 0.83rem;
}
.deck-numbers strong {
  color: var(--ink);
}
.deck-numbers small {
  color: var(--muted);
  margin-top: 3px;
}
.deck-toggle {
  width: 50px;
  height: 50px;
  flex: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
}
.deck-toggle:hover {
  color: var(--ink);
}
.deck-toggle svg {
  display: block;
  width: 20px;
  height: 20px;
  margin: auto;
  transition: transform 0.15s ease;
}
.deck-toggle[aria-expanded='true'] svg {
  transform: rotate(180deg);
}
.deck-chevron {
  width: 50px;
  flex: none;
  text-align: center;
  color: var(--muted);
  font-size: 1.4rem;
}
.deck-children {
  margin: 0;
}
.deck-children[hidden] {
  display: none;
}
.deck-children > .deck-node {
  border-top: 1px solid var(--line);
}
.deck-children .deck-row {
  min-height: 61px;
}
.deck-children .deck-open {
  padding-left: 48px;
  font-size: 0.91rem;
}
.deck-children .deck-name {
  font-weight: 500;
}
.deck-children .deck-children .deck-open {
  padding-left: 74px;
}
@media (max-width: 600px) {
  .deck-list {
    gap: 10px;
  }
  .deck-row {
    min-height: 65px;
  }
  .deck-open {
    padding-left: 16px;
    padding-right: 9px;
  }
  .deck-toggle,
  .deck-chevron {
    width: 43px;
  }
  .deck-children {
    margin: 0;
  }
  .deck-children .deck-open {
    padding-left: 42px;
  }
  .deck-numbers {
    font-size: 0.78rem;
  }
}
.study-card {
  min-height: 390px;
}
.study-card-top {
  padding: 16px 22px;
}
.study-content {
  min-height: 320px;
  padding: 44px 50px;
}
.study-main {
  width: 100%;
  max-width: 610px;
  font-size: clamp(1.25rem, 1.8vw, 1.5rem);
  line-height: 1.5;
}
.study-main br + br {
  display: none;
}
.study-main a.hint {
  display: inline-block;
  margin: 13px 0 4px;
}
.study-main .typed-answer {
  width: min(320px, 100%);
  margin-top: 24px;
  font:
    400 1rem Lato,
    system-ui,
    sans-serif;
}
.study-answer {
  padding: 28px 36px;
}
@media (max-width: 600px) {
  .study-card {
    min-height: 350px;
  }
  .study-content {
    min-height: 280px;
    padding: 32px 24px;
  }
  .study-main {
    font-size: 1.25rem;
    line-height: 1.5;
  }
  .study-main a.hint {
    margin: 10px 0 2px;
  }
  .study-main .typed-answer {
    margin-top: 20px;
  }
  .study-card-top {
    padding: 14px 18px;
  }
  .study-answer {
    padding: 24px;
  }
}
.typed-feedback {
  margin: 0 auto 24px;
  max-width: 560px;
  padding: 16px 18px;
  background: #f7f7f1;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  font:
    500 1rem Lato,
    system-ui,
    sans-serif;
}
.typed-feedback-line {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 5px 0;
}
.typed-feedback-label {
  color: var(--muted);
  font-size: 0.78rem;
  padding-top: 3px;
}
.typed-feedback-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 1.1rem;
  line-height: 1.6;
}
.diff-match {
  color: #286b45;
  background: #dff1e3;
  border-radius: 3px;
}
.diff-wrong {
  color: #9a332a;
  background: #fbe2df;
  border-radius: 3px;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.diff-correction {
  color: #815017;
  background: #fae8c9;
  border-radius: 3px;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.study-wrap .empty #undo {
  display: block;
  margin: 16px auto 0;
}
.daily-progress {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 22px;
  margin: 0 0 25px;
  box-shadow: var(--shadow);
}
.daily-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  gap: 12px;
}
.daily-progress-head h2 {
  font:
    700 1rem Lato,
    system-ui,
    sans-serif;
  margin: 0;
}
.daily-progress-head > span {
  color: var(--muted);
  font-size: 0.82rem;
}
.progress-row + .progress-row {
  margin-top: 13px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  margin-bottom: 7px;
}
.progress-label span:first-child {
  font-weight: 700;
}
.progress-label span:last-child {
  color: var(--muted);
}
.progress-row progress {
  display: block;
  width: 100%;
  height: 9px;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: #e9ede7;
  overflow: hidden;
}
.progress-row progress::-webkit-progress-bar {
  background: #e9ede7;
  border-radius: 999px;
}
.progress-row progress::-webkit-progress-value {
  background: #578d72;
  border-radius: 999px;
}
.progress-row progress::-moz-progress-bar {
  background: #578d72;
  border-radius: 999px;
}
.progress-row:nth-child(2) progress::-webkit-progress-value {
  background: #d49a5e;
}
.progress-row:nth-child(2) progress::-moz-progress-bar {
  background: #d49a5e;
}
.study-card-flags {
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-kind {
  font:
    700 0.7rem Lato,
    system-ui,
    sans-serif;
  letter-spacing: 0;
  text-transform: none;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e7ece7;
  color: #436455;
}
.card-kind.kind-new {
  background: #f7e7cf;
  color: #865519;
}
.card-kind.kind-learning {
  background: #e3ecf4;
  color: #406780;
}
.card-kind.kind-relearning {
  background: #f5e2dc;
  color: #92533d;
}
@media (max-width: 600px) {
  .daily-progress {
    padding: 15px 17px;
    margin-bottom: 20px;
  }
  .progress-label {
    font-size: 0.76rem;
  }
  .study-card-flags {
    gap: 7px;
  }
  .card-kind {
    font-size: 0.65rem;
    padding: 4px 7px;
  }
}
.glossary-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
}
.glossary-controls label {
  font-size: 0.82rem;
  font-weight: 700;
}
.glossary-controls select {
  min-width: 230px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
}
.glossary-summary {
  display: flex;
  align-items: baseline;
  gap: 11px;
  margin-bottom: 17px;
}
.glossary-summary strong {
  font-size: 1.4rem;
}
.glossary-summary span,
.glossary-found {
  color: var(--muted);
  font-size: 0.85rem;
}
.glossary-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.glossary-filters button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 13px;
  font-size: 0.8rem;
  font-weight: 700;
}
.glossary-filters button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}
.glossary-filters button span {
  opacity: 0.65;
  margin-left: 5px;
}
.glossary-found {
  margin: 0 0 12px;
}
.glossary-list {
  display: grid;
  gap: 10px;
}
.glossary-entry {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 20px 23px;
}
.glossary-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.glossary-entry h2 {
  font:
    700 1.1rem Lato,
    system-ui,
    sans-serif;
  letter-spacing: 0;
  margin: 0 0 8px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.glossary-translation {
  display: flex;
  gap: 13px;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 0.95rem;
}
.glossary-translation [lang] {
  font-size: 1.25rem;
  font-weight: 600;
}
.glossary-translation span + span {
  color: var(--muted);
}
.glossary-deck {
  color: var(--muted);
  font-size: 0.74rem;
  margin-top: 8px;
}
.glossary-edit {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 9px;
  padding: 8px 12px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  flex: none;
}
.glossary-cards {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.glossary-card {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #e9ebe5;
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 0.75rem;
}
.glossary-stage {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e9eee8;
  color: #436455;
  white-space: nowrap;
}
.stage-new {
  background: #f7e7cf;
  color: #865519;
}
.stage-learning {
  background: #e3ecf4;
  color: #406780;
}
.stage-relearning {
  background: #f5e2dc;
  color: #92533d;
}
.stage-mature {
  background: #dceee2;
  color: #326849;
}
.stage-suspended,
.stage-buried {
  background: #eaeae7;
  color: #6b746c;
}
.glossary-filter {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
}
.glossary-filter.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.glossary-filters .glossary-filter button {
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 0;
}
.glossary-filters .glossary-filter-select {
  padding: 8px 4px 8px 13px;
}
.glossary-filters .glossary-filter-help {
  min-width: 30px;
  padding: 7px 10px 7px 5px;
  font-size: 0.87rem;
  line-height: 1;
  opacity: 0.72;
}
.glossary-filters .glossary-filter-help:hover,
.glossary-filters .glossary-filter-help[aria-expanded='true'] {
  opacity: 1;
}
.glossary-filters .glossary-filter .glossary-tooltip {
  position: absolute;
  z-index: 12;
  top: calc(100% + 8px);
  left: 0;
  width: 250px;
  max-width: calc(100vw - 36px);
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 28px #173c3523;
  font-size: 0.79rem;
  font-weight: 400;
  line-height: 1.45;
}
.glossary-filter:nth-last-child(-n + 2) .glossary-tooltip {
  left: auto;
  right: 0;
}
.glossary-tooltip[hidden] {
  display: none;
}
.browse-search-status {
  margin: -14px 0 14px;
}
.browse-search-status:empty {
  display: none;
}
@media (max-width: 600px) {
  .glossary-filters .glossary-filter .glossary-tooltip {
    position: fixed;
    top: auto;
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
    padding: 14px 16px;
    font-size: 0.84rem;
  }
  .glossary-filter:nth-last-child(-n + 2) .glossary-tooltip {
    left: 16px;
    right: 16px;
  }
}
@media (max-width: 600px) {
  .glossary-hero {
    display: block;
  }
  .glossary-hero h1 {
    font-size: 2.3rem;
  }
  .glossary-hero .btn {
    margin-top: 14px;
    padding: 10px 13px;
  }
  .glossary-controls {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }
  .glossary-controls select {
    width: 100%;
  }
  .glossary-entry {
    padding: 17px;
  }
  .glossary-card {
    width: 100%;
    justify-content: space-between;
  }
  .glossary-summary {
    flex-wrap: wrap;
    gap: 4px 10px;
  }
  .glossary-filters {
    gap: 6px;
  }
  .glossary-filters button {
    padding: 7px 11px;
  }
}

.answer-practice {
  display: grid;
  gap: 7px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.answer-practice label {
  font:
    700 0.78rem Lato,
    system-ui,
    sans-serif;
  color: var(--ink);
}
.answer-practice input {
  width: min(320px, 100%);
  padding: 10px 12px;
  border: 1px solid #dcded5;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font:
    400 0.95rem Lato,
    system-ui,
    sans-serif;
  text-align: center;
}
.answer-practice input.matched {
  border-color: #578d72;
  background: #f1f8f1;
}
.answer-practice-status {
  min-height: 1.1em;
  color: #286b45;
  font:
    700 0.73rem Lato,
    system-ui,
    sans-serif;
}

.study-empty-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0 8px;
}

/* Account and deck library controls. */
#publish-form {
  display: grid;
  gap: 12px;
  max-width: 650px;
}
#publish-form input,
#publish-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface);
  color: var(--ink);
}
#publish-form .btn {
  justify-self: start;
}

/* Keep short pages at the top, and give phone navigation room for readable labels. */
.main {
  margin: 0 auto;
}
.mobile-more-menu {
  display: none;
}
.visually-hidden {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.setting-card h2 {
  font:
    700 1.2rem Lato,
    system-ui,
    sans-serif;
  letter-spacing: -0.02em;
  margin-bottom: 17px;
}
@media (max-width: 850px) {
  .mobile-nav {
    gap: 2px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .mobile-nav button {
    font-size: 0.72rem;
    min-height: 50px;
    gap: 3px;
  }
  .mobile-nav svg {
    width: 22px;
    height: 22px;
  }
  .mobile-more-menu:not([hidden]) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    position: fixed;
    z-index: 11;
    left: 16px;
    right: 16px;
    bottom: calc(73px + env(safe-area-inset-bottom));
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 18px 45px #173c352a;
  }
  .mobile-more-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    min-height: 52px;
    padding: 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    font-weight: 700;
  }
  .mobile-more-menu button.active,
  .mobile-more-menu button:hover {
    background: #e9eee8;
  }
  .mobile-more-menu svg {
    width: 20px;
    height: 20px;
    flex: none;
  }
}
@media (max-width: 600px) {
  .main {
    padding: 20px 18px calc(95px + env(safe-area-inset-bottom));
  }
  .topbar {
    margin-bottom: 27px;
  }
  .setting-card {
    padding: 18px;
    margin: 12px 0;
  }
  .setting-card h3 {
    font:
      700 1rem Lato,
      system-ui,
      sans-serif;
    letter-spacing: -0.01em;
  }
  .study-head {
    align-items: flex-start;
    margin-bottom: 18px;
  }
  .study-head h1 {
    font-size: 1.65rem;
    line-height: 1.18;
  }
  .study-head .btn {
    font-size: 0.8rem;
    padding: 10px 12px;
    max-width: 112px;
  }
  .study-card {
    min-height: 240px;
  }
  .study-content {
    min-height: 155px;
    padding: 22px 18px;
  }
  .study-card-top {
    padding: 13px 16px;
  }
  .study-answer {
    padding: 19px 18px;
  }
  .study-actions {
    margin-top: 16px;
  }
  .study-footer {
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 17px;
  }
}

.deck-details-open {
  position: relative;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 9px 14px;
  margin-left: 16px;
  white-space: nowrap;
}
.deck-details-open::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  height: 36px;
  border-left: 1px solid var(--line);
  transform: translateY(-50%);
}
.deck-details-open:hover {
  background: #e9eee8;
}
.deck-details-short {
  display: none;
}
.auth-switch {
  margin-top: 12px;
}
@media (max-width: 700px) {
  .deck-details-open {
    margin-left: 9px;
    padding: 8px;
    font-size: 0.72rem;
  }
  .deck-details-open::before {
    left: -9px;
    height: 30px;
  }
  .deck-details-label {
    display: none;
  }
  .deck-details-short {
    display: inline;
  }
}
.deck-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 20px;
}
.deck-tabs button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 15px;
  font-weight: 700;
}
.deck-tabs button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}
.import-deck {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
}
.import-deck summary {
  display: inline-flex;
  cursor: pointer;
  font-weight: 700;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 11px 15px;
  list-style: none;
}
.import-deck summary::-webkit-details-marker {
  display: none;
}
.import-deck form {
  max-width: 620px;
  margin-top: 16px;
}

.study-card {
  overflow: visible;
  position: relative;
}
.study-card-top {
  border-radius: 24px 24px 0 0;
  align-items: center;
}
.review-tools {
  position: relative;
  color: var(--ink);
  letter-spacing: 0;
  text-transform: none;
}
.review-tools summary {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  list-style: none;
  cursor: pointer;
  border-radius: 8px;
  color: var(--muted);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}
.review-tools summary::-webkit-details-marker {
  display: none;
}
.review-tools summary:hover,
.review-tools[open] summary {
  background: #e9eee8;
  color: var(--ink);
}
.review-tools-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 5;
  width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.review-tools-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.review-tools-menu button:hover,
.review-tools-menu button:focus-visible {
  background: #e9eee8;
}
.grade-key,
.reveal-key {
  display: block;
  width: max-content;
  min-width: 22px;
  margin: 0 auto 5px;
  padding: 1px 5px;
  border: 1px solid #d4dbd2;
  border-radius: 5px;
  color: var(--muted);
  background: #ffffffa6;
  font-size: 0.69rem;
  font-weight: 700;
  line-height: 1.25;
}
#reveal {
  flex-direction: column;
  gap: 4px;
}
#reveal .reveal-key {
  margin: 0;
  border-color: #ffffff80;
  color: #fff;
  background: #ffffff1a;
}
.review-flag {
  color: #b95143;
  font-size: 1.2rem;
  letter-spacing: 0;
}
.review-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: min(85vh, 800px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  padding: 24px;
  box-shadow: 0 22px 70px #173c3540;
}
.review-dialog::backdrop {
  background: #14231d88;
}
.review-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}
.review-dialog-head h2 {
  font-size: 1.4rem;
  margin: 0;
}
.review-dialog-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.8rem;
  line-height: 1;
  padding: 2px 6px;
}
.review-dialog .field textarea {
  min-height: 72px;
}
.review-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 24px;
}
.review-info-grid div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.review-info-grid dt {
  color: var(--muted);
  font-size: 0.78rem;
}
.review-info-grid dd {
  margin: 5px 0 0;
  font-weight: 700;
}
.review-dialog h3 {
  font-size: 1rem;
  margin: 0 0 10px;
}
.review-history {
  list-style: none;
  padding: 0;
  margin: 0;
}
.review-history li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}
.review-history time {
  color: var(--muted);
}
@media (max-width: 600px) {
  .review-dialog {
    padding: 18px;
  }
  .review-history li {
    gap: 8px;
    font-size: 0.78rem;
  }
}
.import-deck summary:hover {
  background: #f4f6f1;
}
.import-deck summary:focus:not(:focus-visible) {
  outline: none;
}
.import-deck summary:focus-visible {
  outline: 3px solid #df9b65;
  outline-offset: 2px;
}
.import-intro {
  margin: 16px 0 0;
  max-width: 560px;
}
.import-deck form {
  margin-top: 18px;
}
.import-file {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  padding: 15px;
  border: 1px dashed #b9c9bc;
  border-radius: 12px;
  background: #fbfcf8;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.import-file:hover,
.import-file:focus-within {
  background: #f1f7f0;
  border-color: #5e8a70;
}
.import-file:focus-within {
  outline: 3px solid #df9b65;
  outline-offset: 2px;
}
.import-file input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.import-file-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #e7eee6;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
}
.import-file-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.import-file-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}
.import-file-copy small {
  color: var(--muted);
  font-size: 0.78rem;
}
.import-file-action {
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.8rem;
}
.import-deck button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
@media (max-width: 500px) {
  .import-file-action {
    display: none;
  }
}
select:not([multiple]),
#publish-form select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 6 5 5 5-5' fill='none' stroke='%23173c35' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 14px 14px;
  padding-right: 42px;
  cursor: pointer;
}
.marketplace-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding: 17px 0;
}
.marketplace-item p {
  margin: 5px 0 0;
}
.marketplace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 18px;
}
.market-section {
  --market-wash: #e5efe8;
  --market-tile: #f6faf6;
  padding: clamp(16px, 2vw, 24px);
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--market-wash);
}
.market-section-private {
  --market-wash: #eaeae7;
  --market-tile: #f6f6f4;
}
.market-section-subscribed {
  --market-wash: #e2edf2;
  --market-tile: #f3f8fa;
}
.market-section-discover {
  --market-wash: #f2eadc;
  --market-tile: #fcf8ef;
}
.market-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}
.market-section-head h2 {
  margin: 0;
  font-size: 1.2rem;
}
.market-section-head span,
.market-section-empty {
  color: var(--muted);
}
.market-section-empty {
  margin: 0;
}
.marketplace-tile {
  display: flex;
  min-height: 185px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: var(--market-tile);
  box-shadow: 0 8px 24px #173c350a;
  overflow: hidden;
}
.marketplace-tile:hover,
.marketplace-tile:focus-within {
  border-color: #6d927f;
  transform: translateY(-2px);
}
.marketplace-tile-main {
  display: flex;
  flex: 1;
  width: 100%;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 24px;
  border: 0;
  text-align: left;
  color: var(--ink);
  background: transparent;
}
.marketplace-tile-heading {
  font-size: 1.35rem;
  font-weight: 800;
}
.marketplace-tile-owner {
  color: var(--muted);
}
.marketplace-tile-count {
  margin-top: auto;
  font-weight: 700;
}
.marketplace-tile-action {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  margin: 0 24px 20px;
  padding: 8px 11px;
  border: 1px solid #b8c9bc;
  border-radius: 9px;
  color: var(--ink);
  background: #ffffffb8;
  font-weight: 700;
}
.marketplace-tile-action:hover {
  background: #fff;
}
.marketplace-tile-action svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}
.market-dialog {
  width: min(1100px, calc(100vw - 48px));
  height: min(750px, calc(100dvh - 48px));
  max-height: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 24px 80px #102a2640;
}
.market-dialog[open] {
  display: flex;
  flex-direction: column;
}
.market-dialog::backdrop {
  background: #102a2699;
}
.market-dialog-head,
.market-dialog-footer {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
}
.market-dialog-head {
  border-bottom: 1px solid var(--line);
}
.market-dialog-head h2 {
  margin: 0;
  font-size: 1.5rem;
}
.market-dialog-head p {
  margin: 6px 0 0;
  color: var(--muted);
}
.market-close {
  flex: none;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: var(--wash, #edf1eb);
  font-size: 1.5rem;
  cursor: pointer;
}
.market-dialog-body {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  min-height: 0;
  overflow: hidden;
}
.market-card-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 25px 28px;
}
.market-pane-label,
.market-card-side {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.market-card-preview {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  margin-top: 14px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
}
.market-card-content {
  align-self: center;
  flex: 1;
  min-height: 0;
  width: 100%;
  text-align: center;
  overflow-y: auto;
  overflow-wrap: anywhere;
  font-size: 1.35rem;
  line-height: 1.5;
}
.market-card-content img {
  max-width: 100%;
  height: auto;
}
.market-flip-prompt {
  align-self: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.market-side-pane {
  display: grid;
  grid-template-rows: minmax(0, 2fr) minmax(0, 3fr);
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--line);
}
.market-card-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 24px;
}
.market-card-list h3,
.market-definition h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}
.market-card-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.market-card-scroll button {
  display: flex;
  align-items: flex-start;
  width: 100%;
  gap: 12px;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}
.market-card-scroll button.selected,
.market-card-scroll button:hover {
  background: #e8eee7;
}
.market-card-index {
  flex: 0 0 1.25em;
  color: var(--muted);
}
.market-card-title {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.market-definition {
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  border-top: 1px solid var(--line);
}
.market-definition p {
  margin: 0 0 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.market-definition h4 {
  margin: 0 0 8px;
}
.market-dialog-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}
.market-dialog-footer .btn:disabled {
  background: #e4e7e2;
  color: #78847d;
  opacity: 1;
  cursor: not-allowed;
}
.market-copy-step {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  padding: clamp(32px, 5vw, 64px);
}
.market-copy-step h2,
.market-copy-step p,
.market-copy-step form {
  width: min(100%, 520px);
}
.market-copy-step p {
  max-width: 520px;
  line-height: 1.5;
  color: var(--muted);
}
.market-copy-step form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}
.market-copy-step label {
  font-weight: 700;
}
.market-copy-step input {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
}
.market-danger-step h2 {
  color: #934537;
}
.linked-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  background: #e7eee7;
  color: var(--ink);
  font-size: 0.8rem;
}
@media (max-width: 700px) {
  .market-dialog {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }
  .market-dialog-body {
    display: block;
    overflow-y: auto;
  }
  .market-card-preview {
    height: 300px;
    min-height: 0;
  }
  .market-side-pane {
    display: block;
    border-left: 0;
  }
  .market-card-list {
    border-top: 1px solid var(--line);
  }
  .market-card-scroll {
    max-height: 180px;
  }
  .market-definition {
    max-height: none;
  }
  .market-dialog-footer {
    position: sticky;
    bottom: 0;
    background: var(--surface);
  }
  .market-dialog-footer .btn {
    flex: 1;
  }
}
.deck-delete-trigger {
  margin: 22px 0 8px;
}
.btn.deck-delete-trigger {
  color: #9f5146;
  border-color: #c7978e;
}
.btn.deck-delete-trigger:hover {
  background: #f6e8e4;
}
.deck-delete-dialog {
  width: min(440px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 60px #173c3540;
}
.deck-delete-dialog::backdrop {
  background: #102a2699;
}
.deck-delete-dialog h2 {
  font-size: 1.3rem;
  margin: 0 0 10px;
}
.deck-delete-dialog p {
  color: var(--muted);
  line-height: 1.5;
}
.deck-delete-dialog label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  margin: 17px 0 8px;
  overflow-wrap: anywhere;
}
.deck-delete-dialog input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}
.deck-delete-dialog .row {
  margin-top: 22px;
  justify-content: flex-end;
}
.deck-delete-dialog .form-error,
.market-dialog .form-error {
  margin: 10px 0 0;
  color: #934537;
  font-weight: 700;
}
.unpublish-warning {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 50%;
  color: #934537;
  background: #f7e8e1;
  font-weight: 800;
}
@media (max-width: 600px) {
  .marketplace-item {
    align-items: flex-start;
    flex-direction: column;
  }
  .deck-delete-dialog .row {
    flex-wrap: wrap;
  }
  .deck-delete-dialog .btn {
    flex: 1;
  }
}
.deck-details-head {
  margin-bottom: 25px;
}
.deck-details-head h1 {
  font:
    600 clamp(1.8rem, 3vw, 2.4rem) Lato,
    system-ui,
    sans-serif;
  letter-spacing: -0.04em;
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}
.deck-details-wrap .field textarea {
  min-height: 90px;
}
@media (max-width: 700px) {
  .deck-details-head .row {
    align-items: center;
  }
  .deck-details-head .btn {
    padding: 9px 11px;
    font-size: 0.8rem;
  }
}
.grade {
  position: relative;
}
.grade-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  width: 240px;
  max-width: calc(100vw - 32px);
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 24px #173c3533;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: center;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition:
    opacity 0.12s,
    transform 0.12s,
    visibility 0.12s;
  z-index: 10;
}
.grade:hover,
.grade:focus-visible {
  z-index: 11;
}
.grade:hover .grade-tip,
.grade:focus-visible .grade-tip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.development-banner {
  padding: 8px 12px;
  border: 1px solid #bc8d28;
  border-radius: 8px;
  background: #fff5d8;
  color: #664900;
  font-size: 13px;
}

.development-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
#dev-status:empty {
  display: none;
}
@media (max-width: 600px) {
  .development-actions {
    flex-direction: column;
  }
}

/* Deck agent: a single conversation surface, full-page or alongside study. */
.agent-page {
  max-width: 1360px;
  margin: 0 auto;
}
.agent-page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin: 26px 0 28px;
}
.agent-page-heading h1 {
  margin: 8px 0 0;
  font-size: clamp(2rem, 3.5vw, 3.7rem);
  overflow-wrap: anywhere;
}
.agent-page-heading .eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
}
.agent-tabs {
  margin-bottom: 18px;
}
.agent-panel {
  display: flex;
  flex-direction: column;
  height: min(720px, calc(100dvh - 330px));
  min-height: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.agent-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}
.agent-session-picker {
  flex: 1;
  min-width: 0;
}
.agent-session-picker select {
  max-width: 100%;
  width: auto;
  border: 0;
  background-color: transparent;
  padding: 8px 32px 8px 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-overflow: ellipsis;
}
.agent-new,
.agent-expand,
.agent-close {
  width: 36px;
  height: 36px;
  flex: none;
  border: 0;
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.4rem;
}
.agent-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 30px clamp(18px, 4vw, 58px);
  overscroll-behavior: contain;
}
.agent-welcome {
  max-width: 550px;
  margin: 32px auto;
  text-align: center;
}
.agent-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 20px;
  border-radius: 18px;
  background: var(--mint);
}
.agent-mark svg {
  width: 27px;
  height: 27px;
}
.agent-welcome h2 {
  font-size: 1.85rem;
  margin-bottom: 12px;
}
.agent-welcome p {
  color: var(--muted);
  line-height: 1.6;
}
.agent-message {
  max-width: 760px;
  margin: 0 auto 24px;
  line-height: 1.65;
  font-size: 1rem;
}
.agent-message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.agent-message-user {
  margin-left: auto;
  margin-right: 0;
  width: fit-content;
  max-width: 85%;
  background: #eaf0e8;
  padding: 12px 18px;
  border-radius: 18px 18px 4px 18px;
}
.agent-message-assistant {
  width: fit-content;
  max-width: min(100%, 760px);
  margin-left: 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 18px 4px;
  background: var(--paper);
}
.agent-message-error {
  color: #9d4138;
  font-size: 0.9rem;
}
.agent-compose-wrap {
  padding: 14px 24px 22px;
}
.agent-compose {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px;
  border: 1px solid #ccd4cb;
  border-radius: 16px;
  background: var(--surface);
}
.agent-compose:focus-within {
  border-color: #749383;
  box-shadow: 0 0 0 3px #dbeadf66;
}
.agent-compose textarea {
  border: 0;
  outline: none;
  box-shadow: none;
  padding: 4px;
  min-height: 48px;
  max-height: 140px;
  flex: 1;
  min-width: 0;
  resize: vertical;
  background: transparent;
}
.agent-send {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  border: 0;
  font-size: 1.5rem;
}
.agent-context-chips,
.agent-history-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px;
}
.agent-history-chips:empty {
  display: none;
}
.agent-context-chip,
.agent-attach,
.agent-context-snapshot summary {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  background: var(--paper);
  color: var(--muted);
  border: 1px solid #d5ded2;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.75rem;
}
.agent-context-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-context-chip button {
  flex: none;
  background: none;
  border: 0;
  color: inherit;
  padding: 2px 5px;
  font-size: 1rem;
}
.agent-attach {
  border-style: dashed;
  background: transparent;
  min-height: 32px;
}
.agent-context-snapshot {
  max-width: 100%;
  font-size: 0.8rem;
}
.agent-context-snapshot summary {
  cursor: pointer;
  overflow-wrap: anywhere;
}
.agent-context-snapshot[open] {
  width: 100%;
}
.agent-context-snapshot > div {
  padding: 10px 4px;
  overflow-wrap: anywhere;
}
.agent-context-snapshot p {
  white-space: pre-wrap;
  margin: 0 0 8px;
}
.agent-suggestion {
  display: block;
  margin-top: 10px;
  padding: 7px 11px;
  border: 1px solid #d5ded2;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 0.8rem;
}
.agent-suggestion:hover,
.agent-attach:hover,
.agent-context-snapshot summary:hover {
  background: var(--paper);
  color: var(--ink);
}
.agent-proposal-deck {
  padding: 10px 18px 0;
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}
.agent-proposal {
  margin-top: 18px;
  border: 1px solid #d5ded2;
  border-radius: 16px;
  overflow: hidden;
  background: #f8f9f4;
}
.agent-proposal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid #d5ded2;
}
.agent-proposal-head > span {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: capitalize;
}
.agent-proposal-definition,
.agent-edit {
  padding: 18px 20px 0;
}
.agent-proposal h4 {
  margin: 0 0 5px;
  font-size: 0.8rem;
  color: var(--muted);
}
.agent-proposal p {
  margin-bottom: 16px;
  font-size: 0.92rem;
}
.agent-edit {
  overflow-wrap: anywhere;
}
.agent-edit del {
  display: block;
  color: #9d4138;
}
.agent-samples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 18px;
}
.agent-sample {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 145px;
  height: 180px;
  overflow: auto;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 16px;
  color: var(--ink);
}
.agent-sample-face {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}
/* Both faces contribute to intrinsic width, even while one is hidden. */
.agent-sample-back,
.agent-sample[data-flipped='true'] .agent-sample-front {
  visibility: hidden;
}
.agent-sample[data-flipped='true'] .agent-sample-back {
  visibility: visible;
}
.agent-sample small {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.agent-sample small span {
  letter-spacing: 0;
}
.agent-sample-text {
  margin: auto 0;
  padding-top: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.agent-proposal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  padding: 0 18px 18px;
}
.agent-proposal-actions .btn {
  padding: 11px 18px;
  font-size: 0.88rem;
  border-radius: 10px;
}
.agent-thinking {
  display: flex;
  gap: 5px;
  padding: 12px 0;
}
.agent-thinking span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: agent-pulse 1.3s infinite;
}
.agent-thinking span:nth-child(2) {
  animation-delay: 0.2s;
}
.agent-thinking span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes agent-pulse {
  50% {
    opacity: 0.25;
    transform: translateY(-3px);
  }
}
.agent-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--ink);
  color: white;
  border: 0;
  padding: 15px 20px;
  border-radius: 28px;
  box-shadow: 0 8px 30px #173c3533;
  z-index: 30;
}
.agent-bubble svg {
  width: 22px;
  height: 22px;
}
.agent-floating {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(440px, calc(100vw - 32px));
  height: min(650px, calc(100dvh - 48px));
  min-height: 0;
  z-index: 35;
  box-shadow: 0 18px 70px #173c3533;
}
.agent-floating .agent-messages {
  padding: 22px;
}
.agent-floating .agent-compose-wrap {
  padding: 12px;
}
.agent-floating .agent-welcome {
  margin: 24px auto;
}
.agent-floating .agent-welcome h2 {
  font-size: 1.5rem;
}
@media (max-width: 700px) {
  .agent-page-heading {
    margin: 20px 0;
    align-items: flex-start;
    gap: 12px;
  }
  .agent-page-heading h1 {
    font-size: 2rem;
  }
  .agent-page-heading .btn {
    padding: 10px;
    font-size: 0.8rem;
  }
  .agent-tabs {
    gap: 6px;
    flex-wrap: wrap;
  }
  .agent-tabs button {
    padding: 10px 12px;
    font-size: 0.8rem;
  }
  .agent-panel {
    height: calc(100dvh - 330px);
    min-height: 390px;
    border-radius: 18px;
  }
  .agent-toolbar {
    padding: 10px 14px;
  }
  .agent-compose-wrap {
    padding: 12px;
  }
  .agent-messages {
    padding: 20px 16px;
  }
  .agent-welcome {
    margin: 18px auto;
  }
  .agent-welcome h2 {
    font-size: 1.45rem;
  }
  .agent-bubble {
    bottom: 88px;
    right: 16px;
    padding: 13px;
  }
  .agent-bubble span {
    display: none;
  }
  .agent-floating {
    bottom: 80px;
    right: 10px;
    width: calc(100vw - 20px);
    height: calc(100dvh - 100px);
    min-height: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .agent-thinking span {
    animation: none;
  }
}

.agent-deck-picker {
  flex: 1;
  min-width: 0;
  max-width: 420px;
  margin-left: auto;
}
.agent-deck-picker select {
  width: 100%;
  text-overflow: ellipsis;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
@media (max-width: 700px) {
  .agent-page-heading {
    flex-wrap: wrap;
  }
  .agent-deck-picker {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }
}

.agent-global .agent-panel {
  height: min(780px, calc(100dvh - 240px));
}
.agent-attach-select {
  max-width: 220px;
  min-height: 32px;
  padding: 4px 24px 4px 8px;
  border: 1px dashed #d5ded2;
  border-radius: 8px;
  background-color: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  text-overflow: ellipsis;
}
