@font-face {
  font-family: "CoFo Sans";
  src: url("./fonts/CoFoSans-Regular.ttf?v=cofo-figma-fonts-1") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "CoFo Sans";
  src:
    url("./fonts/CoFoSans-Medium.ttf?v=cofo-figma-fonts-1") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "CoFo Sans";
  src:
    url("./fonts/CoFoSans-Medium.ttf?v=cofo-figma-fonts-1") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "CoFo Sans";
  src:
    url("./fonts/CoFoSans-Medium.ttf?v=cofo-figma-fonts-1") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "CoFo Sans";
  src:
    url("./fonts/CoFoSans-Medium.ttf?v=cofo-figma-fonts-1") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "CoFo Sans";
  src:
    url("./fonts/CoFoSans-Medium.ttf?v=cofo-figma-fonts-1") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f3f4f6;
  color: #111827;
  font-family:
    "CoFo Sans", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.start-screen {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 24px;
  min-height: 100vh;
  padding: 116px 32px 32px;
}

.start-topbar {
  display: flex;
  width: calc(100% - 64px);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.user-chip {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.user-chip div:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.user-chip strong,
.user-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip strong {
  font-size: 14px;
}

.user-chip span {
  color: #6b7280;
  font-size: 12px;
}

.connection-status {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  padding: 9px 12px;
}

.connection-status:hover {
  border-color: #111827;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #9ca3af;
}

.connection-status.connected .status-dot {
  background: #16a34a;
}

.connection-status.disconnected .status-dot {
  background: #ef4444;
}

.connection-status.warning .status-dot {
  background: #f59e0b;
}

.connection-status.checking .status-dot {
  background: #2563eb;
}

.template-choice {
  display: grid;
  gap: 28px;
  width: min(100%, 900px);
}

.start-copy {
  display: grid;
  gap: 8px;
}

.start-copy p,
.start-copy h1 {
  margin: 0;
}

.start-copy p {
  color: #6b7280;
  font-size: 15px;
}

.type-status {
  min-height: 22px;
  margin: 0;
  color: #6b7280;
  line-height: 1.4;
}

.type-status:empty,
.direction-status:empty {
  display: none;
}

.start-copy h1 {
  font-size: clamp(32px, 6vw, 64px);
  line-height: 1;
  letter-spacing: 0;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
}

.template-card {
  display: grid;
  min-height: 180px;
  align-items: end;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  padding: 24px;
  text-align: left;
}

.template-card:hover {
  border-color: #111827;
  box-shadow: 0 12px 35px rgba(17, 24, 39, 0.08);
}

.template-card span {
  max-width: 260px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}

.direction-step {
  display: grid;
  gap: 18px;
}

.step-enter-right {
  animation: step-enter-right 0.24s ease both;
}

.step-enter-left {
  animation: step-enter-left 0.24s ease both;
}

.step-exit-left {
  animation: step-exit-left 0.2s ease both;
}

.step-exit-right {
  animation: step-exit-right 0.2s ease both;
}

.screen-enter-right {
  animation: screen-enter-right 0.28s ease both;
}

.screen-enter-left {
  animation: screen-enter-left 0.28s ease both;
}

.screen-exit-left {
  animation: screen-exit-left 0.24s ease both;
}

.screen-exit-right {
  animation: screen-exit-right 0.24s ease both;
}

@keyframes step-enter-right {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes step-enter-left {
  from {
    opacity: 0;
    transform: translateX(-28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes step-exit-left {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-24px);
  }
}

@keyframes step-exit-right {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(24px);
  }
}

@keyframes screen-enter-right {
  from {
    opacity: 0;
    transform: translateX(36px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes screen-enter-left {
  from {
    opacity: 0;
    transform: translateX(-36px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes screen-exit-left {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-32px);
  }
}

@keyframes screen-exit-right {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(32px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .step-enter-right,
  .step-enter-left,
  .step-exit-left,
  .step-exit-right,
  .screen-enter-right,
  .screen-enter-left,
  .screen-exit-left,
  .screen-exit-right {
    animation: none;
  }
}

.direction-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.direction-head p,
.direction-head h2,
.direction-status {
  margin: 0;
}

.direction-head p {
  color: #6b7280;
  font-size: 14px;
}

.direction-head h2 {
  margin-top: 4px;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1;
}

.direction-back {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  padding: 0;
}

.direction-status {
  min-height: 22px;
  color: #6b7280;
  line-height: 1.4;
}

.inline-loader {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(13, 18, 38, 0.72);
  box-shadow:
    0 18px 45px rgba(4, 8, 23, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 16px 18px;
  backdrop-filter: blur(18px);
}

.inline-loader-icon {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  font-size: 22px;
  font-weight: 900;
}

.inline-loader-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.inline-loader-copy strong {
  color: #ffffff;
  font-size: 16px;
  line-height: 1.2;
}

.inline-loader-copy span {
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.35;
}

.inline-loader-action {
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  cursor: pointer;
  margin-top: 6px;
  padding: 8px 12px;
}

.inline-loader-action:hover {
  border-color: rgba(110, 231, 255, 0.75);
  background: rgba(255, 255, 255, 0.16);
}

.inline-loader-spin {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: #8bb7ff;
  border-radius: 999px;
  animation: loader-spin 0.8s linear infinite;
}

.inline-loader.success .inline-loader-icon {
  background: #22c55e;
  color: #052e16;
}

.inline-loader.error .inline-loader-icon {
  background: #ef4444;
  color: #ffffff;
}

.direction-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.direction-card {
  display: grid;
  min-height: 132px;
  align-items: end;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  padding: 20px;
  text-align: left;
}

.direction-card:hover {
  border-color: #111827;
  box-shadow: 0 12px 35px rgba(17, 24, 39, 0.08);
}

.direction-card span {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.12;
}

.history-panel {
  display: grid;
  gap: 12px;
  border-top: 1px solid #d1d5db;
  padding-top: 18px;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-head h2 {
  margin: 0;
  font-size: 18px;
}

.history-head span {
  color: #6b7280;
  font-size: 13px;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-empty {
  border: 1px dashed #d1d5db;
  color: #6b7280;
  padding: 14px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: stretch;
}

.history-open,
.history-copy,
.history-delete {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
}

.history-open {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  text-align: left;
}

.history-open:hover,
.history-copy:hover,
.history-delete:hover {
  border-color: #111827;
}

.history-open span {
  color: #6b7280;
  font-size: 13px;
}

.history-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.history-info strong,
.history-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-preview {
  position: relative;
  overflow: hidden;
  width: 112px;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(209, 213, 219, 0.72);
  border-radius: 10px;
  background: #ffffff;
}

.history-preview.empty {
  display: grid;
  place-items: center;
  color: #d1d5db;
  font-size: 24px;
  font-weight: 800;
}

.history-preview .thumb-preview-slide {
  width: 100%;
  height: 100%;
}

.history-copy,
.history-delete {
  display: grid;
  width: 42px;
  place-items: center;
}

.history-copy svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.history-delete {
  font-size: 22px;
}

.editor-bar {
  display: flex;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid #d1d5db;
  background: #ffffff;
  padding: 12px 16px;
}

.back-button {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  padding: 0;
}

.back-icon-button {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
}

.back-icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.export-button {
  margin-left: auto;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  padding: 8px 12px;
}

.duplicate-deck-button {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  padding: 8px 12px;
}

.icon-text-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-text-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.export-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.back-button:hover {
  border-color: #111827;
}

.export-button:hover,
.duplicate-deck-button:hover {
  border-color: #111827;
}

.editor-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 280px;
  min-height: 0;
  overflow: hidden;
}

.template-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid #d1d5db;
  background: #ffffff;
  padding: 16px;
}

.template-panel h2 {
  margin: 0;
  font-size: 18px;
}

.template-panel > h2,
.template-panel > .figma-status {
  display: none;
}

.ai-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  border-left: 1px solid #d1d5db;
  background: #ffffff;
  padding: 16px;
}

.slide-settings-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  border-left: 1px solid #d1d5db;
  background: #ffffff;
  padding: 16px;
}

.slide-settings-section,
.slide-settings-empty {
  display: grid;
  gap: 10px;
}

.slide-settings-empty h2,
.slide-settings-empty p {
  margin: 0;
}

.slide-settings-empty h2 {
  font-size: 18px;
  line-height: 1.2;
}

.slide-settings-empty p {
  color: #6b7280;
  font-size: 13px;
  line-height: 1.35;
}

.slide-settings-section {
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.slide-settings-section-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  width: 100%;
  align-items: center;
  justify-items: start;
  gap: 10px;
  border: 0;
  background: transparent;
  color: #111827;
  cursor: pointer;
  font: 700 14px/1 "CoFo Sans", Inter, system-ui, sans-serif;
  height: 42px;
  padding: 0 14px;
  text-align: left;
}

.slide-settings-section-toggle span {
  display: flex;
  height: 16px;
  align-items: center;
  line-height: 1;
  transform: translateY(1px);
}

.slide-settings-section-toggle svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  align-self: center;
  display: block;
  justify-self: end;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transform: translateY(1px);
  transition: transform 0.24s ease;
}

.slide-settings-section.collapsed .slide-settings-section-toggle svg {
  transform: translateY(1px) rotate(-90deg);
}

.slide-settings-section-body {
  display: grid;
  gap: 8px;
  max-height: 620px;
  opacity: 1;
  overflow: hidden;
  transform: translateY(0);
  transition:
    max-height 0.28s ease,
    opacity 0.22s ease,
    transform 0.26s ease,
    padding 0.26s ease;
  padding: 0 10px 10px;
}

.slide-settings-section-body > * {
  min-height: 0;
}

.slide-settings-section-body p {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.35;
}

.slide-settings-section.collapsed .slide-settings-section-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
  transform: translateY(-4px);
}

.settings-action {
  display: grid;
  width: 100%;
  min-height: 38px;
  place-items: center;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  cursor: pointer;
  font: 700 12px/1 "CoFo Sans", Inter, system-ui, sans-serif;
  padding: 10px 12px;
  text-align: center;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.settings-action:hover {
  transform: translateY(-1px);
}

.settings-action input {
  display: none;
}

.ai-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-panel h2 {
  margin: 0;
  font-size: 18px;
}

.ai-panel-head span,
.ai-panel label span,
.ai-status {
  color: #6b7280;
  font-size: 13px;
}

.ai-panel label {
  display: grid;
  gap: 7px;
}

.ai-panel textarea {
  width: 100%;
  min-height: 156px;
  resize: vertical;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font: inherit;
  line-height: 1.35;
  padding: 10px 11px;
}

.ai-panel textarea:focus {
  border-color: #111827;
  outline: none;
}

.ai-run {
  border: 1px solid #111827;
  background: #111827;
  color: #ffffff;
  cursor: pointer;
  padding: 10px 12px;
}

.ai-run:disabled {
  cursor: wait;
  opacity: 0.65;
}

.ai-status {
  min-height: 36px;
  margin: 0;
  line-height: 1.35;
}

.template-panel label {
  display: grid;
  gap: 7px;
}

.template-panel label span {
  color: #6b7280;
  font-size: 13px;
}

.template-panel input,
.template-panel textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font: inherit;
  padding: 9px 10px;
}

.template-panel textarea {
  resize: vertical;
}

.figma-status {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.35;
}

.template-library {
  display: grid;
  align-content: start;
  align-items: start;
  flex: 1 1 auto;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.library-card {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  padding: 7px;
  text-align: left;
}

.library-card:hover {
  border-color: #111827;
}

.library-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #f3f4f6;
}

.library-card span {
  overflow: hidden;
  color: #374151;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#selectedTemplateName {
  color: #6b7280;
  font-size: 13px;
}

.editor-title {
  display: grid;
  gap: 2px;
}

.deck-name-input {
  width: min(420px, 52vw);
  border: 1px solid transparent;
  background: transparent;
  color: #111827;
  font: inherit;
  font-weight: 700;
  padding: 4px 6px;
}

.deck-name-input:focus {
  border-color: #d1d5db;
  background: #ffffff;
  outline: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.42);
  padding: 20px;
}

.modal-card {
  display: grid;
  width: min(100%, 520px);
  gap: 14px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.2);
}

.guest-identity-modal {
  z-index: 120;
  background: rgba(5, 10, 24, 0.72);
  backdrop-filter: blur(14px);
}

.guest-identity-card {
  width: min(100%, 430px);
  gap: 18px;
  text-align: left;
}

.guest-identity-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-pink));
  color: #08111f;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
}

.guest-identity-card .modal-actions {
  justify-content: stretch;
}

.guest-identity-card .primary-action {
  width: 100%;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-head h2,
.modal-head p {
  margin: 0;
}

.modal-head h2 {
  font-size: 22px;
}

.modal-head p {
  margin-top: 5px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.35;
}

.modal-close {
  display: grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.modal-close:hover {
  border-color: #111827;
}

.modal-card label {
  display: grid;
  gap: 7px;
}

.modal-card label span,
.modal-status {
  color: #6b7280;
  font-size: 13px;
}

.modal-card input {
  width: 100%;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font: inherit;
  padding: 10px 11px;
}

.modal-status {
  min-height: 18px;
  margin: 0;
  line-height: 1.35;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions .primary-action:only-child {
  width: 100%;
}

.primary-action,
.secondary-action {
  border: 1px solid #111827;
  cursor: pointer;
  padding: 10px 12px;
}

.primary-action {
  background: #111827;
  color: #ffffff;
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-action {
  background: #ffffff;
  color: #111827;
}

.template-loader {
  position: absolute;
  inset: 64px 0 92px;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 8, 20, 0.62);
  backdrop-filter: blur(18px);
}

.template-loader-card {
  display: grid;
  width: min(420px, 100%);
  justify-items: center;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(13, 18, 38, 0.96);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.4);
  color: #ffffff;
  padding: 28px;
  text-align: center;
}

.loader-orbit {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-top-color: #8bb7ff;
  border-radius: 999px;
  animation: loader-spin 0.8s linear infinite;
}

.template-loader h2 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.2;
}

.template-loader p {
  max-width: 320px;
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
  line-height: 1.45;
}

.template-loader-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.template-loader.error .loader-orbit {
  position: relative;
  border-color: rgba(248, 113, 113, 0.24);
  animation: none;
}

.template-loader.error .loader-orbit::before,
.template-loader.error .loader-orbit::after {
  position: absolute;
  top: 21px;
  left: 12px;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: #f87171;
  content: "";
}

.template-loader .primary-action {
  border-color: #ffffff;
  background: #ffffff;
  color: #0d1226;
}

.template-loader .secondary-action {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.toast-host {
  position: fixed;
  top: 88px;
  right: 22px;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.toast-host.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast {
  display: flex;
  max-width: min(360px, calc(100vw - 32px));
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(13, 18, 38, 0.96);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.35);
  color: #ffffff;
  line-height: 1.35;
  padding: 12px 14px;
}

.toast-icon {
  display: grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 900;
}

.toast.success .toast-icon {
  background: #22c55e;
  color: #052e16;
}

.toast.error .toast-icon {
  background: #ef4444;
  color: #ffffff;
}

.template-loader.error .loader-orbit::before {
  transform: rotate(45deg);
}

.template-loader.error .loader-orbit::after {
  transform: rotate(-45deg);
}

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}

.print-deck {
  display: none;
}

.print-deck.pdf-exporting {
  position: fixed;
  top: 0;
  left: -200vw;
  z-index: -1;
  display: block;
  width: 1600px;
  background: #ffffff;
  pointer-events: none;
}

.print-deck.pdf-exporting .print-slide {
  position: relative;
  overflow: hidden;
  container-type: inline-size;
  width: 1600px;
  height: 900px;
  background: #ffffff;
}

.print-deck.pdf-exporting .print-slide.slide {
  display: block;
  width: 1600px;
  height: 900px;
  border: 0;
  box-shadow: none;
  transform: none;
  transition: none;
}

.print-deck.pdf-exporting .thumb-preview-slide {
  width: 100%;
  height: 100%;
}

.print-deck.pdf-exporting .print-slide > span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #d1d5db;
  font-size: 15cqw;
  font-weight: 700;
}

.print-deck.pdf-exporting .slide-overlay-action,
.print-deck.pdf-exporting .cover-bg-actions,
.print-deck.pdf-exporting .logo-picker-toggle,
.print-deck.pdf-exporting [data-delete-text-block],
.print-deck.pdf-exporting [data-delete-logo-id],
.print-deck.pdf-exporting [data-delete-logo-slot],
.print-deck.pdf-exporting [data-add-table-row],
.print-deck.pdf-exporting [data-delete-table-row] {
  display: none !important;
}

.print-deck.pdf-exporting .editable-title,
.print-deck.pdf-exporting .editable-template-field,
.print-deck.pdf-exporting .table-cell,
.print-deck.pdf-exporting .user-text-block {
  outline: none !important;
  background: transparent !important;
}

.canvas {
  display: grid;
  position: relative;
  --slide-zoom: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  place-items: center;
  padding: 32px;
}

.logo-panel-host {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.zoom-control {
  position: absolute;
  top: 50%;
  left: 18px;
  z-index: 4;
  display: grid;
  gap: 8px;
  transform: translateY(-50%);
}

.zoom-control button,
.zoom-control label {
  display: grid;
  width: 54px;
  min-height: 40px;
  place-items: center;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
}

.zoom-control button {
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.zoom-control label {
  grid-template-columns: 1fr auto;
  gap: 1px;
  padding: 0 6px;
}

.zoom-control input {
  width: 31px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 0;
  text-align: right;
}

.zoom-control input:focus {
  outline: none;
}

.zoom-control input::-webkit-outer-spin-button,
.zoom-control input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.zoom-control span {
  font-size: 12px;
  font-weight: 700;
}

.floating-tools {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  pointer-events: none;
  margin-top: -56px;
  margin-bottom: 14px;
}

.tool-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  font-weight: 800;
  pointer-events: auto;
  box-shadow: 0 12px 35px rgba(17, 24, 39, 0.12);
}

.tool-button:hover {
  border-color: #111827;
}

.slide {
  display: grid;
  position: relative;
  overflow: hidden;
  container-type: inline-size;
  width: min(100%, 1100px);
  aspect-ratio: 16 / 9;
  place-items: center;
  border: 1px solid #d1d5db;
  background: #ffffff;
  box-shadow: 0 12px 35px rgba(17, 24, 39, 0.08);
  transform: scale(var(--slide-zoom));
  transform-origin: center;
  transition: transform 0.22s ease;
}

.template-slide {
  display: block;
  background: #ffffff;
}

.template-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}

.template-layer {
  position: absolute;
  object-fit: fill;
  user-select: none;
}

.template-fill-layer {
  pointer-events: none;
}

.title-mask {
  position: absolute;
}

.editable-title {
  position: absolute;
  overflow: visible;
  outline: 1px dashed transparent;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  word-wrap: break-word;
  min-width: 0;
  max-width: 100%;
}

.editable-title:focus {
  background: rgba(255, 255, 255, 0.32);
  outline-color: #2563eb;
}

.editable-template-field {
  position: absolute;
  overflow: visible;
  outline: 1px dashed transparent;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  word-wrap: break-word;
  min-width: 0;
  max-width: 100%;
}

.editable-template-field:focus {
  background: rgba(255, 255, 255, 0.32);
  outline-color: #2563eb;
}

.figma-auto-layout {
  position: absolute;
  display: flex;
  overflow: visible;
  box-sizing: border-box;
}

.figma-auto-layout > .editable-title,
.figma-auto-layout > .editable-template-field {
  position: relative;
  inset: auto;
}

.figma-repeat-row {
  display: flex;
  flex: 0 0 auto;
  min-width: 0;
  box-sizing: border-box;
}

.figma-repeat-row > .editable-template-field {
  position: relative;
  inset: auto;
}

.editable-image-field {
  position: absolute;
  display: grid;
  place-items: center;
  overflow: hidden;
  outline: 1px dashed transparent;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.18);
}

