:root {
  color-scheme: light;
  --ink: #162a24;
  --text: #172e26;
  --muted: #4e635a;
  --page: #f1f6f2;
  --line: #ccd9d0;
  --accent: #246246;
  --highlight: #c1e8be;
  --display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, serif;
  font: 16px/1.6 system-ui, "Microsoft YaHei", sans-serif;
  background: var(--page);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #b26a18; outline-offset: 4px; }
.wrap { width: min(100% - 2rem, 78rem); margin-inline: auto; }
.header { background: var(--ink); color: #f1f7f0; }
.header-inner { min-height: 3.75rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.header h1 { font: 700 clamp(1.125rem, 3vw, 1.5rem)/1.25 var(--display); }
.wordmark { display: inline-flex; align-items: center; gap: .6rem; }
.mark { width: 1.15rem; aspect-ratio: 1; border: 1px solid var(--highlight); border-radius: 50% 50% 50% .2rem; position: relative; }
.mark::after { content: ""; position: absolute; inset: 4px; background: var(--highlight); border-radius: inherit; }

.directory { padding-block: 1rem 2.5rem; }
.index-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.recent-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-bottom: .85rem; }
.recent-tools[hidden] { display: none; }
.recent-tools h2 { font-size: .9rem; color: var(--muted); }
.recent-tools > div { display: flex; flex-wrap: wrap; gap: .4rem; }
.recent-tools button { min-height: 2.75rem; padding: .38rem .65rem; border: 1px solid var(--line); border-radius: .6rem; background: #fff; color: var(--ink); font: inherit; font-size: .875rem; cursor: pointer; }
.recent-tools button:hover { background: #e6efe7; }
.index-tabs button { display: flex; align-items: center; gap: .5rem; min-height: 2.75rem; padding: .45rem .85rem; font: inherit; font-weight: 700; border: 1px solid var(--line); border-radius: .6rem; color: var(--ink); background: #fff; cursor: pointer; }
.index-tabs button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.index-tabs span { min-width: 1.5rem; padding: 0 .3rem; border-radius: .3rem; background: #e6efe7; text-align: center; color: var(--ink); font-size: .8rem; }

.visually-hidden { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; }
@media (min-width: 45rem) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 72rem) {
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.tool { display: grid; min-width: 0; border: 1px solid var(--line); border-radius: .75rem; background: #fff; }
.tool-copy { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; padding: .875rem; }
.tool-heading { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .625rem; }
.tool-heading > .account-badge { margin-inline-start: auto; }
.tool-heading > img, .tool-heading > svg { flex: none; }
.tool-heading img { border-radius: .65rem; object-fit: cover; }
.tool-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  border-radius: .5rem;
  background: #e7eee8;
}
.tool h3 { font: 700 1.25rem/1.25 var(--display); }
.category, .note { color: var(--muted); font-size: .82rem; }
.description { font-size: .94rem; line-height: 1.5; }
.tool-actions { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: .375rem .625rem; }
.tool-actions, .tool-copy > .note, .tool-copy > .button { margin-block-start: auto; }
.tool-actions > .note { flex: 1 1 8rem; }
.tool .button { font-size: .875rem; }
.empty { padding: .8rem 1rem; border: 1px dashed var(--line); border-radius: .65rem; color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; justify-self: start; min-height: 2.75rem; border: 1px solid var(--accent); border-radius: .55rem; padding: .45rem .8rem; background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.button:hover { background: #194b33; }
.header-account { display: flex; align-items: center; gap: .42rem; border: 1px solid #7b9a88; color: inherit; background: transparent; border-radius: .55rem; min-height: 2.75rem; padding-inline: .65rem; font: inherit; cursor: pointer; }
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
#admin-entry { display: flex; align-items: center; gap: .4rem; }
.header-role { color: #d8f0e4; padding: .2rem .45rem; border-radius: .35rem; background: #285247; font-size: .875rem; font-weight: 650; white-space: nowrap; }
.member-account { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
@media (max-width: 44.99rem) {
  .wrap { width: calc(100% - 1.5rem); }
  .header-inner { flex-wrap: wrap; gap: .25rem .5rem; padding-block: .5rem; }
  .wordmark { gap: .5rem; white-space: nowrap; }
  .header-account { gap: .35rem; padding-inline: .5rem; font-size: .875rem; white-space: nowrap; }
  .header-actions { margin-inline-start: auto; gap: .375rem; }
  #admin-entry .header-role { display: none; }
  .directory { padding-block-start: .75rem; }
  .index-tabs { margin-bottom: .75rem; }
  .index-tabs button { flex: 1; justify-content: center; }
  .recent-tools { display: grid; gap: .125rem; margin-bottom: .75rem; }
  .recent-tools > div { flex-wrap: nowrap; overflow-x: auto; padding-block: .25rem; }
  .recent-tools button { flex: none; white-space: nowrap; }
  .recent-tools button:focus-visible { outline-offset: -3px; }
}
@media (max-width: 23rem) {
  .header-inner { column-gap: .375rem; }
  .header-actions .header-account { gap: .25rem; padding-inline: .375rem; }
}
.account-badge { border: 0; border-radius: .45rem; padding: .18rem .42rem; background: #eaf0ea; color: #4a6155; font-size: .75rem; font-weight: 650; line-height: 1.45; white-space: nowrap; }
.account-badge[data-active] { background: #d6efda; color: #20543d; }
.tool-account { min-height: 2.75rem; padding-inline: .55rem; font-family: inherit; cursor: pointer; }
.member-dialog { width: min(100% - 1.75rem, 26rem); max-height: calc(100dvh - 1.75rem); padding: clamp(1.1rem, 5vw, 1.8rem); border: 1px solid var(--line); border-radius: 1.15rem; color: var(--text); overflow-wrap: anywhere; }
.member-dialog::backdrop { background: #0b2118a8; }
.member-dialog h2 { font-size: 1.5rem; line-height: 1.25; }
.member-header, .member-actions { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.member-header { align-items: flex-start; margin-bottom: .85rem; }
.member-mark { display: grid; place-items: center; width: 2.65rem; height: 2.65rem; border-radius: .75rem; background: var(--accent); }
.member-description { margin-block: .65rem 1rem; color: var(--muted); font-size: .9rem; }
.close-dialog, .text-button { border: 0; min-height: 2.75rem; padding: .4rem .55rem; color: var(--accent); background: transparent; font: inherit; cursor: pointer; }
.close-dialog { font-size: 1.5rem; }
.member-dialog label { display: block; margin-top: .7rem; }
.member-dialog input { display: block; width: 100%; min-height: 2.9rem; padding: .4rem .65rem; margin: .3rem 0 .6rem; border: 1px solid var(--line); border-radius: .55rem; font: inherit; }
.member-dialog .member-otp { font-variant-numeric: tabular-nums; font-size: 1.35rem; letter-spacing: .26em; }
.member-submit { width: 100%; margin-top: .25rem; }
.member-actions { margin-top: .5rem; }
.member-tool { margin-block: .75rem .35rem; padding: .75rem; border: 1px solid var(--line); border-radius: .65rem; }
#index-membership { margin-block: .3rem .5rem; }
#member-status:empty { display: none; }
#member-status { margin-top: .65rem; }
#member-status[data-error] { color: #9b3228; }
.member-dialog :disabled { opacity: .65; cursor: wait; }
