:root { --ink:#22201c; --paper:#faf7f1; --accent:#5b4a2f; --line:#ddd3c2; }
* { box-sizing: border-box; }
body { margin:0; font-family: Georgia, 'Times New Roman', serif; background: var(--paper); color: var(--ink); }
.card { max-width: 380px; margin: 12vh auto; background:#fff; border:1px solid var(--line); border-radius:10px; padding:28px; }
.card h1 { margin:0 0 4px; font-size:24px; }
.sub { color:#6b6252; margin:0 0 18px; }
label { display:block; margin:10px 0; font-size:14px; }
input, textarea { width:100%; font: inherit; padding:8px; border:1px solid var(--line); border-radius:6px; background:#fff; }
button { font: inherit; background: var(--accent); color:#fff; border:0; border-radius:6px; padding:8px 14px; cursor:pointer; }
button.quiet { background:transparent; color:var(--accent); border:1px solid var(--line); }
button.danger { color:#8a2f23; }
.error { color:#8a2f23; min-height:1em; font-size:14px; }
header { display:flex; justify-content:space-between; align-items:center; padding:12px 18px; border-bottom:1px solid var(--line); background:#fff; }
.brand { font-size:19px; font-weight:bold; }
.navbtn { background:transparent; color:var(--accent); border:1px solid transparent; }
.navbtn.active { border-color:var(--line); background:var(--paper); }
#tellView { display:flex; min-height: calc(100vh - 53px); }
aside { width:250px; border-right:1px solid var(--line); padding:14px; background:#fff; }
.asidehead { display:flex; justify-content:space-between; align-items:center; font-weight:bold; margin-bottom:8px; }
.asidehead button { padding:4px 10px; font-size:13px; }
#memoryList { list-style:none; margin:0; padding:0; }
#memoryList li { padding:8px 10px; border-radius:6px; cursor:pointer; }
#memoryList li.sel { background:var(--paper); border:1px solid var(--line); }
#memoryList .meta { display:block; font-size:12px; color:#6b6252; }
main { flex:1; padding:20px 26px; max-width:860px; }
.titleRow { display:flex; gap:8px; align-items:center; }
.titleRow h2 { margin:0; flex:1; }
h3 { color:var(--accent); margin:22px 0 8px; font-size:15px; text-transform:uppercase; letter-spacing:.06em; }
.refined { background:#fff; border:1px solid var(--line); border-radius:8px; padding:16px 18px; white-space:pre-wrap; line-height:1.55; }
.refined.none { color:#6b6252; font-style:italic; }
details { margin-top:10px; }
details textarea { margin-top:8px; }
.pieces { padding-left:22px; }
.pieces li { margin:0 0 10px; line-height:1.5; }
.pieces .pt { display:block; font-size:12px; color:#6b6252; }
.pieces .corr { font-style:italic; }
.tellbox { margin-top:18px; border-top:1px solid var(--line); padding-top:14px; }
.tellrow { display:flex; justify-content:space-between; align-items:center; margin-top:8px; }
.check { display:flex; gap:6px; align-items:center; font-size:14px; margin:0; }
.check input { width:auto; }
#bookMain .entry { margin-bottom:38px; }
#bookMain .entry .pieces { color:#3c382f; }
.empty { color:#6b6252; }
@media (max-width: 720px) { #tellView { flex-direction:column; } aside { width:auto; border-right:0; border-bottom:1px solid var(--line); } }

/* V2: views, desk, marks */
.cols { display:flex; min-height: calc(100vh - 53px); }
.wide { max-width: 860px; margin: 0 auto; }
.pick li .meta a { color: var(--accent); }
.hint { color:#6b6252; font-size:13px; }
.pieces li.piece { cursor: pointer; }
.pieces li.selp { outline: 2px solid var(--accent); border-radius: 6px; padding: 4px 6px; }
.pieces audio { display:block; margin:6px 0; max-width:100%; }
.meta .tag, .meta .mark { display:inline-block; font-size:11px; padding:1px 7px; border-radius:99px; background:#efe8da; color:var(--accent); margin-right:4px; font-family: -apple-system, sans-serif; }
.meta .mark { background:#5b4a2f; color:#fff; font-weight:700; letter-spacing:.04em; }
.meta .seal { background:#8a2f23; color:#fff; }
.chain { display:block; font-size:13px; color:#6b6252; font-style:italic; margin-top:2px; }
.deskcard { border:2px solid var(--accent); border-radius:10px; padding:14px 16px; background:#fff; margin:14px 0; }
.deskhead { display:flex; gap:10px; align-items:baseline; margin-bottom:8px; }
.deskhead strong { font-size:16px; } .deskhead .hint { flex:1; }
.drow { display:flex; gap:10px; align-items:center; margin:7px 0; font-size:14px; }
.drow > span { width:170px; flex:none; color:var(--accent); }
.drow input, .drow select { flex:1; }
fieldset { border:1px solid var(--line); border-radius:8px; margin:12px 0; }
legend { font-size:13px; color:var(--accent); text-transform:uppercase; letter-spacing:.05em; }
.row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin:8px 0; }
.row input { flex:1; }
button.on { background: var(--accent); color:#fff; }
.upload { display:inline-block; padding:8px 14px; border:1px solid var(--line); border-radius:6px; cursor:pointer; color:var(--accent); font-size:14px; }
.plain { list-style:none; padding:0; } .plain li { padding:9px 0; border-bottom:1px solid var(--line); }
.plain .pt, .pieces .pt { display:block; }
.grid2 { display:flex; gap:12px; } .grid2 label { flex:1; }
.subst { background:#fdf0d5; padding:0 3px; border-radius:3px; }
.profile-large { font-size: 19.5px; line-height: 1.75; }
.profile-large .refined, .profile-large .pieces li { text-align: left; }
.profile-listening .pieces li { background:#fff; border:1px solid var(--line); border-radius:8px; padding:10px 12px; margin-bottom:8px; }
.answrap { display:block; margin-top:8px; } .answrap textarea { margin-top:6px; }
@media print { header, aside, .tellbox, #desk, details, button, .row, h3, .hint { display:none !important; } body { background:#fff; } }

/* V2.1: phone layout — the telling happens where life does */
@media (max-width: 760px) {
  .cols { flex-direction: column; }
  aside { width: auto; border-right: none; border-bottom: 1px solid var(--line); }
  header { flex-wrap: wrap; gap: 8px; }
  nav { flex-wrap: wrap; }
  .drow { flex-direction: column; align-items: stretch; gap: 3px; }
  .drow > span { width: auto; }
  .grid2 { flex-direction: column; }
  .titleRow { flex-wrap: wrap; }
  main { padding: 14px; }
}

.pieceimg { display:block; max-width:100%; height:auto; border-radius:6px; margin:6px 0; border:1px solid var(--line); }
.thumb { width:64px; height:64px; object-fit:cover; border-radius:6px; border:1px solid var(--line); }
.langcap { font-family:-apple-system, sans-serif; font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:var(--accent); margin:14px 0 4px; }

/* Print, with care (APH practice for the large-print edition): real point sizes, generous
   margins, left-aligned ragged right, nothing broken mid-piece, no widowed headings. */
@media print {
  @page { size: Letter; margin: 0.85in 0.8in; }
  body { font-size: 12pt; line-height: 1.5; color: #000; }
  .entry h2 { page-break-after: avoid; }
  .pieces li { page-break-inside: avoid; }
  .refined p { orphans: 3; widows: 3; }
  .profile-large { font-size: 18pt; line-height: 1.6; text-align: left; }
  .profile-large .refined, .profile-large .pieces li, .profile-large h2 { text-align: left; }
  .profile-large h2 { font-size: 22pt; }
  .profile-listening .pieces li { border: none; padding: 0; }
  audio { display: none; }
}
