/* ---------- Editor shell ---------- */
.tc-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  animation: fade-in-up 0.3s var(--ease-out);
}

.tc-toolbar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.tc-toolbar-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.tc-toolbar-row + .tc-toolbar-row {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.tc-scrubber-row {
  align-items: center;
  gap: var(--space-3);
  border-radius: var(--radius-sm);
  transition: background var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}

.tc-scrubber-row.broadcast-all {
  background: var(--accent-glow);
  box-shadow: 0 0 0 1px var(--border-medium) inset;
}

.tc-toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tc-toolbar-inline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.tc-toolbar-spacer {
  flex: 1;
}

.tc-toolbar-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tc-toolbar-search {
  flex: 1;
  min-width: 160px;
}

.tc-toolbar-actions {
  display: flex;
  gap: var(--space-2);
  align-self: flex-end;
}

.tc-back-btn {
  align-self: center;
  margin-right: 4px;
  padding-right: var(--space-3);
  border-right: 1px solid var(--border-subtle);
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  border-left: none;
}

.tc-file-badge {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: var(--space-4);
  border-right: 1px solid var(--border-subtle);
}

.tc-file-badge-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tc-file-badge-name {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-icon-btn {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.tc-icon-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.tc-file-badge-pills {
  display: flex;
  gap: 6px;
}

.tc-status-pill {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--bg-app);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}

.tc-status-pill.modified {
  color: var(--value-accent);
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.1);
}

.tc-status-pill.saved {
  color: var(--success);
  border-color: rgba(74, 222, 128, 0.3);
  background: var(--success-glow);
}

.tc-autosave-indicator {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  min-height: 12px;
}

.tc-weather-pill {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--accent-glow);
  color: var(--accent-bright);
  border: 1px solid var(--border-medium);
}

.tc-select {
  background: var(--bg-app);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12.5px;
  padding: 7px 10px;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.tc-select:hover {
  border-color: var(--border-strong);
}

.tc-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.tc-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.tc-tab:hover {
  color: var(--text-primary);
}

.tc-tab.active {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  box-shadow: 0 0 0 1px var(--border-medium) inset;
}

.tc-scrubber {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tc-scrubber-dot {
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-app);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.tc-scrubber-dot:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.tc-scrubber-dot:active {
  transform: scale(0.95);
}

.tc-scrubber-dot.active {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  color: #000;
}

.tc-search-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-app);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}

.tc-search-input:focus {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.tc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.tc-btn:active {
  transform: scale(0.97);
}

.tc-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.tc-btn-ghost:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.tc-btn-ghost.active {
  background: var(--accent-glow);
  border-color: var(--accent-bright);
  color: var(--text-primary);
}

.tc-btn-primary {
  background: linear-gradient(180deg, var(--bg-surface-raised), var(--bg-surface));
  color: var(--text-primary);
}

.tc-btn-primary:hover {
  border-color: var(--accent-bright);
  box-shadow: 0 0 16px -6px var(--accent-glow);
}

/* ---------- Body layout ---------- */
.tc-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.tc-sidebar-categories {
  width: 250px;
  flex-shrink: 0;
  overflow-y: auto;
  padding: var(--space-5) var(--space-3);
  border-right: 1px solid var(--border-subtle);
}

.tc-sidebar-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 10px 14px;
}

.tc-category-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tc-category-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.tc-category-nav-item span:nth-child(2) {
  flex: 1;
}

.tc-category-nav-dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--dur-fast) var(--ease-out);
}

.tc-category-nav-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.tc-category-nav-item.active {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  font-weight: 700;
  box-shadow: inset 2px 0 0 var(--accent-bright);
}

.tc-category-nav-item.active .tc-category-nav-dot {
  background: var(--accent-bright);
  box-shadow: 0 0 6px 1px var(--accent-glow);
}

.tc-category-count {
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--bg-app);
  border-radius: 999px;
  padding: 2px 8px;
}

.tc-params-panel {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5) var(--space-6) 60px;
}

.tc-empty-state {
  padding: 40px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.tc-loading {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------- Category sections ---------- */
.tc-category {
  margin-bottom: var(--space-5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  overflow: hidden;
  animation: fade-in-up 0.25s var(--ease-out) both;
}

.tc-category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-4) var(--space-5);
}

.tc-category-name {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.tc-category-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
  padding: var(--space-5);
  border-top: 1px solid var(--border-subtle);
}

/* ---------- Param cards ---------- */
.tc-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}

.tc-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.tc-card-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  cursor: help;
}

.tc-card-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tc-card-value-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tc-card-value-input {
  background: transparent;
  border: 1px solid transparent;
  text-align: right;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  width: 100px;
  padding: 3px 6px;
  border-radius: 6px;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.tc-card-value-input:hover {
  background: var(--bg-surface);
}

.tc-card-value-input:focus {
  border-color: var(--accent-bright);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.tc-card-value-input.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-glow);
}

.tc-card-slider {
  width: 100%;
  accent-color: var(--accent-bright);
  height: 4px;
}

.tc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 2px;
}

