:root { --primary: #1565c0; --border: #d0d4da; --muted: #667; }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, "Hiragino Sans", "Meiryo", sans-serif; background: #f4f5f7; color: #222; }
[hidden] { display: none !important; }
.bar { background: var(--primary); color: #fff; padding: 12px 16px; font-weight: bold; font-size: 1.1rem; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.narrow { max-width: 380px; margin: 40px auto; display: flex; flex-direction: column; gap: 12px; }
h1 { font-size: 1.3rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 8px; text-align: center; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: #444; }
input, select { font: inherit; padding: 8px; border: 1px solid var(--border); border-radius: 4px; }
button { font: inherit; padding: 8px 18px; border-radius: 4px; border: 1px solid var(--primary); background: #fff; color: var(--primary); cursor: pointer; }
button.primary { background: var(--primary); color: #fff; }
button.big { font-size: 1.2rem; padding: 12px 32px; }
button:disabled { opacity: .5; cursor: default; }
.error { color: #c62828; min-height: 1.2em; margin: 0; }
.topline { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; margin-bottom: 8px; }
#saveStatus { font-size: .9rem; padding: 2px 10px; border-radius: 12px; background: #e8f5e9; color: #1b5e20; }
#saveStatus[data-status="saving"], #saveStatus[data-status="pending"] { background: #fff8e1; color: #8d6e00; }
#saveStatus[data-status="error"] { background: #ffebee; color: #c62828; }
.board { width: fit-content; max-width: 100%; margin: 0 auto; }
.instruction { text-align: center; margin: 0 0 8px; color: #333; min-height: 1.5em; }
.legend { display: flex; gap: 16px; justify-content: center; font-size: .85rem; margin-bottom: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border: 1px solid #000; margin-right: 4px; vertical-align: -1px; }
.legend .dot { border-radius: 50%; }
.canvasWrap { position: relative; }
canvas { display: block; max-width: 100%; height: auto; touch-action: none; border: 1px solid var(--border); }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.6); }
.controls { display: flex; justify-content: space-between; margin-top: 12px; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; background: #fff; }
th, td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
th { background: #eef1f5; }
.muted { color: var(--muted); font-size: .85rem; }
.live { color: #1b7f3b; font-weight: bold; }
.warn { color: #c62828; font-weight: bold; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.row label { flex: 1 1 160px; }
section + section { margin-top: 16px; }
