:root {
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
  color:#17382e;
  background:#f3f6f3;
  color-scheme:light;
  --ink:#17382e;
  --muted:#527064;
  --line:#d7e4db;
  --green:#164936;
  --lime:#d2ed9a;
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
  line-height:1.5;
  min-width:0;
}

body:has(dialog[open]) {
  overflow:hidden;
}

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

button,a,input,select,textarea {
  touch-action:manipulation;
}

button,a {
  cursor:pointer;
}

a {
  color:var(--green);
}

button {
  color:inherit;
}

button:disabled {
  opacity:.62;
  cursor:wait;
}

button:focus-visible,a:focus-visible,select:focus-visible,input:focus-visible,textarea:focus-visible {
  outline:3px solid #63892e;
  outline-offset:3px;
}

button {
  min-height:44px;
}

p {
  margin:.25rem 0 .8rem;
}

h1,h2,h3 {
  margin:0;
  line-height:1.2;
  overflow-wrap:anywhere;
}

h1 {
  font-size:clamp(1.8rem,4vw,2.7rem);
  letter-spacing:-.04em;
}

h2 {
  font-size:1.35rem;
  letter-spacing:-.025em;
}

h3 {
  font-size:1.08rem;
}

small {
  font-size:.86rem;
}

button {
  border:0;
}

button,a,section,article,form,.row>* {
  min-width:0;
}

[hidden] {
  display:none!important;
}

.site-header {
  border-bottom:1px solid var(--line);
  background:#fff;
}

.header-inner {
  max-width:1000px;
  margin:auto;
  padding:12px 22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.8rem;
}

.brand {
  font-size:1.65rem;
  font-weight:800;
  letter-spacing:-1px;
  text-decoration:none;
}

.brand i {
  font-style:normal;
  color:#72a33a;
}

.languages {
  display:flex;
  padding:3px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
}

.languages button {
  min-width:44px;
  background:transparent;
  border-radius:8px;
  font-size:.875rem;
  font-weight:700;
}

.languages button[aria-pressed=true] {
  background:var(--green);
  color:white;
}

main {
  max-width:1000px;
  margin:auto;
  padding:24px 22px calc(100px + env(safe-area-inset-bottom));
  overflow-wrap:anywhere;
}

main:focus {
  outline:none;
}

.panel,.group-card,.empty {
  background:#fff;
  padding:clamp(17px,3vw,25px);
  border:1px solid var(--line);
  border-radius:19px;
  margin-bottom:16px;
}

.group-card {
  padding:20px;
}

.page-heading,.row,.group-card header,.modal-head,.split-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.page-heading {
  margin:10px 0 18px;
}

.group-card header {
  align-items:flex-start;
}

.muted,.help,.group-card .meta {
  color:var(--muted);
  font-size:.94rem;
}

.primary,.secondary,.quiet,.danger,.chip-link,.button-link {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  padding:10px 16px;
  border-radius:11px;
  font-weight:650;
  line-height:1.3;
  overflow-wrap:anywhere;
  text-align:center;
}

.primary {
  background:#164936;
  color:#fff;
}

.secondary,.button-link,.chip-link {
  border:1px solid #bed1c5;
  background:#fff;
  color:var(--ink);
  text-decoration:none;
}

.quiet {
  background:#eef3ee;
  color:#315c45;
}

.danger {
  background:#fff1ee;
  border:1px solid #f0c2b9;
  color:#97321f;
}

.actions {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:9px;
  margin-top:14px;
}

.actions>* {
  max-width:100%;
}

.tag {
  display:inline-block;
  background:#eaf2de;
  color:#36552c;
  font-size:.82rem;
  font-weight:650;
  border-radius:99px;
  padding:4px 10px;
}

.picker {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr));
  gap:10px;
  margin:14px 0;
}

.picker button {
  background:#eff5ed;
  border:1px solid #c7d8c6;
  text-align:start;
  border-radius:12px;
  padding:15px 13px;
  min-height:54px;
  font-weight:650;
}

.tabs {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  padding:5px;
  background:#e2eae2;
  border-radius:13px;
  width:fit-content;
  max-width:100%;
  margin:18px 0;
}

.tabs button {
  border-radius:9px;
  background:transparent;
  padding:9px 12px;
  font-weight:650;
}

