:root{
  --bg: #0f1115;
  --panel: #171a21;
  --panel2:#1d2130;
  --text: #e7e9ee;
  --muted:#aab0c0;
  --border: rgba(255,255,255,.10);
  --accent:#5b8cff;
  --danger:#ff5b6a;
  --shadow: 0 10px 30px rgba(0,0,0,.35);

  --slideW: 960px;
  --slideH: 540px;
}

*{ box-sizing:border-box; }

[hidden]{ display:none !important; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: "Roboto", system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar{
  height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 14px;
  border-bottom:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent);
}
.brand{ font-weight:700; letter-spacing:.2px; }
.actions{ display:flex; gap:10px; align-items:center; }
.sep{ width:1px; height:22px; background:var(--border); }

.btn{
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
  color:var(--text);
  padding:8px 10px;
  border-radius:10px;
  cursor:pointer;
}
.btn:hover{ border-color: rgba(255,255,255,.22); }
.btn.small{ padding:6px 10px; }
.btn.primary{ background: rgba(91,140,255,.18); border-color: rgba(91,140,255,.45); }
.btn.danger{ background: rgba(255,91,106,.16); border-color: rgba(255,91,106,.40); }

.layout{
  display:grid;
  grid-template-columns: 360px 1fr;
  height: calc(100% - 56px);
}

.panel{
  border-right:1px solid var(--border);
  background: var(--panel);
  padding:14px;
  overflow:auto;
}

.panel h2{
  font-size:13px;
  letter-spacing:.3px;
  text-transform:uppercase;
  color: var(--muted);
  margin:14px 0 10px;
}

.toolbox{ display:grid; gap:10px; }
.tool{
  border:1px solid var(--border);
  background: var(--panel2);
  border-radius:10px;
  padding:10px 12px;
  cursor: grab;
  user-select:none;
}
.tool:active{ cursor:grabbing; }
.tool-file{ cursor:pointer; display:flex; align-items:center; justify-content:space-between; }
.tool-file input{ display:none; }

.format{
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
  background: rgba(255,255,255,.02);
}
.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:10px 0;
}
.label{ font-size:13px; color:var(--muted); }
.btn-group{ display:flex; gap:8px; align-items:center; }
.line-ctrl{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.line-ctrl label{
  font-size:12px;
  color: var(--muted);
  display:flex;
  gap:6px;
  align-items:center;
}
.hint{
  margin-top:10px;
  font-size:12px;
  color:var(--muted);
  line-height:1.35;
}

.slides-list{ display:grid; gap:10px; }
.slide-thumb{
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  border-radius:12px;
  padding:10px;
  cursor:pointer;
}
.slide-thumb.active{
  outline: 2px solid rgba(91,140,255,.65);
  border-color: rgba(91,140,255,.45);
}
.slide-thumb .meta{
  display:flex;
  justify-content:space-between;
  color: var(--muted);
  font-size:12px;
  margin-bottom:8px;
}
.slide-thumb .mini{
  width:100%;
  aspect-ratio:16/9;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  position:relative;
  overflow:hidden;
}
.slide-thumb .mini .dot{
  position:absolute;
  width:6px; height:6px;
  border-radius:50%;
  background: rgba(0,0,0,.25);
}

/* stage */
.stage{ display:flex; align-items:center; justify-content:center; overflow:auto; }
.slide-wrap{
  background: rgba(255,255,255,.03);
  border:1px solid var(--border);
  border-radius:18px;
  padding:18px;
  box-shadow: var(--shadow);
}
.slide{
  width: var(--slideW);
  height: var(--slideH);
  background: #fff;
  color:#111;
  border-radius:14px;
  position:relative;
  overflow:hidden;
}

/* elements */
.el{
  position:absolute;
  min-width: 40px;
  min-height: 24px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  box-sizing: border-box;
}
.el .content{
  width:100%;
  height:100%;
  padding: 6px 10px;
  overflow:hidden;
}
.el.text .content{
  overflow:auto;
}
.el.title .content{ font-size:44px; font-weight:900; }
.el.subtitle .content{ font-size:26px; font-weight:700; }
.el.paragraph .content{ font-size:18px; }
.el.bullets .content{ font-size:18px; }
.el.bullets ul{ margin:0; padding-left:22px; }

.el.image{
  border-radius:12px;
  overflow:hidden;
  border:1px solid rgba(0,0,0,.15);
}
.el.image img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  user-select:none;
  -webkit-user-drag:none;
}