.tc-card-footer-caption {
  font-size: 10.5px;
  color: var(--text-muted);
}

.tc-apply-all-btn {
  font-size: 10.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-medium);
  background: transparent;
  color: var(--accent-bright);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.tc-apply-all-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent-bright);
}

.tc-apply-all-btn:active {
  transform: scale(0.95);
}

/* ---------- Color cards ---------- */
.tc-card-color-main {
  display: flex;
  gap: var(--space-3);
}

.tc-card-swatch-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.tc-card-swatch {
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.tc-card-hex {
  font-size: 9.5px;
  color: var(--text-muted);
  text-align: center;
}

.tc-card-hex-value {
  width: 62px;
  padding: 2px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text-secondary);
  font-family: Consolas, monospace;
  font-size: 9.5px;
  text-align: center;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.tc-card-hex-value:hover {
  background: var(--bg-surface);
}

.tc-card-hex-value:focus {
  border-color: var(--accent-bright);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.tc-card-hex-value.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-glow);
}

.tc-channel-rows {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  justify-content: center;
  min-width: 0;
}

.tc-channel-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tc-channel-label {
  width: 10px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
}

.tc-channel-label.r {
  color: var(--channel-r);
}
.tc-channel-label.g {
  color: var(--channel-g);
}
.tc-channel-label.b {
  color: var(--channel-b);
}
.tc-channel-label.a {
  color: var(--text-muted);
}

.tc-channel-slider {
  flex: 1;
  min-width: 0;
  height: 4px;
}

.tc-channel-slider.r {
  accent-color: var(--channel-r);
}
.tc-channel-slider.g {
  accent-color: var(--channel-g);
}
.tc-channel-slider.b {
  accent-color: var(--channel-b);
}
.tc-channel-slider.a {
  accent-color: var(--text-muted);
}

.tc-channel-number {
  width: 46px;
  flex-shrink: 0;
  font-size: 10.5px;
  text-align: right;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  padding: 3px 5px;
  color: var(--text-primary);
  outline: none;
}

.tc-channel-number:focus {
  border-color: var(--accent-bright);
}

.tc-channel-number.invalid {
  border-color: var(--danger);
}

/* ---------- Preview panel ---------- */
.tc-preview-panel {
  width: 0;
  flex-shrink: 0;
  overflow: hidden;
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-app);
  transition: width var(--dur-base) var(--ease-out);
}

.tc-editor.preview-open .tc-preview-panel {
  width: 380px;
}

.tc-editor.preview-open .tc-preview-code {
  animation: panel-slide-in var(--dur-base) var(--ease-out) both;
}

.tc-preview-header {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.tc-preview-code {
  margin: 0;
  padding: 14px 16px 60px;
  height: 100%;
  overflow: auto;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre;
}

/* ---------- Load error ---------- */
.tc-load-error {
  max-width: 420px;
  margin: 60px auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.tc-load-error-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.tc-load-error-message {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------- Empty state (no file loaded yet) ---------- */
.tc-empty-state {
  max-width: 420px;
  margin: 100px auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.tc-empty-state-message {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.tc-empty-state-actions {
  display: flex;
  gap: var(--space-2);
}

.tc-recovery-banner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.tc-recovery-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.tc-recovery-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.tc-recovery-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: 8px;
}

/* ---------- Modal (shared by weatherModal.js and confirmDialog.js) ---------- */
.tc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
  z-index: 2000;
}

.tc-modal-overlay.visible {
  opacity: 1;
}

.tc-modal {
  width: 440px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--bg-surface-raised) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(0.98);
  transition: transform var(--dur-base) var(--ease-out);
}

.tc-modal-overlay.visible .tc-modal {
  transform: translateY(0) scale(1);
}

.tc-modal-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.tc-modal-body {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.tc-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: 20px;
}

/* ---------- Weather preset list (Timecycle's weather-preset picker) ---------- */
.tc-weather-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 380px;
  overflow-y: auto;
  margin-right: -8px;
  padding-right: 8px;
}

.tc-weather-group-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 6px 6px;
}

.tc-weather-group-title:first-child {
  padding-top: 0;
}

.tc-weather-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.tc-weather-row:hover {
  background: var(--bg-surface-hover);
}

.tc-weather-row.active {
  background: var(--accent-glow);
  border-color: var(--accent-bright);
}

.tc-weather-row-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-surface-raised);
  color: var(--accent-bright);
}

.tc-weather-row-text {
  min-width: 0;
}

.tc-weather-row-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.tc-weather-row-desc {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Toasts ---------- */
.tc-toast {
  position: fixed;
  left: 50%;
  top: 54px;
  transform: translate(-50%, -10px);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  z-index: 3000;
  max-width: 420px;
}

.tc-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.tc-toast-icon {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--success);
}

.tc-toast-error .tc-toast-icon {
  color: var(--danger);
}

.tc-toast-info .tc-toast-icon {
  color: var(--accent-bright);
}

.tc-toast-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.tc-toast-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.tc-toast-error {
  border-color: var(--danger);
}
