/* ==========================================================================
   pale chestnut: an early-2000s fansite / imageboard skin
   no rounded corners, no gradients. flat colours, 1px borders, pixel fonts.
   cream text on dusty-chestnut panels over a pink sky (vndb-style).
   ========================================================================== */

:root {
  --bg: #d8a898;            /* pink evening sky */
  --bg-dot: #cd9a89;
  --bg-ink: #4e2618;        /* text sitting straight on the sky (footer) */
  --main-bg: rgba(156, 101, 80, .84);  /* the content column: a see-through panel */
  --tint: rgba(255, 232, 210, .08);    /* a lighter layer inside it (replies, tabs) */
  --paper: #9c6550;         /* dusty chestnut panel */
  --post: #a7705a;
  --post-line: #c4917a;
  --head: #82503c;          /* darker header bars */
  --head-ink: #fbecd2;
  --line: #deb08c;
  --ink: #fbecd2;           /* cream */
  --muted: #ebc8ab;
  --link: #f8cb8a;          /* gold-peach */
  --link-hover: #fff3dc;
  --visited: #f0b6a0;
  --accent: #f2a291;        /* salmon: markers, admin links, NEW */
  --badge-ink: #3c2016;
  --quote: #cfe39a;         /* greentext, lightened for the dark panels */
  --name: #bfe8a2;
  --subject: #ffdca4;
  --star-on: #ffd27a;
  --star-off: #c4917a;
  --ok: #cfe39a;
  --wait: #ffd27a;
  --danger: #ffb4a4;

  /* header frame, counter, form controls */
  --frame: #3c2016;
  --frame-line: #deb08c;
  --night: #2c1d33;
  --glow: #e88aa0;
  --sub-ink: #fbe3e4;
  --hi-ink: #f8cb8a;        /* admin links on dark backgrounds */
  --bar-ink: #fbecd2;
  --odo-bg: #1d1310;
  --odo-edge: #5a4038;
  --odo-digit: #0f0a08;
  --odo-ink: #f6e7c8;
  --odo-top: #3b2a24;
  --odo-last: #8a4a1c;
  --field: #82503c;
  --field-line: #deb08c;
  --field-dark: #5e3424;
  --btn: #82503c;
  --btn-hi: #b9826a;
  --btn-off: #c4a090;
  --star-edge: #4e2618;
  --dots: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' shape-rendering='crispEdges'%3E%3Crect x='1' y='1' width='1' height='1' fill='%23cd9a89'/%3E%3Crect x='5' y='5' width='1' height='1' fill='%23cd9a89'/%3E%3C/svg%3E");
  --sky: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='64' shape-rendering='crispEdges'%3E%3Crect x='7' y='9' width='1' height='1' fill='%23fff'/%3E%3Crect x='31' y='41' width='1' height='1' fill='%23ddadaf'/%3E%3Crect x='52' y='14' width='2' height='2' fill='%23fff'/%3E%3Crect x='70' y='50' width='1' height='1' fill='%23fff'/%3E%3Crect x='83' y='25' width='1' height='1' fill='%23f6e7c8'/%3E%3Crect x='18' y='56' width='1' height='1' fill='%23fff'/%3E%3Crect x='44' y='30' width='1' height='1' fill='%23a98bbd'/%3E%3Crect x='90' y='6' width='1' height='1' fill='%23ddadaf'/%3E%3Crect x='62' y='3' width='1' height='1' fill='%23a98bbd'/%3E%3C/svg%3E");

  --pix: "DotGothic16", "MS Gothic", "ＭＳ ゴシック", "Osaka-Mono", monospace;
  --body: Tahoma, Verdana, "MS PGothic", "ＭＳ Ｐゴシック", "Hiragino Kaku Gothic Pro", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--bg);
  /* tiny pixel dots, like an old tiled background */
  background-image: var(--dots);
  font: 13px/1.55 var(--body);
}

a { color: var(--link); }
a:visited { color: var(--visited); }
a:hover { color: var(--link-hover); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px dotted var(--head-ink);
  outline-offset: 1px;
}

img { max-width: 100%; height: auto; }
code { font-family: var(--pix); background: var(--post); padding: 0 3px; border: 1px solid var(--post-line); }
.jp { font-family: var(--pix); }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.break { overflow-wrap: anywhere; }
[hidden] { display: none !important; }

.page { max-width: 1120px; margin: 0 auto; padding: 10px 12px 24px; }

/* ---------- admin bar ---------- */
.adminbar {
  display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center;
  padding: 3px 12px; background: var(--frame); color: var(--bar-ink); font-size: 12px;
}
.adminbar a, .adminbar a:visited, .adminbar .linkbtn { color: var(--hi-ink); }
.adminbar a.hot { background: var(--accent); color: var(--badge-ink); padding: 0 4px; font-weight: bold; }

