:root {
  --bg: #06080b;
  --surface: rgba(13, 17, 23, 0.94);
  --surface-raised: rgba(18, 24, 31, 0.96);
  --surface-soft: rgba(255, 255, 255, 0.045);
  --line: rgba(143, 164, 184, 0.18);
  --line-strong: rgba(143, 164, 184, 0.3);
  --text: #edf5f7;
  --text-muted: #8d9da8;
  --text-dim: #81939e;
  --cyan: #23d7e5;
  --cyan-bright: #68f4ff;
  --cyan-soft: rgba(35, 215, 229, 0.12);
  --magenta: #ff4fd8;
  --danger: #ff5575;
  --success: #50e6a5;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
  --radius: 10px;
  --ui-font: 'Noto Sans JP', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --display-font: 'Orbitron', 'Noto Sans JP', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  margin: -1px !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.desktop-app-only {
  display: none !important;
}

body.desktop-app .file-menu-popover .desktop-app-only {
  display: grid !important;
}

body.desktop-app .recent-projects-dialog.desktop-app-only[open] {
  display: block !important;
}

body.desktop-app .recovery-banner.desktop-app-only:not([hidden]) {
  display: flex !important;
}

body.desktop-app.presentation-mode .recovery-banner.desktop-app-only {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui-font);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
summary {
  font: inherit;
}

button,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
.slide-thumbnail:focus-visible {
  outline: 2px solid var(--cyan-bright);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed !important;
  opacity: 0.35;
}

kbd {
  display: inline-flex;
  min-width: 22px;
  min-height: 20px;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-color: rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: #c8d3d9;
  font: 600 11px/1 var(--ui-font);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

#glitchCanvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100vw;
  height: 100vh;
  opacity: 0.34;
  transition: opacity 180ms ease;
}

.app-shell {
  display: grid;
  grid-template: 64px minmax(0, 1fr) / 224px minmax(440px, 1fr) 292px;
  grid-template-areas:
    "topbar topbar topbar"
    "slides workspace inspector";
  width: 100vw;
  height: 100vh;
  background:
    radial-gradient(circle at 50% 42%, rgba(35, 215, 229, 0.045), transparent 42%),
    rgba(3, 5, 8, 0.68);
}

.topbar {
  grid-area: topbar;
  z-index: 30;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 12, 16, 0.96);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.025);
}

.document-meta {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 12px;
}

.document-name {
  position: relative;
  display: flex;
  min-width: 120px;
  max-width: min(360px, 34vw);
  flex: 0 1 360px;
}

.document-name input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 9px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #cfd9de;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-name input:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.document-name input:focus-visible {
  border-color: rgba(104, 244, 255, 0.62);
  outline: 2px solid rgba(104, 244, 255, 0.2);
  outline-offset: 1px;
  background: rgba(35, 215, 229, 0.055);
  color: #f2fdff;
}

.save-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 11px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(80, 230, 165, 0.55);
}

.save-status.is-saving .status-dot {
  background: #ffc857;
  box-shadow: 0 0 8px rgba(255, 200, 87, 0.55);
}

.save-status.is-dirty .status-dot {
  background: #ffc857;
  box-shadow: 0 0 8px rgba(255, 200, 87, 0.55);
}

.save-status.is-error {
  color: var(--danger);
}

.save-status.is-error .status-dot {
  background: var(--danger);
}

.topbar-actions,
.history-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.history-actions {
  gap: 4px;
  padding-right: 8px;
  border-right: 1px solid var(--line);
}

.icon-button,
.secondary-button,
.primary-button,
.canvas-toolbar button,
.property-panel button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: #d2dde2;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.icon-button {
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 17px;
}

.secondary-button,
.primary-button {
  padding: 0 12px;
}

.compact-button {
  min-height: 34px;
  font-size: 12px;
}

.icon-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.canvas-toolbar button:hover:not(:disabled),
.property-panel button:hover:not(:disabled) {
  border-color: rgba(104, 244, 255, 0.42);
  background: var(--cyan-soft);
  color: var(--cyan-bright);
}

