:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #ffffff;
  --surface-soft: rgba(241, 245, 249, 0.8);
  --ink: #0f172a;
  --muted: #64748b;
  --line: rgba(0, 0, 0, 0.06);
  --line-strong: rgba(0, 0, 0, 0.12);
  --accent: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.15);
  --accent-deep: #059669;
  --accent-soft: rgba(16, 185, 129, 0.06);
  --warm: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 8px 30px rgba(15, 23, 42, 0.03);
  --font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "SF Pro SC", "HanHei SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body.dark-theme {
  color-scheme: dark;
  --bg: #090c15;
  --surface: rgba(17, 24, 39, 0.7);
  --surface-solid: #0d121f;
  --surface-soft: rgba(30, 41, 59, 0.5);
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.3);
  --accent-deep: #059669;
  --accent-soft: rgba(16, 185, 129, 0.1);
  --shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-family);
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
  background-image:
    radial-gradient(circle at 10% 15%, rgba(16, 185, 129, 0.04) 0%, transparent 30%),
    radial-gradient(circle at 90% 85%, rgba(99, 102, 241, 0.03) 0%, transparent 30%);
}

body.dark-theme {
  background-image:
    radial-gradient(circle at 10% 15%, rgba(16, 185, 129, 0.12) 0%, transparent 35%),
    radial-gradient(circle at 90% 85%, rgba(99, 102, 241, 0.1) 0%, transparent 35%);
}

/* Background Animated Glows */
.ambient-glow {
  position: fixed;
  width: min(650px, 80vw);
  height: min(650px, 80vw);
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.05;
  z-index: -1;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

body.dark-theme .ambient-glow {
  opacity: 0.14;
}

.glow-1 {
  background: radial-gradient(circle, #10b981 0%, transparent 70%);
  top: -15%;
  left: -10%;
  animation: pulseGlow 14s ease-in-out infinite alternate;
}

.glow-2 {
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
  bottom: -15%;
  right: -10%;
  animation: pulseGlow 18s ease-in-out infinite alternate-reverse;
}

@keyframes pulseGlow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.15); }
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

body.dark-theme ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* App Structure */
.app-shell {
  width: min(1520px, calc(100vw - 40px));
  min-height: calc(100vh - 40px);
  margin: 20px auto;
  display: grid;
  grid-template-columns: minmax(380px, 490px) minmax(0, 1fr);
  gap: 20px;
}

.control-panel,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: border-color 0.3s ease;
}

.control-panel:hover,
.preview-panel:hover {
  border-color: var(--line-strong);
}

.control-panel {
  padding: 28px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.preview-panel {
  min-width: 0;
  padding: 28px;
  display: grid;
  grid-template-rows: auto minmax(430px, 1fr) auto;
  gap: 20px;
}

/* Branding */
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.studio-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  align-self: flex-start;
  margin-bottom: 8px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-icon {
  width: 12px;
  height: 12px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

h1 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #0f172a 40%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.dark-theme h1 {
  background: linear-gradient(135deg, #ffffff 40%, var(--muted) 100%);
  -webkit-background-clip: text;
}

/* Status Indicator */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 12px var(--accent);
  transition: all 0.3s ease;
  position: relative;
}

.status-dot.busy {
  background: var(--warm);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15), 0 0 12px var(--warm);
}

/* Forms & Layout */
.form-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field > span,
.upload-header > span,
.slider-header > span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.char-count {
  color: var(--muted);
  font-size: 11px;
}

/* Tab Switching */
.mode-switch {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  gap: 4px;
}