.editable-image-field:hover {
  outline-color: #2563eb;
}

.editable-image-field img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.editable-image-field span {
  color: #6b7280;
  background: rgba(255, 255, 255, 0.82);
  padding: 6px 9px;
  font-size: 12px;
}

.editable-image-field input {
  display: none;
}

.cover-bg-actions {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 8;
  display: flex;
  gap: 8px;
  align-items: center;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.slide-overlay-action {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

.template-slide:hover .slide-overlay-action,
.template-slide:focus-within .slide-overlay-action {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.cover-bg-control {
  display: grid;
  min-height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.72);
  color: #ffffff;
  cursor: pointer;
  font: 700 12px/1 "CoFo Sans", Inter, system-ui, sans-serif;
  padding: 8px 11px;
  transition:
    transform 0.2s ease,
    background 0.2s ease;
  backdrop-filter: blur(12px);
}

.template-slide:hover .cover-bg-actions,
.cover-bg-actions:focus-within {
  opacity: 1;
  transform: translateY(0);
}

.cover-bg-control:hover {
  background: rgba(17, 24, 39, 0.9);
  transform: translateY(-1px);
}

.logo-picker-toggle {
  position: absolute;
  right: 14px;
  bottom: 58px;
  z-index: 8;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.72);
  color: #ffffff;
  cursor: pointer;
  font: 700 12px/1 "CoFo Sans", Inter, system-ui, sans-serif;
  padding: 8px 11px;
  backdrop-filter: blur(12px);
}

.logo-picker-toggle:hover {
  background: rgba(17, 24, 39, 0.9);
}

.logo-picker-panel {
  position: absolute;
  z-index: 12;
  width: 340px;
  max-height: min(560px, calc(100% - 24px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(11, 18, 32, 0.92);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  color: #ffffff;
  backdrop-filter: blur(18px);
  pointer-events: auto;
}

.logo-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px 11px;
  cursor: move;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-picker-head div {
  display: grid;
  gap: 4px;
}

.logo-picker-head strong {
  font-size: 14px;
}

.logo-picker-head span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
}

.logo-picker-head button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.logo-picker-search {
  display: block;
  padding: 12px 12px 0;
}

.logo-picker-search input {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font: 500 13px/1.2 "CoFo Sans", Inter, system-ui, sans-serif;
  outline: none;
  padding: 9px 12px;
}

.logo-picker-search input::placeholder {
  color: rgba(255, 255, 255, 0.44);
}

.logo-picker-search input:focus {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.12);
}

.logo-picker-list {
  display: grid;
  gap: 9px;
  max-height: 420px;
  overflow: auto;
  padding: 12px;
}

.logo-picker-item {
  display: grid;
  grid-template-columns: 18px 72px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  padding: 9px;
  cursor: pointer;
}

.logo-picker-item input {
  accent-color: #7c3aed;
}

.logo-picker-item img {
  width: 72px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  padding: 4px;
}

.logo-picker-item span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.logo-picker-item strong,
.logo-picker-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo-picker-item strong {
  color: #ffffff;
  font-size: 13px;
}

.logo-picker-item small,
.logo-picker-empty {
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
}

.logo-picker-empty {
  margin: 0;
  padding: 8px;
}

.settings-logo-search {
  padding: 0;
}

.settings-logo-list {
  height: min(320px, 42vh);
  max-height: 320px;
  overflow-y: auto;
  padding: 0;
  padding-right: 4px;
}

.settings-logo-list::-webkit-scrollbar {
  width: 7px;
}

.settings-logo-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
}