.primary-button {
  min-height: 38px;
  border-color: rgba(104, 244, 255, 0.7);
  background: linear-gradient(135deg, #29cbd8, #15a9bb);
  color: #031012;
  font-weight: 700;
  box-shadow: 0 5px 20px rgba(35, 215, 229, 0.14);
}

.primary-button:hover {
  background: linear-gradient(135deg, #68f4ff, #23d7e5);
  transform: translateY(-1px);
}

.play-icon {
  font-size: 10px;
}

.file-menu {
  position: relative;
}

.file-menu summary {
  list-style: none;
  cursor: pointer;
}

.file-menu summary::-webkit-details-marker {
  display: none;
}

.file-menu[open] summary {
  border-color: rgba(104, 244, 255, 0.5);
  background: var(--cyan-soft);
  color: var(--cyan-bright);
}

.file-menu-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 100;
  display: flex;
  width: 260px;
  flex-direction: column;
  gap: 2px;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(16, 21, 27, 0.98);
  box-shadow: var(--shadow);
}

.file-menu-popover button {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  min-height: 40px;
  align-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #cdd7dc;
  cursor: pointer;
  text-align: left;
}

.file-menu-popover button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.file-menu-popover button small {
  color: var(--text-dim);
  font-size: 10px;
}

.file-menu-popover .danger-menu-item {
  color: #ff91a7;
}

.file-menu-popover small {
  white-space: nowrap;
}

.menu-separator {
  height: 1px;
  margin: 5px 4px;
  background: var(--line);
}

.slide-panel,
.property-panel {
  min-height: 0;
  border-color: var(--line);
  background: var(--surface);
}

.slide-panel {
  grid-area: slides;
  z-index: 12;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--line);
}

.panel-heading,
.property-panel-header {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--cyan);
  font: 600 8px/1.2 var(--display-font);
  letter-spacing: 0.2em;
}

.panel-heading h2,
.property-panel-header h2,
.dialog-header h2 {
  color: #e7eff2;
  font-size: 14px;
  font-weight: 700;
}

.add-slide-button {
  border-color: rgba(35, 215, 229, 0.3);
  color: var(--cyan-bright);
}

.slide-list {
  overflow: auto;
  padding: 12px 12px 18px;
  scrollbar-color: rgba(143, 164, 184, 0.35) transparent;
  scrollbar-width: thin;
}

.slide-thumbnail {
  position: relative;
  display: grid;
  width: 100%;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 7px;
  margin-bottom: 10px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.slide-thumbnail:hover {
  background: rgba(255, 255, 255, 0.035);
  color: #dce5e8;
}

.slide-thumbnail.is-active {
  border-color: rgba(35, 215, 229, 0.44);
  background: rgba(35, 215, 229, 0.07);
  color: var(--cyan-bright);
}

.slide-thumbnail.is-dragging {
  opacity: 0.42;
}

.slide-thumbnail.drop-before::before,
.slide-thumbnail.drop-after::after {
  position: absolute;
  right: 6px;
  left: 6px;
  height: 3px;
  border-radius: 99px;
  background: var(--cyan-bright);
  box-shadow: 0 0 10px rgba(35, 215, 229, 0.75);
  content: "";
}

.slide-thumbnail.drop-before::before { top: -6px; }
.slide-thumbnail.drop-after::after { bottom: -6px; }

.slide-number {
  padding-top: 3px;
  font: 600 10px/1 var(--display-font);
  text-align: center;
}

.slide-preview-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  background: #071012;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.24);
}

.slide-thumbnail.is-active .slide-preview-frame {
  border-color: rgba(104, 244, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(35, 215, 229, 0.16), 0 5px 16px rgba(0, 0, 0, 0.3);
}

.slide-preview-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 720px;
  transform: scale(var(--preview-scale, 0.13));
  transform-origin: top left;
  color: #00f2ff;
  font-family: 'Courier New', monospace;
}

.preview-element {
  position: absolute;
  overflow: hidden;
}

