.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); position: relative; }
.p { display: none; }
:where(.tool-card) p { margin: 0; }
.tool-card[data-state="idle"] .p-drop,
.tool-card[data-state="drag"] .p-drop { display: flex; }
.tool-card[data-state="working"] .p-work { display: block; }
.tool-card[data-state="done"] .p-done { display: block; }
.tool-card[data-state="error"] .p-err { display: flex; }

.fico { width: 36px; height: 44px; flex: 0 0 36px; border-radius: 5px 11px 5px 5px; background: var(--acc-soft); border: 1px solid var(--acc-line); color: var(--acc); font: 600 9.5px/1 var(--mono); letter-spacing: .02em; display: grid; place-items: end center; padding-bottom: 7px; position: relative; }
.fico::after { content: ""; position: absolute; right: -1px; top: -1px; width: 11px; height: 11px; background: linear-gradient(225deg, var(--surface) 50%, var(--acc-line) 50%); border-radius: 0 0 0 3px; }
.fico.bad { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 35%, transparent); color: var(--err); }
.fico.bad::after { background: linear-gradient(225deg, var(--surface) 50%, color-mix(in srgb, var(--err) 35%, transparent) 50%); }
.file-row { display: flex; align-items: center; gap: 13px; min-width: 0; }
.file-row .fn { min-width: 0; flex: 1; }
.file-row .fn b { display: block; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fn span { display: block; color: var(--ink-3); font-size: 13px; font-family: var(--mono); }

.p-drop { padding: 12px; min-height: 420px; }
.drop { flex: 1; display: flex; flex-direction: column; border: 1.5px dashed var(--line-2); border-radius: 12px; background-color: var(--surface); background-image: radial-gradient(color-mix(in srgb, var(--line-2) 55%, transparent) 1px, transparent 1.2px); background-size: 20px 20px; background-position: 10px 10px; transition: border-color .15s, background-color .15s; cursor: pointer; }
.drop:hover { border-color: var(--ink-3); }
.drop-in { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 24px 32px; }
.drop-art { width: 176px; height: 74px; color: var(--ink-3); margin-bottom: 20px; transition: transform .2s; }
.drop-art .acc { stroke: var(--acc); }
.drop-t { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.drop-t .t-drag, .drop-t .t-touch { display: none; }
.drop-s { color: var(--ink-3); font-size: 14.5px; margin-top: 6px; }
.drop-actions { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; justify-content: center; }
.drop-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; color: var(--ink-3); font-size: 13px; margin-top: 22px; }
.drop-meta span { display: flex; align-items: center; gap: 6px; }
.drop-meta svg { width: 14px; height: 14px; }
.drop-meta .ok svg { color: var(--ok); }
.drop-foot { border-top: 1px dashed var(--line-2); padding: 12px 20px; text-align: center; color: var(--ink-3); font-size: 13.5px; background: color-mix(in srgb, var(--sunken) 70%, transparent); border-radius: 0 0 11px 11px; }
.drop-foot b { color: var(--ink-2); font-weight: 600; }
.tool-card[data-state="drag"] .drop { border-color: var(--acc); border-style: solid; background-color: var(--acc-soft); }
.tool-card[data-state="drag"] .drop-art { transform: translateY(-4px) scale(1.04); }
.tool-card[data-state="drag"] .t-idle { display: none; }
.tool-card[data-state="drag"] .t-drag { display: inline; color: var(--acc); }
.tool-card[data-state="drag"] .drop-s, .tool-card[data-state="drag"] .drop-actions { visibility: hidden; }
@media (hover: none) and (pointer: coarse) {
  .drop-t .t-idle { display: none; }
  .drop-t .t-touch { display: inline; }
  .drop-s { display: none; }
}
@media (max-width: 640px) { .p-drop { min-height: 400px; padding: 8px; } .drop-t { font-size: 19px; } .drop-art { width: 150px; height: 63px; } }

.p-work { padding: 22px 24px 24px; min-height: 452px; }
.prog { height: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; margin: 20px 0 14px; }
.prog i { display: block; height: 100%; background: var(--acc); border-radius: inherit; width: 0; transition: width .25s linear; }
.steps { display: flex; gap: 8px 22px; list-style: none; padding: 0; margin: 0 0 22px; font-size: 13.5px; color: var(--ink-3); flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps li::before { content: ""; width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--line-2); box-sizing: border-box; }
.steps li.done { color: var(--ink-2); }
.steps li.done::before { border-color: var(--ok); background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2 7 10.6l4.6-5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; }
.steps li.now { color: var(--ink); font-weight: 550; }
.steps li.now::before { border-color: var(--acc); border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tgrid .th { border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: var(--sunken); position: relative; aspect-ratio: 16 / 9; }
.tgrid .th .sl { width: 100%; }
.tgrid .th.pending { background: linear-gradient(90deg, var(--sunken) 0%, color-mix(in srgb, var(--line) 70%, var(--sunken)) 50%, var(--sunken) 100%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
.tgrid .th.pending .sl { display: none; }
.tgrid .th.fresh { animation: pop .35s ease-out; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.local-note { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-3); margin-top: 20px; }
.local-note svg { width: 15px; height: 15px; color: var(--ok); }

.res-head { display: flex; align-items: center; gap: 13px; padding: 14px 18px 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.res-head .done-ok { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: 13px; font-weight: 550; background: var(--ok-soft); padding: 3px 9px 3px 7px; border-radius: 99px; white-space: nowrap; }
.res-head .done-ok svg { width: 14px; height: 14px; }
.res-body { display: grid; grid-template-columns: minmax(0, 1fr) 348px; }
.viewer { padding: 14px 20px 18px; border-right: 1px solid var(--line); min-width: 0; }
.v-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-height: 34px; }
.tabs { display: flex; gap: 2px; background: var(--sunken); padding: 3px; border-radius: 9px; border: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 4px 12px; border-radius: 6px; font-size: 13.5px; font-weight: 550; color: var(--ink-3); }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.tool-card[data-out="present"] .tab-src { display: none; }
.v-bar .sp { flex: 1; }
.v-bar .btn { height: 34px; }
.tool-card[data-out="edit"] .only-present { display: none !important; }
.tool-card[data-out="present"] .only-edit { display: none !important; }
.stage-wrap { position: relative; }
.stage { background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; padding: 22px; display: grid; place-items: center; height: 452px; }
.stage .sl { width: 100%; max-width: 720px; border-radius: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 10px 30px rgba(0,0,0,.10); }
.stage-fit { width: 100%; max-width: calc(406px * 16 / 9); }
.v-nav { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 0 10px; }
.v-nav .btn { width: 34px; padding: 0; }
.v-nav .cnt { font-size: 13px; color: var(--ink-2); min-width: 96px; text-align: center; }
.strip { position: relative; display: flex; gap: 8px; overflow-x: auto; padding: 3px 3px 8px; scrollbar-width: thin; }
.strip button { flex: 0 0 108px; padding: 0; border: 0; background: none; border-radius: 6px; position: relative; outline-offset: 1px; }
.strip button .sl { width: 100%; border-radius: 4px; box-shadow: 0 0 0 1px var(--line); }
.strip button.on .sl { box-shadow: 0 0 0 2px var(--acc); }
.strip button .n { position: absolute; left: 5px; bottom: 4px; font: 500 10px/1.4 var(--mono); background: rgba(0, 0, 0, .6); color: #fff; border-radius: 4px; padding: 0 4px; }

.pagepv { height: 452px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.pv-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--sunken); border-bottom: 1px solid var(--line); }
.pv-bar .dots { display: flex; gap: 5px; }
.pv-bar .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.pv-bar .addr { flex: 1; font: 12px var(--mono); color: var(--ink-3); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pv-scroll { position: relative; flex: 1; overflow-y: auto; padding: 26px 24px 40px; background: #fff; color: #1e293b; scroll-behavior: smooth; }
.pv-scroll .pv-title { font: 600 15px/1.3 -apple-system, 'Helvetica Neue', Arial, sans-serif; color: #0f172a; max-width: 540px; margin: 0 auto 18px; }
.pv-scroll .pv-sec { max-width: 540px; margin: 0 auto 26px; }
.pagepv.fluid .pv-scroll .pv-title, .pagepv.fluid .pv-scroll .pv-sec { max-width: none; }
.pv-sec .sl { width: 100%; box-shadow: 0 0 0 1px #e2e8f0; }
.pv-sec .pv-notes { font: 12.5px/1.55 -apple-system, 'Helvetica Neue', Arial, sans-serif; color: #475569; margin-top: 8px; padding-left: 10px; border-left: 2px solid #e2e8f0; }
.pagepv.no-notes .pv-notes { display: none; }
.pv-sec.hit .sl { box-shadow: 0 0 0 2px var(--acc); }

.code { height: 452px; overflow: auto; background: var(--code-bg); border-radius: 10px; padding: 16px 0; font: 12.5px/1.75 var(--mono); color: #d6d3cb; counter-reset: ln; }
.code .ln { display: block; padding: 0 18px 0 58px; text-indent: -58px; white-space: pre-wrap; overflow-wrap: anywhere; }
.code .ln::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 44px; padding-right: 14px; text-align: right; color: #5d5a53; user-select: none; }
.code .t { color: #f08d6b; }
.code .a { color: #e6c07b; }
.code .s { color: #9fcf8a; }
.code .c { color: #7d7a72; font-style: italic; }
.code .x { color: #f2efe8; }
.code-cap { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--ink-3); margin-top: 10px; }

.view-src .stage-wrap, .view-src .pagepv, .view-src .v-nav-extra { display: none; }
.viewer:not(.view-src) .code, .viewer:not(.view-src) .code-cap { display: none; }
.tool-card[data-out="present"] .pagepv { display: none; }
.tool-card[data-out="edit"] .stage-wrap { display: none; }

.export { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.ex-h { font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 6px 0 2px; }
.opt { display: grid; grid-template-columns: 18px 1fr; gap: 3px 11px; padding: 12px 14px 13px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.opt:hover { border-color: var(--line-2); }
.opt:has(input:checked) { border-color: var(--acc); background: var(--acc-soft); }
.opt input { accent-color: var(--acc); margin: 3px 0 0; width: 16px; height: 16px; }
.opt .ot { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.opt .ot em { font-style: normal; font: 500 11px/1 var(--mono); color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 99px; padding: 3px 7px; }
.opt .od { grid-column: 2; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.sub-opts { display: grid; gap: 9px; padding: 2px 2px 0; }
.chk { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); cursor: pointer; line-height: 1.45; }
.chk input { accent-color: var(--acc); margin: 2px 0 0; width: 15px; height: 15px; flex: 0 0 15px; }
.chk small { display: block; color: var(--ink-3); font-size: 12.5px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--sunken); padding: 3px; border-radius: 9px; border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 5px 8px; border-radius: 6px; font-size: 13px; font-weight: 550; color: var(--ink-3); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.sub-lbl { font-size: 12.5px; color: var(--ink-3); margin-bottom: -3px; }
.fname { display: flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--surface); }
.fname:focus-within { border-color: var(--acc); }
.fname input { flex: 1; border: 0; background: transparent; padding: 9px 12px; font: 14px var(--sans); color: var(--ink); min-width: 0; outline: none; }
.fname span { padding: 9px 12px; background: var(--sunken); color: var(--ink-3); font: 13px/1.5 var(--mono); border-left: 1px solid var(--line); }
.dl { display: grid; gap: 6px; }
.dl .btn { height: 50px; }
.dl .btn { min-width: 0; max-width: 100%; }
.dl-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fn span.sans { font-family: var(--sans); }
.v-title { font-weight: 600; font-size: 14.5px; padding-left: 2px; }
.dl-meta { text-align: center; font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.notes { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 2px; }
.notes summary { cursor: pointer; font-size: 13.5px; font-weight: 550; display: flex; align-items: center; gap: 8px; list-style: none; padding: 4px 0; }
.notes summary::-webkit-details-marker { display: none; }
.notes summary .chev { margin-left: auto; width: 14px; height: 14px; color: var(--ink-3); transition: transform .15s; }
.notes[open] summary .chev { transform: rotate(180deg); }
.notes summary .cnt-badge { font: 500 11.5px/1 var(--mono); background: var(--warn-soft); color: var(--warn); padding: 3px 7px; border-radius: 99px; }
.note { display: grid; grid-template-columns: 16px 1fr; gap: 9px; font-size: 13px; color: var(--ink-2); padding: 8px 0 2px; line-height: 1.5; }
.note svg { width: 16px; height: 16px; margin-top: 1px; }
.note.w svg { color: var(--warn); }
.note.i svg { color: var(--ink-3); }
.note button.slref { border: 0; background: none; padding: 0; color: var(--acc); font: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.note a { color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; }

.next-row { display: flex; align-items: center; gap: 6px 18px; padding: 13px 20px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-3); background: color-mix(in srgb, var(--sunken) 70%, transparent); border-radius: 0 0 17px 17px; flex-wrap: wrap; }
.next-row a { color: var(--ink-2); display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }
.next-row a:hover { color: var(--acc); }
.next-row a svg { width: 14px; height: 14px; }

@media (max-width: 980px) {
  .res-body { grid-template-columns: 1fr; }
  .viewer { border-right: 0; border-bottom: 1px solid var(--line); }
  .stage, .pagepv, .code { height: auto; }
  .stage { padding: 14px; }
  .pagepv .pv-scroll { height: 380px; flex: none; }
  .code { max-height: 420px; }
}
@media (max-width: 640px) {
  .viewer { padding: 12px 12px 14px; }
  .export { padding: 14px 14px 18px; }
  .res-head { padding: 12px 14px; }
  .res-head .btn { width: 100%; }
  .v-bar .play-lbl { display: none; }
  .strip button { flex-basis: 88px; }
}

.p-err { min-height: 452px; padding: 12px; }
.err-box { flex: 1; border: 1.5px solid color-mix(in srgb, var(--err) 30%, var(--line)); background: color-mix(in srgb, var(--err-soft) 55%, var(--surface)); border-radius: 12px; display: grid; place-items: center; align-content: center; text-align: center; padding: 40px 24px; }
.err-box .file-row { justify-content: center; margin-bottom: 26px; text-align: left; max-width: 100%; }
.err-box .file-row .fn { flex: 0 1 auto; }
.err-ico { width: 44px; height: 44px; border-radius: 50%; background: var(--err-soft); color: var(--err); display: grid; place-items: center; margin-bottom: 16px; border: 1px solid color-mix(in srgb, var(--err) 25%, transparent); }
.err-ico svg { width: 22px; height: 22px; }
.err-t { font-size: 21px; font-weight: 600; letter-spacing: -.02em; }
.err-d { color: var(--ink-2); max-width: 520px; margin: 10px auto 0; font-size: 14.5px; line-height: 1.6; }
.err-actions { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; justify-content: center; }
.err-detail { margin-top: 18px; font-size: 12.5px; color: var(--ink-3); }
.err-detail summary { cursor: pointer; }
.err-detail code { display: block; margin-top: 8px; font: 12px var(--mono); background: var(--sunken); border: 1px solid var(--line); padding: 8px 10px; border-radius: 8px; text-align: left; }

.player { position: fixed; inset: 0; z-index: 200; background: #0b0b0a; display: none; flex-direction: column; }
.player.open { display: flex; }
.pl-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: #a8a49b; font-size: 13px; }
.pl-top b { color: #f2efe8; font-weight: 550; }
.pl-top .x { margin-left: auto; background: #1d1c1a; border: 1px solid #34322e; color: #e8e5de; border-radius: 8px; height: 32px; padding: 0 12px; font-size: 13px; }
.pl-stage { flex: 1; display: grid; place-items: center; padding: 8px 24px; min-height: 0; }
.pl-slide { width: min(92vw, calc((100vh - 150px) * 16 / 9)); }
.player.show-notes .pl-slide { width: min(92vw, calc((100vh - 260px) * 16 / 9)); }
.pl-slide .sl { width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.pl-slide.in-fade { animation: plFade .45s ease; }
.pl-slide.in-push { animation: plPush .45s cubic-bezier(.2, .7, .2, 1); }
.pl-slide.in-back { animation: plBack .45s cubic-bezier(.2, .7, .2, 1); }
@keyframes plFade { from { opacity: 0; } }
@keyframes plPush { from { opacity: 0; transform: translateX(40px); } }
@keyframes plBack { from { opacity: 0; transform: translateX(-40px); } }
.player .sl .b { transition: opacity .4s ease, transform .4s ease; }
.player.builds .sl .b.hide { opacity: 0; transform: translateY(1.2cqw); }
.pl-notes { display: none; margin: 0 auto 6px; width: min(92vw, 900px); background: #171614; border: 1px solid #2e2c28; border-radius: 10px; padding: 10px 14px; color: #d6d2c8; font-size: 14px; line-height: 1.55; }
.player.show-notes .pl-notes { display: block; }
.pl-notes b { color: #8f8a80; font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; display: block; margin-bottom: 3px; }
.pl-bottom { display: flex; align-items: center; gap: 14px; padding: 8px 16px 14px; color: #8f8a80; font-size: 12.5px; }
.pl-bottom .pl-btn { background: #1d1c1a; border: 1px solid #34322e; color: #e8e5de; border-radius: 8px; width: 34px; height: 32px; display: grid; place-items: center; }
.pl-bottom .pl-btn svg { width: 16px; height: 16px; }
.pl-bottom .pl-n { color: #e8e5de; font-family: var(--mono); min-width: 54px; text-align: center; }
.pl-bottom .pl-prog { flex: 1; height: 3px; background: #2a2926; border-radius: 99px; overflow: hidden; }
.pl-bottom .pl-prog i { display: block; height: 100%; background: var(--acc); width: 0; transition: width .3s; }
.pl-bottom kbd { font: 11px var(--mono); border: 1px solid #3a3834; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: #c9c5bb; }
@media (max-width: 720px) { .pl-bottom .keys { display: none; } }

/* slides are shown as small documents of their own (the same markup as the Editable HTML export), scaled to fit */
.ppf { display: block; position: relative; overflow: hidden; width: 100%; background: #fff; }
.ppf iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; pointer-events: none; }
.stage .ppf { border-radius: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 10px 30px rgba(0,0,0,.10); }
.strip button .ppf { border-radius: 4px; box-shadow: 0 0 0 1px var(--line); }
.strip button.on .ppf { box-shadow: 0 0 0 2px var(--acc); }
.pv-fit { flex: 1; position: relative; overflow: hidden; min-height: 0; }
.pv-fit iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; }
.player iframe { flex: 1; width: 100%; border: 0; background: #000; }
.tool-card.busy .dl .btn, .tool-card.busy [data-act="play"] { opacity: .6; cursor: progress; }
