:root {
  --cp-bg: #0a1f33;
  --cp-panel: linear-gradient(145deg, rgba(10, 61, 79, 0.92) 0%, rgba(30, 107, 138, 0.88) 48%, rgba(126, 184, 212, 0.82) 100%);
  --cp-text: #fff;
  --cp-muted: rgba(255, 255, 255, 0.82);
  --cp-accent: #7eb8d4;
  --cp-bar: rgba(8, 24, 40, 0.72);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--cp-bg);
  color: var(--cp-text);
}

.cp-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.cp-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1rem;
  background: var(--cp-bar);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.cp-toolbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.cp-toolbar-brand img { flex-shrink: 0; }

.cp-toolbar-meta {
  min-width: 0;
  flex: 1;
}

.cp-toolbar-meta h1 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-toolbar-meta p {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--cp-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cp-btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.cp-btn:hover { background: rgba(255, 255, 255, 0.14); }

.cp-btn.is-active {
  background: rgba(126, 184, 212, 0.28);
  border-color: var(--cp-accent);
}

.cp-btn-primary {
  background: linear-gradient(145deg, #0a3d4f 0%, #1e6b8a 70%, #2a8aad 100%);
  border-color: rgba(126, 184, 212, 0.55);
  font-weight: 600;
}

.cp-btn-primary:hover {
  background: linear-gradient(145deg, #0e4a60 0%, #247a9c 70%, #3a9bc0 100%);
}

.cp-save-status {
  font-size: 0.75rem;
  color: var(--cp-muted);
  max-width: 11rem;
  line-height: 1.25;
}

.cp-save-status.is-ok { color: #a8e6cf; }
.cp-save-status.is-warn { color: #ffd89b; }

.cp-counter {
  font-size: 0.82rem;
  color: var(--cp-muted);
  min-width: 4.5rem;
  text-align: center;
}

.cp-main {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
  overflow: hidden;
}

.cp-main.is-sidebar-hidden {
  grid-template-columns: 1fr;
}

.cp-main.is-sidebar-hidden .cp-sidebar {
  display: none;
}

.cp-sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  overflow-y: auto;
  padding: 0.5rem;
}

.cp-slide-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cp-slide-list button {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--cp-muted);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font-size: 0.75rem;
  line-height: 1.3;
  cursor: pointer;
}

.cp-slide-list button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.cp-slide-list button.is-active {
  background: rgba(126, 184, 212, 0.18);
  border-color: rgba(126, 184, 212, 0.45);
  color: #fff;
}

.cp-stage-wrap {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 1rem;
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 1rem 1.25rem 0.5rem;
  overflow: hidden;
}

.cp-stage-col {
  flex: 1 1 58%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.cp-stage {
  width: 100%;
  height: 100%;
  min-height: 280px;
  max-width: none;
  aspect-ratio: 16 / 9;
  max-height: 100%;
  background: var(--cp-panel);
  border: 1px solid rgba(200, 230, 248, 0.35);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1.5rem, 3.5vw, 3rem);
  overflow-y: auto;
  position: relative;
}

.cp-stage::before {
  content: '';
  position: absolute;
  top: 0;
  left: clamp(1.5rem, 3.5vw, 3rem);
  width: 96px;
  height: 3px;
  margin-top: -1px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1e6b8a, #d4ebf8, #1e6b8a);
}

.cp-slide-heading {
  display: inline-block;
  margin: 0 0 1.25rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(145deg, #0a3d4f 0%, #1e6b8a 52%, #7eb8d4 100%);
  box-shadow: 0 4px 12px rgba(30, 107, 138, 0.3);
}

.cp-slide-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  line-height: 1.15;
  font-weight: 700;
}

.cp-slide-subtitle {
  margin: 0 0 0.5rem;
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  color: var(--cp-accent);
  font-weight: 600;
}

.cp-slide-body {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.45;
  color: var(--cp-muted);
}

.cp-slide-intro,
.cp-slide-footer {
  margin: 0 0 0.85rem;
  font-size: clamp(0.95rem, 1.8vw, 1.1rem);
  line-height: 1.45;
  color: var(--cp-muted);
}

.cp-slide-footer {
  margin-top: 1rem;
  margin-bottom: 0;
  font-style: italic;
}

.cp-slide-paragraphs p {
  margin: 0 0 0.85rem;
  font-size: clamp(0.95rem, 1.9vw, 1.15rem);
  line-height: 1.5;
}

.cp-slide-paragraphs p:last-child { margin-bottom: 0; }

.cp-bullets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cp-bullets li {
  position: relative;
  padding-left: 1.25rem;
  font-size: clamp(0.92rem, 1.85vw, 1.1rem);
  line-height: 1.45;
}

.cp-bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cp-accent);
  box-shadow: 0 0 0 3px rgba(126, 184, 212, 0.2);
}

.cp-bullets.is-left {
  align-items: flex-start;
  text-align: left;
  width: 100%;
}

.cp-bullets-nested {
  margin-top: 0.45rem;
  padding-left: 0.5rem;
}

.cp-bullets-nested li {
  font-size: 0.92em;
}

.cp-bullets-nested .cp-bullets-nested li {
  font-size: 0.88em;
}

.cp-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem 1rem 1rem;
}

