/* Header */
.header {
  background: var(--surface-dark);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header .back-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.15s;
}

.header .back-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.header-spacer {
  flex: 1;
}

.settings-menu {
  position: relative;
}

.settings-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.15s;
}

.settings-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.settings-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  min-width: 200px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.settings-label {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.settings-value {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.settings-source {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
}

.settings-clear {
  width: 100%;
  background: none;
  border: 1px solid var(--text-dim);
  color: var(--text-dim);
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}

.settings-clear:hover {
  border-color: #f87171;
  color: #f87171;
}

/* Home Screen - Runs List */
.home-screen {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.home-screen-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.home-screen h2 {
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.runs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.run-item {
  background: transparent;
  border: none;
  text-align: left;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}

.run-item:hover {
  background: var(--surface-light);
}

.run-item:focus {
  background: #252540;
  outline: none;
}

.run-task {
  font-family: var(--font-sans);
  color: var(--text);
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.run-task::before {
  content: "▸";
  color: var(--accent);
}

.run-meta {
  font-family: var(--font-sans);
  color: var(--text-dim);
  font-size: 0.9rem;
  padding-left: 1rem;
}

/* Simulation View */
.sim-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--surface-dark);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.sidebar-section {
  padding: 0.75rem 0;
}

.section-header {
  padding: 0.5rem 1rem 0.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 0.5rem 1rem 0.5rem 1.25rem;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.sidebar-item.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-left-color: var(--accent);
}

.channel-item::before {
  content: "# ";
  opacity: 0.5;
}

.person-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}

.content-header {
  background: var(--surface-light);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.content-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.export-btn {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #6366f1;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.export-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
}

.stop-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.stop-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

.sim-status {
  color: var(--success);
  font-size: 0.8rem;
  font-weight: 500;
}

.sim-status.complete::before {
  content: "✓ ";
}

.sim-status.live {
  color: var(--warning);
}

.sim-status.live::before {
  content: "● ";
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
}

/* Continue Form */
.continue-form {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.continue-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.continue-message-input {
  flex: 1;
  background: var(--surface-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.continue-message-input:focus {
  outline: none;
  border-color: var(--accent);
}

.continue-message-input::placeholder {
  color: var(--text-dim);
}

.continue-duration {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.continue-duration-input {
  width: 60px;
  background: var(--surface-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 0.5rem;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  text-align: center;
}

.continue-duration-input:focus {
  outline: none;
  border-color: var(--accent);
}

.continue-duration-label {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.continue-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
}

.continue-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.continue-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Messages */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 800px;
}

.message {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.message:last-child {
  border-bottom: none;
}

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.msg-author {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
}

.msg-time {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.msg-text {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text);
  padding-left: 0;
  white-space: pre-wrap;
  line-height: 1.7;
  letter-spacing: 0.01em;
}

/* Proposal Cards */
.proposal-card {
  padding: 0.75rem;
  margin: 0.5rem 0;
  background: var(--surface-dark);
  border: 1px solid var(--accent);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}

.proposal-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.proposal-icon {
  font-size: 1rem;
}

.proposal-author {
  font-weight: 600;
  color: var(--accent);
}

.proposal-label {
  color: var(--text-dim);
}

.proposal-text {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.5;
  padding: 0.5rem 0;
}

.proposal-votes {
  display: flex;
  gap: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.vote-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  cursor: default;
}

.vote-group.vote-yes {
  color: #4ade80;
}

.vote-group.vote-no {
  color: #f87171;
}

.vote-group.vote-unsure {
  color: #fbbf24;
}

/* Events Timeline */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 900px;
}

.event-row {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.event-row:last-child {
  border-bottom: none;
}

.event-time {
  color: var(--text-muted);
  min-width: 60px;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}

.event-name {
  color: var(--accent);
  font-weight: 500;
  min-width: 110px;
  font-size: 0.85rem;
}

.event-content {
  color: var(--text-dim);
  font-family: var(--font-sans);
  flex: 1;
}

/* Person Card */
.person-card {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  max-width: 700px;
}

.person-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.person-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.person-role {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.person-bio {
  font-family: var(--font-sans);
  color: var(--text);
  line-height: 1.7;
  font-size: 0.95rem;
}

/* Journal section in person view */
.journal-section {
  margin-top: 2rem;
  max-width: 700px;
}

.journal-header {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Final Result */
.final-result {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-top: 2rem;
  max-width: 800px;
}

.final-result-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--success);
  margin-bottom: 0.5rem;
}

.final-result p {
  font-family: var(--font-sans);
  line-height: 1.7;
}

/* Empty State */
.empty-state {
  color: var(--text-dim);
  text-align: center;
  padding: 3rem;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
}

/* Home Header */
.home-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.new-run-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: background 0.15s;
}

.new-run-btn:hover {
  background: var(--accent-dim);
}

/* New Run Form */
.new-run-form {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.optional-hint {
  font-weight: 400;
  text-transform: none;
  color: var(--text-dim);
}

.mode-toggle {
  display: flex;
  gap: 0.5rem;
}

.mode-btn {
  flex: 1;
  background: var(--surface-dark);
  border: 2px solid transparent;
  color: var(--text-dim);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.05rem;
  transition: all 0.15s;
}

.mode-btn:hover {
  background: var(--surface-light);
  color: var(--text);
}

.mode-btn.active {
  border-color: var(--accent);
  background: var(--surface-light);
  color: var(--text);
}

.mode-hint {
  font-family: var(--font-sans);
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.task-input {
  width: 100%;
  background: var(--surface-dark);
  border: 1px solid var(--text-dim);
  color: var(--text);
  padding: 0.75rem;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  resize: vertical;
}

.task-input:focus {
  outline: none;
  border-color: var(--accent);
}

.task-input::placeholder {
  color: var(--text-dim);
}

.voting-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.voting-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text);
}

.voting-checkbox {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.voting-start-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.voting-label {
  color: var(--text-dim);
  font-size: 0.95rem;
}

.voting-input-small {
  width: 70px;
  background: var(--surface-dark);
  border: 1px solid var(--text-dim);
  color: var(--text);
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  text-align: center;
}

.voting-input-small:focus {
  outline: none;
  border-color: var(--accent);
}

/* Character select list (for NewRunForm) */
.character-select-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.character-select-list {
  max-height: 300px;
  overflow-y: auto;
  outline: none;
  border: 1px solid var(--surface-dark);
  border-radius: 6px;
  background: var(--surface-dark);
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--surface-dark);
}

.cancel-btn {
  background: none;
  border: 1px solid var(--text-dim);
  color: var(--text-dim);
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}

.cancel-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

.start-btn {
  background: var(--success);
  color: #000;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: opacity 0.15s;
}

.start-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.start-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Home Tabs */
.home-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--surface-dark);
  padding-bottom: 0;
}

.home-tab {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 0.75rem 1.5rem;
  font-size: 1.05rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  outline: none;
}

.home-tab:hover {
  color: var(--text);
  background: var(--surface-light);
}

.home-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Character List */
.character-list-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative;
}

.character-list-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.search-box {
  flex: 1;
  position: relative;
}

.search-input {
  width: 100%;
  background: var(--surface-dark);
  border: 1px solid var(--text-dim);
  color: var(--text);
  padding: 0.6rem 2rem 0.6rem 0.75rem;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 1rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}

.search-clear:hover {
  color: var(--text);
}

.bulk-actions {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface-dark);
  border: 1px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.bulk-count {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
}

.bulk-confirm-text {
  color: var(--text);
  font-size: 0.85rem;
}

.bulk-delete {
  background: none;
  border: 1px solid #f87171;
  color: #f87171;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

.bulk-delete:hover {
  background: rgba(248, 113, 113, 0.1);
}

.bulk-delete-confirm {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.bulk-delete-confirm:hover {
  background: #b91c1c;
}

.bulk-cancel {
  background: none;
  border: 1px solid var(--text-dim);
  color: var(--text-dim);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

.bulk-cancel:hover {
  border-color: var(--text);
  color: var(--text);
}

.character-list {
  flex: 1;
  overflow-y: auto;
  outline: none;
}

.keyboard-hint-icon {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  z-index: 10;
}

.hint-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: var(--surface-dark);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  font-size: 1rem;
}

.keyboard-hint-icon:hover .hint-icon {
  opacity: 1;
}

.hint-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 0.5rem;
  background: var(--surface-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.keyboard-hint-icon:hover .hint-tooltip {
  display: block;
}

.hint-tooltip div {
  padding: 0.2rem 0;
}

.character-list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  border: 2px solid transparent;
}

.character-list-item:hover {
  background: var(--surface-light);
}

.character-list-item.focused {
  background: var(--surface-light);
  border-color: var(--accent);
}

.character-list-item.selected {
  background: rgba(74, 222, 128, 0.08);
}

.character-list-item.selected.focused {
  border-color: var(--success);
}

.char-checkbox {
  margin-top: 0.25rem;
  width: 16px;
  height: 16px;
  accent-color: var(--success);
  cursor: pointer;
}

.char-list-emoji {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.char-list-info {
  flex: 1;
  min-width: 0;
}

.char-list-name {
  font-family: var(--font-sans);
  color: var(--text);
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.char-list-bio {
  font-family: var(--font-sans);
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Generate button */
.generate-btn {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.15s;
  white-space: nowrap;
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.generate-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.keyhint {
  opacity: 0.7;
  font-size: 0.8em;
  margin-left: 0.25rem;
}

/* Creating placeholder */
.creating-placeholder {
  opacity: 0.7;
  pointer-events: none;
}

.char-checkbox-placeholder {
  width: 16px;
  height: 16px;
}

.creating-spinner-small {
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid var(--text-dim);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.creating-status {
  color: var(--accent);
  font-style: italic;
}

.creating-status.pending {
  color: var(--text-dim);
}

.creating-status.error {
  color: #e74c3c;
}

.creating-placeholder.pending {
  opacity: 0.5;
}

.creating-placeholder.error {
  opacity: 0.8;
}

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

/* Character Detail View */
.character-detail {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

.char-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--surface-dark);
}

.char-detail-emoji {
  font-size: 4rem;
  line-height: 1;
}

.char-detail-info {
  flex: 1;
}

.char-detail-info h2 {
  color: var(--text);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.char-detail-meta {
  font-family: var(--font-sans);
  color: var(--text-dim);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.meta-sep {
  opacity: 0.5;
}

.char-detail-confidence {
  text-align: right;
}

.confidence-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.confidence-bar {
  width: 120px;
  height: 6px;
  background: var(--surface-dark);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--warning), var(--success));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.confidence-value {
  color: var(--success);
  font-size: 0.85rem;
  font-weight: 600;
}

.char-detail-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.char-section {
  background: var(--surface-light);
  border: 1px solid var(--surface-dark);
  border-radius: 8px;
  padding: 1.25rem;
}

.char-section h3 {
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.char-section p {
  font-family: var(--font-sans);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.8;
  white-space: pre-wrap;
  letter-spacing: 0.01em;
}

.context-content {
  max-height: 200px;
  overflow: hidden;
  position: relative;
}

.context-content::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(transparent, var(--surface-light));
  pointer-events: none;
}

.context-content.expanded {
  max-height: none;
}

.context-content.expanded::after {
  display: none;
}

.context-toggle {
  background: none;
  border: 1px solid var(--text-dim);
  color: var(--text-dim);
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  margin-top: 0.75rem;
}

.context-toggle:hover {
  border-color: var(--text);
  color: var(--text);
}

.char-detail-actions {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--surface-dark);
  display: flex;
  justify-content: flex-end;
}

.delete-btn {
  background: none;
  border: 1px solid #f87171;
  color: #f87171;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.15s;
}

.delete-btn:hover {
  background: rgba(248, 113, 113, 0.1);
}

.delete-confirm {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  font-size: 1rem;
}

.confirm-yes {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
}

.confirm-yes:hover {
  background: #b91c1c;
}

.confirm-no {
  background: none;
  border: 1px solid var(--text-dim);
  color: var(--text-dim);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

.confirm-no:hover {
  border-color: var(--text);
  color: var(--text);
}

/* New Character Form */
.new-character-form {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

.new-character-form h2 {
  color: var(--text);
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.form-desc {
  color: var(--text-dim);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.prompt-input {
  width: 100%;
  background: var(--surface-dark);
  border: 2px solid var(--text-dim);
  color: var(--text);
  padding: 1rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  min-height: 120px;
}

.prompt-input:focus {
  outline: none;
  border-color: var(--accent);
}

.prompt-input::placeholder {
  color: var(--text-dim);
}

.prompt-hint {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

/* API Key Modal */
.modal-overlay {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-content {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 400px;
  width: 100%;
}

.api-key-modal h2 {
  color: var(--text);
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.modal-description {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.modal-description a {
  color: var(--accent);
  text-decoration: none;
}

.modal-description a:hover {
  text-decoration: underline;
}

.api-key-input {
  width: 100%;
  background: var(--surface-dark);
  border: 1px solid var(--text-dim);
  color: var(--text);
  padding: 0.75rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.api-key-input:focus {
  outline: none;
  border-color: var(--accent);
}

.api-key-input::placeholder {
  color: var(--text-dim);
}

.api-key-submit {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: opacity 0.15s;
}

.api-key-submit:hover:not(:disabled) {
  opacity: 0.9;
}

.api-key-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.api-key-error {
  color: #f87171;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  margin-top: -0.5rem;
}