.tabs button[aria-pressed=true] {
  color:#193c29;
  background:#fff;
  box-shadow:0 1px 4px #17382e14;
}

.stack {
  display:grid;
  gap:12px;
}

.field,label.field {
  display:grid;
  gap:6px;
  margin:12px 0;
  font-weight:600;
}

.field input,.field textarea,.field select,form input:not([type=checkbox]),form select,form textarea,.round-select {
  width:100%;
  min-width:0;
  min-height:44px;
  padding:10px 12px;
  border:1px solid #b8ccbe;
  background:#fff;
  color:var(--ink);
  border-radius:10px;
  font-size:1rem;
}

input[type=checkbox] {
  accent-color:var(--green);
}

textarea {
  resize:vertical;
}

.error {
  color:#8e311d;
}

.notice {
  color:#436447;
  background:#eef5ec;
  border:1px solid #d2e2d2;
  padding:12px 14px;
  border-radius:12px;
}

.pending {
  padding:24px;
}

.detail-head {
  background:#164635;
  color:#fff;
  border-radius:22px;
  padding:clamp(20px,4.5vw,40px);
  margin-bottom:16px;
}

.detail-head .tag {
  background:#d4eaad;
  color:#254325;
}

.detail-head .title {
  margin:12px 0;
}

.description {
  white-space:pre-line;
  color:#e0eee1;
}

.hero-stats {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  max-width:600px;
  margin:22px 0 7px;
}

.hero-stats strong {
  display:block;
  font-weight:700;
  font-size:clamp(1.2rem,3vw,1.65rem);
}

.hero-stats small {
  color:#d6e7db;
}

.bar {
  background:#315c4b;
  height:8px;
  width:100%;
  border-radius:8px;
  overflow:hidden;
  margin:12px 0;
}

.bar>span {
  background:#cce799;
  display:block;
  height:100%;
  transition:width .2s;
}

.detail-head .meta {
  font-size:.9rem;
  color:#e3ece4;
}

.detail-head .actions>.primary {
  color:#1b3c28;
  background:var(--lime);
}

.detail-head .actions>.secondary {
  color:white;
  background:#ffffff10;
  border-color:#ffffff55;
}

.detail-utilities {
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  margin:10px 0 15px;
}

.detail-utilities button {
  font-size:.9rem;
  padding:7px 11px;
}

.round-label {
  display:flex;
  align-items:center;
  gap:8px;
  font-size:.88rem;
}

.round-select {
  width:auto;
}

.legend {
  display:flex;
  flex-wrap:wrap;
  gap:8px 16px;
  font-size:.86rem;
  color:#416352;
  margin:14px 0;
}

.legend span:before {
  content:'';
  display:inline-block;
  width:.65em;
  height:.65em;
  margin-right:.4em;
  border-radius:50%;
  border:1px solid #adbfab;
  background:#f1f6ef;
}

.legend .reading:before {
  background:#eaf0bc;
}

.legend .read:before {
  background:#245743;
}

.parts {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,85px),1fr));
  gap:8px;
}

.part {
  position:relative;
  min-height:76px;
  padding:9px 5px;
  border-radius:12px;
  border:1px solid #dae6d9;
  background:#f4f7f2;
  min-width:0;
  color:#28503d;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
  overflow-wrap:anywhere;
}

.part span,.part b {
  width:100%;
  white-space:normal;
}

.part b {
  font-size:1rem;
  line-height:1.28;
}

.part small,.part span {
  font-size:.81rem;
  line-height:1.25;
}

.part.reading {
  background:#eff3cc;
  border-color:#c7d68c;
}

.part.read {
  background:#22533e;
  color:white;
  border-color:#22533e;
}

.part.mine {
  box-shadow:inset 0 0 0 2px #718e3e;
}

.part:focus-visible {
  outline-offset:1px;
}

.pagination {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  margin-top:16px;
}

.pagination span {
  font-size:.9rem;
}

.empty {
  border-style:dashed;
}

.bottom-nav {
  position:fixed;
  z-index:3;
  inset:auto 0 0;
  display:flex;
  justify-content:center;
  gap:clamp(0px,8vw,80px);
  padding:7px 10px max(7px,env(safe-area-inset-bottom));
  min-height:60px;
  background:#fffffff5;
  backdrop-filter:blur(12px);
  border-top:1px solid var(--line);
}