.cp-nav-btn {
  min-width: 110px;
}

.cp-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.cp-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  max-width: min(100%, 560px);
}

.cp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: rgba(255, 255, 255, 0.25);
  cursor: pointer;
}

.cp-dot.is-active { background: var(--cp-accent); }

body.cp-edit-mode [contenteditable="true"] {
  outline: 1px dashed rgba(255, 255, 255, 0.35);
  outline-offset: 3px;
  border-radius: 4px;
}

body.cp-edit-mode [contenteditable="true"]:focus {
  outline-color: var(--cp-accent);
  background: rgba(255, 255, 255, 0.06);
}

.cp-edit-hint {
  font-size: 0.75rem;
  color: var(--cp-muted);
  text-align: center;
  padding: 0 1rem 0.75rem;
}

.cp-edit-hint.hidden { display: none; }

.cp-voice-panel {
  flex: 0 0 340px;
  width: 340px;
  max-width: 42%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  align-self: stretch;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(200, 230, 248, 0.2);
  border-radius: 14px;
  padding: 0.85rem 0.9rem;
}

.cp-voice-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.cp-voice-panel-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--cp-accent);
}

.cp-btn-sm {
  padding: 0.28rem 0.5rem;
  font-size: 0.72rem;
}

.cp-voice-panel-lead {
  margin: 0 0 0.55rem;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--cp-muted);
}

.cp-voice-input {
  flex: 1;
  min-height: 180px;
  width: 100%;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid rgba(200, 230, 248, 0.25);
  background: rgba(8, 24, 40, 0.55);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
  padding: 0.65rem 0.75rem;
}

.cp-voice-input:focus {
  outline: none;
  border-color: var(--cp-accent);
  box-shadow: 0 0 0 2px rgba(126, 184, 212, 0.2);
}

.cp-voice-input:read-only {
  opacity: 0.85;
  cursor: default;
}

.cp-voice-char-count {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  color: var(--cp-muted);
  text-align: right;
}

body:not(.cp-edit-mode) .cp-voice-panel {
  opacity: 0.92;
}

body:not(.cp-edit-mode) #cpVoiceFromSlide {
  display: none;
}

.cp-deck-select {
  max-width: 14rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(8, 24, 40, 0.55);
  color: #fff;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
}

.admin-tool-links {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.admin-tool-links a {
  color: var(--accent, #2a7ab8);
  text-decoration: none;
  font-weight: 500;
}

.admin-tool-links a:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .cp-stage-wrap {
    flex-direction: column;
    overflow-y: auto;
  }

  .cp-stage-col {
    flex: 0 0 auto;
    width: 100%;
  }

  .cp-stage {
    height: auto;
    max-height: none;
  }

  .cp-voice-panel {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-height: 240px;
  }
}

@media (max-width: 900px) {
  .cp-main { grid-template-columns: 1fr; }
  .cp-sidebar { display: none; }
  .cp-main.is-sidebar-visible .cp-sidebar {
    display: block;
    position: fixed;
    inset: 52px 0 0 0;
    z-index: 20;
    width: min(280px, 88vw);
  }
}