.preview-element.text {
  min-width: 50px;
  min-height: 30px;
  padding: 5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-element.shape {
  border: 2px solid #00f2ff;
  background: rgba(0, 242, 255, 0.2);
}

.preview-element.image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
}

.slide-actions .icon-button {
  width: 100%;
}

.danger-button:hover:not(:disabled) {
  border-color: rgba(255, 85, 117, 0.45);
  background: rgba(255, 85, 117, 0.1);
  color: #ff91a7;
}

.workspace {
  grid-area: workspace;
  position: relative;
  z-index: 2;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 54px minmax(0, 1fr) 32px;
  background: rgba(5, 8, 11, 0.28);
}

.canvas-toolbar {
  z-index: 14;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 20, 0.91);
}

.toolbar-group,
.slide-nav,
.color-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-label,
.color-control > span {
  margin-right: 3px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.canvas-toolbar button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.canvas-toolbar .icon-button {
  width: 32px;
  min-width: 32px;
  padding: 0;
  font-size: 20px;
}

.tool-icon {
  display: inline-grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 1px solid rgba(104, 244, 255, 0.22);
  border-radius: 5px;
  color: var(--cyan-bright);
  font: 600 11px/1 var(--display-font);
}

.toolbar-divider {
  width: 1px;
  height: 26px;
  background: var(--line);
}

.toolbar-spacer {
  min-width: 8px;
  flex: 1 1 auto;
}

.color-control input[type="color"] {
  width: 30px;
  height: 30px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.slide-nav {
  flex: 0 0 auto;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

#slideIndicator {
  min-width: 54px;
  color: #d9e4e8;
  font: 600 11px/1 var(--display-font);
  text-align: center;
}

.workspace-canvas {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(35, 215, 229, 0.055), transparent 55%),
    rgba(2, 4, 7, 0.42);
}

.canvas-grid {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image:
    linear-gradient(rgba(35, 215, 229, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 215, 229, 0.025) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, #000 0, transparent 76%);
  pointer-events: none;
}

.slide-container {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 1280px;
  height: 720px;
  overflow: hidden;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  border: 1px solid rgba(104, 244, 255, 0.68);
  background: rgba(2, 18, 20, 0.68);
  box-shadow: 0 0 0 1px rgba(35, 215, 229, 0.08), 0 24px 70px rgba(0, 0, 0, 0.58), 0 0 42px rgba(35, 215, 229, 0.06);
  color: #00f2ff;
  font-family: 'Courier New', Courier, monospace;
}

.empty-slide-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  color: rgba(155, 214, 219, 0.42);
  text-align: center;
  pointer-events: none;
}

.empty-slide-hint strong {
  color: rgba(183, 235, 239, 0.62);
  font: 600 28px/1.3 var(--ui-font);
}

.empty-slide-hint span {
  font: 400 16px/1.5 var(--ui-font);
}

.slide-element {
  position: absolute;
  user-select: none;
  cursor: move;
}

.slide-element:focus-visible {
  outline: 4px solid var(--cyan-bright);
  outline-offset: 3px;
}

.slide-element.selected {
  outline: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(35, 215, 229, 0.9), 0 0 18px rgba(35, 215, 229, 0.42);
}

.slide-element img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.slide-element.image {
  background: rgba(1, 5, 8, 0.78);
  border: 1px solid #00f2ff;
}

.slide-element.image.is-cropping {
  outline: 3px solid var(--magenta);
  outline-offset: 2px;
  cursor: grab;
}

.slide-element.image.is-cropping:active { cursor: grabbing; }

.crop-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  background-image:
    linear-gradient(90deg, transparent 33.1%, rgba(255,255,255,.72) 33.2%, rgba(255,255,255,.72) 33.5%, transparent 33.6%, transparent 66.4%, rgba(255,255,255,.72) 66.5%, rgba(255,255,255,.72) 66.8%, transparent 66.9%),
    linear-gradient(transparent 33.1%, rgba(255,255,255,.72) 33.2%, rgba(255,255,255,.72) 33.5%, transparent 33.6%, transparent 66.4%, rgba(255,255,255,.72) 66.5%, rgba(255,255,255,.72) 66.8%, transparent 66.9%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.75), inset 0 0 60px rgba(0,0,0,.18);
  pointer-events: none;
}