.mode-button {
  flex: 1;
  min-height: 40px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

.mode-button.active {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* Form Controls styling */
textarea,
input:not([type="range"]):not([type="file"]),
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink);
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 12px 14px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

input[type="text"],
input[type="password"],
select {
  height: 44px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
}

textarea::placeholder,
input::placeholder {
  color: rgba(148, 163, 184, 0.5);
}

textarea:focus,
input:not([type="range"]):not([type="file"]):focus,
select:focus {
  border-color: var(--accent);
  background: var(--surface-solid);
  box-shadow: 0 0 0 1px var(--accent), 0 0 14px var(--accent-glow);
}

/* Special inputs styling */
.key-input-row {
  display: flex;
  gap: 10px;
}

.input-with-icon {
  position: relative;
  flex: 1;
}

.input-with-icon input:not([type="range"]):not([type="file"]) {
  padding-left: 40px;
}

.field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

/* Range input styling */
.compression-slider-field {
  margin-top: 6px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-header strong {
  font-family: monospace;
  font-size: 14px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 4px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--line-strong);
  border-radius: 99px;
  outline: none;
  margin: 12px 0;
  transition: background 0.3s;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  border-radius: 99px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-glow), 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s, background-color 0.2s;
  margin-top: -5px;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  background: #2dd4bf;
}

/* Upload & Dropzone Area */
.upload-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.upload-header strong {
  font-family: monospace;
  color: var(--accent);
  font-size: 13px;
}

.drop-zone {
  min-height: 140px;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--surface-soft);
  cursor: pointer;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
}

.drop-zone input {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 20px rgba(16, 185, 129, 0.05);
}

.upload-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  transition: all 0.3s ease;
}

.drop-zone:hover .upload-icon-wrapper {
  transform: translateY(-4px);
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 6px 16px var(--accent-glow);
}

.upload-cloud-icon {
  width: 22px;
  height: 22px;
}

.drop-zone-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.drop-zone-sub {
  font-size: 11px;
  color: var(--muted);
}

/* Thumbnails for uploaded images */
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-soft);
  animation: scaleIn 0.25s ease-out;
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.thumb:hover img {
  transform: scale(1.15);
}

.thumb-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.thumb-remove:hover {
  background: #dc2626;
  transform: scale(1.15);
}

/* Action Rows & Buttons */
.action-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

button,
.download {
  min-height: 44px;
  border-radius: 10px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

/* Primary Button (Generate) */
#submitButton {
  flex: 1.5;
  color: #ffffff;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#submitButton:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

#submitButton:active:not(:disabled) {
  transform: translateY(1px);
}

#submitButton:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background: var(--surface-soft);
  border-color: var(--line);
  box-shadow: none;
  color: var(--muted);
}

/* Secondary Button (Clear, Toggle eye, etc) */
.secondary {
  flex: 1;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink);
}

.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.secondary:active {
  background: rgba(255, 255, 255, 0.03);
}

.icon-button {
  flex: 0 0 44px;
  width: 44px;
  padding: 0;
  display: grid;
  place-items: center;
}

.button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.button-icon svg {
  width: 100%;
  height: 100%;
}

/* Preview Panel Specifics */
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.preview-toolbar h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.job-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 44px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.job-panel > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.job-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.job-panel strong {
  color: var(--ink);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line-strong);
  font-size: 13px;
  box-shadow: var(--shadow-soft);
}

.download:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  transform: translateY(-1px);
}

/* Preview Canvas / Checkerboard */
.preview-stage {
  position: relative;
  min-height: 460px;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
  /* Light checkerboard pattern by default */
  background-image:
    linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
    linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #ffffff;
}