.el.line{
  border-radius:0;
  overflow:hidden;
  min-height:1px;
}
.el.line .line-inner{
  width:100%;
  height:100%;
  background:#111;
}

/* selection box */
.el.selected{
  outline: 2px solid rgba(91,140,255,.75);
  outline-offset: 1px;
}

/* resize handles */
.handle{
  position:absolute;
  width:10px;
  height:10px;
  background: rgba(91,140,255,.95);
  border:2px solid #fff;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.handle.nw{ left:-6px; top:-6px; cursor:nwse-resize; }
.handle.ne{ right:-6px; top:-6px; cursor:nesw-resize; }
.handle.sw{ left:-6px; bottom:-6px; cursor:nesw-resize; }
.handle.se{ right:-6px; bottom:-6px; cursor:nwse-resize; }
.handle.n{ left:50%; top:-6px; transform:translateX(-50%); cursor:ns-resize; }
.handle.s{ left:50%; bottom:-6px; transform:translateX(-50%); cursor:ns-resize; }
.handle.w{ left:-6px; top:50%; transform:translateY(-50%); cursor:ew-resize; }
.handle.e{ right:-6px; top:50%; transform:translateY(-50%); cursor:ew-resize; }

.el.editing{
  outline: 2px solid rgba(91,140,255,.45);
}
.el.editing .handle{ display:none; } /* no resize while typing */

/* print */
.print-area{ display:none; }












@media print{
  html, body{
    background:#fff !important;
    margin:0 !important;
    padding:0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .topbar,.panel,.stage{ display:none !important; }

  .print-area{
    display:block !important;
    background:#fff !important;
    padding:0 !important;
    margin:0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* One slide per page, with equal margins created via padding (not browser margins) */
  .print-slide{
    width: 297mm;
    height: 210mm;
    box-sizing: border-box;
    padding: 10mm;           /* <-- equal margins all around */
    margin: 0;
    overflow: hidden;

    display:flex;
    align-items:center;
    justify-content:center;

    /* avoid splitting */
    break-inside: avoid;
    page-break-inside: avoid;

    /* page breaks (after each slide, except last) */
    page-break-after: always;
    break-after: page;

    /* prevent accidental blank page before */
    page-break-before: auto;
    break-before: auto;

    background:#fff !important;
  }

  .print-slide:last-of-type{
    page-break-after: auto;
    break-after: auto;
  }

  .print-scale{
    width: 960px;
    height: 540px;
    transform-origin: center center;
  }

  .print-scale .slide{
    width: 960px !important;
    height: 540px !important;
    border-radius: 0 !important;
    box-shadow:none !important;
    overflow:hidden;
    position:relative;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  @page{ size: A4 landscape; margin: 0; }
}



/* --- Presentation mode --- */
.present-overlay{
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display:flex;
  flex-direction:column;
}

.present-top{
  height: 56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 0 14px;
  background: rgba(0,0,0,.55);
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.present-counter{
  color: rgba(255,255,255,.85);
  font-size: 14px;
  user-select:none;
}

.present-stage{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}

.present-slide-wrap{
  /* We scale the inner .slide with transform to keep 16:9 and positions */
  width: var(--slideW);
  height: var(--slideH);
  transform-origin: center center;
}

.present-nav{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 80px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.92);
  border-radius: 14px;
  font-size: 44px;
  line-height: 74px;
  text-align:center;
  cursor:pointer;
  user-select:none;
}
.present-nav:hover{ border-color: rgba(255,255,255,.32); }
.present-nav.prev{ left: 14px; }
.present-nav.next{ right: 14px; }

@media (max-width: 700px){
  .present-nav{ width:44px; height:70px; font-size:38px; line-height:64px; }
}


/* --- Site footer --- */
.site-footer{
  padding: 18px 12px;
  background: #0f1115;
  border-top: 1px solid rgba(255,255,255,.08);
}
.site-footer .footer-inner{
  max-width: 1200px;
  margin: 0 auto;
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  color: rgba(255,255,255,.75);
  font-size: 13px;
}
.site-footer a{
  color: rgba(255,255,255,.85);
  text-decoration: none;
}
.site-footer a:hover{ text-decoration: underline; }
.site-footer .dot{ opacity:.5; }

@media print{
  .site-footer{ display:none !important; }
}