/* ---------- banner ---------- */
.skip { display: none; }
/* a framed picture with the title over it, like an old fansite header */
.banner {
  padding: 4px;
  background: var(--frame);
  border: 2px solid var(--frame);
  box-shadow: 3px 3px 0 var(--bg-dot);
}
.banner-in {
  position: relative; overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "time time" ". ." "title count";
  min-height: 200px;
  padding: 8px 12px 10px;
  border: 1px solid var(--frame-line);
  color: #fff;
}
/* no picture chosen yet: a pixel night sky (svg tile, flat colours) */
.banner-in.no-img {
  background-color: var(--night);
  background-image: var(--sky);
}
.banner-img {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; max-width: none;
  object-fit: cover; object-position: center;
}
/* picture focus: which slice shows (0 = top edge, 100 = bottom edge) */
.banner-img.bf-0 { object-position: 50% 0%; }
.banner-img.bf-10 { object-position: 50% 10%; }
.banner-img.bf-20 { object-position: 50% 20%; }
.banner-img.bf-30 { object-position: 50% 30%; }
.banner-img.bf-40 { object-position: 50% 40%; }
.banner-img.bf-50 { object-position: 50% 50%; }
.banner-img.bf-60 { object-position: 50% 60%; }
.banner-img.bf-70 { object-position: 50% 70%; }
.banner-img.bf-80 { object-position: 50% 80%; }
.banner-img.bf-90 { object-position: 50% 90%; }
.banner-img.bf-100 { object-position: 50% 100%; }
/* banner height (taller shows more of the picture) */
.banner-in.bh-medium { min-height: 260px; }
.banner-in.bh-tall { min-height: 320px; }
.banner-in > :not(.banner-img) { position: relative; z-index: 1; }

/* white text with a hard 1px outline so it reads on any picture */
.banner-in {
  --outline: 1px 1px 0 var(--frame), -1px -1px 0 var(--frame), 1px -1px 0 var(--frame), -1px 1px 0 var(--frame);
}
.banner-time {
  grid-area: time; justify-self: end; margin: 0;
  font: 16px/1.2 var(--pix); text-shadow: var(--outline); letter-spacing: 1px;
}
.banner-time .adm { margin-left: 10px; color: var(--hi-ink); text-shadow: var(--outline); }
.banner-title { grid-area: title; align-self: end; min-width: 0; }
.banner-sub { margin: 0 0 0 2px; font: 15px/1.2 var(--pix); color: var(--sub-ink); text-shadow: var(--outline); letter-spacing: 2px; }
.site-name, .site-name:visited {
  display: inline-block;
  font: 34px/1.15 var(--pix); color: #fff; text-decoration: none; letter-spacing: 2px;
  text-shadow: var(--outline), 0 0 10px var(--glow), 0 0 2px var(--glow);
  overflow-wrap: anywhere;
}
.site-name:hover { color: var(--sub-ink); }
.banner-tag {
  margin: 2px 0 0 4px;
  font: italic bold 15px/1.3 Georgia, "Times New Roman", serif;
  text-shadow: var(--outline), 2px 2px 3px #000;
}
.banner-count { grid-area: count; align-self: end; justify-self: end; text-align: right; margin-left: 12px; }
.banner-count span { display: block; font: 13px/1.4 var(--pix); text-shadow: var(--outline); }

/* ---------- ticker ---------- */
.ticker {
  display: flex; align-items: stretch; margin: 8px 0 10px;
  background: var(--paper); border: 1px solid var(--line);
}
.ticker-view { flex: 1; min-width: 0; overflow: hidden; padding: 2px 0; }
.ticker-track {
  display: inline-block; white-space: nowrap; padding-left: 100%;
  animation: tick 40s linear infinite;
}
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
.tk-note { color: var(--accent); }
.tsep { color: var(--accent); margin: 0 14px; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; padding-left: 8px; white-space: normal; }
}

/* ---------- layout: content right, menu left; on phones the menu goes below ---------- */
.wrap {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 200px;
  grid-template-areas: "side main log";
  gap: 10px; align-items: start;
}
main {
  grid-area: main; min-width: 0; overflow-wrap: anywhere;
  background: var(--main-bg); border: 1px solid var(--line); padding: 8px;
}
/* inside the see-through column, panels don't repaint the colour (so it stays see-through) */
main .box, main .panel, main .op, main .greet, main .empty, main .prevnext, main .shelf-filters,
main .qa .a, main .owner-note, main table.list, main .tabs b { background: transparent; }
main .post:not(.op), main .tabs a, main .thumb-none, main .pending { background: var(--tint); }
.side { grid-area: side; min-width: 0; }
.side-r { grid-area: log; min-width: 0; overflow-wrap: anywhere; }
.log .changelog { max-height: 420px; padding: 4px 8px; font-size: 12px; }
.log .changelog time { display: block; font-size: 11px; }
.lastup { margin: 0; font-size: 11px; color: var(--bg-ink); text-align: center; }