.settings-logo-list::-webkit-scrollbar-track {
  background: transparent;
}

.settings-logo-item {
  grid-template-columns: 18px 54px minmax(0, 1fr);
  min-height: 60px;
  gap: 9px;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  padding: 8px;
}

.settings-logo-item img {
  width: 54px;
  height: 40px;
}

.editable-logo-slot {
  position: absolute;
  z-index: 2;
  cursor: grab;
  border-radius: 8px;
  outline: 1px solid transparent;
  transition:
    opacity 0.16s ease,
    outline-color 0.16s ease,
    background 0.16s ease;
}

.editable-logo-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.editable-logo-slot.dragging {
  cursor: grabbing;
  opacity: 0.48;
}

.editable-logo-slot.drop-target {
  outline-color: rgba(124, 58, 237, 0.95);
  background: rgba(124, 58, 237, 0.12);
}

.delete-logo-slot {
  position: absolute;
  top: -9px;
  right: -9px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.86);
  color: #ffffff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.86);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease,
    background 0.16s ease;
}

.editable-logo-slot:hover .delete-logo-slot,
.editable-logo-slot:focus-within .delete-logo-slot {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.delete-logo-slot:hover {
  background: rgba(220, 38, 38, 0.92);
}

.cover-bg-control input {
  display: none;
}

.slide .cover-bg-actions,
.slide .cover-bg-control {
  width: auto;
  height: auto;
}

.slide .cover-bg-control span {
  color: inherit;
  display: inline;
  min-height: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.user-text-block {
  position: absolute;
  min-height: 1.2em;
  cursor: move;
  outline: 1px dashed transparent;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.2;
}

.user-text-block span {
  display: block;
  min-height: 1.2em;
  outline: none;
}

.user-text-delete {
  position: absolute;
  top: -12px;
  right: -12px;
  display: none;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  z-index: 2;
}

.user-text-block:hover .user-text-delete,
.user-text-block:focus-within .user-text-delete {
  display: grid;
}

.user-text-block:focus-within,
.user-text-block.moving {
  background: rgba(255, 255, 255, 0.28);
  outline-color: #2563eb;
}

.table-cell {
  position: absolute;
  box-sizing: border-box;
  overflow: visible;
  outline: 1px dashed transparent;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table-cell:focus {
  background: rgba(255, 255, 255, 0.28);
  outline-color: #2563eb;
}

.table-add-row,
.table-row-tools button {
  position: absolute;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  font: 12px/1.2 "CoFo Sans", Inter, system-ui, sans-serif;
  z-index: 3;
}

.table-row-line {
  position: absolute;
  height: 0;
  border-top: 1px solid rgba(156, 163, 175, 0.55);
  transform: translateY(-0.5px) scaleY(0.75);
  transform-origin: left top;
  z-index: 2;
}

.table-total-bg {
  position: absolute;
  background: #422eff;
  z-index: 1;
}

.table-total-cell {
  color: #ffffff;
  z-index: 3;
}

.table-total-line {
  z-index: 3;
}

.table-add-row {
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  font: 700 12px/1 "CoFo Sans", Inter, system-ui, sans-serif;
  min-height: 34px;
  padding: 8px 11px;
  box-shadow:
    0 10px 26px rgba(17, 24, 39, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.table-add-row:hover {
  border-color: rgba(37, 99, 235, 0.32);
  background: #ffffff;
  box-shadow:
    0 14px 34px rgba(37, 99, 235, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  transform: translateY(-2px);
}

.table-row-tools {
  position: absolute;
  display: none;
  width: 22px;
  height: 22px;
  z-index: 4;
}

.template-slide:hover .table-row-tools {
  display: block;
}

.table-row-tools button {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font-size: 16px;
}

.slide span {
  color: #d1d5db;
  font-size: clamp(56px, 10vw, 140px);
  font-weight: 700;
}

.slide .table-add-row {
  width: auto;
  height: auto;
  color: #111827;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.slide-strip {
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
  align-items: center;
  overflow-x: auto;
  border-top: 1px solid #d1d5db;
  background: #ffffff;
  padding: 14px;
}

.slide-list {
  display: flex;
  gap: 12px;
  align-items: center;
}

.thumb,
.add-slide {
  flex: 0 0 auto;
  width: 128px;
  aspect-ratio: 16 / 9;
  border: 1px solid #d1d5db;
  background: #ffffff;
}

.thumb {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
}

.thumb.active {
  border-color: #111827;
  box-shadow: inset 0 0 0 1px #111827;
}

.thumb.dragging {
  opacity: 0.45;
}

.thumb.drop-target {
  border-color: #2563eb;
  box-shadow: inset 0 0 0 2px #2563eb;
}

.thumb-presence {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-left: 4px;
}

.thumb-presence-avatar,
.thumb-presence-more {
  display: grid;
  width: 22px;
  height: 22px;
  margin-left: -4px;
  place-items: center;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  background: var(--presence-color, #2563eb);
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(3, 8, 23, 0.34);
}

.thumb-presence-more {
  --presence-color: #111827;
  font-size: 8px;
}

.thumb > span:first-child {
  font-size: 24px;
  font-weight: 700;
}

.thumb > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb > .thumb-snapshot {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
}

.thumb-snapshot-placeholder {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04)),
    rgba(17, 24, 39, 0.24);
}

.thumb-preview-slide {
  position: relative;
  overflow: hidden;
  container-type: inline-size;
  width: 100%;
  background: #ffffff;
}

.thumb-scale-stage {
  position: relative;
  overflow: hidden;
  container-type: inline-size;
  transform-origin: 0 0;
}

.thumb-bg,
.thumb-layer,
.thumb-logo-slot,
.thumb-image-field {
  position: absolute;
  object-fit: cover;
  user-select: none;
}

.thumb-bg {
  inset: 0;
  width: 100%;
  height: 100%;
}

.thumb-layer {
  object-fit: fill;
}

.thumb-logo-slot {
  object-fit: contain;
  pointer-events: none;
}

.thumb-field,
.thumb-table-cell,
.thumb-user-text {
  position: absolute;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  word-wrap: break-word;
  min-width: 0;
  max-width: 100%;
}

.thumb-table-cell,
.thumb-user-text {
  overflow: hidden;
}

.thumb-field {
  overflow: visible;
}

.slide.capturing-thumbnail .slide-overlay-action,
.slide.capturing-thumbnail .cover-bg-actions,
.slide.capturing-thumbnail .logo-picker-toggle,
.slide.capturing-thumbnail [data-delete-text-block],
.slide.capturing-thumbnail [data-delete-logo-id],
.slide.capturing-thumbnail [data-delete-logo-slot],
.slide.capturing-thumbnail [data-add-table-row],
.slide.capturing-thumbnail [data-delete-table-row] {
  display: none !important;
}

.slide.capturing-thumbnail .editable-title,
.slide.capturing-thumbnail .editable-template-field,
.slide.capturing-thumbnail .table-cell,
.slide.capturing-thumbnail .user-text-block {
  outline: none !important;
  background: transparent !important;
}

.thumb-table-line {
  position: absolute;
  height: 0;
  border-top: 1px solid rgba(156, 163, 175, 0.55);
  transform: translateY(-0.5px) scaleY(0.75);
  transform-origin: left top;
  z-index: 2;
}

.thumb-table-total-bg {
  position: absolute;
  background: #422eff;
  z-index: 1;
}

.thumb-table-total-cell {
  color: #ffffff;
  z-index: 3;
}

.delete-slide {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
}

.thumb:hover .delete-slide {
  display: grid;
}

.thumb:only-child .delete-slide {
  display: none;
}

.add-slide {
  display: grid;
  place-items: center;
  color: #6b7280;
  cursor: pointer;
  font-size: 34px;
  line-height: 1;
}

.add-slide:hover {
  border-color: #111827;
  color: #111827;
}

@media (max-width: 1360px) {
  .editor-layout {
    grid-template-columns: 220px minmax(0, 1fr) 240px;
  }

  .template-panel,
  .slide-settings-panel {
    padding: 12px;
  }

  .template-library {
    gap: 8px;
  }

  .library-card {
    border-radius: 14px;
    padding: 6px;
  }

  .library-card img {
    border-radius: 10px;
  }

  .canvas {
    padding: 20px 24px;
  }

  .slide {
    width: min(100%, calc((100vh - 210px) * 16 / 9));
    max-height: calc(100vh - 210px);
  }

  .thumb,
  .add-slide {
    width: 112px;
  }

  .slide-strip {
    gap: 10px;
    padding: 10px 12px;
  }
}

@media (max-height: 820px) {
  .canvas {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .slide {
    width: min(100%, calc((100vh - 184px) * 16 / 9));
    max-height: calc(100vh - 184px);
    border-radius: 16px;
  }

  .slide-strip {
    padding: 8px 12px;
  }

  .thumb,
  .add-slide {
    width: 104px;
  }
}

@media (max-width: 1120px) {
  .editor-layout {
    grid-template-columns: 190px minmax(0, 1fr) 220px;
  }

  .canvas {
    padding: 16px;
  }

  .slide {
    width: min(100%, calc((100vh - 178px) * 16 / 9));
    max-height: calc(100vh - 178px);
  }
}

@media (max-width: 720px) {
  .start-screen {
    padding: 156px 18px 24px;
  }

  .start-topbar {
    align-items: stretch;
    flex-direction: column;
    right: 16px;
    left: 16px;
    width: calc(100% - 32px);
  }

  .connection-status {
    justify-content: center;
  }

  .toast-host {
    top: 142px;
    right: 16px;
    left: 16px;
  }

  .template-grid {
    grid-template-columns: 1fr;
  }

  .history-item {
    grid-template-columns: 1fr auto auto;
  }

  .history-open {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .history-preview {
    width: 88px;
  }

  .direction-head {
    flex-direction: column;
  }

  .direction-grid {
    grid-template-columns: 1fr;
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .template-panel {
    border-right: 0;
    border-bottom: 1px solid #d1d5db;
  }

  .ai-panel,
  .slide-settings-panel {
    border-left: 0;
    border-top: 1px solid #d1d5db;
  }

  .canvas {
    padding: 16px;
  }

  .thumb,
  .add-slide {
    width: 96px;
  }

  .modal-actions {
    flex-direction: column;
  }
}

/* 3D glass visual skin */
:root {
  --space-1: #09111f;
  --space-2: #1a1742;
  --space-3: #5f2bc7;
  --neon-cyan: #6ee7ff;
  --neon-pink: #ff5ea8;
  --neon-orange: #ff9d4d;
  --glass: rgba(255, 255, 255, 0.11);
  --glass-strong: rgba(255, 255, 255, 0.16);
  --glass-border: rgba(255, 255, 255, 0.24);
  --soft-text: rgba(255, 255, 255, 0.72);
  --deep-shadow: 0 24px 70px rgba(4, 8, 23, 0.42);
  --neon-shadow: 0 18px 50px rgba(123, 92, 255, 0.34);
}

body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 10%, rgba(110, 231, 255, 0.28), transparent 28rem),
    radial-gradient(circle at 88% 18%, rgba(255, 94, 168, 0.28), transparent 30rem),
    linear-gradient(135deg, var(--space-1) 0%, var(--space-2) 48%, #34155c 100%);
  color: #ffffff;
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
}

body::before {
  z-index: -2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 82%);
}

body::after {
  z-index: -1;
  background:
    radial-gradient(circle at 76% 78%, rgba(255, 157, 77, 0.16), transparent 22rem),
    linear-gradient(120deg, rgba(255, 255, 255, 0.035), transparent 40%);
}

input,
textarea {
  border-radius: 14px;
}

.start-screen {
  perspective: 1200px;
}

.start-topbar,
.editor-bar,
.template-panel,
.slide-settings-panel,
.slide-strip,
.modal-card {
  border-color: var(--glass-border);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07));
  box-shadow: var(--deep-shadow);
  backdrop-filter: blur(22px);
}

.start-topbar {
  position: fixed;
  top: 18px;
  right: 32px;
  left: 32px;
  z-index: 80;
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 12px 14px;
}

.user-avatar {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-pink));
  color: #08111f;
  box-shadow: 0 12px 32px rgba(110, 231, 255, 0.26);
}

.user-chip strong,
.history-head h2,
.template-panel h2,
.modal-head h2,
.editor-title {
  color: #ffffff;
}

.user-chip span,
.start-copy p,
.history-head span,
.history-open span,
.figma-status,
.modal-head p,
.modal-card label span,
.modal-status,
#selectedTemplateName,
.template-panel label span {
  color: var(--soft-text);
}

.connection-status,
.back-button,
.export-button,
.duplicate-deck-button,
.zoom-control button,
.zoom-control label,
.history-open,
.history-copy,
.history-delete,
.modal-close,
.secondary-action {
  border-color: var(--glass-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(4, 8, 23, 0.22);
  transition:
    transform 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    background 0.28s ease;
}

.connection-status:hover,
.back-button:hover,
.export-button:hover,
.duplicate-deck-button:hover,
.zoom-control button:hover,
.history-open:hover,
.history-copy:hover,
.history-delete:hover,
.modal-close:hover,
.secondary-action:hover {
  transform: translateY(-2px);
  border-color: rgba(110, 231, 255, 0.7);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 42px rgba(110, 231, 255, 0.18);
}

.start-copy h1 {
  max-width: 760px;
  color: #ffffff;
  text-shadow:
    0 8px 30px rgba(0, 0, 0, 0.32),
    0 0 44px rgba(110, 231, 255, 0.22);
  transform: translateZ(32px);
}

.template-card {
  position: relative;
  overflow: hidden;
  min-height: 196px;
  border-color: var(--glass-border);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.055)),
    linear-gradient(135deg, rgba(110, 231, 255, 0.12), rgba(255, 94, 168, 0.14));
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    var(--deep-shadow);
  transform-style: preserve-3d;
  transition:
    transform 0.38s ease,
    box-shadow 0.38s ease,
    border-color 0.38s ease;
}

.template-card::before {
  position: absolute;
  top: -35%;
  right: -25%;
  width: 170px;
  height: 170px;
  border-radius: 32px;
  background: linear-gradient(135deg, rgba(110, 231, 255, 0.45), rgba(255, 94, 168, 0.36));
  box-shadow: 0 28px 70px rgba(255, 94, 168, 0.24);
  content: "";
  opacity: 0.75;
  transform: rotate(24deg) translateZ(24px);
}

.template-card:hover {
  border-color: rgba(110, 231, 255, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    var(--neon-shadow);
  transform: translateY(-8px) rotateX(3deg) rotateY(-4deg);
}

.template-card span {
  position: relative;
  z-index: 1;
  text-shadow: 0 12px 26px rgba(0, 0, 0, 0.34);
}

.direction-head p,
.type-status,
.direction-status {
  color: var(--soft-text);
}

.type-status.inline-loader,
.direction-status.inline-loader {
  color: #ffffff;
}

.direction-head h2 {
  color: #ffffff;
  text-shadow:
    0 8px 30px rgba(0, 0, 0, 0.28),
    0 0 36px rgba(110, 231, 255, 0.18);
}

.direction-back {
  border-color: var(--glass-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(4, 8, 23, 0.22);
  transition:
    transform 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    background 0.28s ease;
}

.direction-back:hover {
  transform: translateY(-2px);
  border-color: rgba(110, 231, 255, 0.7);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 42px rgba(110, 231, 255, 0.18);
}

.direction-card {
  position: relative;
  overflow: hidden;
  border-color: var(--glass-border);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.055)),
    linear-gradient(135deg, rgba(110, 231, 255, 0.1), rgba(255, 157, 77, 0.12));
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 18px 50px rgba(4, 8, 23, 0.28);
  transition:
    transform 0.34s ease,
    box-shadow 0.34s ease,
    border-color 0.34s ease;
}

.direction-card::before {
  position: absolute;
  top: -38px;
  right: -28px;
  width: 96px;
  height: 96px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(110, 231, 255, 0.38), rgba(255, 157, 77, 0.32));
  content: "";
  transform: rotate(22deg);
}

