/* ===== SECTION: Typography and controls ===== */
:root{--ink:#172f44;--muted:#53675f;--paper:#fff9ec;--cream:#f5f4ef;--yellow:#ffe36c;--red:#df5140;--line:#d4ddd5;--s1:4px;--s2:8px;--s3:12px;--s4:16px;--s5:24px;font-family:"Hiragino Sans","Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,system-ui,sans-serif;font-size:14px;line-height:1.6;color:var(--ink);background:var(--cream);font-synthesis:none}
*{box-sizing:border-box}[hidden]{display:none!important}body{margin:0}h1,h2,h3,p{margin:0}h1{font-size:18px}h2,h3{font-size:14px}a{color:inherit;text-decoration:none}button,input,textarea,select{font:inherit;color:inherit}button{cursor:pointer;touch-action:manipulation;border:0;background:none;min-height:44px;font-weight:600}button:disabled{opacity:.45;cursor:not-allowed}button:hover:enabled{filter:brightness(.95)}:focus-visible{outline:3px solid #147eb0;outline-offset:3px}.skip{position:fixed;top:-80px;left:16px;background:var(--yellow);padding:12px;z-index:99}.skip:focus{top:8px}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
label{display:block;font-size:12px;font-weight:600}label>span{font-size:11px;color:var(--muted);font-weight:400;margin-left:4px}input,textarea{width:100%;background:#fff;border:1px solid #aebfb5;border-radius:5px;padding:8px 12px;font-size:14px}label>input,label>textarea{display:block;margin-top:8px}input[type=checkbox]{width:18px;height:18px;accent-color:var(--ink);flex-shrink:0;margin:0}input[type=range]{accent-color:var(--red);padding:0;border:0;height:36px}textarea{resize:vertical;line-height:1.6;min-height:80px}.text-button{font-size:12px;font-weight:600;padding:8px;text-decoration:underline;text-underline-offset:3px}.primary-button,.outline-button,.small-button{border-radius:5px;padding:8px 12px;font-size:12px;font-weight:600}.primary-button{background:var(--ink);color:#fff}.primary-button>span{font-size:11px;margin-left:8px;color:#e0e6df}.outline-button,.small-button{border:1px solid #a7b7ad;background:#fff}.small-button{font-size:11px}
/* ===== SECTION: Compact workspace and deliberate spacing ===== */
.header{height:56px;max-width:1600px;margin:auto;display:flex;align-items:center;justify-content:space-between;padding:0 24px;border-bottom:1px solid var(--line)}.brand{display:flex;align-items:center;gap:8px;font-size:18px;font-weight:700}.brand-light{font-size:14px;margin-left:4px}.brand-mark{display:block;flex:none;width:32px;height:32px}.header-right{display:flex;align-items:center}.help-button{display:grid;place-items:center;width:44px;height:44px;padding:0}.help-mark{display:grid;place-items:center;width:28px;height:28px;border:1.7px solid currentColor;border-radius:50%;font-size:18px;font-weight:600;line-height:1}.icon-button{display:grid;place-items:center;min-width:44px;min-height:44px;padding:8px}
main{max-width:1600px;margin:16px auto 0;padding:0 24px}.workspace{display:grid;grid-template-columns:minmax(320px,390px) minmax(0,1fr);gap:24px;align-items:start}.editor{background:#fff;border:1px solid var(--line);border-radius:6px;overflow:hidden}.panel-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px;border-bottom:1px solid var(--line)}.autosave{font-size:11px;color:var(--muted)}.editor-body{padding:16px}.sample-notice{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px;background:#fff2c4;border-radius:5px;font-size:11px;margin-bottom:16px}.profile-fields{margin-bottom:16px}.guide-heading{margin-bottom:8px}.guide-modes{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.guide-modes button{border:1px solid #c2cfc4;border-radius:5px;padding:8px 4px;background:#f7f8f3;min-height:72px}.guide-modes button.selected{background:var(--yellow);border-color:#9b7d19}.guide-modes button>span{display:block;font-size:18px;line-height:1.2;margin-bottom:4px}.guide-modes b{display:block;font-size:12px;font-weight:600}.guide-modes small{display:block;font-size:11px;color:var(--muted);margin-top:4px}.guide-settings{display:flex;flex-wrap:wrap;gap:12px;align-items:end;margin-top:12px}.guide-settings label{flex:1;min-width:80px}.number-wrap{display:flex;align-items:center;margin-top:8px}.number-wrap input{width:72px}.number-wrap span{font-size:11px;margin-left:4px}.guide-hint{font-size:11px;line-height:1.6;color:var(--muted);margin:8px 0 16px}.age-warning{font-size:11px;line-height:1.6;border-left:3px solid #9f6b08;background:#fff4cf;padding:8px 12px;margin:-4px 0 16px}.events-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.events-heading h2 span{display:inline-block;padding:0 8px;border-radius:4px;background:#eff1e8;font-size:12px}.events-heading>span{font-size:11px;color:var(--muted)}
.bulk-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:0 0 8px;border-bottom:1px solid var(--line);margin-bottom:8px;font-size:11px}.bulk-tools label{display:flex;align-items:center;gap:8px;min-height:44px;font-size:12px}.bulk-tools>span{margin-right:auto;color:var(--muted)}.bulk-tools>button{font-size:11px;padding:4px;color:#a03027;text-decoration:underline}.event-item{border:1px solid #cfdbd0;border-radius:5px;margin-bottom:8px;background:#fff;overflow:hidden}.event-item.selected{border-color:#ad8b20}.event-row{display:flex;align-items:stretch}.event-select-label{display:flex;align-items:center;justify-content:center;flex:0 0 40px;min-height:56px;background:#f5f7f0}.event-toggle{display:flex;align-items:center;gap:8px;text-align:left;padding:12px 8px;flex:1;min-width:0}.event-index{font-size:11px;font-weight:600;flex:0 0 20px;color:var(--muted)}.event-toggle-body{min-width:0;flex:1}.event-toggle-body small{display:block;font-size:11px;color:var(--muted);margin-bottom:4px}.event-toggle-body b{display:block;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600}.event-score{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:#fff1b9;font-size:12px;font-weight:700;flex-shrink:0}.chevron{font-size:14px;width:12px}.event-fields{padding:12px;background:#fcfcf7;border-top:1px solid #dce4db}.event-fields>label{margin-bottom:12px}.event-two-fields{display:grid;grid-template-columns:80px 1fr;gap:12px;margin-bottom:12px}.score-label{display:flex;align-items:center;justify-content:space-between;margin-top:8px}.score-label output{font-size:24px;font-weight:700}.range-ends{display:flex;justify-content:space-between;font-size:11px;color:var(--muted)}.delete-event{font-size:11px;color:#a03027;text-decoration:underline;margin-top:8px;padding-left:0}.add-event{width:100%;border:1px dashed #9db3a4;border-radius:5px;font-size:12px;font-weight:600;padding:8px}.empty-state{text-align:center;padding:24px 8px;color:var(--muted);font-size:12px;line-height:1.6}.advanced{margin-top:16px;padding-top:12px;border-top:1px solid var(--line);font-size:12px}.advanced summary{cursor:pointer;font-weight:600;min-height:44px;display:list-item}.check-label{display:flex;align-items:center;gap:8px;font-size:12px;margin-top:8px}.advanced p{font-size:11px;color:var(--muted);line-height:1.6;margin:8px 0}.data-tools{display:flex;justify-content:space-between;gap:8px;margin-top:12px;border-top:1px solid var(--line);padding-top:8px}.data-tools button{font-size:11px}
/* ===== SECTION: Panorama viewer and export controls ===== */
.preview-panel{min-width:0;max-width:100%}.board-tools{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}.board-info{display:flex;align-items:center;gap:8px;min-width:0}.board-info>span{font-size:11px;color:var(--muted)}.tag{font-size:11px;border:1px solid #afc0b1;padding:0 8px;border-radius:4px;white-space:nowrap}.board-zoom{display:flex;align-items:center;gap:0;background:#fff;border:1px solid var(--line);border-radius:5px;padding:0}.board-zoom button{font-size:12px;font-weight:600;min-height:44px;padding:8px;white-space:nowrap}.board-zoom button:hover{background:#fff0b7}.board-zoom output{font-size:11px;min-width:32px;text-align:center}.board-viewport{height:min(72vh,780px);min-height:420px;overflow:auto;width:100%;max-width:100%;border:1px solid #adbdad;border-radius:5px;background:#e9e8df;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-width:thin;scrollbar-color:#849b89 #e9e8df}.integrated-board{width:1360px;max-width:none;line-height:0}.integrated-board>svg{display:block;width:100%;height:auto;max-width:none}.timeline-event[role=button],.timeline-point[role=button]{cursor:pointer}.timeline-event:focus,.timeline-point:focus{outline:none}.timeline-event:focus .bubble-outline{stroke:#147eb0;stroke-width:5}.timeline-point:focus .point-core{stroke:#147eb0;stroke-width:5}.timeline-point.is-selected .point-core{stroke:var(--red);stroke-width:4}.playback{display:flex;align-items:center;gap:12px;padding:8px 0}.play-button{display:grid;place-items:center;border-radius:50%;width:44px;min-height:44px;background:var(--ink);color:#fff;flex-shrink:0}.playback>div{flex:1}.playback b{display:block;font-size:12px;font-weight:600}.playback span:empty{display:none}.playback span{display:block;font-size:11px;color:var(--muted);margin-top:4px}.export-section{border-top:1px solid var(--line);padding-top:12px}.export-actions{display:grid;grid-template-columns:1fr auto;gap:12px}.export-note{font-size:11px;color:var(--muted);margin-top:8px}.footer{max-width:1600px;margin:16px auto 0;padding:8px 24px;text-align:right}.footer button{font-size:11px}.mobile-tabs{display:none}
/* ===== SECTION: Dialogs and status ===== */
.toast{position:fixed;left:50%;bottom:24px;transform:translate(-50%,16px);opacity:0;pointer-events:none;transition:.2s;background:var(--ink);color:white;max-width:min(90vw,700px);width:max-content;padding:12px 16px;border-radius:6px;z-index:60;font-size:12px;line-height:1.6}.toast.visible{opacity:1;pointer-events:auto;transform:translate(-50%,0)}.toast button{font-size:12px;margin-left:12px;color:#ffe36c;text-decoration:underline}dialog{border:1px solid #879d8e;border-radius:8px;padding:24px;width:min(860px,92vw);max-height:90dvh;overflow:auto;color:var(--ink);background:#fffdf5;box-shadow:0 12px 48px #172f4430}dialog::backdrop{background:#172f4470}.dialog-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px}.dialog-heading h2{font-size:18px}.close-dialog{font-size:24px;width:44px;flex-shrink:0}.dialog-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:16px}dialog>p{font-size:12px;line-height:1.6;color:var(--muted)}.muted{color:var(--muted);font-size:11px!important;margin-top:12px}.info-box{padding:12px;background:#eef3e8;border-radius:5px;font-size:12px;line-height:1.6;margin-top:12px}.help-list{padding-left:24px;font-size:14px;line-height:1.6}.help-list li{margin-bottom:16px}.help-list p{font-size:12px;color:var(--muted)}.raster-notice{background:#fff0bf;padding:8px 12px;border-radius:5px;margin-top:12px;font-size:11px!important}.export-preview{overflow:auto;max-height:50dvh;margin-top:12px;border:1px solid var(--line);background:#e9e8df}.dialog-label{margin:16px 0 8px;font-weight:600;color:var(--ink)}.output-layouts{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.output-layouts button{display:flex;justify-content:center;align-items:center;gap:8px;border:1px solid #bdcdbf;border-radius:5px;background:#fff;padding:8px;font-size:12px;font-weight:600}.output-layouts small{font-size:11px;color:var(--muted);font-weight:400}.output-layouts button.selected{background:#fff0bf;border-color:#947d28}.aspect-icon{display:inline-block;width:20px;height:13px;border:1.5px solid currentColor}.aspect-icon.square{width:16px;height:16px}.aspect-icon.portrait{width:12px;height:18px}video{display:block;width:100%;max-height:50dvh;margin-top:12px;background:var(--paper)}progress{width:100%;height:16px;margin-top:16px}
/* ===== SECTION: Narrow screens ===== */
@media(max-width:1100px){.workspace{grid-template-columns:minmax(300px,350px) minmax(0,1fr);gap:24px}.board-tools{align-items:start;flex-direction:column}.board-zoom{align-self:flex-end}}
@media(max-width:850px){.header{padding:0 16px}.brand{font-size:16px}.brand-light{font-size:12px}main{margin-top:12px;padding:0 16px}.mobile-tabs{display:flex;gap:4px;border:1px solid #c3d0c3;background:#e9ede3;border-radius:5px;padding:4px;margin-bottom:12px;position:sticky;top:8px;z-index:5}.mobile-tabs button{width:50%;min-height:44px;font-size:12px;font-weight:600;border-radius:4px}.mobile-tabs button.active{background:var(--ink);color:white}.workspace{display:block}.preview-panel{display:none}body[data-mobile-view=preview] .editor{display:none}body[data-mobile-view=preview] .preview-panel{display:block}.guide-settings input,.profile-fields input,.event-fields input,.event-fields textarea{font-size:16px}.bulk-tools button{min-height:44px}.board-tools{gap:8px}.board-zoom{width:100%;justify-content:center}.board-viewport{height:67dvh;min-height:350px}.footer{padding:8px 16px;margin-top:8px}dialog{padding:16px}.dialog-actions>*{flex:1}.output-layouts button{padding:8px 4px;gap:4px}}
@media(max-width:380px){.bulk-tools{gap:4px}.export-actions{grid-template-columns:1fr}.board-info{flex-wrap:wrap}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}

.output-designs{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.output-designs span{font-size:12px;font-weight:600}
.output-designs button{min-width:44px;min-height:44px;border:1px solid #a7b7ad;border-radius:5px}
.output-designs button[aria-pressed="true"]{outline:2px solid var(--ink);outline-offset:1px}
.output-designs button:focus-visible{outline:3px solid #147eb0;outline-offset:3px}
[data-output-design="A"]{background:#fff;color:#2456d3}
[data-output-design="B"]{background:#101824;color:#ffce61}
[data-output-design="C"]{background:#ecf4f2;color:#15785e}
[data-output-design="D"]{background:#fff36a;color:#a91754}
[data-output-design="E"]{background:#101719;color:#55df9a}

.migration-note{margin:12px 0 0;font-size:12px;color:var(--muted)}
.migration-note a{text-decoration:underline}
.milestone-jump{display:flex;align-items:center;gap:8px;margin:8px 0;font-size:12px}
.milestone-jump select{flex:1;min-width:0;min-height:44px;font-size:16px}
.board-frame{position:relative}
.png-preview-controls{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:12px}
.png-preview-controls p{font-size:12px;margin:0}
.export-preview img{display:block;max-width:100%;height:auto}
.export-preview.actual-size img{max-width:none}

/* Keep narrow controls within the page and let only the timeline scroll sideways. */
@media(max-width:850px){
  .mobile-tabs button{flex:1;min-width:0;width:auto}
  .event-select-label{flex-basis:44px}
  .event-toggle-body small,.event-toggle-body b{white-space:normal;overflow-wrap:anywhere}
  .event-two-fields{grid-template-columns:minmax(0,80px) minmax(0,1fr)}
  .board-info,.board-zoom,.data-tools,.png-preview-controls{flex-wrap:wrap}
  .board-zoom button{min-width:44px}
  #reset-play{min-width:44px}
  .board-viewport{height:min(67dvh,700px);min-height:min(350px,55dvh)}
  .export-actions{grid-template-columns:minmax(0,1fr) auto}
  .dialog-actions>*{flex:1 1 auto;min-width:0}
  .output-layouts{grid-template-columns:repeat(3,minmax(0,1fr))}
  .output-layouts button{flex-wrap:wrap}
  .output-layouts small{flex-basis:100%;text-align:center}
  .toast{bottom:max(12px,env(safe-area-inset-bottom))}
  .toast button,#share-caption summary{min-height:44px}
  .toast button{margin-left:8px}
  dialog{max-height:calc(100dvh - 24px);overscroll-behavior:contain}
}
@media(max-width:380px){
  .export-actions{grid-template-columns:minmax(0,1fr)}
}
