.system-node {
  align-self: center;
  max-width: 92%;
  color: var(--text-muted);
  background: var(--bg-global);
  padding: 5px 12px;
  border-radius: 18px;
  text-align: center;
  font-size: 11px;
  line-height: 1.45;
  font-weight: 650;
}

.narration-node,
.thought-node {
  align-self: stretch;
  border-radius: 4px var(--radius-md) var(--radius-md) 4px;
  padding: 11px 14px;
  box-shadow: var(--shadow-light);
  font-size: 13px;
  line-height: 1.65;
  color: #595675;
}

.narration-node {
  background: rgba(102, 105, 172, 0.05);
  border-left: 3px solid var(--color-primary);
}

.thought-node {
  align-self: stretch;
  border-radius: 4px var(--radius-md) var(--radius-md) 4px;
  padding: 11px 14px;
  box-shadow: var(--shadow-light);
  font-size: 13px;
  line-height: 1.65;
  color: #595675;
}

.thought-node {
  background: var(--color-child-bg);
  border-left: 3px solid var(--color-child);
}

.history-bubble-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.history-bubble-row.is-child {
  flex-direction: row-reverse;
}

.bubble-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(102, 105, 172, 0.08);
}

.bubble-avatar.mami { background: var(--color-mami-bg); border-color: var(--color-mami); }

.bubble-avatar.mom { background: var(--color-mom-bg); border-color: var(--color-mom); }

.bubble-avatar.child { background: var(--color-child-bg); border-color: var(--color-child); }

.bubble-content-wrap {
  max-width: min(78%, 286px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-bubble-row.is-child .bubble-content-wrap {
  align-items: flex-end;
}

.bubble-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.bubble-name {
  font-weight: 700;
}

.bubble-name.mami { color: var(--color-mami); }

.bubble-name.mom { color: var(--color-mom); }

.bubble-name.child { color: #c08a1e; }

.bubble-debug {
  display: none;
  color: var(--color-primary);
  font-size: 10px;
}

.bubble-cue {
  color: var(--text-muted);
  background: var(--color-primary-bg);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}

body.debug-mode .bubble-debug {
  display: inline;
}

.bubble-text-box {
  background: #fff;
  padding: 10px 13px;
  border-radius: 4px var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-light);
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.history-bubble-row.is-child .bubble-text-box {
  background: var(--color-child-bg);
  border-radius: var(--radius-md) 4px var(--radius-md) var(--radius-md);
}

.continue-button,
.option-button,
.secondary-button {
  min-height: 44px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.continue-button {
  width: 100%;
  background: var(--color-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  box-shadow: 0 8px 24px rgba(102, 105, 172, 0.3);
}

.continue-button:focus-visible,
.option-button:focus-visible,
.secondary-button:focus-visible,
.text-button:focus-visible {
  outline: 3px solid rgba(102, 105, 172, 0.28);
  outline-offset: 2px;
}

.continue-button:active,
.option-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.options-list[hidden],
.continue-button[hidden],
.end-actions[hidden],
.text-button[hidden] {
  display: none;
}

.option-button {
  width: 100%;
  background: #fff;
  color: var(--text-main);
  border: 1.5px solid var(--line-soft);
  box-shadow: var(--shadow-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.option-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.option-index {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--color-primary);
  font-size: 11px;
  font-weight: 800;
}

.end-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.secondary-button {
  min-height: 44px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.secondary-button {
  background: #fff;
  border: 1px solid var(--line-soft);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
}

.text-button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  text-decoration: underline;
}