body.dark-theme .preview-stage {
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
  /* Dark checkerboard pattern */
  background-image:
    linear-gradient(45deg, #101524 25%, transparent 25%),
    linear-gradient(-45deg, #101524 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #101524 75%),
    linear-gradient(-45deg, transparent 75%, #101524 75%);
  background-color: #080a10;
}

#resultImage {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  z-index: 1;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  opacity: 0;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.result-grid {
  width: 100%;
  height: 100%;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-auto-rows: minmax(160px, 220px);
  gap: 14px;
  overflow: auto;
  z-index: 1;
}

.result-tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
}

.result-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.result-tile span {
  position: absolute;
  left: 10px;
  bottom: 10px;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* Empty State styling */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 30px;
  z-index: 1;
  max-width: 320px;
}

.empty-mark {
  color: var(--muted);
  margin-bottom: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease;
}

.empty-state:hover .empty-mark {
  transform: translateY(-4px);
  color: var(--accent);
}

.empty-svg {
  width: 60px;
  height: 60px;
}

.empty-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.empty-subtext {
  font-size: 12px;
  color: var(--muted);
}

/* Loading Overlay & Spinner */
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

body.dark-theme .loading-overlay {
  background: rgba(8, 10, 16, 0.85);
}

.spinner-container {
  position: relative;
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
}

.spinner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid rgba(16, 185, 129, 0.1);
  border-top-color: var(--accent);
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.spinner-glow {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: var(--accent);
  filter: blur(4px);
  opacity: 0.6;
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

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

#loadingText {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--ink);
}

/* Feedback message styling */
.message-container {
  display: flex;
  align-items: center;
}

.message {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  transition: all 0.3s ease;
  width: 100%;
}

.message.error {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid var(--danger);
  padding: 8px 12px;
  border-radius: 6px;
}

.hidden {
  display: none !important;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: min(720px, calc(100vw - 32px));
    margin: 16px auto;
  }

  .control-panel {
    max-height: none;
  }

  .preview-panel {
    grid-template-rows: auto minmax(360px, 500px) auto;
  }
}

@media (max-width: 580px) {
  .app-shell {
    width: 100%;
    margin: 0;
    padding: 12px;
    gap: 12px;
  }

  .control-panel,
  .preview-panel {
    padding: 18px;
    border-radius: 12px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

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

  .job-panel {
    grid-template-columns: 1fr 44px;
  }

  .job-panel > div:first-child {
    grid-column: 1 / -1;
  }

  .download {
    width: 100%;
  }

  .action-row {
    flex-direction: column;
  }

  button, .download {
    min-height: 42px;
  }
}

/* Pulse animation for Status Dot */
@keyframes pulseDot {
  0% {
    box-shadow: 0 0 0 0px rgba(16, 185, 129, 0.5), 0 0 8px rgba(16, 185, 129, 0.3);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0), 0 0 8px rgba(16, 185, 129, 0.3);
  }
  100% {
    box-shadow: 0 0 0 0px rgba(16, 185, 129, 0), 0 0 8px rgba(16, 185, 129, 0.3);
  }
}

@keyframes pulseDotBusy {
  0% {
    box-shadow: 0 0 0 0px rgba(245, 158, 11, 0.5), 0 0 8px rgba(245, 158, 11, 0.3);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(245, 158, 11, 0), 0 0 8px rgba(245, 158, 11, 0.3);
  }
  100% {
    box-shadow: 0 0 0 0px rgba(245, 158, 11, 0), 0 0 8px rgba(245, 158, 11, 0.3);
  }
}

.status-dot {
  animation: pulseDot 2s infinite;
}

.status-dot.busy {
  animation: pulseDotBusy 2s infinite;
}

/* Disabled Field Overrides */
.field-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.field-disabled input[type="range"]::-webkit-slider-thumb {
  background: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
}

/* Theme Toggle Button Styling */
.brand-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  box-shadow: var(--shadow-soft);
}

.theme-toggle-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface);
  transform: translateY(-1px);
}

.theme-toggle-btn:active {
  transform: translateY(1px);
}

.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.theme-toggle-btn:hover svg {
  transform: rotate(15deg);
}

/* Visibility toggling */
.theme-toggle-btn .sun-icon {
  display: none;
}

.theme-toggle-btn .moon-icon {
  display: block;
}

body.dark-theme .theme-toggle-btn .sun-icon {
  display: block;
}

body.dark-theme .theme-toggle-btn .moon-icon {
  display: none;
}