.direction-card:hover {
  border-color: rgba(110, 231, 255, 0.68);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 22px 54px rgba(110, 231, 255, 0.18);
  transform: translateY(-5px);
}

.direction-card span {
  position: relative;
  z-index: 1;
  text-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.history-panel {
  border-top-color: rgba(255, 255, 255, 0.18);
}

.history-empty,
.history-item {
  border-radius: 20px;
}

.history-empty {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: var(--soft-text);
}

.history-open {
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
}

.history-preview {
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 12px 28px rgba(4, 8, 23, 0.18);
}

.history-copy,
.history-delete {
  border-radius: 20px;
}

.editor-bar {
  position: sticky;
  top: 0;
  z-index: 6;
  border-bottom-color: var(--glass-border);
}

.deck-name-input {
  border-radius: 12px;
  color: #ffffff;
}

.deck-name-input:focus {
  border-color: rgba(110, 231, 255, 0.62);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.template-panel {
  border-right-color: var(--glass-border);
}

.slide-settings-panel {
  border-left-color: var(--glass-border);
}

.template-panel input,
.template-panel textarea,
.modal-card input {
  border-color: var(--glass-border);
  background: rgba(8, 17, 31, 0.42);
  color: #ffffff;
}

.template-panel input:focus,
.template-panel textarea:focus,
.modal-card input:focus {
  border-color: rgba(110, 231, 255, 0.72);
  outline: none;
  box-shadow: 0 0 0 3px rgba(110, 231, 255, 0.12);
}

.library-card {
  overflow: hidden;
  border-color: var(--glass-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
  box-shadow: 0 16px 38px rgba(4, 8, 23, 0.24);
  transition:
    transform 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.library-card:hover {
  border-color: rgba(255, 94, 168, 0.7);
  box-shadow: 0 22px 54px rgba(255, 94, 168, 0.18);
  transform: translateY(-4px);
}

.library-card img {
  border-radius: 12px;
}

.library-card span {
  color: rgba(255, 255, 255, 0.82);
}

.template-library {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
  overflow-y: auto;
}

.template-library .library-card {
  flex: 0 0 auto;
  transform: none;
}

.template-library .library-card:hover {
  transform: none;
}

.template-library .library-card img {
  flex: 0 0 auto;
}

.template-library,
.slide-settings-panel,
.settings-logo-list,
.slide-strip {
  scrollbar-color: rgba(110, 231, 255, 0.56) transparent;
  scrollbar-width: thin;
}

.template-library::-webkit-scrollbar,
.slide-settings-panel::-webkit-scrollbar,
.settings-logo-list::-webkit-scrollbar,
.slide-strip::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.template-library::-webkit-scrollbar-track,
.slide-settings-panel::-webkit-scrollbar-track,
.settings-logo-list::-webkit-scrollbar-track,
.slide-strip::-webkit-scrollbar-track {
  background: transparent;
}

.template-library::-webkit-scrollbar-thumb,
.slide-settings-panel::-webkit-scrollbar-thumb,
.settings-logo-list::-webkit-scrollbar-thumb,
.slide-strip::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(110, 231, 255, 0.74), rgba(255, 94, 168, 0.62))
    border-box;
  background-clip: padding-box, border-box;
}

.template-library::-webkit-scrollbar-thumb:hover,
.slide-settings-panel::-webkit-scrollbar-thumb:hover,
.settings-logo-list::-webkit-scrollbar-thumb:hover,
.slide-strip::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(135deg, rgba(110, 231, 255, 0.95), rgba(255, 94, 168, 0.82))
    border-box;
  background-clip: padding-box, border-box;
}

.slide-settings-empty h2,
.slide-settings-section-toggle {
  color: #ffffff;
}

.slide-settings-section-body p,
.slide-settings-empty p {
  color: rgba(255, 255, 255, 0.64);
}

.slide-settings-section {
  border-color: var(--glass-border);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 16px 34px rgba(4, 8, 23, 0.2);
}

.settings-action {
  border-color: rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, rgba(110, 231, 255, 0.2), rgba(255, 94, 168, 0.22));
  color: #ffffff;
  box-shadow:
    0 14px 30px rgba(4, 8, 23, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.settings-action:hover {
  border-color: rgba(110, 231, 255, 0.62);
  background: linear-gradient(135deg, rgba(110, 231, 255, 0.28), rgba(255, 94, 168, 0.32));
}

.canvas {
  background:
    radial-gradient(circle at 50% 42%, rgba(110, 231, 255, 0.16), transparent 30rem),
    radial-gradient(circle at 72% 70%, rgba(255, 94, 168, 0.12), transparent 24rem);
}

.slide {
  border-color: rgba(255, 255, 255, 0.34);
  border-radius: 22px;
  box-shadow:
    0 30px 80px rgba(4, 8, 23, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.12);
}

.floating-tools {
  z-index: 5;
}

.tool-button,
.primary-action,
.ai-run {
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-orange));
  color: #ffffff;
  box-shadow:
    0 16px 36px rgba(255, 94, 168, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition:
    transform 0.28s ease,
    box-shadow 0.28s ease,
    filter 0.28s ease;
}

.tool-button:hover,
.primary-action:hover,
.ai-run:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 22px 48px rgba(255, 94, 168, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  filter: saturate(1.08);
}

.slide-strip {
  border-top-color: var(--glass-border);
}

.thumb,
.add-slide {
  overflow: hidden;
  border-color: var(--glass-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.68);
  box-shadow: 0 12px 30px rgba(4, 8, 23, 0.25);
  transition:
    transform 0.24s ease,
    border-color 0.24s ease,
    box-shadow 0.24s ease;
}

.thumb:hover,
.add-slide:hover {
  border-color: rgba(110, 231, 255, 0.68);
  color: #ffffff;
  transform: translateY(-3px);
  box-shadow: 0 18px 42px rgba(110, 231, 255, 0.16);
}

.thumb.active {
  border-color: rgba(255, 94, 168, 0.82);
  box-shadow:
    0 0 0 2px rgba(255, 94, 168, 0.35),
    0 18px 42px rgba(255, 94, 168, 0.2);
}

.thumb.drop-target {
  border-color: var(--neon-cyan);
  box-shadow:
    0 0 0 2px rgba(110, 231, 255, 0.4),
    0 18px 42px rgba(110, 231, 255, 0.18);
}

.delete-slide,
.user-text-delete,
.table-row-tools button {
  background: linear-gradient(135deg, #101827, #331d5f);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(4, 8, 23, 0.34);
}

.modal {
  background:
    radial-gradient(circle at 20% 15%, rgba(110, 231, 255, 0.22), transparent 24rem),
    rgba(4, 8, 23, 0.68);
  backdrop-filter: blur(10px);
}

.modal-card {
  border-radius: 28px;
}

.modal-close {
  border-radius: 12px;
}

@media (max-width: 720px) {
  .start-topbar {
    border-radius: 20px;
  }

  .template-card {
    min-height: 160px;
  }

  .template-panel {
    border-bottom-color: var(--glass-border);
  }

  .slide {
    border-radius: 16px;
  }
}

.sr-only {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.start-screen {
  align-content: start;
  justify-items: stretch;
  padding: 118px 32px 40px;
}

.start-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.start-user-tools,
.start-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.start-user-tools {
  flex: 1 1 auto;
}

.start-search {
  display: flex;
  width: min(360px, 34vw);
  min-width: 180px;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.78);
  padding: 9px 13px;
}

.start-search svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.start-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #ffffff;
  font: inherit;
}

.start-search input::placeholder {
  color: rgba(255, 255, 255, 0.56);
}

.create-menu {
  position: relative;
  flex: 0 0 auto;
}

.create-presentation-btn {
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  font-weight: 800;
  padding: 11px 18px;
  box-shadow: 0 18px 42px rgba(4, 8, 23, 0.22);
  transition:
    transform 0.24s ease,
    box-shadow 0.24s ease;
}

.create-presentation-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 54px rgba(110, 231, 255, 0.2);
}