.bottom-nav a {
  flex:0 1 130px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  min-height:44px;
  font-size:.82rem;
  color:#536b5a;
  gap:2px;
  text-align:center;
}

.bottom-nav a strong {
  font-size:1.15rem;
  height:22px;
  line-height:20px;
}

.bottom-nav a[aria-current=page] {
  color:var(--green);
  font-weight:750;
}

.bottom-nav .nav-icon {
  width:21px;
  height:21px;
  stroke:currentColor;
  fill:none;
  stroke-width:1.65;
}

dialog {
  width:min(calc(100% - 28px),480px);
  border:0;
  border-radius:22px;
  padding:22px;
  color:var(--ink);
  background:#fff;
  max-height:calc(100dvh - 36px);
  overflow:auto;
}

dialog::backdrop {
  background:#09271d88;
  backdrop-filter:blur(4px);
}

.modal-head {
  margin-bottom:12px;
  flex-wrap:nowrap;
}

.modal-head h2 {
  flex:1;
}

.icon-close {
  flex:0 0 44px;
  width:44px;
  border-radius:50%;
  background:#eef3ed;
  font-size:1.5rem;
}

.share-options {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
}

.detail-head .actions button,.split-heading .quiet {
  font-size:.88rem;
}

.error:empty {
  display:none;
}

#toast {
  position:fixed;
  bottom:calc(75px + env(safe-area-inset-bottom));
  left:50%;
  transform:translateX(-50%);
  z-index:9;
  background:#153b2f;
  color:white;
  padding:12px 18px;
  border-radius:12px;
  max-width:calc(100% - 24px);
  width:max-content;
  overflow-wrap:anywhere;
}

.round-select:focus {
  outline-color:var(--green);
}

@media(max-width:600px) {
  .header-inner {
    padding:9px 16px;
  }
  main {
    padding:16px 13px calc(95px + env(safe-area-inset-bottom));
  }
  .panel,.group-card {
    border-radius:16px;
  }
  .parts {
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
  .detail-head {
    border-radius:18px;
  }
  .bottom-nav {
    gap:2px;
  }
  .bottom-nav a {
    flex:1;
  }
  .group-card header {
    gap:7px;
  }
  .detail-head .actions {
    gap:6px;
  }
  .tabs button {
    font-size:.9rem;
  }
  .hero-stats {
    gap:6px;
  }
  dialog {
    padding:18px;
  }
  .hero-stats small {
    font-size:.82rem;
  }
}

@media(prefers-reduced-motion:reduce) {
  * {
    transition:none!important;
  }
}

@media print {
  .site-header,.bottom-nav,#toast {
    display:none;
  }
}

.permission {
  display:flex;
  align-items:flex-start;
  gap:.7rem;
  margin:1.1rem 0 .6rem;
  max-width:58ch;
}

.permission input {
  flex:none;
  width:1.2rem;
  height:1.2rem;
  margin-top:.2rem;
}

.text-link {
  display:inline-block;
  padding:6px 0;
}

.actions a.quiet {
  text-decoration:none;
}

.mobile-share {
  display:none;
}

@media(max-width:600px) {
  main:has(.mobile-share) {
    padding-bottom:calc(149px + env(safe-area-inset-bottom));
  }
  .detail-head .share-bar {
    display:none;
  }
  .mobile-share {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    position:fixed;
    z-index:3;
    inset:auto 0 calc(59px + env(safe-area-inset-bottom));
    background:#f3f6f3f5;
    border-top:1px solid var(--line);
    margin:0;
    padding:8px 13px;
    gap:8px;
    backdrop-filter:blur(10px);
  }
}

@media print {
  .mobile-share {
    display:none!important;
  }
}


.detail-utilities a.quiet {
  text-decoration:none;
  font-size:.9rem;
  padding:7px 11px;
}

.reading-history {
  margin-block: 1rem;
}
.history-heading {
  display: flex;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
}
.history-count {
  background: var(--green);
  color: #fff;
  border-radius: 1rem;
  padding: .12rem .7rem;
  font-variant-numeric: tabular-nums;
}
.reading-history summary {
  cursor: pointer;
  color: var(--green);
  font-weight: 650;
  padding: .6rem 0;
}
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.history-list li {
  border-top: 1px solid var(--line);
  padding: .65rem 0;
  overflow-wrap: anywhere;
}
.history-list p { margin: .2rem 0 0; }
