/* cyoa.css — CYOA Adventure Builder Custom Stylesheet */

:root {
  --cy-bg: #131923;
  --cy-sidebar-bg: rgba(22, 28, 38, 0.72);
  --cy-border: rgba(255, 255, 255, 0.08);
  --cy-text: #faf7f0;
  --cy-text-muted: #8b9bb0;
  --cy-glass-border: rgba(255, 255, 255, 0.06);
  --cy-glass-bg: rgba(18, 24, 37, 0.45);
  
  --narrative: #4a6fa5;
  --choice: #cca43b;
  --logic_gate: #4a8fa5;
  --modifier: #3b9c7b;
}

/* Base Studio Layout */
.cy-studio-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--cy-bg);
  color: var(--cy-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.cy-header-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--cy-border);
  background: rgba(22, 28, 38, 0.45);
  backdrop-filter: blur(12px);
}

.cy-h-left {
  min-width: 0;
}

.cy-h-left .cy-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--cy-text-muted);
  text-transform: uppercase;
}

.cy-h-left h2 {
  margin: 4px 0;
  font-size: 24px;
  font-weight: 600;
  background: linear-gradient(135deg, #faf7f0 0%, #a4b3c6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cy-h-left p {
  margin: 0;
  font-size: 13px;
  color: var(--cy-text-muted);
}

.cy-header-bar--split {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

.cy-h-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.cy-h-actions-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.cy-import-module-btn {
  border-color: rgba(200, 120, 80, 0.45);
}

.cy-h-actions .wr-btn {
  height: 36px;
  min-width: max-content;
  justify-content: center;
}

.cy-studio-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.cy-surface-nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--cy-border);
  background: rgba(250, 247, 240, 0.96);
  color: #2a2419;
}

.cy-context-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 13px;
  border: 0.5px solid rgba(42, 36, 25, 0.16);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.86);
  color: #2a2419;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(38, 31, 22, 0.08);
}

.cy-context-back:hover {
  background: #fffaf1;
  border-color: rgba(42, 36, 25, 0.28);
}

.cy-context-back.is-strong {
  background: #2a2115;
  color: #fffaf1;
  border-color: #2a2115;
}

.cy-context-back.is-strong:hover {
  background: #3a2e1e;
  border-color: #3a2e1e;
}

/* Sidebar Collections (Arcs) */
.cy-sidebar-collections {
  width: 280px;
  background: var(--cy-sidebar-bg);
  border-right: 1px solid var(--cy-border);
  padding: 16px;
  overflow-y: auto;
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
}

.cy-sec-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--cy-text-muted);
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.cy-collection-tab-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 8px;
}

.cy-collection-tab-row .cy-collection-tab {
  flex: 1;
  margin-bottom: 0;
}

.cy-col-delete-btn {
  flex: 0 0 auto;
  align-self: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--cy-text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cy-col-delete-btn:hover {
  background: rgba(235, 94, 85, 0.15);
  border-color: rgba(235, 94, 85, 0.25);
  color: #eb5e55;
}

.cy-col-delete-btn.is-disabled,
.cy-col-delete-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.cy-col-delete-btn.is-disabled:hover,
.cy-col-delete-btn:disabled:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: transparent;
  color: var(--cy-text-muted);
}

.cy-collection-tab {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cy-collection-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.cy-collection-tab.is-active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cy-col-icon {
  font-size: 16px;
  margin-right: 12px;
  color: var(--choice);
}

.cy-col-tab-info h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.cy-col-tab-info small {
  font-size: 11px;
  color: var(--cy-text-muted);
}

/* Modules Panel */
.cy-modules-main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: radial-gradient(circle at top right, rgba(32, 42, 60, 0.3) 0%, transparent 100%);
}

.cy-help-launch {
  margin-top: auto;
  width: 100%;
  border: 1px solid rgba(213, 170, 98, 0.32);
  background: rgba(213, 170, 98, 0.12);
  color: var(--cy-text);
  border-radius: 12px;
  padding: 13px 14px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 5px;
}

.cy-help-launch:hover {
  background: rgba(213, 170, 98, 0.18);
  border-color: rgba(213, 170, 98, 0.48);
}