.resize-handle {
  position: absolute;
  z-index: 20;
  width: 14px;
  height: 14px;
  border: 2px solid #071012;
  border-radius: 3px;
  background: var(--cyan-bright);
  box-shadow: 0 0 0 1px #fff, 0 0 10px rgba(35, 215, 229, 0.5);
}

.resize-handle.nw { top: -7px; left: -7px; cursor: nwse-resize; }
.resize-handle.ne { top: -7px; right: -7px; cursor: nesw-resize; }
.resize-handle.sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.resize-handle.se { right: -7px; bottom: -7px; cursor: nwse-resize; }

.slide-element.text {
  display: flex;
  min-width: 50px;
  min-height: 30px;
  padding: 5px;
  border: 1px dashed transparent;
  outline: none;
  font-size: 24px;
}

.text-content {
  width: 100%;
  height: auto;
  outline: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.slide-element.text:hover {
  border-color: rgba(35, 215, 229, 0.34);
  background: rgba(35, 215, 229, 0.055);
}

.glitch-text {
  animation: none;
}

.gaming-text-fx {
  background: linear-gradient(90deg, #ff315d, #ffd23f, #2cff88, #34efff, #6574ff, #ff43de, #ff315d);
  background-size: 400%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gamingColor 3s linear infinite;
}

@keyframes gamingColor {
  from { background-position: 0%; }
  to { background-position: 400%; }
}

@keyframes textGlitch {
  0%, 12%, 22%, 34%, 48%, 62%, 78%, 92%, 100% { text-shadow: none; transform: translate(0); }
  10% { text-shadow: 3px 0 #ff315d, -3px 0 #315cff; transform: translate(-1px, 0); }
  60% { text-shadow: -2px 0 #ff315d, 2px 0 #315cff; transform: translate(1px, 0); }
  90% { text-shadow: 2px 0 #ff315d, -2px 0 #315cff; transform: translate(0, 1px); }
}

.slide-element.shape {
  position: absolute;
  overflow: hidden;
  border: 2px solid #00f2ff;
  background: rgba(0, 242, 255, 0.2);
  animation: none;
}

@keyframes shapeGlitch {
  0%, 44%, 50%, 100% { opacity: 1; transform: translate(0); }
  46% { opacity: 0.78; transform: translate(1px, 1px); }
  48% { opacity: 1; transform: translate(-1px, -1px); }
}

.slide-element.shape::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 0, 0, 0.14) 2px, rgba(0, 0, 0, 0.14) 4px);
  content: "";
  pointer-events: none;
}

.workspace-status {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: rgba(10, 13, 17, 0.94);
  color: var(--text-dim);
  font-size: 10px;
  white-space: nowrap;
}

.workspace-status kbd {
  min-height: 17px;
  padding: 1px 4px;
  font-size: 9px;
}

.zoom-level {
  margin-left: auto;
  color: var(--text-muted);
  font: 600 10px/1 var(--display-font);
}

.property-panel {
  grid-area: inspector;
  z-index: 12;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--line);
}

.property-panel-header {
  flex: 0 0 auto;
}

.inspector-tabs {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.14);
}

.property-panel .inspector-tabs button {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
}

.property-panel .inspector-tabs button[aria-selected="true"] {
  border-color: rgba(35, 215, 229, 0.34);
  background: var(--cyan-soft);
  color: var(--cyan-bright);
  box-shadow: inset 0 -2px 0 var(--cyan);
}

.inspector-panel-body {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.selection-status {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 9px;
}

.property-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  place-items: center;
  border: 1px solid rgba(35, 215, 229, 0.24);
  border-radius: 14px 4px 14px 4px;
  background: rgba(35, 215, 229, 0.06);
  color: var(--cyan);
  font-size: 19px;
}

.property-empty h3 {
  margin-bottom: 7px;
  color: #c9d4d9;
  font-size: 13px;
}

