:root{color-scheme:dark;--bg:#06080b;--surface:#12161c;--surface2:#191f27;--stroke:#2a333c;--text:#f0f4f5;--muted:#9baab6;--accent:#51d2bc;--accentDark:#173b36;--danger:#e79492;--radius:14px}*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--bg);color:var(--text);font:14px/1.5 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;-webkit-tap-highlight-color:transparent}button,input,textarea{font:inherit;color:inherit}button{cursor:pointer}button:focus-visible,input:focus-visible,textarea:focus-visible,a:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.hidden{display:none!important}h1,h2,h3,p{margin:0}a{color:#94ebdc}button{touch-action:manipulation}button:disabled{opacity:.4;cursor:default}.topbar{position:sticky;top:0;z-index:30;background:#090c10f7;border-bottom:1px solid var(--stroke);padding-top:env(safe-area-inset-top);backdrop-filter:blur(14px)}.topinner{max-width:1450px;margin:auto;padding:8px 18px;min-height:52px;display:flex;align-items:center;justify-content:space-between;gap:12px}.brand{display:flex;align-items:center;gap:9px;border:0;background:none;font-weight:850;font-size:18px;letter-spacing:-.5px;padding:0}.brand small{font-size:11px;color:var(--muted);font-weight:500}.logo{width:33px;height:33px;display:grid;place-items:center;background:#19443d;border-radius:10px;color:#a5f5e8;font-size:20px}.header-actions{display:flex;gap:10px;align-items:center}.save-state{font-size:11px;color:var(--muted)}.ghost{background:var(--surface2);border:1px solid var(--stroke);border-radius:9px;padding:8px 12px;font-weight:750}.top-action.active{background:#205246;border-color:var(--accent)}.page{padding:20px 0 80px}.wrap{max-width:800px;margin:0 auto;padding:0 20px}.wrap.narrow{max-width:740px}.eyebrow{font-size:10px;letter-spacing:1.6px;color:var(--accent);font-weight:850;margin-bottom:7px}h1{font-size:28px;letter-spacing:-.8px;line-height:1.13;margin-bottom:9px}h2{font-size:17px}.hint,.helper{color:var(--muted);font-size:12px}.helper{line-height:1.5;margin:10px 0}.search-shell{position:sticky;top:calc(57px + env(safe-area-inset-top));z-index:21;background:var(--bg);padding:9px 0 13px}.search{border:1px solid #3a4c56;background:#131a20;border-radius:13px;display:flex;align-items:center;gap:10px;padding:0 13px}.search span{font-size:24px;color:var(--accent)}.search input{width:100%;height:48px;background:none;border:0;outline:0;font-size:15px}.suggestions{position:absolute;left:0;right:0;top:calc(100% - 9px);background:#191f27;border:1px solid #41525b;border-radius:12px;box-shadow:0 14px 34px #000a;max-height:50vh;overflow:auto}.suggestions button{width:100%;background:none;border:0;border-bottom:1px solid var(--stroke);padding:12px 15px;text-align:left}.suggestions button:last-child{border:0}.suggestions button:active{background:#25473f}.letter-heading{color:var(--accent);font-size:19px;letter-spacing:.3px;font-weight:850;margin:19px 0 7px;scroll-margin-top:132px}.machine-list{display:grid;gap:7px}.machine-row{width:100%;text-align:left;background:var(--surface);border:1px solid var(--stroke);border-radius:11px;min-height:52px;padding:11px 13px;display:flex;justify-content:space-between;align-items:center;gap:8px}.machine-row strong{font-size:14px}.machine-row small{display:block;color:var(--muted);font-size:11px;font-weight:400}.machine-row .arrow{font-size:22px;color:#718493}.alpha-rail{position:fixed;z-index:24;right:max(2px,calc((100vw - 800px)/2 - 27px));top:55%;transform:translateY(-50%);display:flex;flex-direction:column;width:27px;height:min(68dvh,540px);border-radius:24px;background:#19242bdc;border:1px solid #36444b;align-items:center;padding:5px 0;touch-action:none;user-select:none}.alpha-rail button{flex:1;border:0;background:none;font-size:10px;font-weight:800;color:#c6d5de;width:100%;line-height:1}.alpha-rail button.dim{opacity:.28}.alpha-rail button.active{color:var(--accent)}.alpha-bubble{position:fixed;z-index:32;right:41px;border-radius:13px;background:#24554d;color:#e4fff9;font-size:33px;font-weight:850;padding:5px 16px;pointer-events:none}.back-link{border:0;background:none;color:var(--muted);padding:0 0 18px;font-size:13px}.machine-head{display:flex;justify-content:space-between;gap:16px;align-items:start}.machine-head h1{font-size:26px}.mini-image{width:94px;height:117px;flex:0 0 auto;padding:0;background:#131820;border:1px solid var(--stroke);border-radius:10px;overflow:hidden}.mini-image img{display:block;width:100%;height:100%;object-fit:cover}.switcher{display:grid;grid-template-columns:1fr 1fr;background:#131922;border:1px solid var(--stroke);border-radius:12px;padding:4px;margin:18px 0 16px;gap:3px}.switcher button{border:0;background:transparent;border-radius:9px;padding:10px 5px;color:var(--muted);font-weight:750}.switcher button.active{background:#26453f;color:#ddfff6}.accordion{border:1px solid var(--stroke);border-radius:12px;background:var(--surface);margin-bottom:9px;overflow:hidden}.accordion.quick{background:#132621;border-color:#2b5c50}.acc-title{min-height:48px;width:100%;background:transparent;border:0;display:flex;align-items:center;gap:10px;text-align:left;padding:13px 15px}.acc-title b{font-size:14px;flex:1}.acc-title .chev{color:var(--muted);font-size:16px}.acc-title .accent{color:var(--accent)}.acc-body{padding:0 15px 14px;color:#dce5e8;white-space:pre-wrap;line-height:1.55;font-size:14px}.acc-body:empty{display:none}.acc-children{padding:0 10px 11px}.accordion.depth-1{margin:0 0 8px;background:#151e25}.accordion.depth-2{background:#1a232b;margin:0 0 8px}.depth-1>.acc-title,.depth-2>.acc-title{min-height:42px}.depth-2>.acc-title{padding-left:11px}.rules-link{display:flex;align-items:center;justify-content:space-between;padding:14px;text-decoration:none;color:#a6efe3;border:1px solid var(--stroke);border-radius:12px;background:var(--surface);margin-top:8px;font-weight:650}.bottom-space{height:32px}.empty-note{font-size:13px;color:var(--muted);padding:12px 0}.btn{border-radius:10px;min-height:37px;padding:8px 12px;border:1px solid #44515b;font-weight:700;background:#232c36}.btn.primary{background:#276357;border-color:#3d927f;color:#ecfffa}.btn.secondary{background:#222831}.btn.danger{background:#5e2d2d;border-color:#a74f4f}.btn.full{width:100%}.iconbtn{border:1px solid var(--stroke);background:#26323b;border-radius:9px;font-size:21px;width:35px;height:35px;display:grid;place-items:center}.fieldcontrol{background:#0c1217;border:1px solid #394751;border-radius:10px;padding:10px 11px;width:100%;font-size:14px}.fieldcontrol:focus{outline:1px solid var(--accent)}textarea.fieldcontrol{min-height:170px;resize:vertical}.form-label{display:block;font-size:12px;color:#b4c7ce;font-weight:750;margin:14px 0 6px}.form-actions{display:flex;gap:8px;flex-wrap:wrap;margin:16px 0}.field-page{position:fixed;inset:0;z-index:60;background:#030507;display:flex;flex-direction:column;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}.field-bar{display:flex;align-items:center;gap:9px;padding:8px 10px;background:#0c1015;border-bottom:1px solid #29343d;min-height:53px}.field-bar strong{font-size:14px;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.field-tools{display:flex;gap:5px}.roundbtn{display:grid;place-items:center;border:1px solid #3a4650;border-radius:10px;background:#1b242b;width:35px;height:35px;font-size:20px}.field-viewport{touch-action:none;overflow:hidden;position:relative;flex:1;min-height:100px;background:#000}.field-stage{position:absolute;top:50%;left:50%;transform-origin:50% 50%;will-change:transform;user-select:none}.field-stage img{width:100%;height:100%;object-fit:fill;pointer-events:none;-webkit-user-drag:none}.shot-dots{position:absolute;inset:0;pointer-events:none}.shot-dot{position:absolute;transform:translate(-50%,-50%);border:1.5px solid #fafdfc;background:#39d4b7;box-shadow:0 0 0 3px #09150e8c,0 0 12px #0b1817;border-radius:50%;width:12px;height:12px;padding:0;pointer-events:auto;touch-action:none}.shot-dot::after{content:"";position:absolute;inset:-10px}.shot-dot.selected{background:#ffd46b;box-shadow:0 0 0 4px #362804}.field-help{font-size:11px;color:#a0afbb;text-align:center;padding:7px 10px;background:#0b0e12}.shot-popup{position:absolute;z-index:70;bottom:calc(22px + env(safe-area-inset-bottom));left:12px;right:12px;max-width:620px;margin:0 auto;background:#192128;border:1px solid #4d606a;border-radius:17px;padding:15px 17px 17px;box-shadow:0 15px 40px #000b}.shot-popup .popup-top{display:flex;justify-content:space-between;gap:10px;align-items:center}.shot-popup p{font-size:14px;line-height:1.5;margin-top:9px;white-space:pre-wrap;color:#d9e5ea}.editor-shell{max-width:1450px;margin:0 auto;padding:0 18px}.editor-header{display:flex;justify-content:space-between;align-items:center;gap:18px;margin-bottom:20px;flex-wrap:wrap}.editor-actions{display:flex;flex-wrap:wrap;gap:8px}.editor-grid{display:grid;grid-template-columns:minmax(200px,.78fr) minmax(220px,1fr) minmax(350px,1.65fr);gap:12px;align-items:start}.panel{background:var(--surface);border:1px solid var(--stroke);border-radius:14px;min-height:400px;padding:13px}.panel-title{display:flex;align-items:center;justify-content:space-between;gap:10px;padding-bottom:12px}.panel-title b{font-size:14px}.editor-machines{max-height:calc(100dvh - 185px);overflow:auto}.editor-machine-list{display:flex;flex-direction:column;gap:3px;margin-top:10px}.editor-machine-list button{border:0;background:none;border-radius:8px;text-align:left;padding:10px;font-size:13px}.editor-machine-list button.selected{background:#1d4942;color:#dffff6}.editor-machine-list button:hover{background:#222b33}.editor-tree{max-height:calc(100dvh - 330px);overflow:auto}.tree-entry{display:flex;align-items:center;gap:4px;border:1px solid transparent;border-radius:8px;margin:2px 0;padding:2px 5px}.tree-entry.active{background:#1d413a;border-color:#397668}.tree-entry.drag-over{border-color:var(--accent);background:#25473f}.tree-entry .handle{background:none;border:0;color:#79919d;font-size:16px;padding:5px;cursor:grab;touch-action:none}.tree-entry .tree-text{flex:1;background:none;border:0;text-align:left;padding:8px 2px;font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tree-entry .tree-add{border:0;background:none;color:var(--accent);font-size:20px;padding:4px 7px}.tree-entry.depth-1{margin-left:15px}.tree-entry.depth-2{margin-left:30px}.tree-entry.depth-2 .tree-add{display:none}.editor-form{max-height:calc(100dvh - 185px);overflow:auto}.panel-footer{border-top:1px solid var(--stroke);padding-top:11px;margin-top:10px}.preview-head{margin:8px 0 12px}.editor-image{position:relative;width:100%;max-width:520px;margin:10px auto 0;line-height:0;overflow:hidden;border:1px solid #3c4852;border-radius:11px;touch-action:none;cursor:crosshair}.editor-image img{width:100%;display:block;pointer-events:none}.editor-image .shot-dot{z-index:2}.editpoint-row{padding:9px 0;border-bottom:1px solid var(--stroke);display:flex;gap:8px;align-items:center}.editpoint-row button{font-size:12px}.editpoint-row .name{flex:1}.editor-form .inline-hint{color:var(--muted);font-size:12px;margin-top:4px}.editor-form .section-small{font-size:13px;color:var(--muted);margin-top:10px}.fieldfile{margin-top:9px;font-size:12px;width:100%}dialog{border:1px solid #4b5a66;border-radius:16px;background:#192027;color:var(--text);max-width:min(540px,calc(100vw - 30px));width:100%;padding:18px}dialog::backdrop{background:#000b}.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:14px}.dialog-head h2{font-size:18px}.toast{position:fixed;z-index:90;bottom:25px;left:50%;transform:translateX(-50%);background:#244f44;border:1px solid #4b9786;border-radius:12px;color:#e9fff8;padding:11px 18px;box-shadow:0 8px 28px #0008;max-width:min(90vw,400px);text-align:center}.divider{border-top:1px solid var(--stroke);margin:12px 0}.section-foot{display:flex;justify-content:space-between;align-items:center;gap:8px}.warning{color:#ffd48d}@media(max-width:980px){.editor-grid{grid-template-columns:minmax(190px,.7fr) 1fr}.editor-form{grid-column:1/-1;max-height:none}.editor-machines,.editor-tree{max-height:400px}}@media(max-width:580px){.wrap{padding:0 15px}.page{padding-top:18px}.alpha-rail{right:2px}.editor-header{align-items:stretch}.editor-grid{display:block}.editor-shell{padding:0 12px}.editor-grid .panel{min-height:unset;margin-bottom:11px}.editor-machines,.editor-tree{max-height:300px}.editor-header .editor-actions{gap:5px}.editor-actions .btn{font-size:12px;min-height:34px;padding:6px 9px}.machine-head h1{font-size:24px}.mini-image{width:91px;height:114px}.save-state{display:none}.field-help{font-size:10px}}@media(hover:hover){.machine-row:hover,.acc-title:hover{background:#1d292e}.btn:hover{filter:brightness(1.08)}}

.reader-label{font-size:10px;font-weight:800;letter-spacing:1.5px;color:var(--muted)}
.personal-note{border:1px solid var(--stroke);border-radius:13px;padding:15px;margin:20px 0 80px;background:#10161b}.personal-title{display:flex;justify-content:space-between;align-items:center;gap:6px;margin-bottom:10px;flex-wrap:wrap}.personal-title small{color:var(--muted);font-size:11px}.personal-note textarea{width:100%;border-radius:10px;min-height:115px;resize:vertical;background:#0a0f13;color:var(--text);border:1px solid var(--stroke);padding:12px;font:inherit}.note-saved{color:var(--muted);font-size:11px;margin-top:7px}.notes-tools{display:flex;flex-wrap:wrap;gap:8px;margin:20px 36px 50px 0}.notes-tools button{font-size:12px}.field-stage img{-webkit-touch-callout:none;user-select:none}.mini-image{touch-action:manipulation}.field-stage{touch-action:none}

.reader-label{font-size:10px;font-weight:800;letter-spacing:1.5px;color:var(--muted)}
.personal-note{border:1px solid var(--stroke);border-radius:13px;padding:15px;margin:20px 0 80px;background:#10161b}.personal-title{display:flex;justify-content:space-between;align-items:center;gap:6px;margin-bottom:10px;flex-wrap:wrap}.personal-title small{color:var(--muted);font-size:11px}.personal-note textarea{width:100%;border-radius:10px;min-height:115px;resize:vertical;background:#0a0f13;color:var(--text);border:1px solid var(--stroke);padding:12px;font:inherit}.note-saved{color:var(--muted);font-size:11px;margin-top:7px}.notes-tools{display:flex;flex-wrap:wrap;gap:8px;margin:20px 36px 50px 0}.notes-tools button{font-size:12px}.field-stage img{-webkit-touch-callout:none;user-select:none}.mini-image{touch-action:manipulation}.field-stage{touch-action:none}

.reader-label{font-size:10px;font-weight:800;letter-spacing:1.5px;color:var(--muted)}
.personal-note{border:1px solid var(--stroke);border-radius:13px;padding:15px;margin:20px 0 80px;background:#10161b}.personal-title{display:flex;justify-content:space-between;align-items:center;gap:6px;margin-bottom:10px;flex-wrap:wrap}.personal-title small{color:var(--muted);font-size:11px}.personal-note textarea{width:100%;border-radius:10px;min-height:115px;resize:vertical;background:#0a0f13;color:var(--text);border:1px solid var(--stroke);padding:12px;font:inherit}.note-saved{color:var(--muted);font-size:11px;margin-top:7px}.notes-tools{display:flex;flex-wrap:wrap;gap:8px;margin:20px 36px 50px 0}.notes-tools button{font-size:12px}.field-stage img{-webkit-touch-callout:none;user-select:none}.mini-image{touch-action:manipulation}.field-stage{touch-action:none}

/* 0.7a persistent storage errors remain visible. */
.storage-error{position:sticky;top:60px;z-index:60;background:#521e20;color:#fff;padding:12px 18px;border:1px solid #ff8585;overflow-wrap:anywhere}.storage-error[hidden]{display:none}

/* 0.7b: desktop comfort without changing the three-column layout. */
.editor-form textarea.fieldcontrol{height:clamp(320px,48dvh,720px);min-height:240px;resize:vertical;line-height:1.6}
.editor-form{max-height:none;min-width:0}
.editor-tree{max-height:calc(100dvh - 185px)}
.tree-toggle,.tree-toggle-space{flex:0 0 24px;width:24px}
.tree-toggle{background:none;border:0;color:var(--accent);padding:5px 0;font-size:17px}
.editor-search{position:relative}
.editor-search input{padding-right:38px}
.search-clear{flex:0 0 30px;border:0;border-radius:6px;background:transparent;color:var(--muted);font-size:23px;line-height:1;width:30px;height:32px;padding:0}
.editor-search .search-clear{position:absolute;right:5px;top:50%;transform:translateY(-50%)}
.search-clear[hidden],[hidden]{display:none!important}
.search input{min-width:0}
.search input::-webkit-search-cancel-button{-webkit-appearance:none}
.crop-dialog{max-width:min(1000px,calc(100vw - 30px));max-height:94dvh;overflow:auto}
.crop-columns{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin:12px 0}
.crop-columns section{min-width:0}
.crop-columns h3{font-size:14px;margin-bottom:8px}
.crop-canvas-wrap{display:flex;justify-content:center;align-items:flex-start;background:#080c10;min-height:100px}
.crop-canvas-wrap canvas{display:block;max-width:100%;max-height:48dvh;width:auto;height:auto}
#cropSource{touch-action:none;cursor:crosshair}
.crop-fields{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:14px 0}
.crop-fields label{font-size:12px;color:var(--muted)}
.crop-fields input{margin-top:5px}
@media(max-width:980px){.editor-tree{max-height:400px}}
@media(max-width:580px){.editor-form textarea.fieldcontrol{height:320px}.editor-tree{max-height:300px}.crop-columns{grid-template-columns:1fr}.crop-fields{grid-template-columns:1fr 1fr}}

.crop-dialog[open]{display:flex;flex-direction:column;overflow:hidden}
.crop-dialog>.dialog-head,.crop-dialog>.form-actions{flex:0 0 auto}
.crop-dialog>.form-actions{border-top:1px solid var(--stroke);padding-top:12px;margin-bottom:0}
.crop-content{overflow:auto;min-height:0;padding-right:4px}

#cropMessage{flex:0 0 auto;max-height:20dvh;overflow:auto;margin:10px 0 0}

/* 0.7c: stable image + adjacent marker form; narrow editor uses a bottom sheet. */
@media(min-width:981px){
 .editor-grid.marker-workspace{grid-template-columns:200px minmax(0,1fr);grid-template-rows:auto 1fr}
 .marker-workspace .editor-machine-list{max-height:30dvh}
 .marker-workspace .editor-machines{max-height:42dvh;overflow:auto}
 .marker-workspace .editor-form{grid-column:2;grid-row:1 / span 2;overflow:visible}
 .marker-workspace .editor-tree{grid-column:1;max-height:40dvh}
}
.shot-workspace{display:grid;grid-template-columns:minmax(0,1fr) minmax(230px,.85fr);gap:20px;align-items:start}
.shot-picture{position:sticky;top:75px;min-width:0;text-align:center}
.shot-workspace .editor-image{width:fit-content;max-width:100%;margin:0 auto;border:0;overflow:visible}
.shot-workspace .editor-image img{width:auto;max-width:100%;height:auto;max-height:calc(100dvh - 300px);border-radius:10px}
#shotEditPanel{position:sticky;top:75px;background:var(--surface);padding:12px;border:1px solid var(--stroke);border-radius:12px;max-height:calc(100dvh - 90px);overflow:auto}
.editor-form #shotDesc{height:clamp(140px,25dvh,350px);min-height:100px}
#closeShotPanel{display:none}
@media(max-width:700px){
 .shot-workspace{display:block}
 .shot-picture{position:static}
 #shotEditPanel{display:none}
 #shotEditPanel.has-selection{display:block;position:fixed;inset:auto 8px max(8px,env(safe-area-inset-bottom));z-index:55;max-height:65dvh;box-shadow:0 -12px 40px #000b}
 .editor-form #shotDesc{height:110px;min-height:80px}
 #closeShotPanel{display:inline-block}
 .topbar:has(~ main #editorPage:not(.hidden)) .save-state{display:inline;font-size:10px}
}

@media(max-width:700px){body:has(#shotEditPanel.has-selection) .toast{bottom:70dvh;pointer-events:none}}

/* 0.9: compact field selection and shot list, existing visual language. */
.field-select-bar{display:flex;gap:8px;align-items:center;padding:4px 10px;background:#0c1015;flex:none}
.field-select-bar:has(select[hidden]):has(button[hidden]){display:none}
.field-select-bar select{min-width:0;flex:1;padding:6px;max-width:100%}
.field-select-bar button{margin-left:auto;white-space:nowrap}
#shotListItems{max-height:55dvh;overflow:auto;overscroll-behavior:contain}
.shot-list-item{display:block;width:100%;text-align:left;padding:14px 8px;background:none;border:0;border-bottom:1px solid var(--stroke)}
.shot-popup{max-height:70dvh;overflow:auto;overscroll-behavior:contain}
.playfield-controls{border-bottom:1px solid var(--stroke);padding-bottom:8px;margin-bottom:12px}
#strategyPage{touch-action:pan-y pinch-zoom}
.update-banner{position:fixed;bottom:12px;left:12px;right:12px;z-index:90;background:#193b35;border:1px solid var(--accent);border-radius:12px;padding:12px;max-width:540px;margin:auto;display:flex;gap:12px;align-items:center}

#zoomReset{min-width:46px;font-size:12px}