.cy-help-launch span {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.cy-help-launch small {
  color: var(--cy-text-muted);
  line-height: 1.35;
}

.cy-help-root {
  overflow-y: auto;
}

.cy-help-page {
  padding: clamp(24px, 4vw, 48px);
  display: grid;
  gap: 22px;
}

.cy-help-hero,
.cy-help-section,
.cy-help-steps {
  border: 1px solid var(--cy-border);
  background: rgba(18, 24, 37, 0.54);
  border-radius: 18px;
  padding: clamp(22px, 4vw, 38px);
}

.cy-help-hero h3,
.cy-help-section h3,
.cy-help-steps h3 {
  margin: 0;
  color: var(--cy-text);
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1.08;
  max-width: 16ch;
}

.cy-help-hero p {
  max-width: 72ch;
  color: var(--cy-text-muted);
  font-size: 17px;
  line-height: 1.65;
  margin: 18px 0 0;
}

.cy-help-eyebrow,
.cy-help-card-num {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #d5aa62;
  font-weight: 800;
  margin-bottom: 12px;
}

.cy-help-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.cy-help-card {
  border: 1px solid var(--cy-border);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 14px;
  padding: 20px;
}

.cy-help-card h4 {
  margin: 0 0 10px;
  color: var(--cy-text);
  font-size: 20px;
}

.cy-help-card p,
.cy-help-copy p,
.cy-help-example p,
.cy-help-steps li {
  color: var(--cy-text-muted);
  line-height: 1.6;
  font-size: 15px;
}

.cy-help-section {
  display: grid;
  grid-template-columns: minmax(220px, 0.62fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 42px);
  align-items: start;
}

.cy-help-example,
.cy-help-copy {
  border-left: 1px solid rgba(213, 170, 98, 0.32);
  padding-left: 24px;
}

.cy-help-page code {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  padding: 1px 5px;
  color: #f1d49a;
}

.cy-help-copy blockquote {
  margin: 18px 0;
  padding: 16px 18px;
  border-left: 3px solid #d5aa62;
  background: rgba(213, 170, 98, 0.08);
  color: var(--cy-text);
  line-height: 1.6;
}

.cy-help-steps h3 {
  max-width: none;
  margin-bottom: 14px;
}

.cy-help-steps ol {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 10px;
}

.cy-help-footer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.cy-modules-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 80%;
  color: var(--cy-text-muted);
}

.cy-modules-placeholder h3 {
  margin: 16px 0 8px;
  color: var(--cy-text);
}

.cy-module-list-wrap .cy-ml-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.cy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.cy-card {
  position: relative;
  background: var(--cy-glass-bg);
  border: 1px solid var(--cy-glass-border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: all 0.25s ease;
}

.cy-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.cy-card-color-strip {
  height: 4px;
  background: linear-gradient(90deg, var(--narrative), var(--choice));
}

.cy-card-body {
  padding: 16px;
}

.cy-card-body h4 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 500;
}

.cy-card-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--cy-text-muted);
  margin-bottom: 16px;
}

.cy-status-pill {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.cy-status-pill.draft { background: rgba(139, 155, 176, 0.15); color: #8b9bb0; }
.cy-status-pill.published { background: rgba(59, 156, 123, 0.15); color: #3b9c7b; }

.cy-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--cy-border);
  padding-top: 12px;
}

.cy-act-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--cy-text);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.cy-act-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.cy-act-btn.is-danger:hover {
  background: rgba(235, 94, 85, 0.15);
  color: #eb5e55;
}

/* Editor Workspace */
.cy-editor-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  width: 100%;
  min-width: 0;
  background: #111720;
}

.cy-editor-header {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--cy-border);
  background: #161b22;
  gap: 8px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.cy-editor-nav-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(42, 36, 25, 0.12);
  background: #faf7f0;
  color: #2a2419;
}

.cy-editor-nav-row .cy-eh-title {
  margin-left: 4px;
  color: #2a2419;
}

.cy-editor-nav-row .cy-eh-title h3 {
  color: #2a2419;
  font-weight: 650;
}

.cy-editor-header--tools {
  justify-content: flex-start;
}

.cy-eh-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.cy-eh-actions .wr-btn,
.cy-editor-header .cy-back-btn {
  min-height: 32px;
}

.cy-export-control {
  display: inline-flex;
  align-items: stretch;
  gap: 6px;
  min-height: 32px;
}

.cy-export-control select {
  min-height: 32px;
  max-width: 150px;
  border: 1px solid var(--cy-border);
  border-radius: 6px;
  background: #10151d;
  color: var(--cy-text);
  padding: 0 30px 0 10px;
  font-size: 12px;
}

.cy-back-btn {
  background: none;
  border: none;
  color: var(--cy-text-muted);
  font-size: 13px;
  cursor: pointer;
  margin-right: 16px;
}

.cy-back-btn:hover {
  color: var(--cy-text);
}

.cy-eh-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 260px;
  min-width: 0;
}

.cy-eh-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}

.cy-editor-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  background: #111720;
  position: relative;
}

.cy-canvas-holder {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  margin: 14px;
  border: 1px solid rgba(250, 247, 240, 0.10);
  border-radius: 16px;
  background: #efe8dc;
  box-shadow: inset -18px 0 34px rgba(18, 24, 37, 0.10), inset 0 0 0 1px rgba(43, 36, 24, 0.06), 0 18px 60px rgba(0, 0, 0, 0.24);
}

.cy-canvas-holder.has-inspector-open {
  margin-right: calc(clamp(380px, 34vw, 500px) + 28px);
}

.cy-canvas-holder .canvas-wrap {
  top: 70px;
}

.cy-canvas-holder .node-title {
  overflow-wrap: anywhere;
}

.cy-canvas-holder .canvas-world {
  filter: drop-shadow(0 1px 0 rgba(42, 36, 25, 0.06));
}

.cy-canvas-holder .edge path {
  stroke-opacity: 0.88;
  stroke-width: 2.4px;
}

.cy-canvas-holder .edge.is-selected path {
  stroke-width: 3.6px;
}

