/* 紙の作業報告書に合わせた単一テーマ（薄い青灰色の用紙・灰色の見出し・青インク） */
:root {
  --desk: #2b2e33;
  --paper: #eef2f6;
  --cell: #c9cdd2;
  --line: #3b3f45;
  --dot: #8a9097;
  --label: #1e2125;
  --ink: #1f3fae;
  --calc: #3d5bc4;
  --warn: #c0392b;
  --accent: #2f6fd6;
  --f-label: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  --f-ink: "Klee One", "Yu Mincho", serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--desk); color: var(--label); font-family: var(--f-label); }

/* 上のバー */
.bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--desk); color: #e8ebef; flex-wrap: wrap; }
.bar-left, .bar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trial { background: #f6d77a; color: #3a2e00; font-size: 13px; font-weight: 700; padding: 3px 8px; border-radius: 3px; }
.status { font-size: 14px; opacity: .8; }
.msg { margin: 0 16px 8px; padding: 12px 14px; background: #fde8e6; color: var(--warn); border-radius: 6px; font-weight: 700; font-size: 17px; }

.btn { font-family: var(--f-label); font-size: 18px; font-weight: 700; min-height: 52px; padding: 10px 22px; border-radius: 8px; border: 0; cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.sub { background: #e8ebef; color: #22262b; }
.btn:active { transform: translateY(1px); }
button:focus-visible { outline: 3px solid #f6d77a; outline-offset: 2px; }

/* 用紙 */
.sheetwrap { max-width: 1000px; margin: 0 auto; padding: 0 8px 40px; }
.sheet { display: block; width: 100%; height: auto; box-shadow: 0 8px 30px rgba(0,0,0,.35); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.sheet .paper { fill: var(--paper); }
.sheet .hole { fill: var(--desk); }
.sheet .cell { fill: var(--cell); stroke: var(--line); stroke-width: 1.4; }
.sheet .box { fill: none; stroke: var(--line); stroke-width: 1.4; }
.sheet .box.thin { stroke-width: 1.2; }
.sheet .rule { stroke: var(--line); stroke-width: 1.4; }
.sheet .dash { stroke: var(--dot); stroke-width: 1; stroke-dasharray: 3 3; }
.sheet .logo { fill: none; stroke: var(--label); stroke-width: 4; }
.sheet .label { fill: var(--label); font-family: var(--f-label); font-weight: 500; }
.sheet .ink-text { fill: var(--ink); font-family: var(--f-ink); font-weight: 600; }
.sheet .ink-text.calc { fill: var(--calc); }
.sheet .placeholder { fill: #8f9aae; font-family: var(--f-label); font-size: 13px; }
.sheet .ink { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
.sheet .circle { fill: none; stroke: var(--ink); stroke-width: 2; }
.sheet .check { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.sheet .hit { fill: transparent; cursor: pointer; }
.sheet .hit:active { fill: rgba(255, 236, 140, .45); }
.sheet .hit.missing { fill: rgba(192, 57, 43, .10); stroke: var(--warn); stroke-width: 2.5; stroke-dasharray: 6 4; }

/* 編集画面（欄を開いて書く） */
.ed { width: min(96vw, 1100px); max-width: none; max-height: 96vh; margin: 2vh auto auto; padding: 16px; border: 0; border-radius: 12px;
  background: #f4f6f9; color: var(--label); overflow: auto; }
.ed::backdrop { background: rgba(20, 22, 26, .7); }
.ed-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ed-title { margin: 0; font-size: 22px; font-weight: 700; }
.ed-tabs { display: flex; border-radius: 8px; overflow: hidden; border: 2px solid var(--accent); }
.ed-tabs button { font-family: var(--f-label); font-size: 18px; font-weight: 700; min-width: 96px; min-height: 48px; border: 0; background: #fff; color: var(--accent); cursor: pointer; }
.ed-tabs button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.ed[data-mode="ink"] .ed-textbox, .ed[data-mode="text"] .ed-inkbox { display: none; }

.ed-mini { display: none; margin: 0 auto 10px; border: 1px solid #b9c0c9; border-radius: 4px; cursor: pointer; touch-action: manipulation; }
.ed.scrolling .ed-mini { display: block; }
.ed-padrow { display: flex; justify-content: center; align-items: stretch; gap: 8px; }
.ed-pad { position: relative; overflow: hidden; background: #fff; border: 2px solid var(--line); border-radius: 4px;
  background-image: linear-gradient(to bottom, transparent calc(50% - .5px), #e3e7ee calc(50% - .5px), #e3e7ee calc(50% + .5px), transparent calc(50% + .5px)); }
.ed-pad canvas { position: absolute; left: 0; top: 0; touch-action: none; cursor: crosshair; }
.ed-nav { display: none; width: 64px; flex: none; font-size: 26px; border: 0; border-radius: 8px; background: #dfe4ea; color: #22262b; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.ed-nav small { font-size: 14px; font-weight: 700; }
.ed.scrolling .ed-nav { display: flex; }
.ed-nav:disabled { opacity: .3; cursor: default; }
.ed-nav.pulse { background: #f6d77a; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(246, 215, 122, .5); } }
@media (prefers-reduced-motion: reduce) { .ed-nav.pulse { animation: none; } }
.ed-tools { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }

.ed-textbox input, .ed-textbox textarea { width: 100%; font-family: var(--f-ink); font-weight: 600; font-size: 28px; color: var(--ink);
  padding: 12px 14px; border: 2px solid var(--line); border-radius: 6px; background: #fff; }
.ed-textbox textarea { font-size: 22px; line-height: 1.6; resize: vertical; }
.ed-note { min-height: 1.4em; margin: 10px 0 0; color: var(--warn); font-weight: 700; font-size: 16px; }
.ed-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; }
.ed-foot .btn { flex: 1; max-width: 280px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; background: #22262b; color: #fff;
  padding: 14px 22px; border-radius: 8px; font-size: 17px; max-width: calc(100vw - 32px); }