.property-empty p {
  max-width: 210px;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.7;
}

.property-content {
  flex: 1;
  overflow: auto;
  scrollbar-color: rgba(143, 164, 184, 0.35) transparent;
  scrollbar-width: thin;
}

.property-section {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.section-title {
  color: var(--text-dim);
  font: 600 9px/1 var(--display-font);
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.control-hint {
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.65;
}

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--text-muted);
  font-size: 11px;
}

.font-preview {
  display: grid;
  min-width: 0;
  min-height: 48px;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  gap: 3px;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid rgba(104, 244, 255, 0.18);
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(104, 244, 255, 0.055), transparent 64%),
    rgba(0, 0, 0, 0.18);
}

.font-preview > span,
.font-preview > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-preview > span {
  color: #edf7f8;
  font-size: 17px;
  line-height: 1.1;
}

.font-preview > small {
  color: var(--text-dim);
  font-family: var(--ui-font);
  font-size: 9px;
  letter-spacing: 0.02em;
}

.font-source-hint {
  margin-top: -3px;
}

.property-panel select,
.property-panel input[type="text"],
.property-panel input[type="number"] {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.2);
  color: #dbe5e9;
}

.size-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  align-items: center;
  gap: 10px;
}

.size-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.size-control input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
}

.number-field {
  position: relative;
}

.number-field input {
  padding-right: 27px !important;
}

.number-field span {
  position: absolute;
  top: 50%;
  right: 9px;
  color: var(--text-dim);
  font-size: 10px;
  transform: translateY(-50%);
  pointer-events: none;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.toggle-row > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.toggle-row strong {
  color: #d5dfe4;
  font-size: 11px;
  font-weight: 600;
}

.toggle-row small {
  color: var(--text-dim);
  font-size: 9px;
}

.toggle-row input {
  width: 34px;
  height: 18px;
  accent-color: var(--cyan);
}

.button-grid {
  display: grid;
  gap: 6px;
}

.button-grid.three-column { grid-template-columns: repeat(3, 1fr); }
.button-grid.two-column { grid-template-columns: repeat(2, 1fr); }

.segmented-control button[aria-pressed="true"] {
  border-color: rgba(35, 215, 229, 0.48);
  background: var(--cyan-soft);
  color: var(--cyan-bright);
  box-shadow: inset 0 -2px 0 var(--cyan);
}

.crop-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 11px;
  border: 1px solid rgba(255, 79, 216, 0.28);
  border-radius: 8px;
  background: rgba(255, 79, 216, 0.045);
}

.crop-controls[hidden] { display: none; }

.crop-controls input[type="range"] {
  width: 100%;
  accent-color: var(--magenta);
}

.range-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.range-label output {
  color: var(--cyan-bright);
  font: 600 10px/1 var(--display-font);
}

.property-panel button {
  min-width: 0;
  min-height: 34px;
  padding: 0 6px;
  font-size: 10px;
}

.sound-inspector {
  overflow: auto;
  scrollbar-color: rgba(143, 164, 184, 0.35) transparent;
  scrollbar-width: thin;
}

.sound-intro h3 {
  color: #e0eaee;
  font-size: 14px;
}

.sound-current-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(35, 215, 229, 0.25);
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(35, 215, 229, 0.1), rgba(255, 79, 216, 0.045));
}

.sound-current-card span {
  color: var(--cyan);
  font: 600 9px/1.35 var(--display-font);
  letter-spacing: 0.06em;
}

.sound-current-card strong {
  overflow: hidden;
  color: #e9f2f4;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sound-action-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 6px;
}

#addSoundCueBtn {
  border-color: rgba(35, 215, 229, 0.4);
  background: var(--cyan-soft);
  color: var(--cyan-bright);
}

.sound-volume-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.sound-volume-label output {
  color: var(--cyan-bright);
  font: 600 10px/1 var(--display-font);
}

#bgmVolumeInput {
  width: 100%;
  accent-color: var(--cyan);
}

.sound-preview {
  width: 100%;
  height: 38px;
  color-scheme: dark;
}