/* ---------- boxes ---------- */
.box, .panel { background: var(--paper); border: 1px solid var(--line); margin: 0 0 10px; }
.panel { padding: 10px 12px; }
.box-h {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  margin: 0; padding: 2px 8px;
  background: var(--head); color: var(--head-ink);
  border-bottom: 1px solid var(--line);
  font: 14px/1.5 var(--pix);
}
.box-tools { font: 12px var(--body); }
.box-b { padding: 8px 10px; }
.box-b > :first-child { margin-top: 0; }
.box-b > :last-child { margin-bottom: 0; }
.adminbox { border-color: var(--head-ink); border-style: dashed; }
.okbox { border-color: var(--ok); }
.okbox .box-h { background: #cfe0b8; color: #2e4a18; border-color: var(--ok); }

.pagehead { margin: 0 0 10px; padding: 0 0 6px; border-bottom: 1px dashed var(--line); }
.pagehead h1 { margin: 0; font: 22px/1.3 var(--pix); font-weight: normal; color: var(--head-ink); }
.pagehead p { margin: 2px 0 0; color: var(--muted); }

.form-h { font: 15px/1.4 var(--pix); color: var(--head-ink); margin: 14px 0 6px; padding-bottom: 2px; border-bottom: 1px dotted var(--line); }
.form-h:first-of-type { margin-top: 0; }

/* ---------- side menu ---------- */
.menu ul { list-style: none; margin: 0; padding: 4px 0; }
.menu li a { display: block; padding: 2px 10px; text-decoration: none; color: var(--link); }
.menu li a::before { content: "▸ "; color: var(--line); }
.menu li a:hover { background: var(--post); }
.menu li a[aria-current="page"] { background: var(--post); font-weight: bold; color: var(--head-ink); }
.menu li a[aria-current="page"]::before { content: "■ "; color: var(--accent); }

/* ---------- odometer hit counter ---------- */
.odo { display: inline-flex; gap: 2px; padding: 3px; background: var(--odo-bg); border: 2px solid var(--odo-edge); }
.odo span {
  display: inline-block; width: 14px; height: 20px;
  background: var(--odo-digit); color: var(--odo-ink); border-top: 1px solid var(--odo-top); border-bottom: 1px solid #000;
  font: 16px/20px var(--pix); text-align: center; text-shadow: none;
}
.odo span:last-child { background: var(--odo-last); }

/* ---------- calendar ---------- */
.cal { width: 100%; border-collapse: collapse; font-size: 11px; text-align: center; }
.cal caption { font-family: var(--pix); padding: 0 0 4px; }
.cal caption a { text-decoration: none; padding: 0 6px; }
.cal th { font-weight: normal; color: var(--muted); font-family: var(--pix); }
.cal th:first-child { color: var(--accent); }
.cal td { padding: 1px 0; border: 1px solid transparent; }
.cal td.today { border-color: var(--link); font-weight: bold; }
.cal td.posted a { display: block; background: var(--head); color: var(--head-ink); font-weight: bold; text-decoration: none; }
.cal td.posted a:hover { background: var(--head-ink); color: var(--head); }
.cal-note { margin: 4px 0 0; font-size: 11px; color: var(--muted); text-align: center; }

/* ---------- footer + 88x31 buttons ---------- */
.foot { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--bg-ink); font-size: 11px; color: var(--bg-ink); }
.buttons { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.b88img { flex: none; display: block; width: 88px; height: 31px; }
.b88img img { display: block; image-rendering: pixelated; }

/* ---------- posts (imageboard style) ---------- */
.post {
  display: block; margin: 0 0 8px; padding: 6px 10px;
  background: var(--post); border: 1px solid var(--post-line);
  overflow: hidden; /* contain floated thumbnails */
}
.post-head { margin: 0 0 4px; }
.post-head > * { margin-right: 4px; }
.subject { color: var(--subject); font-weight: bold; font-size: 14px; margin: 0; display: inline; }
a.subject, a.subject:visited { color: var(--subject); }
h1.subject { font-size: 18px; font-family: var(--body); }
.name { color: var(--name); font-weight: bold; }
.no, .no:visited { color: var(--ink); text-decoration: none; }
.cat, .cat:visited { color: var(--muted); }
time, .stamp { color: var(--muted); font-size: 12px; }
.stamp { margin: 6px 0 0; }
.post-body { margin: 6px 0 2px; }
blockquote.post-body { margin: 8px 0 4px 0; }
.post-body p:first-child { margin-top: 0; }

.op { background: var(--paper); border-color: var(--line); }
.filemeta { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.thumb { float: left; margin: 2px 14px 6px 0; display: block; }
.thumb img { display: block; max-width: 220px; max-height: 220px; width: auto; border: 1px solid var(--line); }
.thumb-none {
  width: 120px; height: 120px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); background: var(--post); color: var(--muted);
  font: 13px/1.3 var(--pix); text-align: center;
}

.rich { overflow-wrap: anywhere; }
.quote { color: var(--quote); }
.sp { background: var(--ink); color: var(--ink); cursor: pointer; }
.sp a, .sp .quote { color: var(--ink); }
.sp.open { background: transparent; color: inherit; cursor: auto; }
.sp.open a { color: var(--link); }
.yt { max-width: 480px; aspect-ratio: 16 / 9; margin: 6px 0; border: 1px solid var(--line); background: #000; }
.yt iframe { display: block; width: 100%; height: 100%; border: 0; }

.greet { margin: 0 0 10px; padding: 6px 10px; background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--head); }
.greet p { margin: 0; }
.greet b { font: 16px var(--pix); font-weight: normal; color: var(--head-ink); margin-right: 6px; }
.greet .clock { font-size: 11px; margin-top: 2px; }

/* home: "right now" and today's fortune side by side */
.now-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 215px); gap: 10px; align-items: stretch; margin-bottom: 10px; }
.now-row > .box { margin: 0; display: flex; flex-direction: column; }
.now-row > .box > .box-b { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.now-song { margin: 2px 0 0; text-align: center; font-size: 12px; color: var(--muted); }

/* today's fortune: a little paper slip with a red-ink stamp */
.fortune .box-b { gap: 6px; }
.omikuji {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  margin: 0 auto; padding: 8px 10px 6px; width: 100%;
  background: #fbecd2; color: #8a2a1a;
  border: 1px solid #c4917a; outline: 2px solid #fbecd2; outline-offset: -5px;
  box-shadow: 2px 2px 0 rgba(40, 16, 8, .35);
}
.kuji-kanji {
  display: inline-block; padding: 2px 8px;
  font: 20px/1.2 var(--pix); letter-spacing: 3px; color: #b0281a;
  border: 2px solid #b0281a; transform: rotate(-3deg);
}
.kuji-name { font: 14px/1.4 var(--pix); color: #6a2a1a; text-transform: uppercase; letter-spacing: 1px; }
.omikuji.bad { filter: grayscale(.6); }
.lucky { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; margin: 2px 0 0; font-size: 13px; }
.lucky dt { color: var(--muted); }
.lucky dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.swatch { display: inline-block; width: 11px; height: 11px; margin-right: 4px; border: 1px solid var(--frame); vertical-align: -1px; }
/* lucky colours: same dust and lightness as the first six, hues shifted */
.lc-0 { background: #f2a291; } /* salmon */    .lc-1 { background: #a8c47a; } /* matcha */
.lc-2 { background: #7fb0ec; } /* sky */       .lc-3 { background: #ffd27a; } /* honey */
.lc-4 { background: #c9a0dc; } /* lilac */     .lc-5 { background: #fbecd2; } /* cream */
.lc-6 { background: #f0996a; } /* persimmon */ .lc-7 { background: #7dae6a; } /* clover */
.lc-8 { background: #5eb0c4; } /* sea */       .lc-9 { background: #f0b84a; } /* mango */
.lc-10 { background: #b07cc8; } /* grape */    .lc-11 { background: #f0c4c8; } /* blush */
.advice { margin: 2px 0 0; font-size: 14px; font-style: italic; color: var(--ink); }
.advice::before { content: "» "; color: var(--accent); font-style: normal; }
.kuji-foot { margin: 0; font-size: 12px; color: var(--muted); }
.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.duo > .box { margin-bottom: 10px; }

.changelog { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow-y: auto; }
.changelog.full { max-height: none; }
.changelog li { padding: 2px 0; border-bottom: 1px dotted var(--post-line); }
.changelog time { font-family: var(--pix); margin-right: 4px; }
.more { margin: 6px 0 0; text-align: right; }

/* question + answer */
.qa { margin: 0 0 12px; }
.qa .post { margin-bottom: 0; }
.qa .a { margin: -1px 0 0 22px; background: var(--paper); border-left: 4px solid var(--head); }
.qa .a .name::before { content: "↳ "; color: var(--line); }
.qa .answer-form { margin: 4px 0 0 22px; }

/* ---------- notices, empties, badges ---------- */
.notice { margin: 0 0 10px; padding: 4px 10px; background: #e6efd5; border: 1px solid var(--ok); color: #2e4a18; }
.error { padding: 4px 10px; background: #f7d9d3; border: 1px solid #b0281a; color: #8a1c10; }
.notice a, .notice a:visited, .error a, .error a:visited { color: inherit; }
.notice .linkbtn { color: inherit; text-decoration: underline; }
.draft-note { margin: 0 0 8px; }
.empty { padding: 14px 12px; text-align: center; color: var(--muted); background: var(--paper); border: 1px dashed var(--line); }
.box .empty { border: 0; padding: 10px 4px; }
.empty .kao { display: block; font: 20px/1.4 var(--pix); color: var(--head-ink); }
.empty p { margin: 4px 0 0; }
.badge { display: inline-block; padding: 0 5px; font: 11px/1.6 var(--pix); color: var(--badge-ink); background: var(--muted); }
.badge.new { background: var(--accent); }
.badge.ok { background: var(--ok); }
.badge.wait { background: var(--wait); }

/* ---------- nav bits ---------- */
.filters { margin: 0 0 10px; }
.filters b { color: var(--head-ink); }
.crumbs { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.pager { margin: 10px 0; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.pager b { color: var(--head-ink); }
.prevnext { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; padding: 6px 10px; background: var(--paper); border: 1px solid var(--line); }
.tabs { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 10px; border-bottom: 1px solid var(--line); }
.tabs a, .tabs b { padding: 3px 12px; border: 1px solid var(--line); border-bottom: 0; margin: 0 -1px -1px 0; background: var(--post); }
.tabs b { background: var(--paper); color: var(--head-ink); position: relative; }
.admin-row { margin: 6px 0; }
.adm, .adm:visited { color: var(--accent); font-weight: bold; text-decoration: none; }
.inbox-top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 10px; }
.inbox-top p { margin: 0; }
.inbox-item { margin-bottom: 6px; }

/* ---------- forms ---------- */
input, select, textarea, button { font: inherit; color: inherit; border-radius: 0; }
input:not([type=checkbox]):not([type=range]):not([type=file]), select, textarea {
  width: 100%; padding: 3px 5px;
  background: var(--field); border: 1px solid var(--field-line); border-top-color: var(--field-dark); border-left-color: var(--field-dark);
}
textarea { resize: vertical; min-height: 4em; }
::placeholder { color: var(--muted); opacity: .75; }
button {
  padding: 2px 12px; cursor: pointer;
  background: var(--btn); color: var(--ink);
  border: 2px outset var(--btn-hi);
}
button:active { border-style: inset; }
button:disabled { color: var(--btn-off); cursor: default; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font-size: inherit; }
.linkbtn:hover { color: var(--link-hover); text-decoration: underline; }
.linkbtn.danger { color: var(--danger); }
.linkbtn.armed { color: var(--badge-ink); background: var(--danger); padding: 0 3px; font-weight: bold; }
form.inline { display: inline; }

.form label { display: block; margin: 0 0 8px; }
.form label > span:first-child, .imgup .lbl { display: block; font-weight: bold; color: var(--head-ink); font-size: 12px; }
.form .check { font-weight: normal; }
.form.narrow { max-width: 320px; }
.formrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 10px; }
.formgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 240px); gap: 0 16px; }
.help { color: var(--muted); font-size: 11px; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.imgup { margin: 0 0 10px; }
.imgup-preview { display: block; max-width: 200px; max-height: 200px; margin: 4px 0; border: 1px solid var(--line); }
.imgup input[type=file] { max-width: 100%; }
.copyrow { display: flex; gap: 6px; }
.copyrow input { flex: 1; min-width: 0; }
.answer-form textarea { min-height: 5em; }
.approve-form { margin: 4px 0; }

/* rating slider with pixel stars */
.rating-field { margin: 0 0 10px; }
.rating-field input[type=range] { width: 180px; max-width: 100%; vertical-align: middle; accent-color: var(--head-ink); }
.rating-field output { font-family: var(--pix); margin-left: 6px; }

/* ---------- pixel stars ---------- */
.stars { display: inline-flex; gap: 1px; vertical-align: middle; line-height: 0; }
.pstar { width: 22px; height: 20px; filter: drop-shadow(1px 1px 0 var(--star-edge)); }
.stars-sm .pstar { width: 11px; height: 10px; filter: none; }
.stars-lg .pstar { width: 33px; height: 30px; }
.pstar .e { fill: var(--star-off); }
.pstar .h, .pstar .f { fill: var(--star-on); display: none; }
.pstar.s-half .h, .pstar.s-full .f { display: inline; }
.score { font: 18px var(--pix); color: var(--head-ink); }

/* ---------- shelf ---------- */
.shelf-filters { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: flex-end; padding: 6px 10px; background: var(--paper); border: 1px solid var(--line); }
.shelf-filters label { display: block; font-size: 11px; color: var(--muted); }
.shelf-filters select { width: auto; display: block; }

/* display case: covers in a grid, each with its title and stars underneath */
.case {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 18px 14px;
  padding: 14px 12px 10px;
  border: 1px solid var(--line);
  margin-top: 10px;
}
.book { display: flex; flex-direction: column; gap: 6px; min-width: 0; text-decoration: none; color: var(--ink); }
.book .cover {
  position: relative; display: block; aspect-ratio: 2 / 3;
  border: 1px solid var(--frame);
  box-shadow: 2px 2px 0 rgba(40, 16, 8, .35);
  transform: translateY(0);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s cubic-bezier(.2, .8, .2, 1);
}
/* a darker strip on the left edge, like a book's spine */
.book .cover::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; z-index: 1;
  background: rgba(0, 0, 0, .22); border-right: 1px solid rgba(255, 255, 255, .18);
}
.book .cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.book .cover .blank { width: 100%; height: 100%; border: 0; box-shadow: none; }
.book:hover .cover, .book:focus-visible .cover {
  transform: translateY(-7px) rotate(-1deg);
  box-shadow: 4px 9px 0 rgba(40, 16, 8, .3);
}
.book-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.book-title {
  font-size: 12px; line-height: 1.3; color: var(--link);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  transition: color .25s ease;
}
.book:hover .book-title, .book:focus-visible .book-title { color: var(--link-hover); text-decoration: underline; }
.book-meta { display: flex; justify-content: space-between; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); }
.book-media { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .book .cover, .book-title { transition: none; }
  .book:hover .cover, .book:focus-visible .cover { transform: none; }
}
.blank {
  width: 96px; height: 144px; display: flex; align-items: center; justify-content: center; padding: 8px;
  border: 1px solid var(--frame); box-shadow: 3px 0 0 #0003;
  font: 13px/1.3 var(--pix); text-align: center; color: #fff; overflow: hidden; overflow-wrap: anywhere;
}
.book .blank { padding: 8px 8px 8px 12px; }
.blank > span { display: block; padding: 4px 2px; border-top: 2px solid #fff8; border-bottom: 2px solid #fff8; }
.m-book { background: #6b3b2e; }
.m-manga { background: #2d2d2d; }
.m-ln { background: #3e5f8a; }
.m-vn { background: #8a3e6b; }
.m-game { background: #3d6b3a; }
.m-anime { background: #b0562d; }
.m-film { background: #4a3f6b; }
.m-other { background: #6b6253; }

.review-top { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.review-cover img, .review-cover .blank { width: 180px; height: 270px; object-fit: cover; border: 1px solid var(--frame); }
.review-cover .blank { font-size: 18px; }
.review-meta { flex: 1; min-width: 220px; }
.meta { border-collapse: collapse; margin-top: 8px; }
.meta th { text-align: left; font-weight: normal; color: var(--muted); padding: 2px 12px 2px 0; vertical-align: middle; }
.meta td { padding: 2px 0; }
.review-body { clear: both; border-top: 1px dashed var(--post-line); padding-top: 8px; }

.tablewrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: var(--paper); }
table.list th, table.list td { border: 1px solid var(--post-line); padding: 3px 6px; text-align: left; vertical-align: middle; }
table.list th { background: var(--head); color: var(--head-ink); font-weight: normal; font-family: var(--pix); }

/* dashboard lists (shelf / writing tabs) */
.manage .mini-cover { width: 34px; padding: 3px; }
.manage .mini-cover img, .manage .mini-cover .blank { display: block; width: 28px; height: 42px; padding: 0; object-fit: cover; border: 1px solid var(--frame); box-shadow: none; }
.manage .actions { white-space: nowrap; }

/* ---------- writing: a library of post cards ---------- */
.posts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--tint); border: 1px solid var(--line);
  transition: border-color .25s ease, transform .3s cubic-bezier(.2, .8, .2, 1);
}
.card:hover, .card:focus-within { border-color: var(--link); transform: translateY(-2px); }
.card-cover { display: block; aspect-ratio: 16 / 9; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--head); }
.card-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.card:hover .card-cover img { transform: scale(1.04); }
.cover-none {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  background-color: var(--head); background-image: var(--dots);
}
.cover-none span { padding: 2px 10px; font: 16px/1.4 var(--pix); letter-spacing: 2px; color: var(--head-ink); border: 1px solid var(--line); background: var(--head); }
.card-body { display: flex; flex-direction: column; gap: 4px; flex: 1; padding: 8px 12px 10px; }
.card-meta { margin: 0; font-size: 11px; color: var(--muted); }
.card-cat, .card-cat:visited { color: var(--accent); text-decoration: none; text-transform: uppercase; letter-spacing: 1px; }
.card-cat:hover { text-decoration: underline; }
.card-title { margin: 0; font: 17px/1.3 var(--pix); font-weight: normal; }
.card-title a, .card-title a:visited { color: var(--head-ink); text-decoration: none; }
.card-title a:hover { color: var(--link-hover); text-decoration: underline; }
.card-sub { margin: 0; font-size: 13px; font-style: italic; color: var(--link); }
.card-excerpt { margin: 2px 0 0; font-size: 12px; color: var(--ink); opacity: .9; }
.card-more { margin-top: auto; padding-top: 4px; align-self: flex-end; font-size: 12px; }
/* the newest post: bigger, cover beside the text */
.card.featured { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); margin-bottom: 12px; }
.card.featured .card-cover { aspect-ratio: auto; min-height: 220px; height: 100%; border-bottom: 0; border-right: 1px solid var(--line); }
.card.featured .card-body { padding: 12px 14px; justify-content: center; }
.card.featured .card-title { font-size: 22px; }
.card.featured .card-sub { font-size: 14px; }
.card.featured .card-excerpt { font-size: 13px; }
@media (prefers-reduced-motion: reduce) {
  .card, .card-cover img { transition: none; }
  .card:hover, .card:hover .card-cover img { transform: none; }
}

/* one post: cover banner, big title, subtitle, byline, then the text */
.article { margin: 0 0 10px; border: 1px solid var(--line); background: var(--tint); }
.article-cover { display: block; max-height: 340px; overflow: hidden; border-bottom: 1px solid var(--line); }
.article-cover img { display: block; width: 100%; max-height: 340px; object-fit: cover; }
.article-head { padding: 12px 16px 10px; border-bottom: 1px dashed var(--line); }
.article-title { margin: 2px 0 0; font: 26px/1.25 var(--pix); font-weight: normal; color: var(--head-ink); }
.article-sub { margin: 4px 0 0; font-size: 15px; font-style: italic; color: var(--link); }
.article-by { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
.article-body { padding: 12px 16px 14px; font-size: 14px; line-height: 1.7; }
.article-body p:first-child { margin-top: 0; }
.article .admin-row { padding: 0 16px 10px; }

/* ---------- askbox ---------- */
.mine { list-style: none; margin: 0; padding: 0; }
.mine li { padding: 4px 0; border-bottom: 1px dotted var(--post-line); }
.mine .excerpt { color: var(--ink); margin: 0 6px; }
.www, .www:visited { font-size: 11px; }
.owner-note { background: var(--paper); border-left: 4px solid var(--head); padding: 4px 8px; }

/* ---------- oekaki ---------- */
/* toolbar on top, then the canvas (as wide as the box allows, up to its real size), then name/caption */
.oekaki { display: flex; flex-direction: column; gap: 8px; }
.oekaki-tools { display: flex; flex-direction: column; gap: 6px; }
.tool-row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.tool-group { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.tool-label { font: 11px var(--pix); color: var(--muted); margin-right: 3px; text-transform: uppercase; letter-spacing: 1px; }
.tool-group button { padding: 1px 8px; }
.tool-group button.on { border-style: inset; background: var(--head); color: var(--link); }
.oekaki-stage { display: flex; justify-content: center; padding: 6px; background: rgba(40, 16, 8, .25); border: 1px solid var(--line); }
#oekaki {
  display: block; width: 100%; max-width: 320px; height: auto; aspect-ratio: 1;
  background: #fff; border: 1px solid var(--frame); cursor: crosshair; touch-action: none;
  image-rendering: pixelated;
}
#oekaki.tool-fill { cursor: cell; }
#oekaki.tool-picker { cursor: copy; }
.oekaki-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; align-items: end; }
.oekaki-meta > p { grid-column: 1 / -1; margin: 4px 0 0; }
.colours { max-width: 100%; }
.sw { width: 22px; height: 22px; padding: 0 !important; border: 1px solid var(--frame) !important; }
.tool-group button.sw.on { outline: 2px solid var(--head-ink); outline-offset: 1px; }
.cur-color { display: inline-block; width: 28px; height: 22px; margin-right: 4px; border: 2px solid var(--head-ink); background: #000; }
.more-wrap { position: relative; display: inline-flex; }
.more-color { flex: none; white-space: nowrap; padding: 1px 8px; font-size: 12px; }
.more-color[aria-expanded=true] { border-style: inset; background: var(--head); color: var(--link); }
/* our colour picker (same look in every browser) */
.cpick {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; width: 256px;
  display: flex; flex-direction: column; gap: 10px; padding: 12px;
  background: #3b3b3b; color: #e8e8e8; border: 1px solid #1d1d1d; box-shadow: 4px 6px 0 rgba(0, 0, 0, .35);
}
.cpick[hidden] { display: none; }
.cpick canvas { display: block; touch-action: none; cursor: crosshair; }
.cpick-sv { width: 232px; height: 140px; border: 1px solid #1d1d1d; }
.cpick-row { display: flex; align-items: center; gap: 10px; }
.cpick-drop { width: 26px; height: 26px; padding: 0 !important; background: none !important; border: 0 !important; color: #e8e8e8; font-size: 18px; cursor: pointer; }
.cpick-drop:hover { color: #fff; }
.cpick-prev { flex: none; width: 30px; height: 30px; border: 2px solid #1d1d1d; }
.cpick-hue { width: 150px; height: 14px; }
.cpick-nums { align-items: flex-start; gap: 6px; }
.cpick-nums label { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: #cfcfcf; }
.cpick-nums input { width: 46px !important; padding: 4px !important; text-align: center; background: #2b2b2b !important; color: #fff; border: 1px solid #5a5a5a !important; }
.cpick-hex input { width: 72px !important; text-transform: lowercase; }
.sz { width: 30px; height: 26px; padding: 0 !important; display: inline-flex; align-items: center; justify-content: center; }
.sz i { display: block; width: 3px; height: 3px; background: var(--ink); }
.oekaki-status { font-family: var(--pix); color: var(--head-ink); }

.gallery.doodles { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.draw-cta { text-align: center; margin-top: 8px; font-size: 14px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(162px, 1fr)); gap: 10px; }
.gallery.small { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.drawing { margin: 0; }
.drawing img { display: block; width: 160px; max-width: 100%; height: auto; border: 1px solid var(--line); background: #fff; }
.drawing figcaption { font-size: 11px; margin-top: 2px; }
.pending-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.pending { padding: 6px; background: var(--post); border: 1px solid var(--post-line); }
.pending img { display: block; max-width: 100%; height: auto; background: #fff; border: 1px solid var(--line); }
.drawing-view > img { display: block; width: auto; max-width: 100%; height: auto; margin-bottom: 6px; border: 1px solid var(--line); background: #fff; image-rendering: pixelated; }

/* ---------- about ---------- */
.linktree { list-style: none; margin: 0; padding: 0; }
.linktree li { margin: 0 0 6px; }
.linktree a {
  display: flex; justify-content: space-between; gap: 8px; padding: 5px 10px;
  background: var(--post); border: 1px solid var(--post-line); text-decoration: none;
}
.linktree a:hover { background: var(--head); color: var(--head-ink); }
.linktree .host { color: var(--muted); font-size: 11px; }
.linktree .note { display: block; font-size: 11px; color: var(--muted); padding: 1px 10px 0; }
.daylist { margin: 0; padding-left: 18px; }
.btnlist { list-style: none; margin: 0; padding: 0; }
.btnlist li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px dotted var(--post-line); }

/* ==========================================================================
   phones: one column, the menu drops below the content, nothing scrolls sideways
   ========================================================================== */
/* mid widths: the changelog moves under the content */
@media (max-width: 1000px) {
  .wrap { grid-template-columns: 180px minmax(0, 1fr); grid-template-areas: "side main" "side log"; }
  .log .changelog { max-height: 220px; }
}

/* ---------- moods: a chosen face looks exactly like an empty state's ---------- */
.empty.mood .rich { margin: 6px 0 0; }
.empty.mood .rich p:first-child { margin-top: 0; }
.empty.mood .rich p:last-child { margin-bottom: 0; }
.post .empty.mood { border: 0; padding: 8px 4px 2px; background: transparent; }
/* with text: the face is a big faint watermark centred behind the words */
.empty.mood.behind { position: relative; display: grid; place-items: center; min-height: 84px; overflow: hidden; }
.empty.mood.behind .kao {
  grid-area: 1 / 1; z-index: 0;
  font-size: 56px; line-height: 1; white-space: nowrap;
  color: var(--head-ink); opacity: .22; pointer-events: none; user-select: none;
}
.empty.mood.behind .rich { grid-area: 1 / 1; z-index: 1; position: relative; margin: 0; color: var(--ink); }
.mood-pick { margin: 0 0 10px; padding: 6px 8px 8px; border: 1px dotted var(--line); }
.mood-pick legend { padding: 0 4px; font-weight: bold; color: var(--head-ink); font-size: 12px; }
.mood-pick { position: relative; min-width: 0; }
.mood-opt, .form .mood-opt { display: inline-block; margin: 2px; cursor: pointer; }
.mood-opt input { position: absolute; left: 0; top: 0; opacity: 0; width: 1px; height: 1px; margin: 0; }
.mood-opt span {
  display: inline-block; min-width: 3em; padding: 3px 7px; text-align: center;
  font: 13px/1.4 var(--pix); color: var(--head-ink);
  border: 1px solid var(--post-line); background: var(--tint);
  transition: background-color .2s ease, border-color .2s ease;
}
.mood-opt:hover span { border-color: var(--line); background: rgba(255, 232, 210, .16); }
.mood-opt input:checked + span { background: var(--head); border-color: var(--head-ink); color: var(--link); }
.mood-opt input:focus-visible + span { outline: 2px dotted var(--head-ink); outline-offset: 1px; }

/* ---------- ask & draw chooser ---------- */
.chooser a, .chooser b { font: 14px/1.6 var(--pix); padding: 4px 16px; }
.chooser b { font-weight: normal; }

/* ---------- photo gallery ---------- */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo { display: flex; flex-direction: column; gap: 4px; min-width: 0; text-decoration: none; }
.photo-frame {
  display: block; aspect-ratio: 1; overflow: hidden;
  border: 1px solid var(--line); padding: 3px; background: var(--tint);
  transition: border-color .3s ease, transform .35s cubic-bezier(.2, .8, .2, 1);
}
.photo-frame img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), filter .3s ease;
  filter: saturate(.92);
}
.photo:hover .photo-frame, .photo:focus-visible .photo-frame { border-color: var(--link); transform: translateY(-3px); }
.photo:hover .photo-frame img, .photo:focus-visible .photo-frame img { transform: scale(1.05); filter: saturate(1.05); }
.photo-cap { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo:hover .photo-cap { color: var(--link-hover); }
@media (prefers-reduced-motion: reduce) {
  .photo-frame, .photo-frame img { transition: none; }
  .photo:hover .photo-frame, .photo:hover .photo-frame img { transform: none; }
}
.photo-view { margin: 0 0 10px; text-align: center; }
.photo-view img { display: block; margin: 0 auto; max-width: 100%; max-height: 80vh; width: auto; border: 1px solid var(--line); padding: 4px; background: var(--tint); }
.photo-view figcaption { margin: 8px auto 0; max-width: 60ch; }
.photo-view figcaption .rich p { margin: 0 0 4px; }

@media (max-width: 820px) {
  .duo { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .now-row { grid-template-columns: minmax(0, 1fr); }
  .posts { grid-template-columns: minmax(0, 1fr); }
  .card.featured { display: flex; }
  .card.featured .card-cover { aspect-ratio: 16 / 9; min-height: 0; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .card.featured .card-title { font-size: 19px; }
  .article-title { font-size: 21px; }
  .article-head, .article-body { padding-left: 12px; padding-right: 12px; }
  .formgrid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  body { font-size: 14px; }
  .page { padding: 8px 10px 20px; }
  .wrap { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "side" "log"; }
  .skip { display: block; text-align: right; margin: 0 0 4px; font-family: var(--pix); font-size: 12px; }
  .banner { padding: 3px; }
  .banner-in {
    min-height: 170px; padding: 6px 8px 8px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "time" "." "title" "count";
    grid-template-rows: auto 1fr auto auto;
  }
  .banner-in.bh-medium { min-height: 200px; }
  .banner-in.bh-tall { min-height: 230px; }
  .banner-time { font-size: 14px; }
  .site-name { font-size: 24px; letter-spacing: 1px; }
  .banner-tag { font-size: 13px; }
  .banner-count { margin: 6px 0 0; display: flex; align-items: center; gap: 6px; }
  .banner-count span { display: inline; }
  .odo span { width: 12px; height: 17px; font-size: 14px; line-height: 17px; }
  .thumb img { max-width: 120px; max-height: 160px; }
  .thumb-none { width: 80px; height: 80px; }
  .thumb { margin-right: 10px; }
  .qa .a, .qa .answer-form { margin-left: 10px; }
  .review-cover img, .review-cover .blank { width: 120px; height: 180px; }
  .case { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 14px 10px; padding: 10px 8px; }
  .photos { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .mood-opt span { min-width: 0; padding: 2px 5px; font-size: 12px; }
  .tabs a, .tabs b { padding: 3px 8px; }
}