.create-presentation-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 100;
  display: grid;
  width: min(360px, calc(100vw - 40px));
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  background: rgba(14, 20, 34, 0.94);
  padding: 14px;
  box-shadow: 0 28px 70px rgba(4, 8, 23, 0.42);
  backdrop-filter: blur(24px);
}

.create-presentation-menu.hidden {
  display: none;
}

.create-menu-head {
  display: grid;
  gap: 3px;
  padding: 4px 4px 0;
}

.create-menu-head strong {
  color: #ffffff;
  font-size: 15px;
}

.create-menu-head span {
  color: var(--soft-text);
  font-size: 12px;
}

.create-presentation-menu .template-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.create-presentation-menu .template-card {
  display: flex;
  min-height: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  padding: 14px;
  box-shadow: none;
}

.create-presentation-menu .template-card:hover {
  border-color: rgba(110, 231, 255, 0.62);
  background: rgba(255, 255, 255, 0.13);
  transform: none;
}

.create-presentation-menu .template-card::before {
  display: none;
}

.create-presentation-menu .template-card span {
  max-width: none;
  font-size: 15px;
  font-weight: 700;
}

.create-presentation-menu .template-card svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.create-presentation-menu .type-status {
  min-height: 0;
  color: var(--soft-text);
  font-size: 13px;
}

