:root {
  color-scheme: light;
  font-family: "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  background: #fff;
  color: #191a20;
  --surface: #fff;
  --raised: #f5f6f9;
  --border: #e3e5eb;
  --muted: #626775;
  --accent: #505cc2;
  --focus: #606dd9;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, p { margin: 0; }

.workspace { width: min(800px, calc(100% - 48px)); margin-inline: auto; padding-block: 72px 48px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.section-head h1 { font-size: clamp(2rem, 5vw, 2.625rem); line-height: 1.13; font-weight: 650; letter-spacing: -.055em; }
.drop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px 12px 16px;
  border: 1px dashed #cbd0e0;
  border-radius: 10px;
  background: #fafbfe;
}
.drop.dragging { border-color: var(--focus); background: #f0f2ff; }
.drop p { color: var(--muted); font-size: .875rem; line-height: 1.4; }
.drop button { flex: none; }

.primary, .secondary, .danger, .icon-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.25;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover:not(:disabled) { background: #424eae; }
.secondary { background: var(--surface); border-color: var(--border); }
.secondary:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: var(--raised); }
.danger { background: #b52d39; color: #fff; }
.danger:hover:not(:disabled) { background: #982431; }
.icon-button { width: 38px; padding: 0; border-color: var(--border); background: transparent; flex: none; }
.icon { display: inline-block; position: relative; width: 16px; height: 16px; flex: none; }
.upload::before { content: ""; position: absolute; inset: 9px 1px 1px; border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; }
.upload::after { content: "↑"; position: absolute; inset: -4px 0 0; font: 600 17px/16px system-ui; }
.menu::before { content: ""; position: absolute; inset: 7px 1px auto; height: 1.5px; background: currentColor; box-shadow: 0 -4px currentColor, 0 4px currentColor; }
.close::before, .close::after { content: ""; width: 14px; height: 1.5px; background: currentColor; position: absolute; top: 7px; left: 1px; transform: rotate(45deg); }
.close::after { transform: rotate(-45deg); }
.fullscreen { border: 1.5px solid currentColor; border-radius: 3px; }
.fullscreen::before, .fullscreen::after { content: ""; background: #fff; position: absolute; }
.fullscreen::before { inset: 3px -2px; }
.fullscreen::after { inset: -2px 3px; }
.icon-button:hover .fullscreen::before, .icon-button:hover .fullscreen::after { background: var(--raised); }
.pencil::before { content: ""; position: absolute; top: 6px; left: 2px; width: 13px; height: 5px; border: 1.5px solid currentColor; border-radius: 1px 2px 2px 1px; transform: rotate(-45deg); }
.pencil::after { content: ""; position: absolute; bottom: 0; left: 1px; width: 3px; height: 3px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; }
.trash::before { content: ""; position: absolute; inset: 5px 3px 1px; border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 2px 2px; }
.trash::after { content: ""; position: absolute; top: 3px; left: 2px; right: 2px; height: 1.5px; background: currentColor; }
.trash { background: linear-gradient(currentColor, currentColor) center top / 4px 1.5px no-repeat; }

.collection { margin-top: 20px; border-top: 1px solid var(--border); }
.count, .empty { color: var(--muted); font-size: .875rem; }
.empty { padding: 20px 0; }
.deck-row { display: flex; align-items: center; gap: 4px; padding-right: 4px; border-bottom: 1px solid var(--border); }
.deck-row:hover, .deck-row:focus-within { background: #fafbfe; }
.deck {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: start;
  padding: 11px 8px; min-height: 62px; border: 0; background: transparent;
}
.deck-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border: 1px solid #dce0fb; border-radius: 8px; background: #f0f2fd; }
.deck-icon::before { content: ""; width: 15px; height: 12px; border: 1.5px solid #5c65bb; border-radius: 2px; }
.deck-label { min-width: 0; display: grid; gap: 3px; }
.deck-label strong { overflow-wrap: anywhere; font-size: .9375rem; font-weight: 600; }
.deck-label small { color: var(--muted); font-size: .8125rem; }
.deck-action { border-color: transparent; color: var(--muted); }
.deck-action:hover:not(:disabled) { color: #191a20; background: #eef0f6; }
.deck-remove:hover:not(:disabled) { color: #a62c38; background: #fff0f2; }
.status { color: #8a2834; margin-top: 12px; font-size: .875rem; line-height: 1.45; }

dialog { width: min(432px, calc(100% - 32px)); background: var(--surface); color: inherit; border: 1px solid var(--border); border-radius: 14px; padding: 24px; box-shadow: 0 18px 65px #161b3628; }
dialog::backdrop { background: #20243b55; }
dialog h2 { font-size: 1.25rem; letter-spacing: -.025em; }
#filename, #delete-name { color: var(--muted); font-size: .875rem; margin-top: 7px; overflow-wrap: anywhere; }
dialog label { display: block; margin: 20px 0 7px; font-size: .875rem; }
dialog input { width: 100%; padding: 9px 10px; border: 1px solid #cbd0db; border-radius: 8px; color: inherit; background: #fff; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

.viewer { position: fixed; inset: 0; display: flex; background: #f1f2f5; }
.viewer-body { position: relative; flex: 1; min-width: 0; display: flex; overflow: hidden; }
.stage { display: grid; place-items: center; flex: 1; min-width: 0; min-height: 0; position: relative; overflow: hidden; }
.slide-frame { display: grid; place-items: center; width: 100%; height: 100%; overflow: hidden; }
.slide-frame :is(canvas, img) { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-status { position: absolute; margin: 10px; padding: 8px 12px; text-align: center; background: #fff; border: 1px solid var(--border); border-radius: 8px; font-size: .875rem; }
.viewer-start, .viewer-controls, #fullscreen { position: absolute; z-index: 2; }
.viewer-start, .viewer-controls { display: flex; gap: 7px; align-items: center; }
.viewer-start { top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); }
#fullscreen { top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
.viewer-controls { bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); }
.viewer-start button, .viewer-controls button, #fullscreen, #position { background: #fff; box-shadow: 0 1px 4px #1e233522; }
.viewer :is(.viewer-start button, .viewer-controls button, #fullscreen):hover:not(:disabled) { background: var(--raised); }
.viewer-controls button { font-size: 1rem; }
#position { min-width: 52px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px; text-align: center; font-size: .8125rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.sidebar { width: 214px; flex: none; display: flex; flex-direction: column; padding-top: 56px; background: #fff; border-right: 1px solid var(--border); }
.sidebar-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; }
.sidebar h2 { font-size: .875rem; }
.slides { overflow: auto; padding: 0 10px 10px; min-height: 0; }
.slide-button { width: 100%; padding: 7px; margin-bottom: 6px; display: grid; gap: 5px; border: 1px solid transparent; border-radius: 8px; text-align: left; color: var(--muted); background: transparent; font-size: .8125rem; }
.slide-button:hover { background: var(--raised); }
.slide-button[aria-current="page"] { border-color: #aab2ee; background: #f0f2ff; color: #30387e; }
.thumbnail { display: grid; place-items: center; width: 100%; aspect-ratio: 16/9; background: #edeff4; border-radius: 3px; overflow: hidden; }
.thumbnail :is(canvas, img) { display: block; }

@media (max-width: 550px) {
  .workspace { width: calc(100% - 32px); padding-top: 40px; }
  .drop { padding: 10px 11px; gap: 9px; }
  .drop button { padding-inline: 10px; }
  .sidebar { position: absolute; z-index: 1; inset: 0 auto 0 0; width: min(214px, 72vw); }
}