.sound-cue-section {
  min-height: 180px;
}

.sound-cue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sound-cue-item {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
}

.sound-cue-item.is-active {
  border-color: rgba(35, 215, 229, 0.4);
  background: rgba(35, 215, 229, 0.07);
}

.sound-cue-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sound-cue-copy {
  min-width: 0;
}

.sound-cue-copy strong,
.sound-cue-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sound-cue-copy strong {
  color: #dfe9ec;
  font-size: 11px;
}

.sound-cue-copy small {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 9px;
}

.sound-cue-range {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(35, 215, 229, 0.11);
  color: var(--cyan);
  font: 600 8px/1.2 var(--display-font);
}

.sound-cue-controls {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 34px;
  gap: 5px;
}

.sound-cue-controls input {
  height: 32px !important;
  padding-inline: 7px !important;
}

.sound-cue-controls button {
  min-height: 32px;
}

.sound-cue-delete {
  color: #ff91a7;
}

.sound-cue-empty {
  display: grid;
  min-height: 128px;
  place-items: center;
  gap: 8px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  color: var(--text-dim);
  text-align: center;
}

.sound-cue-empty span {
  color: rgba(35, 215, 229, 0.58);
  font-size: 24px;
}

.sound-cue-empty p {
  max-width: 200px;
  font-size: 10px;
  line-height: 1.6;
}

.slide-audio-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  min-width: 22px;
  padding: 3px 5px;
  border: 1px solid rgba(35, 215, 229, 0.36);
  border-radius: 999px;
  background: rgba(6, 8, 11, 0.9);
  color: var(--cyan-bright);
  font: 600 8px/1 var(--display-font);
  text-align: center;
}

.slide-audio-badge.is-silence {
  border-color: rgba(255, 85, 117, 0.38);
  color: #ff91a7;
}

.context-menu {
  position: fixed;
  z-index: 300;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(13, 18, 24, 0.98);
  box-shadow: var(--shadow);
}

.context-menu-item {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #dce7eb;
  cursor: pointer;
}

.context-menu-item:hover {
  background: var(--cyan-soft);
  color: var(--cyan-bright);
}

.snap-guide {
  position: absolute;
  z-index: 9999;
  display: none;
  background: var(--magenta);
  box-shadow: 0 0 8px var(--magenta);
  pointer-events: none;
}

.snap-guide-x { top: 0; width: 1px; height: 100%; }
.snap-guide-y { left: 0; width: 100%; height: 1px; }

.shortcut-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #11171d;
  color: var(--text);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
}

.recent-projects-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 48px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #11171d;
  color: var(--text);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
}

.recent-projects-dialog::backdrop {
  background: rgba(1, 3, 5, 0.76);
  backdrop-filter: blur(5px);
}

.recent-projects-description {
  padding: 14px 18px 12px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.65;
}

.recent-projects-list {
  display: flex;
  max-height: min(440px, 56vh);
  flex-direction: column;
  gap: 6px;
  padding: 0 12px 14px;
  overflow-y: auto;
  scrollbar-color: rgba(143, 164, 184, 0.35) transparent;
  scrollbar-width: thin;
}

.recent-projects-list:not(:empty) + .recent-projects-empty {
  display: none;
}

.recent-project-item {
  display: grid;
  width: 100%;
  min-height: 58px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  color: #dce7eb;
  cursor: pointer;
  text-align: left;
}

.recent-project-item:hover,
.recent-project-item:focus-visible {
  border-color: rgba(104, 244, 255, 0.42);
  background: var(--cyan-soft);
}

.recent-project-item strong,
.recent-project-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-project-item small {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 10px;
}

.recent-projects-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--text-dim);
  text-align: center;
}

.recent-projects-empty > span {
  color: var(--cyan);
  font-size: 24px;
}

.recovery-banner {
  position: fixed;
  top: 76px;
  left: 50%;
  z-index: 450;
  width: min(720px, calc(100vw - 32px));
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 200, 87, 0.46);
  border-radius: 10px;
  background: rgba(24, 20, 12, 0.97);
  color: #f7e7bd;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.48);
}

