:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #f5f7fb;
  background: #192644;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button {
  background: #353c47;
  color: #fff;
  border: 1px solid #687383;
  border-radius: 5px;
  min-height: 34px;
  padding: 4px 11px;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #485568; }
button:disabled { opacity: .48; cursor: default; }
:focus-visible { outline: 2px solid #8cc9ff; outline-offset: 3px; }

.stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 440px;
  height: 100vh;
  height: 100dvh;
}
.toolbar {
  position: absolute;
  z-index: 3;
  top: 8px;
  left: 12px;
  right: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: .86rem;
}
.file-start { margin-left: 12px; }
.toolbar button[aria-pressed="true"] { background: #c8dfa9; color: #19252d; border-color: #e2efcf; }
.icon-button { display: grid; place-items: center; width: 36px; padding: 0; }
.play-icon { border-block: 8px solid transparent; border-left: 13px solid currentColor; margin-left: 3px; }
.stop-icon, .record-icon { width: 13px; height: 13px; background: currentColor; }
.record-icon { border-radius: 50%; color: #ff9a91; }
.status {
  position: absolute;
  z-index: 2;
  left: 13px;
  top: 48px;
  margin: 0;
  max-width: calc(100% - 26px);
  font-size: .85rem;
  color: #d7e5f8;
  background: #192644;
}

.slide {
  position: absolute;
  top: 13%;
  left: 7%;
  width: 54%;
  height: 61%;
}
.slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.presenter {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(38%, calc(100dvh * .72));
  aspect-ratio: 848 / 1264;
}
.presenter img { position: absolute; width: 100%; height: 100%; display: block; }

.subtitle {
  position: absolute;
  z-index: 1;
  bottom: 4%;
  left: 6.25%;
  right: 4.8%;
  min-height: 2.7em;
  max-height: 5.5em;
  overflow: auto;
  padding: .55em .65em;
  border: 1px solid #e8e8ec;
  border-radius: 10px;
  background: #383737;
  font-size: clamp(1rem, 1.9vw, 1.65rem);
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

dialog {
  color-scheme: light;
  color: #202a39;
  background: #e8e9eb;
  width: min(92vw, 460px);
  max-height: 92dvh;
  border: 1px solid #929caa;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 16px 70px #080f25a6;
}
dialog::backdrop { background: #0a13265c; }
#editor { width: min(92vw, 760px); }
dialog form { display: flex; flex-direction: column; max-height: 91dvh; }
.dialog-header, dialog footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: #d6d8dd;
}
.dialog-header h1 { flex: 1; margin: 0; font-size: 1.1rem; text-align: center; }
.dialog-header .close { font-size: 1.15rem; min-height: 28px; }
.dialog-body { padding: 14px 16px; overflow: auto; margin: 0; }
dialog footer { justify-content: flex-end; flex-wrap: wrap; }
dialog button { color: #202a39; background: #f5f6f7; border-color: #959eab; }
dialog button:hover:not(:disabled) { background: #dee5ee; }
dialog .primary { color: white; background: #24537f; border-color: #24537f; }
dialog .primary:hover:not(:disabled) { background: #173d61; }
dialog label { font-weight: 600; }
dialog input:not([type="range"]), dialog textarea, dialog select {
  width: 100%;
  min-width: 0;
  border: 1px solid #99a3b0;
  border-radius: 4px;
  padding: 5px 8px;
  background: #fff;
  color: #202a39;
}
dialog textarea { display: block; resize: vertical; min-height: 2.7em; }
#saved-list, #copy-title { margin-top: 6px; }
.editor-fields { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); align-items: start; gap: 8px 12px; }
.editor-fields > label, .script-fields > label { padding-top: 5px; }
.script-fields { display: contents; }
.editor-wide { grid-column: 1 / -1; }
.illustration { display: flex; flex-wrap: wrap; gap: 5px 8px; align-items: center; margin-top: 5px; }
.illustration img { width: 54px; height: 36px; object-fit: contain; background: #c7d1dc; }
.illustration span { flex: 1 1 120px; overflow-wrap: anywhere; }
.illustration button { min-height: 28px; }
.illustration, .hint, .message { font-size: .85rem; }
.speed { display: flex; gap: 8px; align-items: center; }
.speed input { flex: 1; min-width: 0; }
.speed output { min-width: 7em; text-align: right; }
.hint, .message { margin: 4px 0 0; }
.message:empty { display: none; }

@media (max-width: 620px) {
  .slide { z-index: 1; top: 94px; left: 5%; width: 90%; height: min(44%, 50vw); }
  .presenter { width: clamp(150px, calc((100dvh - 240px) * .63), 66%); }
  .status { top: 51px; }
}
@media (max-width: 420px) {
  .file-start { margin-left: 0; }
  .toolbar { gap: 3px; }
  .toolbar button { padding-inline: 7px; }
  .icon-button { width: 29px; }
  .editor-fields { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}
@media (max-width: 320px) {
  .status { top: 83px; }
  .slide { top: 119px; }
}
