/* This editor is rendered only on narrow screens and touch tablets. Desktop uses diagram-editor.js. */
body.mobile-diagram-active .topbar{display:none}
body.mobile-diagram-active .shell{max-width:900px;padding:12px 14px calc(106px + env(safe-area-inset-bottom));padding-top:max(12px,env(safe-area-inset-top))}
body.mobile-diagram-active .drill-workspace .page-heading{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px;margin:0 0 10px}
body.mobile-diagram-active .page-heading h1{font-size:20px;letter-spacing:-.4px;margin:0;line-height:1.25}
body.mobile-diagram-active .page-heading .muted{display:none}
body.mobile-diagram-active .drill-workspace .drill-save-status{font-size:11px;line-height:1.3;margin:5px 0 0}
body.mobile-diagram-active .drill-workspace .page-heading>.button-row{gap:4px;flex-wrap:nowrap}
body.mobile-diagram-active .page-heading [data-action=save-add-drill]{display:none}
body.mobile-diagram-active .page-heading button{min-height:44px;padding:10px 12px;font-size:14px}
body.mobile-diagram-active .page-heading [data-action=save-drill]{background:var(--blue);color:#fff;border-color:var(--blue)}
body.mobile-diagram-active .drill-tabs{margin:0 0 8px;gap:0}
body.mobile-diagram-active .drill-tabs button{flex:1;min-height:44px;padding:9px 12px;font-size:14px}
.mobile-diagram{--touch-line:#d9e2e7;--touch-court:#edf3f6;min-width:0}
.mobile-diagram button,.mobile-diagram-sheet button{min-height:44px;font-size:15px;touch-action:manipulation}
.mobile-diagram button:active,.mobile-diagram-sheet button:active{transform:translateY(1px)}
.mobile-step-bar{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;gap:8px;align-items:center;margin-bottom:4px}
.mobile-step-bar>button:not(.mobile-step-title){padding:10px;border:0;background:transparent;display:grid;place-items:center}
.mobile-step-title{border:0;background:transparent;display:flex;flex-direction:column;align-items:center;min-width:0;padding:4px 10px;gap:3px}
.mobile-step-title strong{font-size:16px;font-weight:700}
.mobile-step-title strong span{font-weight:400;color:var(--muted)}
.mobile-step-title>span{display:block;max-width:100%;font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mobile-court-tools{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}
.mobile-history,.mobile-zoom{display:flex;gap:2px}
.mobile-history button{width:44px;border:0;background:transparent;padding:10px;display:grid;place-items:center}
.mobile-zoom{border:1px solid var(--touch-line);border-radius:10px;overflow:hidden;background:white}
.mobile-zoom button{padding:6px 10px;border:0;border-radius:0;min-width:44px;background:transparent;font-size:20px}
.mobile-zoom [data-action=mobile-zoom-reset]{font-size:12px;padding:6px;min-width:45px;font-variant-numeric:tabular-nums}
.mobile-pan{display:flex;align-items:center;justify-content:center;gap:6px;padding:8px 10px;background:transparent;border-color:transparent}
.mobile-pan[aria-pressed=true]{background:var(--blue);border-color:var(--blue);color:white}
.mobile-pan span{font-size:12px;white-space:nowrap}
.mobile-court-stage{width:100%;aspect-ratio:540/460;min-height:180px;max-height:max(180px,calc(100svh - 370px));border:1px solid #cfdee7;border-radius:14px;overflow:hidden;background:var(--touch-court);display:flex;align-items:center;justify-content:center;isolation:isolate}
.mobile-court-stage[data-court=full]{aspect-ratio:540/880}
.mobile-court-stage .court.editable{display:block;width:100%;height:100%;max-height:none;margin:0;border-radius:0;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.mobile-court-stage.panning .court{cursor:grab}
.mobile-court-stage .court.drawing{outline:0;box-shadow:inset 0 0 0 3px var(--steel)}
.mobile-object-hit{pointer-events:all}
.mobile-court-hint{font-size:11px;line-height:1.4;color:var(--muted);text-align:center;margin:7px 0 9px;max-width:none}
.mobile-selection{display:flex;align-items:center;gap:6px;min-height:58px;padding:4px 0;border-top:1px solid var(--touch-line);border-bottom:1px solid var(--touch-line)}
.mobile-selection-title{flex:1;min-width:0;border:0;background:transparent;text-align:left;display:flex;flex-direction:column;gap:4px;padding:6px 2px}
.mobile-selection-title strong{font-size:14px;overflow-wrap:anywhere}
.mobile-selection-title span{color:var(--muted);font-size:11px;font-weight:400}
.mobile-selection>[data-action=draw-route],.mobile-selection>[data-action=cancel-route-drawing]{font-size:13px;padding:8px 12px}
.mobile-selection>[data-action=mobile-deselect]{border:0;background:transparent;padding:10px;width:44px}
.mobile-playback{display:flex;gap:6px;margin-top:10px}
.mobile-playback button{padding:9px 12px;flex:1;font-size:13px;white-space:nowrap}
.mobile-playback [data-action=play-diagram]{display:flex;gap:6px;align-items:center;justify-content:center}
.mobile-playback svg{width:17px;height:17px}
.mobile-animation-status{font-size:11px;color:var(--muted);text-align:center;margin:7px 0 0;max-width:none;line-height:1.4}
.mobile-diagram-dock{position:fixed;bottom:0;left:50%;transform:translateX(-50%);z-index:20;display:grid;grid-template-columns:repeat(4,1fr);width:100%;max-width:900px;padding:8px max(12px,env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid var(--touch-line);box-shadow:0 -5px 24px #20333f0a}
.mobile-diagram-dock button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:54px;border:0;border-radius:10px;background:transparent;padding:6px}
.mobile-diagram-dock button span{font-size:11px;font-weight:600}
.mobile-diagram-dock button[aria-expanded=true]{background:#e6f0f6}
body.mobile-sheet-open{overflow:hidden}
.mobile-diagram-sheet{width:100%;max-width:600px;max-height:72dvh;max-height:min(72dvh,680px);margin:auto auto 0;padding:0;border:0;border-radius:20px 20px 0 0;box-shadow:0 -12px 60px #20333f2e;background:var(--paper);color:var(--ink);overflow:hidden}
.mobile-diagram-sheet[open]{display:flex;flex-direction:column}
.mobile-diagram-sheet::backdrop{background:#20333f55}
.mobile-sheet-heading{position:relative;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:24px 20px 12px;border-bottom:1px solid var(--line);flex-shrink:0}
.mobile-sheet-grip{position:absolute;top:9px;left:calc(50% - 18px);width:36px;height:4px;border-radius:5px;background:#c4d1d9}
.mobile-sheet-heading h2{font-size:20px;margin:0;letter-spacing:-.4px}
.mobile-sheet-heading button{border:0;color:var(--blue);padding:10px;background:transparent}
.mobile-sheet-body{overflow-y:auto;overscroll-behavior:contain;padding:18px 20px calc(24px + env(safe-area-inset-bottom));scrollbar-gutter:stable}
.mobile-sheet-body input,.mobile-sheet-body select,.mobile-sheet-body textarea{font-size:16px;min-height:48px}
.mobile-sheet-body .field{margin-bottom:16px;font-size:14px}
.mobile-sheet-body .fields{grid-template-columns:1fr 1fr;gap:12px}
.mobile-sheet-body>hr:first-of-type{margin:14px 0}
.mobile-sheet-body h3{font-size:17px}
.mobile-sheet-body .subtle{font-size:12px;line-height:1.55}
.mobile-sheet-body .check{min-height:48px;align-items:center;gap:12px;font-size:14px}
.mobile-sheet-body .check input{min-height:24px;width:24px;flex-shrink:0;accent-color:var(--blue)}
.mobile-sheet-body>[data-action=reset-object-position],.mobile-sheet-body>[data-action=remove-object]{width:100%;margin-top:4px}
.mobile-sheet-body summary{min-height:44px;display:list-item;align-content:center;cursor:pointer;font-size:14px}
.mobile-add-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:16px}
.mobile-add-grid button{display:flex;align-items:center;gap:12px;min-height:76px;text-align:left;padding:14px}
.mobile-object-symbol{font-size:30px;line-height:1;min-width:28px;text-align:center;color:var(--blue)}
.mobile-object-symbol.ball,.mobile-object-symbol.cone{color:#a86126}
.mobile-object-symbol.defense{color:var(--steel)}
.mobile-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;border:0;padding:0;margin:0 0 12px;min-width:0}
.mobile-options legend{font-size:14px;font-weight:600;margin-bottom:8px}
.mobile-options button{padding:9px 5px;font-size:14px;min-width:0;border-width:2px}
.mobile-options button[aria-pressed=true]{border-color:var(--blue);background:#e6f0f6}
.mobile-options [data-option=primary]{border-bottom-color:#dc2626;border-bottom-width:4px}
.mobile-options [data-option=secondary]{border-bottom-color:#eab308;border-bottom-width:4px}
.mobile-options [data-option=primary][aria-pressed=true]{border-color:#dc2626;background:#fff0f0;color:#a51c1c}
.mobile-options [data-option=secondary][aria-pressed=true]{border-color:#d6a510;background:#fff9dc;color:#6c5100}
.mobile-precision{margin:16px 0}
.mobile-step-list{display:flex;flex-direction:column;gap:8px;margin-bottom:16px}
.mobile-step-list button{display:flex;align-items:center;gap:12px;text-align:left;padding:12px}
.mobile-step-list button[aria-current=step]{background:#e6f0f6;border-color:var(--steel)}
.mobile-step-list .badge{flex-shrink:0}
.mobile-current-step{margin-left:auto;font-size:11px;font-weight:400;color:var(--muted)}
.mobile-wide{width:100%}
.mobile-tool-list{display:grid;gap:10px}
.mobile-tool-list button{text-align:left;min-height:50px}
.mobile-key{margin-top:16px}
.mobile-key p{font-size:13px;line-height:1.8;margin:10px 0 0}
.mobile-diagram-sheet.mobile-context-menu{position:fixed;right:auto;bottom:auto;inset-inline-end:auto;width:calc(100vw - 32px);max-width:320px;max-height:calc(100dvh - 24px);margin:0;border-radius:16px;box-shadow:0 12px 50px #20333f40}
.mobile-context-menu .mobile-sheet-heading{padding:10px 12px;gap:6px;min-height:60px}
.mobile-context-menu .mobile-sheet-heading h2{font-size:17px;flex:1;overflow-wrap:anywhere}
.mobile-context-menu .mobile-sheet-heading>button{font-size:13px;flex-shrink:0}
.mobile-context-menu .mobile-context-back{display:grid;place-items:center;padding:8px;width:44px}
.mobile-context-menu .mobile-sheet-body{padding:6px 10px 10px;scrollbar-gutter:auto}
.mobile-context-list{display:flex;flex-direction:column}
.mobile-context-list button{border:0;border-bottom:1px solid #e9eef1;border-radius:0;background:transparent;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;min-height:48px;padding:12px 10px;text-align:left;font-size:15px;overflow-wrap:anywhere}
.mobile-context-list button:last-child{border-bottom:0}
.mobile-context-list button:hover,.mobile-context-list button:focus-visible{border-radius:8px;background:#e6f0f6}
.mobile-context-list button[aria-pressed=true]{background:#e6f0f6;border-radius:8px}
.mobile-context-list small{font-weight:400;color:var(--muted);font-size:12px;line-height:1.4;margin-top:4px}
.mobile-context-note{color:var(--muted);font-size:12px;line-height:1.5;margin:10px 10px 4px}
.mobile-court-stage .court-object:focus-visible{outline:none;filter:drop-shadow(0 0 4px #4682b4)}
@media(max-width:370px){body.mobile-diagram-active .shell{padding-left:10px;padding-right:10px}.mobile-history{gap:0}.mobile-court-tools{gap:2px}.mobile-pan{padding:8px 6px}.mobile-playback button{font-size:12px;padding:8px}.mobile-add-grid{gap:8px}.mobile-add-grid button{font-size:13px;gap:7px;padding:10px}}
@media(orientation:landscape) and (max-height:600px){.mobile-diagram-sheet{max-height:90dvh}.mobile-court-stage{max-height:65svh}.mobile-diagram-dock{padding-top:4px}.mobile-diagram-dock button{min-height:44px;flex-direction:row;gap:8px}}