.recovery-banner-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 200, 87, 0.38);
  border-radius: 8px;
  color: #ffc857;
  font-size: 18px;
}

.recovery-banner-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.recovery-banner-copy strong {
  color: #fff3d2;
  font-size: 12px;
}

.recovery-banner-copy span {
  overflow: hidden;
  color: #cabf9f;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recovery-banner-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.shortcut-dialog::backdrop {
  background: rgba(1, 3, 5, 0.72);
  backdrop-filter: blur(4px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.shortcut-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 13px 20px;
  padding: 20px;
  color: #c9d4d9;
  font-size: 12px;
}

.shortcut-grid kbd {
  justify-self: end;
}

.toast {
  position: fixed;
  bottom: 46px;
  left: 50%;
  z-index: 500;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid rgba(104, 244, 255, 0.3);
  border-radius: 8px;
  background: rgba(15, 21, 27, 0.96);
  color: #dce8eb;
  box-shadow: var(--shadow);
  font-size: 11px;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.presentation-hud {
  position: fixed;
  right: 24px;
  bottom: 20px;
  z-index: 400;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 8px 11px;
  border: 1px solid rgba(104, 244, 255, 0.22);
  border-radius: 999px;
  background: rgba(3, 9, 12, 0.7);
  color: rgba(220, 243, 245, 0.68);
  font-size: 9px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.presentation-progress {
  width: 80px;
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
}

.presentation-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--cyan-bright);
  transition: width 180ms ease;
}

body.presentation-mode {
  cursor: none;
}

body.presentation-mode #glitchCanvas {
  opacity: 1;
}

body.presentation-mode .app-shell {
  display: block;
  background: transparent;
}

body.presentation-mode .topbar,
body.presentation-mode .slide-panel,
body.presentation-mode .property-panel,
body.presentation-mode .canvas-toolbar,
body.presentation-mode .workspace-status,
body.presentation-mode .canvas-grid {
  display: none !important;
}

body.presentation-mode .workspace,
body.presentation-mode .workspace-canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  background: transparent;
}

body.presentation-mode .slide-container {
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.presentation-mode .slide-element {
  cursor: default;
}

body.presentation-mode .glitch-text {
  animation: textGlitch 1.8s infinite linear;
}

body.presentation-mode .slide-element.shape {
  animation: shapeGlitch 4s infinite;
}

body.presentation-mode .presentation-hud {
  display: flex;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 190px minmax(390px, 1fr) 252px;
  }

  .button-label { display: none; }
  .workspace-status span:nth-child(3) { display: none; }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 164px minmax(360px, 1fr) 224px;
  }

  .topbar { gap: 10px; padding-inline: 10px; }
  .document-meta { gap: 6px; }
  .save-status { display: none; }
  .canvas-toolbar { gap: 6px; padding-inline: 8px; }
  .toolbar-label, .color-control > span { display: none; }
  .canvas-toolbar button { padding-inline: 7px; }
  .property-section, .panel-heading, .property-panel-header { padding-inline: 12px; }
  .workspace-status span:nth-child(2) { display: none; }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 140px minmax(0, 1fr) 208px;
  }

  .document-meta,
  #shortcutHelpBtn {
    display: none;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .slide-list {
    padding-inline: 7px;
  }

  .slide-thumbnail {
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 4px;
    padding: 5px;
  }

  .canvas-toolbar {
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .toolbar-spacer {
    display: none;
  }

  .slide-nav {
    margin-left: auto;
  }

  .workspace-status span:not(.zoom-level) {
    display: none;
  }
}

@media (max-width: 600px) {
  .app-shell {
    grid-template-columns: 112px minmax(0, 1fr) 188px;
  }

  .panel-heading,
  .property-panel-header {
    padding-inline: 8px;
  }

  .property-section {
    padding-inline: 10px;
  }

  .slide-number {
    display: none;
  }

  .slide-thumbnail {
    display: block;
  }

  .history-actions {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  #glitchCanvas {
    opacity: 0.08;
  }
}