.history-home {
  width: 100%;
  margin: 0 auto;
}

.history-home .start-copy {
  gap: 6px;
}

.history-home .start-copy h1 {
  font-size: clamp(34px, 5vw, 56px);
}

.history-panel {
  gap: 18px;
  border-top: 0;
  padding-top: 0;
}

.history-count {
  display: none;
}

.history-head {
  padding: 0 2px;
}

.history-head h2 {
  font-size: 20px;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.history-empty {
  grid-column: 1 / -1;
  border-radius: 22px;
  padding: 24px;
  text-align: center;
}

.history-item {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 52px rgba(4, 8, 23, 0.2);
}

.history-open {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr;
  gap: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: #ffffff;
  box-shadow: none;
  text-align: left;
}

.history-open:hover {
  transform: none;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.history-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 24%, rgba(110, 231, 255, 0.14), transparent 12rem),
    linear-gradient(135deg, rgba(25, 47, 99, 0.96), rgba(13, 24, 52, 0.96));
  box-shadow: none;
}

.history-preview .thumb-preview-slide {
  width: 100%;
  height: 100%;
}

.history-preview.empty {
  border-radius: 0;
  color: rgba(255, 255, 255, 0.52);
}

.history-card-footer {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
  padding: 18px;
}

.history-card-badge {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #ffffff;
}