.cy-canvas-holder .edges marker path {
  opacity: 0.95;
}

.cy-canvas-holder .edge-label {
  font-family: var(--sans, ui-sans-serif, system-ui, sans-serif);
  font-style: normal;
  font-size: 11.5px;
  font-weight: 750;
  color: #211d14;
  background: rgba(255, 250, 241, 0.96);
  border: 1px solid rgba(43, 36, 24, 0.14);
  border-radius: 999px;
  padding: 4px 9px;
  box-shadow: 0 6px 16px rgba(42, 36, 25, 0.12);
}

.cy-canvas-tools {
  position: absolute;
  left: 18px;
  top: 14px;
  right: 18px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  max-width: none;
  padding: 9px 11px;
  border: 1px solid rgba(43, 36, 24, 0.12);
  border-radius: 12px;
  background: rgba(250, 247, 240, 0.92);
  color: #2b251b;
  box-shadow: 0 10px 30px rgba(18, 24, 37, 0.16);
  backdrop-filter: blur(10px);
}

.cy-canvas-tools span {
  font-size: 12px;
  line-height: 1.35;
  color: #6c6254;
}

.cy-choice-inline-hint {
  color: #6c6254 !important;
  font-size: 12px;
  font-weight: 700;
}

.cy-connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.cy-connect-icon {
  display: inline-flex;
}

.cy-canvas-empty {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 9;
  width: min(420px, calc(100% - 48px));
  padding: 24px;
  border: 1px solid rgba(43, 36, 24, 0.14);
  border-radius: 16px;
  background: rgba(250, 247, 240, 0.95);
  color: #211d14;
  text-align: center;
  box-shadow: 0 18px 50px rgba(18, 24, 37, 0.2);
}

.cy-canvas-empty h4 {
  margin: 0 0 8px;
  font-size: 20px;
}

.cy-canvas-empty p {
  margin: 0 0 16px;
  color: #706657;
  line-height: 1.5;
}

