@font-face { font-family: "Pretendard"; src: url("../fonts/web/Pretendard-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pretendard"; src: url("../fonts/web/Pretendard-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Pretendard"; src: url("../fonts/web/Pretendard-Light.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Pretendard"; src: url("../fonts/web/Pretendard-Black.woff2") format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: "D2Coding"; src: url("../fonts/web/D2Coding.woff2") format("woff2"); font-weight: 400; font-display: swap; }
/* 레이아웃: 위 고정 탭 + 카드형 단계(빠른 시작 → 주제 → 분량 → 미리보기). 슬라이드 자체 색은 render.js에서 고정 */
:root {
  --bg: #EEF3F9; --card: #FFFFFF; --ink: #1B2A5A; --muted: #5B6475;
  --teal: #1E8C8C; --tealL: #E3F4F2; --red: #E8323C; --line: #D3DCE8;
  --field: #FFFFFF; --warnBg: #FFF6E0; --warnLine: #F0D58A; --onAccent: #FFFFFF;
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0F1626; --card: #17213A; --ink: #E6ECF7; --muted: #A3AEC4; --teal: #3FB8B0; --tealL: #173B40;
  --red: #FF5A62; --line: #2A3756; --field: #101a30; --warnBg: #3A3015; --warnLine: #6B5A22; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0F1626; --card: #17213A; --ink: #E6ECF7; --muted: #A3AEC4; --teal: #3FB8B0; --tealL: #173B40;
  --red: #FF5A62; --line: #2A3756; --field: #101a30; --warnBg: #3A3015; --warnLine: #6B5A22; color-scheme: dark }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); }
body { padding-bottom: env(safe-area-inset-bottom); }
button, input, select { font: inherit; }

.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.logo { background: #121A2B; color: #FF6A13; font-weight: 900; border-radius: 10px; padding: 6px 9px; }
.tabs { display: flex; gap: 4px; }
.tabs button { border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 700; cursor: pointer; }
.tabs button.on { background: var(--tealL); color: var(--teal); }

main { max-width: 1100px; margin: 0 auto; padding-block: 16px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.tab { display: none; } .tab.on { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.card h2 { margin: 0 0 12px; font-size: 18px; } .card h2 small { color: var(--muted); font-weight: 500; font-size: 13px; }
.card h3 { font-size: 15px; margin: 18px 0 8px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.hidden { display: none !important; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--teal); color: var(--teal); background: var(--card); border-radius: 999px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
.chip small { font-weight: 500; opacity: .8; }
.chip:hover, .chip.on { background: var(--teal); color: var(--onAccent); }

.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.mod { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.mod input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--teal); }
.mod b { display: block; } .mod small { color: var(--muted); }
.mod.on { border-color: var(--teal); background: var(--tealL); }
.mod .ord { margin-left: auto; background: var(--teal); color: #fff; border-radius: 999px; font-size: 12px; min-width: 22px; text-align: center; padding: 1px 6px; }

label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
label input, label select { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--field); color: var(--ink); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
button.primary, .actions button { border: 0; background: var(--teal); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 800; cursor: pointer; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; } .actions button:not(.primary) { background: var(--ink); }
.result-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.result-head h2 { margin: 0; }

.warn { background: var(--warnBg); border: 1px solid var(--warnLine); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 8px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.thumb { position: relative; }
.thumb .no { position: absolute; left: 6px; top: 6px; z-index: 2; background: rgba(27,42,90,.85); color: #fff; font-size: 12px; border-radius: 6px; padding: 1px 6px; }
.thumb .del { position: absolute; right: 6px; top: 6px; z-index: 2; border: 0; background: rgba(232,50,60,.9); color: #fff; border-radius: 6px; font-size: 12px; padding: 2px 7px; cursor: pointer; }

.slide { position: relative; width: 100%; aspect-ratio: 16 / 9; container-type: inline-size; overflow: hidden; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.12); background: #DCE6F2; }
.slide .p { position: absolute; }
.slide .t { display: flex; word-break: keep-all; overflow-wrap: anywhere; padding: 0 0.2cqw; }
.slide .t.pre span { white-space: pre-wrap; word-break: break-all; }

.reflist { list-style: none; padding: 0; margin: 0; }
.reflist li { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; line-height: 1.5; }
.reflist a { color: var(--teal); font-weight: 700; word-break: break-all; }
.reflist .org { color: var(--muted); font-size: 12px; }
.badge { display: inline-block; font-size: 11px; border-radius: 6px; padding: 1px 6px; margin-left: 4px; font-weight: 700; }
.badge.ok { background: var(--tealL); color: var(--teal); } .badge.home { background: var(--line); color: var(--ink); } .badge.warn { background: var(--red); color: var(--onAccent); }
.refgroup h3 { margin-top: 16px; }

.presenter { position: fixed; inset: 0; background: #0E1424; padding: env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px); z-index: 50; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.presenter .stage { width: min(100vw, calc((100vh - 56px) * 16 / 9)); }
.presenter .stage .slide { border-radius: 0; box-shadow: none; }
.pbar { display: flex; gap: 10px; align-items: center; color: #fff; padding: 10px; }
.pbar button { background: #2B3245; color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; }

@media (max-width: 560px) {
  .row { grid-template-columns: 1fr; }
  .thumbs { grid-template-columns: 1fr; }
}

button:focus-visible, input:focus-visible, select:focus-visible, .mod:focus-within { outline: 3px solid var(--teal); outline-offset: 2px; }

/* 발표 모드 애니메이션 */
.presenter .slide [data-g] { transition: opacity .5s ease, transform .5s ease; }
.presenter .slide [data-g].hid { opacity: 0; transform: translateY(1.2cqw); }
@media (prefers-reduced-motion: reduce) { .presenter .slide [data-g] { transition: none; transform: none; } }

.card.feature { border: 2px solid var(--teal); }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
label.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--teal); }
input[type=file] { padding: 10px; border: 1.5px dashed var(--teal); border-radius: 10px; width: 100%; background: var(--field); color: var(--ink); }

details.design { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
details.design summary { cursor: pointer; font-weight: 800; margin-bottom: 10px; }
.colorrow { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.colorrow input[type=color] { width: 56px; height: 42px; padding: 2px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--field); }
button.ghost { border: 1.5px solid var(--line); background: var(--card); color: var(--ink); padding: 9px 12px; border-radius: 10px; font-weight: 700; cursor: pointer; }

input.hex { width: 110px !important; display: inline-block !important; margin: 0 !important; font-family: "D2Coding", monospace; }
button:disabled { opacity: .45; cursor: not-allowed; }

.card.empty { border-style: dashed; text-align: center; }

/* 슬라이드 도구 줄 · 발표 대본 */
.tbar { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tbar button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 5px 9px; font-size: 13px; font-weight: 700; cursor: pointer; min-height: 32px; }
.tbar button.warnbtn { color: var(--red); }
.thumb details.script { font-size: 13px; color: var(--muted); margin-top: 4px; }
.thumb details.script p { margin: 4px 0; line-height: 1.55; white-space: pre-wrap; }
.slide .vid { background: #000; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6cqw; }
.slide .vid span { font-size: 5cqw; } .slide .vid small { font-size: 1.2cqw; opacity: .8; padding: 0 2cqw; text-align: center; word-break: break-all; }
.pscript { color: #E6ECF7; background: #1A2133; max-width: min(100vw, 1100px); max-height: 22vh; overflow: auto; padding: 10px 16px; line-height: 1.6; white-space: pre-wrap; border-radius: 8px; }

/* 고치기 · 그림 자르기 창 */
dialog.editor { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); padding: 16px; }
dialog.editor::backdrop { background: rgba(10, 16, 30, .55); }
dialog.editor h3 { margin: 0 0 6px; }
dialog.editor fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 10px; padding: 8px 10px; }
dialog.editor legend { font-weight: 800; font-size: 13px; color: var(--muted); }
dialog.editor textarea, #videoLinks { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--field); color: var(--ink); font: inherit; resize: vertical; }
dialog.editor textarea.mono { font-family: "D2Coding", monospace; white-space: pre; }
.privlist { margin: 8px 0; padding-left: 18px; }
.privlist li { margin: 4px 0; }
.privlist small { color: var(--muted); }
dialog.editor .actions { margin-top: 10px; align-items: center; }
.cropstage { position: relative; margin: 10px 0; touch-action: none; user-select: none; }
.cropstage canvas { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); cursor: crosshair; }
#cropBox { position: absolute; display: none; border: 2px solid var(--red); background: rgba(232, 50, 60, .12); pointer-events: none; }
.cropline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.croplist, .recentlist { list-style: none; padding: 0; margin: 0 0 8px; }
.croplist li, .recentlist li { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.fontnote { margin-top: 8px; line-height: 1.6; }

/* 설치형 앱 */
.tabs button.install { background: var(--teal); color: #fff; }
.updatebar { position: sticky; top: 0; z-index: 6; background: var(--warnBg); border-bottom: 1px solid var(--warnLine); padding: 8px 16px; font-size: 14px; display: flex; gap: 10px; align-items: center; justify-content: center; }
.updatebar[hidden] { display: none; }
.updatebar button { border: 0; background: var(--teal); color: #fff; border-radius: 8px; padding: 6px 12px; font-weight: 800; cursor: pointer; }
.hint.ok { color: var(--teal); font-weight: 700; } .hint.bad { color: var(--red); font-weight: 700; }
html.standalone .top { padding-top: max(10px, env(safe-area-inset-top)); }
table.usage { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
table.usage th, table.usage td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; }
details.admin { margin-top: 12px; } details.admin summary { cursor: pointer; font-weight: 800; }

/* 구형 브라우저용 대체: 슬라이드 크기 단위(cqw)·화면 비율(aspect-ratio)을 모를 때 */
.nocq .slide .t { padding: 0 calc(var(--cq, 8px) * 0.2); }
.nocq .presenter .slide [data-g].hid { transform: translateY(calc(var(--cq, 8px) * 1.2)); }
.nocq .slide .vid { gap: calc(var(--cq, 8px) * 0.6); }
.nocq .slide .vid span { font-size: calc(var(--cq, 8px) * 5); }
.nocq .slide .vid small { font-size: calc(var(--cq, 8px) * 1.2); padding: 0 calc(var(--cq, 8px) * 2); }
@supports not (aspect-ratio: 1) { .slide { height: 0; padding-top: 56.25%; } }
button.danger, button.ghost.danger { background: var(--red) !important; color: #fff !important; border-color: var(--red) !important; }
.edimgs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.edimgs span { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.edimgs img { width: 120px; height: 68px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
label input.fontcustom { margin-top: 6px; }

/* 제목 모양 그림 고르기 */
.tpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.tpick .tp { display: flex; flex-direction: column; gap: 4px; padding: 5px; border: 2px solid #D5DCE6; border-radius: 10px; background: #fff; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.tpick .tp:hover { border-color: #8FA3BF; }
.tpick .tp[aria-checked="true"] { border-color: #1B2A5A; box-shadow: 0 0 0 2px rgba(27,42,90,.25); }
.tpick .tp .crop { width: 100%; aspect-ratio: 16 / 3.6; overflow: hidden; border-radius: 6px; }
.tpick .tp .crop .slide { box-shadow: none; border-radius: 0; }
.tpick .tp .nm { font-size: 12.5px; line-height: 1.3; }
.tpick .tp[aria-checked="true"] .nm { font-weight: 700; }
.tpick .tp[aria-checked="true"] .nm::before { content: "✓ "; }
@media (prefers-color-scheme: dark) { .tpick .tp { background: transparent; border-color: #3A4458; } .tpick .tp[aria-checked="true"] { border-color: #8FB4FF; } }
@media (max-width: 600px) { .tpick { grid-template-columns: 1fr 1fr; gap: 8px; } .tpick .tp .nm { font-size: 11.5px; } }
.tpick.cover .tp .slide { box-shadow: none; border-radius: 6px; }
.croplist li img.cthumb { width: 72px; height: 44px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); flex: none; }
.croplist li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.croplist li small { color: var(--muted); }
/* 고치기 창: 사진 조정 */
.slide.edprev { margin: 4px 0 10px; }
.edimgs.adj { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.imgadj { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.imgadj img { width: 100%; height: 90px; object-fit: contain; background: #0001; border-radius: 6px; }
.imgadj label { font-size: 12.5px; margin: 0; }
.imgadj input[type=range] { width: 100%; padding: 0; margin-top: 2px; accent-color: var(--teal); }
.imgadj select { padding: 6px 8px; font-size: 13px; }
.imgadj .actions button { padding: 6px 10px; font-size: 13px; }
/* 버튼 줄(.actions) 안의 밝은 버튼(ghost)은 밝은 바탕 + 진한 글자 – 진한 바탕에 진한 글자로 안 보이던 문제 */
.actions button.ghost:not(.primary) { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.actions button.ghost.danger { background: var(--red) !important; color: #fff !important; }
/* 발표 화면 전환(js/transitions.js 설정과 같게) */
.presenter .stage { --trDur: .8s; perspective: 1600px; }
.presenter .stage[class*="tr-"] > .slide { animation-duration: var(--trDur); animation-timing-function: ease; animation-fill-mode: both; }
.presenter .stage.tr-fade > .slide { animation-name: trFade; }
.presenter .stage.tr-push > .slide { animation-name: trPush; }
.presenter .stage.tr-wipe > .slide { animation-name: trWipe; }
.presenter .stage.tr-split > .slide { animation-name: trSplit; }
.presenter .stage.tr-cover > .slide { animation-name: trCover; }
.presenter .stage.tr-uncover > .slide { animation-name: trUncover; }
.presenter .stage.tr-reveal > .slide { animation-name: trReveal; }
.presenter .stage.tr-zoom > .slide { animation-name: trZoomIn; }
.presenter .stage.tr-zoom-out > .slide { animation-name: trZoomOut; }
.presenter .stage.tr-gallery > .slide { animation-name: trGallery; }
.presenter .stage.tr-cube > .slide { animation-name: trCube; transform-origin: left center; }
@keyframes trFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes trPush { from { transform: translateY(100%); } to { transform: none; } }
@keyframes trWipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes trSplit { from { clip-path: inset(0 50% 0 50%); } to { clip-path: inset(0 0 0 0); } }
@keyframes trCover { from { transform: translateX(100%); } to { transform: none; } }
@keyframes trUncover { from { opacity: 0; transform: translateX(-6%); } to { opacity: 1; transform: none; } }
@keyframes trReveal { from { opacity: 0; clip-path: inset(0 0 0 100%); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
@keyframes trZoomIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes trZoomOut { from { opacity: 0; transform: scale(1.4); } to { opacity: 1; transform: none; } }
@keyframes trGallery { from { opacity: .3; transform: translateX(60%) scale(.8) rotateY(-25deg); } to { opacity: 1; transform: none; } }
@keyframes trCube { from { transform: translateX(100%) rotateY(-80deg); } to { transform: none; } }
.presenter .stage { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .presenter .stage[class*="tr-"] > .slide { animation: trFade .3s both; } }
/* 새 장을 그릴 때: 숨김 상태를 페이드 없이 바로 적용 */
.presenter .stage.notr .slide [data-g] { transition: none !important; }

/* 클라우드 저장 공간 막대 */
#cloudUsage { margin: 10px 0 6px; }
#cloudUsage .ubar { height: 8px; border-radius: 4px; background: rgba(127,127,127,.25); overflow: hidden; }
#cloudUsage .ubar i { display: block; height: 100%; }
