/* ==========================================================================
   Simpsons-Style Cartoon Caricature Studio Stylesheet - PicDriver
   Cel-shaded animation, yellow skin remapping, comic inking & speech bubbles
   ========================================================================== */

:root {
  --simpson-yellow: #fed90f;
  --simpson-amber: #d89800;
  --simpson-blue: #38bdf8;
  --simpson-pink: #f472b6;
  --primary-color: #f59e0b;
  --primary-hover: #d97706;
  --surface-color: #0f172a;
  --card-bg: rgba(15, 23, 42, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

.simpsons-workspace {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

.tool-hero {
  text-align: center;
  padding: 2.5rem 1rem 1.75rem;
  max-width: 800px;
  margin: 0 auto;
}

.tool-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #fff 20%, #fed90f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.75rem;
}

.tool-hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Studio Grid */
.simpsons-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr);
  gap: 1.75rem;
  align-items: start;
}

/* Stage Column */
.simpsons-stage-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.simpsons-viewport-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.5);
  position: relative;
}

.simpsons-viewport-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid var(--border-color);
  gap: 0.75rem;
  flex-wrap: wrap;
}

.simpsons-status-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hud-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-badge.accent {
  background: rgba(254, 217, 15, 0.15);
  color: #fed90f;
  border-color: rgba(254, 217, 15, 0.35);
}

.hud-badge.pink {
  background: rgba(244, 114, 182, 0.15);
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.3);
}

.simpsons-actions-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Canvas Viewport */
.simpsons-canvas-container {
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: #0b0f19 radial-gradient(circle at center, rgba(30, 34, 45, 0.6) 0%, rgba(10, 12, 16, 0.95) 100%);
  position: relative;
  overflow: hidden;
  user-select: none;
}

canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

#simpsons-canvas {
  max-width: 100%;
  max-height: 580px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Controls Sidebar */
.tool-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.control-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.65rem;
}

.control-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Presets & Toggles */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  transition: all 0.2s ease;
  text-align: left;
}

.preset-btn:hover {
  background: rgba(254, 217, 15, 0.12);
  border-color: rgba(254, 217, 15, 0.35);
}

.preset-btn.active {
  background: rgba(254, 217, 15, 0.22);
  border-color: #fed90f;
  box-shadow: 0 0 12px rgba(254, 217, 15, 0.3);
}

.preset-btn-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Form Groups & Sliders */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-value-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  color: #fed90f;
}

.slider-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  transition: background 0.2s;
}

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fed90f;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(254, 217, 15, 0.6);
  transition: transform 0.15s, background 0.15s;
}

.slider-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.backdrop-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
}

.backdrop-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.5rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.backdrop-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.backdrop-btn.active {
  background: rgba(254, 217, 15, 0.2);
  border-color: #fed90f;
  color: #fff;
}

/* Styled Input / Select */
.styled-input,
.styled-select {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  outline: none;
  width: 100%;
}

.styled-input:focus,
.styled-select:focus {
  border-color: #fed90f;
}

/* Export Card */
.export-card {
  background: linear-gradient(145deg, rgba(30, 34, 45, 0.9), rgba(20, 23, 31, 0.95));
  border: 1px solid rgba(254, 217, 15, 0.3);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 10px 30px -10px rgba(254, 217, 15, 0.2);
}

.btn-download-main {
  background: linear-gradient(135deg, #fed90f, #f59e0b);
  color: #0f172a;
  border: none;
  border-radius: 8px;
  padding: 0.8rem 1.2rem;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(254, 217, 15, 0.35);
}

.btn-download-main:hover {
  background: #f59e0b;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(254, 217, 15, 0.45);
}

.export-sub-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.btn-download-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background 0.2s;
}

.btn-download-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Responsive Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

table th {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

table tr:last-child td {
  border-bottom: none;
}

/* Mobile & Tablet Breakpoint */
@media (max-width: 768px) {
  .simpsons-grid {
    grid-template-columns: 1fr;
  }

  .simpsons-canvas-container {
    min-height: 340px;
    padding: 0.75rem;
  }

  .presets-grid,
  .anim-styles-grid,
  .prop-palette-grid,
  .backdrop-row,
  .export-sub-row {
    grid-template-columns: 1fr;
  }

  .simpsons-viewport-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* 4 Animation Styles Grid */
.anim-styles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.anim-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  transition: all 0.2s ease;
  text-align: left;
}

.anim-btn:hover {
  background: rgba(254, 217, 15, 0.12);
  border-color: rgba(254, 217, 15, 0.35);
  transform: translateY(-1px);
}

.anim-btn.active {
  background: rgba(254, 217, 15, 0.2);
  border-color: #fed90f;
  color: #fff;
  box-shadow: 0 0 12px rgba(254, 217, 15, 0.3);
}

/* Cartoon Prop Rigging Palette */
.prop-palette-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
}

.prop-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
  text-align: left;
}

.prop-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

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

.prop-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

