/* ============================================================
   admin.css — the editing page. Loads AFTER styles.css, and
   neutralises the bits of it that are about presenting slides
   full-screen (hidden overflow, the grain overlay).
   ============================================================ */

body.admin {
  overflow: auto;                 /* styles.css sets overflow:hidden for the deck */
  background: #F3F2EE;
  color: #1A1A18;
  font-family: var(--sans);
  height: auto;
}
body.admin::before { display: none; }   /* the film grain belongs to the deck, not here */
body.admin * { text-wrap: initial; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 12px 18px;
  background: #16181C; color: #EDE8DE;
  border-bottom: 1px solid #2A2E34;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.brand strong { font-weight: 600; letter-spacing: .01em; }
.pill {
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 99px; border: 1px solid #3A3F47; color: #A9A69C;
}
.pill.edited { background: #6B5A1E; border-color: #8A7529; color: #FDF3D8; }
.deckpick {
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em;
  background: #1F2228; color: #EDE8DE; border: 1px solid #343941; border-radius: 3px;
  padding: 7px 9px; max-width: 260px; cursor: pointer;
}
.deckpick:hover { border-color: #C9A45C; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions button, .actions .file, .actions .link {
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em;
  background: #1F2228; color: #DAD5CA; border: 1px solid #343941; border-radius: 3px;
  padding: 8px 12px; cursor: pointer; text-decoration: none; transition: .15s;
}
.actions button:hover, .actions .file:hover, .actions .link:hover { border-color: #C9A45C; color: #fff; }
.actions button.primary { background: #C9A45C; border-color: #C9A45C; color: #17140F; font-weight: 600; }
.actions button.primary:hover { background: #E0B96B; }
.actions .file { position: relative; overflow: hidden; display: inline-block; }
.actions .file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.actions .link { background: transparent; }

/* ---------- three columns ---------- */
.grid3 {
  display: grid;
  grid-template-columns: 220px minmax(360px, 1fr) minmax(420px, 1.2fr);
  gap: 0;
  height: calc(100vh - 57px);
}
.grid3 > * { min-height: 0; overflow: auto; }
.list { border-right: 1px solid #DED9CF; background: #FAF9F5; padding: 10px 0; }
.editor { border-right: 1px solid #DED9CF; display: flex; flex-direction: column; overflow: hidden; }
.preview { display: flex; flex-direction: column; overflow: auto; padding-bottom: 24px; }

/* ---------- slide list ---------- */
.list a {
  display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: baseline;
  padding: 9px 14px; text-decoration: none; color: #33302A; font-size: 13px;
  border-left: 3px solid transparent; cursor: pointer;
}
.list a:hover { background: #F0EDE4; }
.list a.now { background: #EFE7D2; border-left-color: #A66A18; font-weight: 600; }
.list a .n { font-family: var(--mono); font-size: 11px; color: #8A8070; }
.list a .id { font-family: var(--mono); font-size: 11px; color: #6B6558; display: block; margin-top: 2px; }
.list a .era { font-size: 11px; color: #8A8070; }

/* ---------- panes ---------- */
.pane-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #DED9CF; background: #FAF9F5;
  font-size: 13px; color: #4A463E;
}
.pane-head b { font-family: var(--mono); font-weight: 600; }
.pane-head .hint { font-size: 12px; color: #8A8070; }
.langsw { display: flex; gap: 4px; }
.langsw button {
  font-family: var(--mono); font-size: 11px; background: transparent; color: #6B6558;
  border: 1px solid #CFC9BC; border-radius: 2px; padding: 3px 8px; cursor: pointer;
}
.langsw button[aria-pressed="true"] { background: #16181C; color: #fff; border-color: #16181C; }

.mini {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em;
  background: transparent; color: #6B6558; border: 1px solid #CFC9BC;
  border-radius: 2px; padding: 2px 7px; cursor: pointer; margin-left: 6px;
}
.mini:hover { border-color: #A66A18; color: #7A4E0F; }

#md {
  flex: 1; width: 100%; resize: none; border: 0; outline: 0;
  padding: 16px 18px; background: #fff; color: #1A1A18;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65; tab-size: 2;
  white-space: pre-wrap;
}
#md:focus { background: #FFFDF8; }

.errors { padding: 0 16px; font-size: 12px; color: #8A3B2C; }
.errors:not(:empty) { padding: 10px 16px; background: #FBEEE9; border-top: 1px solid #E8CFC4; }
.errors ul { margin: 0; padding-left: 18px; }
.errors .ok { color: #4F7A4A; }

/* ---------- preview ---------- */
.frame {
  position: relative; overflow: hidden; background: #E7E3DA;
  border-bottom: 1px solid #DED9CF;
}
.preview-canvas {
  width: 1920px; height: 1080px; position: relative; transform-origin: top left;
  background: var(--surface); color: var(--ink);
}
/* the preview shows the finished slide, so no entrance animation here */
.preview-canvas .anim { opacity: 1 !important; animation: none !important; }
.preview-canvas .slide { position: absolute; inset: 0; opacity: 1; visibility: visible; transform: none; }

/* ---------- help ---------- */
.help { margin: 18px; border: 1px solid #DED9CF; background: #FAF9F5; border-radius: 3px; }
.help summary { padding: 12px 16px; cursor: pointer; font-size: 13px; font-weight: 600; }
.help-body { padding: 4px 18px 20px; font-size: 13px; line-height: 1.6; color: #33302A; }
.help-body pre {
  background: #16181C; color: #DDD8CC; padding: 14px 16px; border-radius: 3px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6; overflow: auto;
}
.help-body code { font-family: var(--mono); background: #EDE9DF; padding: 1px 4px; border-radius: 2px; }
.help-body b { color: #A66A18; }

/* ---------- images panel ---------- */
.images {
  border-top: 1px solid #DED9CF; background: #FAF9F5;
  max-height: 34vh; display: flex; flex-direction: column;
}
.imgs-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid #EDE9DF; font-size: 12.5px;
}
.imgs-acts { display: flex; gap: 6px; }
.mini-btn {
  position: relative; overflow: hidden; display: inline-block;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em;
  background: #16181C; color: #EDE8DE; border: 1px solid #16181C; border-radius: 2px;
  padding: 6px 10px; cursor: pointer;
}
.mini-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mini-btn:hover { background: #C9A45C; border-color: #C9A45C; color: #17140F; }
.imgs {
  padding: 10px 12px 14px; overflow: auto; display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
}
.imgs .none { grid-column: 1 / -1; margin: 0; font-size: 12px; color: #8A8070; line-height: 1.5; }
.img-cell { border: 1px solid #DED9CF; background: #fff; border-radius: 3px; overflow: hidden; }
.img-cell > img { display: block; width: 100%; height: 72px; object-fit: cover; background: #EFEBE2; }
.img-cell .m { display: flex; justify-content: space-between; gap: 6px; padding: 4px 6px; font-size: 10.5px; color: #6B6558; }
.img-cell .m b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-cell .b { display: flex; border-top: 1px solid #EFEBE2; }
.img-cell .b button {
  flex: 1; border: 0; background: transparent; cursor: pointer; padding: 5px 2px;
  font-size: 11px; color: #4A463E; border-right: 1px solid #EFEBE2;
}
.img-cell .b button:last-child { border-right: 0; flex: 0 0 26px; }
.img-cell .b button:hover { background: #F0EDE4; }
.img-cell .b button.danger:hover { background: #FBEEE9; color: #8A3B2C; }

/* ---------- new presentation dialog ---------- */
.modal {
  position: fixed; inset: 0; z-index: 40; background: rgba(16,18,22,.74);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 18px 18px; overflow: auto;
}
.modal[hidden] { display: none; }
.modal .panel {
  width: 100%; max-width: 560px; background: #FAF9F5;
  border: 1px solid #DED9CF; border-radius: 5px; padding: 20px 22px 24px;
}
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .expl { margin: 0 0 16px; font-size: 12.5px; color: #6B6558; }
.modal .rows { display: grid; gap: 10px; }
.modal label { display: grid; gap: 4px; font-size: 12px; color: #4A463E; }
.modal input, .modal select {
  font-family: var(--mono); font-size: 12.5px; padding: 8px 10px;
  border: 1px solid #CFC9BC; border-radius: 3px; background: #fff; color: #1A1A18;
}
.modal .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.modal .acts button {
  font-family: var(--mono); font-size: 12px; padding: 9px 13px; cursor: pointer;
  border: 1px solid #CFC9BC; background: #EFEBE2; color: #33302A; border-radius: 3px;
}
.modal .acts button.primary { background: #16181C; border-color: #16181C; color: #EDE8DE; font-weight: 600; }
.modal .out { margin-top: 14px; font-size: 13px; line-height: 1.55; }
.modal .out ol { margin: 6px 0 0; padding-left: 20px; }
.modal .out code { font-family: var(--mono); background: #EDE9DF; padding: 1px 4px; border-radius: 2px; font-size: 12px; }
.modal .good { color: #4F7A4A; font-weight: 600; margin: 0; }
.modal .bad { color: #8A3B2C; font-weight: 600; margin: 0; }

@media (max-width: 1100px) {
  .grid3 { grid-template-columns: 180px 1fr; height: auto; }
  .preview { grid-column: 1 / -1; }
  #md { min-height: 55vh; }
}
