:root {
  --bg-page: #f4efe6;
  --bg-card: #ebe3d5;
  --text-main: #4a1c24;
  --text-muted: #7d535a;
  --accent: #4a1c24;
  --border: #cbbba6;
}

[data-theme="noir"] {
  --bg-page: #121212;
  --bg-card: #1d1d1d;
  --text-main: #f5f5f5;
  --text-muted: #999999;
  --accent: #ffffff;
  --border: #363636;
}

[data-theme="blueprint"] {
  --bg-page: #1338be;
  --bg-card: #0f2d99;
  --text-main: #f0f6ff;
  --text-muted: #9bb8ff;
  --accent: #ffffff;
  --border: #3d63e6;
}

[data-theme="blush"] {
  --bg-page: #f7e6e8;
  --bg-card: #efd6da;
  --text-main: #59232d;
  --text-muted: #8c545e;
  --accent: #59232d;
  --border: #d6b2b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'IBM Plex Mono', monospace;
}

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

#flash-overlay {
  position: fixed;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity 0.15s ease-out;
}

#flash-overlay.active {
  opacity: 0.95;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px dashed var(--border);
}

.brand {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.05em;
}

.badge {
  font-size: 0.7rem;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-left: 6px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

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

.icon-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}

.studio-layout {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

.camera-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 28px;
  align-items: start;
}

.viewfinder-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.07);
}

#video {
  display: none;
}

#live-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#countdown-display {
  position: absolute;
  font-size: 4.5rem;
  font-weight: 600;
  background: var(--bg-page);
  color: var(--text-main);
  padding: 10px 30px;
  border: 2px solid var(--accent);
  border-radius: 14px;
}

#shot-progress {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-page);
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.sidebar-controls {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.control-block label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pill {
  background: var(--bg-page);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 9px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.pill:hover {
  border-color: var(--accent);
}

.pill.active {
  background: var(--accent);
  color: var(--bg-page);
  border-color: var(--accent);
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.shutter-btn {
  width: 100%;
  padding: 15px;
  background: var(--accent);
  color: var(--bg-page);
  border: none;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.shutter-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.shutter-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg-page);
}

.result-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
  align-items: start;
}

.preview-panel {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  justify-content: center;
  max-height: 80vh;
  overflow-y: auto;
}

#final-canvas {
  max-width: 100%;
  height: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}

.export-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.export-sidebar input[type="text"] {
  background: var(--bg-page);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 11px 13px;
  border-radius: 6px;
  font-size: 0.88rem;
  outline: none;
}

.info-note {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.action-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  width: 100%;
  padding: 13px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--accent);
}

.btn.primary {
  background: var(--accent);
  color: var(--bg-page);
}

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

@media (max-width: 820px) {
  .camera-grid, .result-grid {
    grid-template-columns: 1fr;
  }
  .hint-text {
    display: none;
  }
}