.history-card-badge svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.history-info strong {
  color: #ffffff;
  font-size: 16px;
}

.history-info span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
}

.history-info small {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: flex;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.history-item:hover .history-actions,
.history-item:focus-within .history-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.history-copy,
.history-delete {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(7, 12, 24, 0.68);
  backdrop-filter: blur(14px);
}

.history-copy:hover,
.history-delete:hover {
  background: rgba(255, 255, 255, 0.18);
}

.danger-action {
  border: 1px solid rgba(248, 113, 113, 0.68);
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  padding: 11px 16px;
  box-shadow: 0 16px 34px rgba(239, 68, 68, 0.22);
}

.danger-action:hover {
  background: #dc2626;
}

.confirm-modal-card {
  width: min(460px, calc(100vw - 32px));
}

@media (max-width: 920px) {
  .start-topbar,
  .start-user-tools,
  .start-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .start-user-tools,
  .start-actions,
  .start-search,
  .create-menu,
  .create-presentation-btn {
    width: 100%;
  }

  .create-presentation-menu {
    right: auto;
    left: 0;
  }

  .start-screen {
    padding-top: 250px;
  }
}

@page {
  size: 16in 9in;
  margin: 0;
}

@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  html,
  body {
    width: 100%;
    min-height: 0;
    margin: 0;
    background: #ffffff !important;
  }

  body::before,
  body::after,
  #startScreen,
  #editorScreen,
  #figmaModal {
    display: none !important;
  }

  .print-deck {
    display: block !important;
  }

  .print-slide {
    position: relative;
    overflow: hidden;
    container-type: inline-size;
    width: 100vw;
    height: 100vh;
    page-break-after: always;
    break-after: page;
    background: #ffffff;
  }

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

  .print-slide .thumb-preview-slide {
    width: 100%;
    height: 100%;
  }

  .print-slide > span {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    color: #d1d5db;
    font-size: 15cqw;
    font-weight: 700;
  }
}

