:root { color-scheme: light; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; color: #15365f; background: #fffefa; }
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
main { width: 100%; height: 100dvh; min-height: 320px; position: relative; }
#board { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; }
.settings { position: absolute; top: max(20px, env(safe-area-inset-top)); left: 24px; padding: 14px 18px; background: #fffefaf0; border: 1px solid #c5e4eb; border-radius: 16px; box-shadow: 0 4px 18px #15365f0a; }
h1 { margin: 0; font-size: 19px; }
.cell-settings { flex-basis: 100%; }
label { font-size: 14px; }
input { width: 80px; margin: 0 4px; padding: 6px; border: 1px solid #a7c6d6; border-radius: 6px; font: inherit; color: inherit; background: white; }
#inputError { display: block; font-size: 12px; color: #a52d33; }
#inputError:empty { display: none; }
.bottom-panel { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); text-align: center; pointer-events: none; }
p { margin: 10px 0; }
#hint { font-size: 14px; text-shadow: 0 0 6px #fffefa, 0 0 6px #fffefa; }
.snapshot-hint { display: inline-block; margin: 4px 6px; padding: 4px 10px; border-radius: 8px; background: #fff1b8; }
.floating-tools { display: inline-flex; gap: 12px; padding: 10px 14px; border: 2px solid #15365f; border-radius: 20px; background: #fffefa; box-shadow: 4px 4px 0 #15365f; pointer-events: auto; }
button { font: inherit; font-size: 18px; font-weight: 600; color: inherit; padding: 12px 22px; border: 2px solid transparent; background: transparent; border-radius: 12px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button[aria-pressed="true"] { border-color: #15365f; background: #ffd84d; }
button:focus-visible, input:focus-visible { outline: 3px solid #247bd0; outline-offset: 3px; }
.help { font-size: 12px; color: #526a80; background: #fffefacc; border-radius: 8px; padding: 4px 8px; }
#handles circle { fill: #fffefa; stroke: #247bd0; stroke-width: 6; cursor: grab; }
#handles circle:focus-visible { outline: none; stroke: #15365f; stroke-width: 8; }
#board.dragging, #board.dragging circle { cursor: grabbing; }
#labels, #snapshotLabels { pointer-events: none; font-size: 34px; font-weight: 600; fill: #15365f; stroke: #fffefa; stroke-width: 8; stroke-linejoin: round; paint-order: stroke; }
.snapshot-area { fill: var(--snapshot-color, #6d70aa); }
#heightLabel { fill: #c84449; }
[hidden] { display: none !important; }
@media (max-width: 520px) { .settings { top: 12px; left: 12px; padding: 12px; } h1 { font-size: 17px; } .help { font-size: 11px; } button { padding: 11px 18px; } #labels, #snapshotLabels { font-size: 28px; } }
@media (max-height: 480px) { .settings { display: none; } .cell-settings { flex-basis: auto; } .bottom-panel { bottom: 4px; } #hint { margin: 4px; } .help { display: none; } button { padding: 6px 18px; } }

.shape-snapshot { fill: var(--snapshot-color, #6d70aa); fill-opacity: .08; stroke: var(--snapshot-color, #6d70aa); stroke-width: 4; stroke-dasharray: 12 8; stroke-linejoin: round; }
.floating-tools { flex-wrap: wrap; justify-content: center; max-width: 100%; }
.zoom-control { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.zoom-control label { white-space: nowrap; }
.zoom-control input { width: 140px; min-width: 60px; margin: 0; padding: 0; border: 0; accent-color: #247bd0; cursor: pointer; }
.zoom-control output { min-width: 5ch; font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }
button:disabled { opacity: .4; cursor: default; }
#baseLeft, #baseRight { cursor: pointer; }
#baseLeft:focus-visible, #baseRight:focus-visible { outline: none; stroke: #15365f; stroke-width: 4; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.free-handle { fill: #fffefa; stroke: #247bd0; stroke-width: 6; cursor: grab !important; }
@media (max-width: 520px) {
  .floating-tools { gap: 8px; }
  .floating-tools button { font-size: 14px; padding: 8px 10px; }
}
