:root {
  color-scheme: light;
  font: 16px/1.56 "Instrument Sans", "Apple SD Gothic Neo", "PingFang SC", system-ui, sans-serif;
  --ink:#352416;
  --muted:#76583c;
  --orange-dark:#823914;
  --accent:#b64614;
  --line:#ebd5b3;
  --paper:#fff5de;
  --surface:#fffdf7;
}
* { box-sizing:border-box }
body { margin:0; color:var(--ink); background:var(--paper); min-height:100vh }
header { background:#ffdf8a; color:var(--ink); border-bottom:1px solid #ecbd61 }
header div,main { max-width:1120px; margin:auto; padding:20px clamp(16px,5vw,46px) }
header div { display:flex; align-items:center; justify-content:space-between; gap:14px }
header strong { font-size:clamp(18px,3vw,24px); font-weight:760 }
main { padding-top:30px; padding-bottom:64px }
button,select,input,textarea { font:inherit }
button,select,.button { border:1px solid var(--line); background:#fff; color:var(--ink); border-radius:10px; padding:8px 13px; cursor:pointer; transition:background .15s,border-color .15s }
button:hover,select:hover,.button:hover { background:#ffe7aa; border-color:#d99d50 }
button:disabled { opacity:.62; cursor:wait }
header button,header select { border-color:var(--line); color:var(--ink); background:#fff0c6 }
header button:hover,header select:hover { background:#ffe7aa; border-color:#d99d50 }
header option { color:var(--ink); background:var(--surface) }
nav,.actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center }
nav button { background:#ffefc5; border-radius:99px; padding:8px 17px }
nav button[aria-pressed=true],form button[type=submit],form button:not([type]) { border-color:var(--accent); background:var(--accent); color:#fff }
h1 { font-size:clamp(2.15rem,5vw,3.5rem); line-height:1.16; letter-spacing:-.052em; margin:30px 0 20px }
h2 { line-height:1.3 }
form { display:flex; gap:8px; margin:16px 0 }
input,textarea { padding:10px 12px; border:1px solid var(--line); border-radius:10px; color:var(--ink); min-width:0 }
form input,textarea { width:100% }
.grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(250px,100%),1fr)); gap:16px }
.card,article,.empty { background:var(--surface); border:1px solid var(--line); border-radius:16px; padding:20px; box-shadow:0 6px 18px #8f4b1410 }
.card { display:grid; border-top:3px solid #f9be55; grid-template-rows:auto auto 1fr; align-content:start; gap:11px }
.card h2 { font-size:19px; margin:0 }
.card button { justify-self:start; align-self:end; background:#ffe9aa; color:var(--orange-dark); font-weight:650 }
.card button:hover { background:#ffdc83 }
small,#status { color:var(--muted) }
.card small { font-weight:650; font-size:.78rem }
.reader { margin-top:18px; overflow-wrap:anywhere }
.body { white-space:pre-wrap }
video,audio,iframe { width:100%; border-radius:10px }
iframe { height:68vh; border:1px solid var(--line) }
video { background:#2a1a0e }
mark { background:#ffd762 }
.button { display:inline-block; text-decoration:none }
dialog { border:1px solid var(--line); border-top:4px solid #ed8a37; border-radius:16px; width:min(480px,90vw); padding:24px; color:var(--ink); box-shadow:0 18px 48px #67340f33 }
dialog form { display:grid }
dialog::backdrop { background:#44200570 }
dialog>button { margin:4px 6px 0 0 }
:focus-visible { outline:3px solid #aa4915; outline-offset:3px }
@media(max-width:520px) {
  header div { gap:8px }
  header button,header select { font-size:.85rem; padding:7px 8px }
  nav button { padding:7px 11px }
  main { padding-top:23px }
}

.custom-compose {
  display:grid;gap:16px;background:var(--surface);border:1px solid var(--line);
  border-radius:16px;padding:clamp(16px,3vw,24px);margin:16px 0 22px;
}
.custom-compose h2 { margin:0;font-size:1.15rem }
.custom-fields { display:grid;grid-template-columns:1fr 1fr;gap:12px }
.custom-fields label { display:grid;gap:5px;font-size:.9rem;font-weight:650;min-width:0 }
.custom-fields label:last-child { grid-column:1/-1 }
.custom-fields textarea { resize:vertical }
.custom-footer { display:flex;flex-wrap:wrap;gap:10px;align-items:center }
.custom-footer button { margin-inline-start:auto;white-space:nowrap }
.custom-file { position:relative;min-width:0;max-width:100% }
.custom-file .button { max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle }
.custom-file-input { position:absolute;inline-size:1px;block-size:1px;opacity:0 }
.custom-file:focus-within .button { outline:3px solid #aa4915;outline-offset:3px }
.card button.custom-delete { background:transparent;color:var(--muted);font-weight:500 }
.card button.custom-delete:hover { background:#ffe7aa }
@media(max-width:520px) { .custom-fields { grid-template-columns:1fr } }

.account-user-row { display:flex; justify-content:space-between; align-items:center; gap:6px; margin:6px 0; }
.account-user-row > span { min-width:0; overflow-wrap:anywhere; }
.account-user-actions { display:flex; gap:4px; flex-shrink:0; }
.account-user-actions button { padding:3px 6px; border-radius:6px; font-size:.72rem; white-space:nowrap; }

.video-frame { position:relative; }
.video-frame video { display:block; }
.video-caption-toggle { position:absolute; bottom:48px; right:8px; z-index:1; padding:4px 9px; background:#222; color:#fff; border-color:#777; }
.video-caption-toggle:hover,.video-caption-toggle[aria-pressed="true"] { background:#fff; color:#222; }