/* The template rail spans the full editor height; the slide strip begins beside it. */
.app {
  grid-template-columns: 280px minmax(0, 1fr) 280px;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.editor-bar {
  grid-column: 1 / -1;
  grid-row: 1;
}

.editor-layout {
  display: contents;
}

.template-panel {
  grid-column: 1;
  grid-row: 2 / 4;
}

.canvas {
  grid-column: 2;
  grid-row: 2;
}

.slide-settings-panel {
  grid-column: 3;
  grid-row: 2;
}

.floating-tools {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
}

.slide-strip {
  grid-column: 2 / -1;
  grid-row: 3;
}

.floating-tools,
.add-slide {
  display: none;
}

@media (max-width: 1360px) {
  .app {
    grid-template-columns: 220px minmax(0, 1fr) 240px;
  }
}

@media (max-width: 1120px) {
  .app {
    grid-template-columns: 190px minmax(0, 1fr) 220px;
  }
}

@media (max-width: 720px) {
  .app {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .editor-layout {
    display: grid;
    grid-column: 1;
    grid-row: 2;
  }

  .template-panel,
  .canvas,
  .slide-settings-panel,
  .floating-tools {
    grid-column: auto;
    grid-row: auto;
  }

  .slide-strip {
    grid-column: 1;
    grid-row: 3;
  }
}
