/* 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: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--cy-border);
  background: rgba(22, 28, 38, 0.45);
  backdrop-filter: blur(12px);
}

.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-studio-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* 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 {
  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: 640px;
  width: 100%;
  min-width: 0;
  background: #111720;
}

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

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

.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;
}

.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;
  box-shadow: inset 0 0 0 1px rgba(43, 36, 24, 0.06), 0 18px 60px rgba(0, 0, 0, 0.24);
}

.cy-canvas-tools {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, calc(100% - 36px));
  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-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 {
  flex: 0 0 clamp(320px, 30vw, 380px);
  min-width: 0;
  border-left: 1px solid var(--cy-border);
  background: #161b22;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cy-inspector-tabs {
  display: flex;
  border-bottom: 1px solid var(--cy-border);
  flex-wrap: wrap;
}

.cy-inspector-tabs button {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--cy-text-muted);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.cy-inspector-tabs button.is-active {
  color: var(--cy-text);
  border-bottom-color: var(--choice);
}

.cy-inspector-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
}

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

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

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

.cy-prose-editor {
  width: 100%;
  min-height: 176px;
  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), 0 10px 24px rgba(0,0,0,0.16);
}

.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: #f3ddaa;
  font-size: 12px;
  line-height: 1.4;
  background: rgba(213, 170, 98, 0.11);
  border: 1px solid rgba(213, 170, 98, 0.18);
  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;
}

.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-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: fit-content;
  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: #f1b83f !important;
  color: #20160b !important;
  -webkit-text-fill-color: #20160b !important;
  border-color: rgba(255, 224, 151, 0.72) !important;
  box-shadow: 0 10px 24px rgba(241, 184, 63, 0.2);
}

.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 {
    flex: 0 0 420px;
    width: 100%;
    border-left: 0;
    border-top: 1px solid var(--cy-border);
  }
}

/* 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;
}

/* 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;
  }
}
