﻿:root {
  font-family: system-ui, "Yu Gothic UI", "Meiryo", sans-serif;
  color: #17282d;
  background: #f3f6f5;
  --line: #d6e0dd;
  --accent: #176752;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; }
#version { position: fixed; top: 8px; left: 8px; font: 11px monospace; opacity: .5; z-index: 2; }
header {
  padding: 9px 12px 9px 132px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  background: white; border-bottom: 1px solid var(--line);
}
h1 { font-size: 1rem; margin: 0 6px 0 0; }
h2 { font-size: .9rem; margin: 0; }
button, select, textarea { font: inherit; color: inherit; }
button, select { background: white; border: 1px solid #baccc7; border-radius: 5px; padding: 5px 8px; }
button { cursor: pointer; }
button:hover, button[aria-current="page"] { background: #e3f3ed; border-color: var(--accent); }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#zoom { min-width: 3.5em; text-align: center; font-variant-numeric: tabular-nums; }
#status { background: #fff0cf; padding: 8px 12px; white-space: pre-wrap; }
main { display: flex; flex: 1; height: 0; min-height: 0; }
aside { background: white; min-width: 0; }
#page-panel { flex: 0 0 170px; border-right: 1px solid var(--line); overflow: auto; padding: 12px; }
#pages { display: grid; gap: 6px; margin-top: 10px; }
#pages button { text-align: left; overflow-wrap: anywhere; }
#viewport { flex: 1; min-width: 0; overflow: auto; background: #e7edeb; position: relative; }
#empty { text-align: center; color: #425a58; margin: 3rem 1rem; }
#sheet { position: relative; margin: 16px auto; background: white; box-shadow: 0 1px 5px #343e4350; }
#image, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
#overlay { touch-action: none; cursor: crosshair; }
#viewport.panning, #viewport.panning #overlay { cursor: grabbing; }
#comment-panel { display: flex; flex-direction: column; flex: 0 0 300px; border-left: 1px solid var(--line); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px; border-bottom: 1px solid var(--line); }
#comments { overflow: auto; }
.comment { display: grid; grid-template-columns: auto 1fr auto; gap: 7px; padding: 9px; border-bottom: 1px solid var(--line); align-items: center; }
.comment.selected { background: #eaf6f1; }
.badge { color: white; border-radius: 50%; min-width: 1.65em; aspect-ratio: 1; display: grid; place-items: center; font-size: .82rem; font-weight: bold; }
.comment-name { overflow-wrap: anywhere; font-size: .82rem; }
.comment textarea { grid-column: 1 / -1; width: 100%; resize: vertical; min-height: 3.5em; border: 1px solid var(--line); border-radius: 4px; padding: 5px; }
#comment-panel.closed { flex-basis: 43px; }
.closed h2, .closed #comments { display: none; }
.closed .panel-head { padding: 3px; justify-content: center; border: 0; }
.closed #toggle { writing-mode: vertical-rl; }
footer { display: flex; gap: 14px; background: white; border-top: 1px solid var(--line); padding: 5px 10px; font-size: .72rem; }
footer a { color: var(--accent); }
@media (min-width: 900px) {
  body { height: 100dvh; }
}
@media (max-width: 899px) {
  main { display: grid; height: auto; grid-template-columns: minmax(0, 1fr); }
  #viewport { grid-row: 1; height: 60dvh; }
  #page-panel, #comment-panel { border: 0; border-top: 1px solid var(--line); }
  #pages, #comments { max-height: 40dvh; overflow: auto; }
  .closed #toggle { writing-mode: horizontal-tb; }
  header { padding: 27px 8px 8px; }
}