/* Sidebar Inspector */
.cy-sidebar-inspector {
  --cy-text: var(--ink, #2a2419);
  --cy-text-muted: var(--ink-3, #756b5d);
  --cy-border: var(--rule, rgba(42, 36, 25, 0.14));
  position: absolute;
  top: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  width: clamp(380px, 34vw, 500px);
  min-width: 0;
  border: 0.5px solid var(--rule, rgba(42, 36, 25, 0.14));
  border-radius: 16px;
  background: var(--paper, #faf7f0);
  color: var(--ink, #2a2419);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(38, 31, 22, 0.22);
}

.cy-inspector-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  border-bottom: 0.5px solid var(--rule, rgba(42, 36, 25, 0.14));
  background: var(--paper, #faf7f0);
  padding: 12px 12px 0;
}

.cy-inspector-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  overflow: visible;
}

.cy-inspector-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-3, #756b5d);
  cursor: pointer;
}

.cy-inspector-close:hover {
  background: var(--paper-2, #f3eee6);
  color: var(--ink, #2a2419);
}

.cy-inspector-tabs button {
  min-width: 0;
  padding: 10px 8px 11px;
  border-radius: 10px 10px 0 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-3, #756b5d);
  font-weight: 600;
  font-size: 11px;
  line-height: 1.2;
  white-space: normal;
  cursor: pointer;
}

.cy-inspector-tabs button.is-active {
  color: var(--ink, #2a2419);
  background: var(--paper-2, #f3eee6);
  border-bottom-color: var(--ink, #2a2419);
}

.cy-inspector-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  background: var(--paper, #faf7f0);
}

.cy-adventure-coauthor-panel {
  display: flex;
  flex-direction: column;
}

.cy-adventure-coauthor-panel .coa-thread {
  flex: 1;
  min-height: 0;
  background: var(--paper, #faf7f0);
}

.cy-adventure-coauthor-panel .coa-followup {
  padding: 12px;
  border-top: 0.5px solid var(--rule, rgba(42, 36, 25, 0.14));
  background: var(--paper, #faf7f0);
}

.cy-adventure-coauthor-panel .if-send-line.small {
  background: rgba(42, 36, 25, 0.92);
}

.cy-inspector-empty {
  display: grid;
  gap: 12px;
  text-align: center;
  color: var(--cy-text-muted);
  padding: 40px 20px;
}

.cy-inspector-empty h4 {
  margin: 0;
  color: var(--cy-text);
  font-size: 18px;
}

.cy-insp-section {
  margin-bottom: 14px;
}

.cy-insp-section label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-3, #756b5d);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.cy-prose-editor {
  width: 100%;
  min-height: 132px;
  font-family: Georgia, serif;
  font-size: 15px;
  line-height: 1.58;
  resize: vertical;
  background: #fffaf1 !important;
  color: #211d14 !important;
  border: 1px solid rgba(213, 170, 98, 0.38) !important;
  border-radius: 12px !important;
  padding: 12px 13px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.cy-card-title-input {
  width: 100%;
  min-height: 46px;
  font-size: 15px !important;
  line-height: 1.35;
  resize: vertical;
  overflow-wrap: anywhere;
}

.cy-prose-toolbar {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  flex-direction: column;
}

.cy-prose-toolbar label {
  margin: 0;
}

.cy-draft-status {
  margin: -2px 0 10px;
  color: var(--ink-2, #4b4136);
  font-size: 12px;
  line-height: 1.4;
  background: var(--paper-2, #f3eee6);
  border: 0.5px solid var(--rule, rgba(42, 36, 25, 0.14));
  border-radius: 10px;
  padding: 8px 10px;
}

.cy-mention-menu {
  margin-top: 8px;
  border: 1px solid var(--cy-border);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(22, 28, 38, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.26);
}
.cy-mention-hint,
.cy-mention-empty {
  padding: 8px 10px;
  font-size: 11px;
  color: var(--cy-text-muted);
}
.cy-mention-hint {
  border-bottom: 1px solid var(--cy-border);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.cy-mention-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid var(--cy-border);
  background: transparent;
  color: var(--cy-text);
  text-align: left;
  cursor: pointer;
}
.cy-mention-option:last-child { border-bottom: 0; }
.cy-mention-option:hover,
.cy-mention-option.is-active {
  background: rgba(255, 255, 255, 0.07);
}
.cy-mention-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.cy-mention-name {
  font-size: 13px;
  font-weight: 700;
}
.cy-mention-role {
  margin-left: auto;
  color: var(--cy-text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Conditions & Mutations Row styles */
.cy-cond-list, .cy-mut-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cy-cond-row, .cy-mut-row, .cy-cond-rule-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.cy-cond-rule-row {
  padding: 8px;
  border: 1px solid rgba(213, 170, 98, 0.24);
  border-radius: 10px;
  background: rgba(213, 170, 98, 0.08);
}

.cy-threshold-input {
  flex: 0 0 84px;
}

/* Scene type picker (node inspector) */
.cy-scene-type-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cy-scene-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(213, 170, 98, 0.28);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.cy-scene-type-chip:hover { border-color: var(--chip-color, #d5aa62); transform: translateY(-1px); }
.cy-scene-type-chip.is-active {
  border-color: var(--chip-color, #d5aa62);
  background: color-mix(in srgb, var(--chip-color, #d5aa62) 22%, transparent);
  box-shadow: inset 0 0 0 1px var(--chip-color, #d5aa62);
}
.cy-scene-type-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--chip-color, #d5aa62);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.12);
}

/* Archived scene cards + adventures */
.cy-archived-cards-wrap { position: relative; }
.cy-archived-pop {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 260px;
  max-height: 260px;
  overflow-y: auto;
  background: #241f18;
  border: 1px solid rgba(213, 170, 98, 0.35);
  border-radius: 10px;
  padding: 8px;
  z-index: 40;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}
.cy-archived-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
}
.cy-archived-row:hover { background: rgba(255, 255, 255, 0.05); }
.cy-archived-title { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cy-archived-heading {
  margin: 22px 0 10px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
}
.cy-card.is-archived { opacity: 0.65; cursor: default; }
.cy-card.is-archived:hover { opacity: 0.85; }

/* Compound Rule Builder — nested condition groups */
.cy-rule-group { display: flex; flex-direction: column; gap: 8px; }
.cy-rule-group.is-nested {
  padding: 8px;
  border: 1px dashed rgba(213, 170, 98, 0.4);
  border-radius: 12px;
  background: rgba(213, 170, 98, 0.05);
  margin-left: 4px;
}
.cy-rule-add-row { display: flex; gap: 6px; flex-wrap: wrap; }
.cy-add-group-btn { opacity: 0.85; }
.cy-add-group-btn:hover { opacity: 1; }

.cy-mut-row {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.cy-mut-row .cy-tiny-input:first-child {
  flex: 1 1 100%;
}

.cy-tiny-input {
  flex: 1 1 130px;
  min-width: 0;
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid rgba(213, 170, 98, 0.38) !important;
  background: #fffaf1 !important;
  color: #211d14 !important;
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.cy-tiny-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.cy-cond-row select, .cy-mut-row select, .cy-cond-rule-row select {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid rgba(213, 170, 98, 0.38) !important;
  background: #fffaf1 !important;
  color: #211d14 !important;
  font-size: 12px;
}

.cy-cond-row input,
.cy-mut-row input,
.cy-cond-rule-row input,
.cy-cond-row select,
.cy-mut-row select,
.cy-cond-rule-row select,
.cy-node-inspector .cy-tiny-input {
  color: #211d14 !important;
  -webkit-text-fill-color: #211d14 !important;
  background-color: #fffaf1 !important;
}

.cy-field-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--cy-text-muted);
}

.cy-choice-builder {
  display: grid;
  gap: 10px;
}

.cy-choice-list {
  display: grid;
  gap: 7px;
}

.cy-choice-row {
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border: 1px solid rgba(213, 170, 98, 0.26);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--cy-text);
  text-align: left;
  cursor: pointer;
}

.cy-choice-row:hover {
  border-color: rgba(213, 170, 98, 0.48);
  background: rgba(213, 170, 98, 0.11);
}

.cy-choice-row span {
  font-weight: 750;
}

.cy-choice-row small {
  color: var(--cy-text-muted);
}

.cy-choice-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.cy-choice-add-row .cy-tiny-input {
  width: 100%;
  min-width: 0;
}

.cy-tiny-link-btn {
  width: fit-content;
  border: 0;
  background: transparent;
  color: #f1d49a;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.cy-tiny-link-btn:hover {
  color: #ffe5ad;
  text-decoration: underline;
}

.cy-tiny-val {
  width: 48px;
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid rgba(213, 170, 98, 0.28);
  background: #fffaf1;
  color: #211d14;
  font-size: 12px;
}

.cy-mut-unique {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--cy-text-muted);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
}

.cy-chain-socket-panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--cy-border);
}

.cy-chain-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.cy-chain-head h4 {
  margin: 0;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.cy-chain-socket-list {
  display: grid;
  gap: 10px;
}

.cy-chain-socket {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--cy-border);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
}

.cy-chain-socket label {
  display: grid;
  gap: 4px;
  color: var(--cy-text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.cy-chain-socket select {
  min-height: 32px;
  border: 1px solid rgba(213, 170, 98, 0.28);
  border-radius: 8px;
  background: #fffaf1;
  color: #211d14;
  padding: 5px 7px;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}

.cy-btn-row-del {
  background: none;
  border: none;
  color: #eb5e55;
  font-size: 16px;
  cursor: pointer;
}

.cy-tiny-add-btn {
  background: #f1b83f !important;
  border: 1px solid rgba(255, 224, 151, 0.72) !important;
  border-radius: 9px;
  color: #20160b !important;
  -webkit-text-fill-color: #20160b !important;
  font-size: 12px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
  padding: 8px 10px;
  width: 100%;
  max-width: 100%;
  white-space: normal;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.cy-tiny-add-btn:hover {
  background: #ffd16a !important;
}

.cy-tiny-add-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: none;
}

.cy-coauthor-draft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
  flex: 0 0 auto;
  min-height: 34px;
  max-width: 100%;
  background: rgba(241, 184, 63, 0.12) !important;
  color: #f6d48a !important;
  -webkit-text-fill-color: #f6d48a !important;
  border-color: rgba(241, 184, 63, 0.42) !important;
  box-shadow: none;
}

.cy-coauthor-draft-btn:disabled {
  color: #4f3b13 !important;
  -webkit-text-fill-color: #4f3b13 !important;
}

.cy-condition-type {
  flex: 0 0 108px;
}

.cy-loading-aside {
  color: var(--cy-text-muted);
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .cy-editor-body {
    flex-direction: column;
    min-height: 760px;
  }

  .cy-canvas-holder {
    min-height: 420px;
  }

  .cy-sidebar-inspector {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    width: auto;
    max-height: 56vh;
    border: 0.5px solid var(--rule, rgba(42, 36, 25, 0.14));
  }

  .cy-canvas-holder.has-inspector-open {
    margin-right: 14px;
  }
}

/* Validation Tab */
.cy-validation-pane h4 {
  margin: 0 0 12px;
  font-size: 14px;
}

.cy-val-pass {
  background: rgba(59, 156, 123, 0.15);
  color: #3b9c7b;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
}

.cy-val-errors {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cy-val-errors li {
  background: rgba(235, 94, 85, 0.1);
  color: #eb5e55;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 8px;
}

/* Module Publishing Coach */
.cy-publish-pane {
  display: grid;
  gap: 14px;
}

.cy-publish-coach-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--cy-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.cy-pub-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #1d160d;
  background: linear-gradient(135deg, #e8d3a8, #9b7a3d);
  font-weight: 800;
  letter-spacing: .04em;
}

.cy-pub-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--choice);
  margin-bottom: 4px;
}

.cy-publish-coach-card h4 {
  margin: 0 0 8px;
  font-size: 17px;
}

.cy-publish-coach-card p {
  margin: 0;
  color: var(--cy-text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.cy-pub-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cy-pub-stats span {
  border: 1px solid var(--cy-border);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  color: var(--cy-text-muted);
  background: rgba(255,255,255,.03);
}

.cy-pub-grid {
  display: grid;
  gap: 10px;
}

.cy-pub-field {
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: var(--cy-text-muted);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.cy-pub-field select,
.cy-pub-field input {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--cy-border);
  background: rgba(0,0,0,.22);
  color: var(--cy-text);
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.cy-pub-check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--cy-text-muted);
}

.cy-pub-preview {
  padding: 12px;
  border: 1px solid var(--cy-border);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
}

.cy-pub-preview-page {
  padding: 18px;
  border-radius: 10px;
  background: #fffdf8;
  color: #241d16;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}

.cy-pub-preview[data-theme="classic"] .cy-pub-preview-page {
  background: #fff;
  color: #1f1f1f;
}

.cy-pub-preview[data-theme="storybook"] .cy-pub-preview-page {
  background: #fffaf0;
  color: #2a2018;
}

.cy-pub-preview[data-theme="midnight"] .cy-pub-preview-page {
  background: #101722;
  color: #f6efe3;
}

.cy-pub-preview-kicker {
  font: 800 10px/1.2 system-ui, sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8a4f2b;
  margin-bottom: 8px;
}

.cy-pub-preview[data-theme="midnight"] .cy-pub-preview-kicker {
  color: #d5aa62;
}

.cy-pub-preview-page h4 {
  margin: 0 0 10px;
  font-size: 22px;
}

.cy-pub-preview-page p {
  margin: 0 0 12px;
}

.cy-pub-preview-choice {
  border: 1px solid rgba(111,63,32,.25);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,.45);
  font-weight: 700;
}

.cy-pub-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Playtester & Serif Reader Pane */
.cy-playtest-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #faf7f0;
  color: #2b2b2b;
}

.cy-playtest-wrap .cy-editor-header {
  background: #ebdccb;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  color: #2b2b2b;
}

.cy-playtest-wrap .cy-back-btn {
  color: #666;
}

.cy-playtest-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.cy-reader-pane {
  flex: 1;
  overflow-y: auto;
  padding: 60px 40px;
  display: flex;
  justify-content: center;
}

.cy-reader-content {
  max-width: 650px;
  width: 100%;
}

.cy-reader-content h2 {
  font-family: "Cinzel", serif;
  font-size: 28px;
  margin-top: 0;
  margin-bottom: 24px;
  color: #1a1a1a;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding-bottom: 12px;
}

.cy-prose-body {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 19px;
  line-height: 1.65em;
  color: #2c2c2c;
  margin-bottom: 40px;
}

.cy-prose-body p {
  margin-bottom: 1.4em;
}

.cy-reader-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cy-choice-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: #fff;
  color: #2c2c2c;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 17px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.cy-choice-btn:hover {
  background: #fbf7f0;
  border-color: var(--choice);
  transform: translateX(4px);
}

.cy-choice-btn.is-disabled {
  background: #f0ede6;
  color: #888;
  cursor: not-allowed;
  transform: none;
  border-color: rgba(0, 0, 0, 0.05);
  box-shadow: none;
}

/* Playtest Monitor */
.cy-sidebar-monitor {
  width: 280px;
  background: #ebdccb;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cy-sidebar-monitor .cy-sec-header {
  color: #666;
}

.cy-monitor-section h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 0.5px;
}

.cy-mon-empty {
  font-size: 12px;
  color: #888;
  font-style: italic;
}

.cy-monitor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cy-monitor-table td {
  padding: 6px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.cy-path-log {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #555;
}

.cy-path-log li {
  padding: 6px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 4px;
}

/* CYOA Playtest Debugger styles */
.cy-playtest-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: #ebdccb;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  color: #2b2b2b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.cy-pt-tb-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cy-pt-back-btn {
  background: none;
  border: none;
  color: #555;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.cy-pt-back-btn:hover {
  color: #000;
}

.cy-pt-divider {
  color: rgba(0, 0, 0, 0.15);
  font-weight: 300;
}

.cy-pt-title {
  font-size: 14px;
}

.cy-pt-tb-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cy-pt-btn {
  padding: 6px 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  background: #fff;
  color: #2c2c2c;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all 0.2s;
}

.cy-pt-btn:hover {
  background: #fbf7f0;
  border-color: #cca43b;
}

.cy-pt-toggle-group {
  display: flex;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px;
  border-radius: 8px;
}

.cy-pt-toggle-btn {
  padding: 5px 12px;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.cy-pt-toggle-btn.is-active {
  background: #fff;
  color: #2b2b2b;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.cy-pt-validation-banner {
  background: #fff3cd;
  border-bottom: 1px solid #ffeeba;
  color: #856404;
  padding: 10px 24px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.cy-val-banner-title {
  font-weight: 700;
}

.cy-val-banner-list {
  margin: 4px 0 0 18px;
  padding: 0;
}

.cy-val-banner-list li {
  margin-bottom: 2px;
}

/* Choice inspector lock styling */
.cy-pt-choice-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.cy-pt-choice-lock-explanation {
  font-size: 12px;
  color: #721c24;
  background: #f8d7da;
  padding: 6px 12px;
  border-radius: 4px;
  margin-top: -6px;
  margin-bottom: 10px;
  border: 1px solid #f5c6cb;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.cy-pt-lock-detail {
  font-style: italic;
  color: #555;
}

.cy-pt-ending-banner {
  background: rgba(0, 0, 0, 0.02);
  border: 1px dashed rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  font-family: "EB Garamond", Georgia, serif;
}

.cy-pt-ending-banner h4 {
  margin: 0 0 6px;
  font-size: 18px;
  font-family: "Cinzel", serif;
}

.cy-pt-ending-banner p {
  margin: 0;
  font-size: 15px;
  color: #555;
}

.cy-pt-softlock-warning {
  margin-top: 12px;
  padding: 8px;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  border-radius: 4px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Monitor specific tools */
.cy-pt-monitor-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cy-pt-inventory-item, .cy-pt-flag-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.4);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.cy-pt-poke-del {
  background: none;
  border: none;
  color: #eb5e55;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
}

.cy-pt-poke-del:hover {
  transform: scale(1.1);
}

.cy-pt-scroller-box {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
  padding: 2px;
}

.cy-pt-inline-node-pill {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.03);
  font-family: monospace;
}

/* Step deltas history styling */
.cy-pt-history-row {
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.cy-pt-history-row:hover {
  background: rgba(255, 255, 255, 0.7) !important;
  transform: translateX(2px);
}

.cy-pt-hist-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  margin-bottom: 2px;
}

.cy-pt-hist-step {
  background: #cca43b;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 9px;
}

.cy-pt-hist-node {
  font-size: 13px;
  margin-bottom: 4px;
}

.cy-pt-step-diff-box {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.cy-diff-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}

.cy-diff-badge.is-added {
  background: rgba(59, 156, 123, 0.15);
  color: #3b9c7b;
}

.cy-diff-badge.is-removed {
  background: rgba(235, 94, 85, 0.15);
  color: #eb5e55;
}

.cy-pt-rewind-helper {
  display: block;
  text-align: right;
  font-size: 9px;
  color: #888;
  margin-top: 4px;
  font-style: italic;
}

/* Seeding modal dialog */
.cy-pt-dialog-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #2b2b2b;
}

.cy-pt-dialog {
  background: #fbf7f0;
  border: 1px solid #ebdccb;
  border-radius: 12px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.cy-pt-dialog h4 {
  margin: 0 0 16px;
  font-size: 18px;
  font-family: "Cinzel", serif;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding-bottom: 8px;
}

.cy-seed-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.cy-pt-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 16px;
}

/* Player faithful only mode override layout */
.is-player-only .cy-reader-pane {
  max-width: 800px;
  margin: 0 auto;
}

.is-player-only .cy-playtest-body {
  justify-content: center;
}

.cy-sim-edge-handle {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 8000;
  width: 18px;
  height: 64px;
  min-width: 18px;
  min-height: 44px;
  border: 0;
  border-radius: 0 8px 8px 0;
  background: rgba(211, 145, 82, .76);
  color: #15110d;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}

.cy-sim-edge-handle:hover,
.cy-sim-edge-handle:focus-visible {
  background: rgba(211, 145, 82, .96);
  outline: 2px solid #f4d09a;
  outline-offset: 2px;
}

.cy-sim-drawer {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
}

.cy-sim-drawer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  cursor: pointer;
  transition: opacity .25s ease;
}

.cy-sim-drawer-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(86vw, 380px);
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 20px 24px;
  background: #15110d;
  color: #e8e2d8;
  box-shadow: 0 0 32px rgba(0, 0, 0, .6);
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.2, .7, .2, 1);
  pointer-events: auto;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cy-sim-drawer.is-open {
  pointer-events: auto;
}

.cy-sim-drawer.is-open .cy-sim-drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.cy-sim-drawer.is-open .cy-sim-drawer-panel {
  transform: translateX(0);
}

.cy-sim-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cy-sim-drawer-kicker {
  margin: 0 0 4px;
  color: rgba(232, 226, 216, .52);
  font: 700 11px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.cy-sim-drawer-head h3 {
  margin: 0;
  color: #d39152;
  font-family: "Cinzel", Georgia, serif;
  font-size: 20px;
  letter-spacing: .06em;
}

.cy-sim-drawer-close {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  background: transparent;
  color: #e8e2d8;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.cy-sim-module-name {
  margin: -6px 0 0;
  color: rgba(232, 226, 216, .62);
  font-size: 13px;
}

.cy-sim-summary {
  margin: 0 0 2px;
  color: #e8e2d8;
  font-size: 16px;
  line-height: 1.55;
}

.cy-sim-drawer-section {
  padding: 12px 0 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.cy-sim-section-title {
  margin-bottom: 8px;
  color: rgba(232, 226, 216, .56);
  font: 800 11px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.cy-sim-empty {
  margin: 0;
  color: rgba(232, 226, 216, .55);
  font-size: 13px;
}

.cy-sim-stat-list,
.cy-sim-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.cy-sim-stat-row,
.cy-sim-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
}

.cy-sim-stat-row {
  justify-content: space-between;
}

.cy-sim-stat-row span,
.cy-sim-item-name {
  overflow: hidden;
  color: #e8e2d8;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cy-sim-stat-row strong,
.cy-sim-item-qty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #d39152;
  color: #15110d;
  font-size: 13px;
  font-weight: 800;
}

.cy-sim-item-list {
  list-style: none;
}

.cy-sim-drawer-hint {
  margin: auto 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  color: rgba(232, 226, 216, .55);
  font-size: 12px;
  line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
  .cy-sim-drawer-panel,
  .cy-sim-drawer-backdrop {
    transition: none !important;
  }
}

/* Reader-faithful app preview polish */
.cy-playtest-wrap {
  background: #050504;
  color: #f5efe2;
}

.cy-playtest-toolbar {
  background: #050504;
  color: #f5efe2;
  border-bottom-color: rgba(255,255,255,.08);
}

.cy-pt-back-btn,
.cy-pt-title {
  color: #f5efe2;
}

.cy-pt-divider {
  color: rgba(255,255,255,.22);
}

.cy-pt-btn {
  background: #15130d;
  color: #f5efe2;
  border-color: rgba(255,255,255,.14);
}

.cy-pt-toggle-group {
  background: rgba(255,255,255,.08);
}

.cy-pt-toggle-btn {
  color: #c6baa8;
}

.cy-pt-toggle-btn.is-active {
  background: #2f56b7;
  color: #fff;
}

.cy-reader-pane {
  background: #050504;
  padding: clamp(24px, 6vw, 70px) clamp(18px, 5vw, 48px);
}

.cy-reader-content {
  max-width: 720px;
}

.cy-reader-content h2,
.cy-reader-node-title {
  font-family: "Cinzel", Georgia, serif;
  color: #8aa2ff;
  border-bottom: 0;
  font-size: clamp(16px, 3vw, 22px);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.cy-prose-body {
  color: #f5efe2;
  font-size: clamp(19px, 3vw, 24px);
  line-height: 1.55;
}

.cy-choice-btn {
  min-height: 58px;
  border-radius: 14px;
  background: #15130d;
  color: #f5efe2;
  border-color: rgba(255,255,255,.12);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 750;
}

.cy-choice-btn:hover:not(:disabled) {
  background: #2f56b7;
  border-color: #5877d6;
  transform: translateY(-1px);
}

.cy-choice-btn.is-disabled {
  background: rgba(10,10,8,.72);
  color: rgba(245,239,226,.38);
  border-color: rgba(255,255,255,.06);
}

.cy-sidebar-monitor {
  background: #11151e;
  color: #f5efe2;
  border-left-color: rgba(255,255,255,.10);
}

.cy-sidebar-monitor .cy-sec-header,
.cy-monitor-section h4,
.cy-mon-empty,
.cy-path-log {
  color: #b9c0cf;
}

.cy-monitor-table td {
  border-bottom-color: rgba(255,255,255,.08);
}

.cy-pt-inventory-item,
.cy-pt-flag-item,
.cy-path-log li {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.08);
  color: #f5efe2;
}

@media (max-width: 900px) {
  .cy-header-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .cy-h-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .cy-studio-main {
    flex-direction: column;
  }

  .cy-sidebar-collections {
    width: 100%;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--cy-border);
  }

  .cy-help-grid,
  .cy-help-section {
    grid-template-columns: 1fr;
  }

  .cy-help-example,
  .cy-help-copy {
    border-left: 0;
    border-top: 1px solid rgba(213, 170, 98, 0.32);
    padding-left: 0;
    padding-top: 18px;
  }

  .cy-playtest-body {
    flex-direction: column;
  }

  .cy-sidebar-monitor {
    width: 100%;
    max-height: 42vh;
    border-left: 0;
    border-top: 1px solid rgba(255,255,255,.10);
  }

  .cy-playtest-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .cy-pt-tb-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  .cy-editor-nav-row {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    padding: 8px 14px;
  }

  .cy-editor-nav-row .cy-context-back {
    flex: 1 1 0;
    min-width: 0;
    min-height: 42px;
    padding: 6px 9px;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
  }

  .cy-editor-nav-row .cy-eh-title {
    flex-basis: 100%;
    margin-left: 0;
  }
}

/* Tabletop import — encounter stat-block asides (shared Reader + Coach prose) */
.cy-prose aside.encounter {
  border: 1px solid var(--cy-border);
  background: var(--cy-encounter-bg, rgba(120, 60, 40, 0.06));
  border-radius: 8px;
  padding: 14px 16px;
  margin: 16px 0;
}
.cy-prose aside.encounter h4 {
  margin: 0 0 6px;
  font-family: var(--cy-heading-font, "Cormorant Garamond", serif);
  letter-spacing: 0.02em;
  font-size: 17px;
}
.cy-prose aside.encounter .env {
  font-style: italic;
  color: var(--cy-text-muted);
  margin: 0 0 10px;
  font-size: 13px;
}
.cy-prose aside.encounter .combatant {
  border-top: 1px dashed var(--cy-border);
  padding-top: 10px;
  margin-top: 10px;
}
.cy-prose aside.encounter .combatant:first-of-type {
  border-top: none;
  margin-top: 0;
}
.cy-prose aside.encounter .combatant h5 {
  margin: 0 0 4px;
  font-size: 14px;
}
.cy-prose aside.encounter .combatant h5::after {
  content: " ×" attr(data-count);
}
.cy-prose aside.encounter .stats,
.cy-prose aside.encounter .abilities {
  font-family: var(--cy-mono-font, "JetBrains Mono", ui-monospace, monospace);
  font-size: 12.5px;
  margin: 2px 0;
  color: var(--cy-text-mute-2, #888);
}
.cy-prose aside.encounter .gm-note {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dotted var(--cy-border);
  font-size: 13px;
  font-style: italic;
  color: var(--cy-text-muted);
}

.cy-review-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(200, 140, 60, 0.2);
  color: #e8c88a;
  border: 1px solid rgba(200, 140, 60, 0.35);
}

.cy-review-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-right: auto;
}

.cy-review-banner .wr-btn.is-active {
  background: rgba(200, 140, 60, 0.25);
}
