*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  color: #e5e7eb;
}

body {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1100px;
  margin: 16px;
  padding: 16px 20px 20px;
  border-radius: 16px;
  background: radial-gradient(circle at top left, #1f2937, #020617 65%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}

.app-header-spacer {
  width: 100px;
  min-width: 100px;
}

.app-title {
  margin: 0;
  font-family: "Righteous", "Varela Round", system-ui, sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #f8fafc;
  text-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(34, 197, 94, 0.35);
  flex-shrink: 0;
}

.project-name-wrap {
  flex: 1;
  min-width: 0;
  max-width: 280px;
  margin: 0 12px;
}
.project-name-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 0.9rem;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 6px;
  outline: none;
}
.project-name-input:focus {
  border-color: rgba(34, 197, 94, 0.5);
}
.project-name-input::placeholder {
  color: #64748b;
}

.app-header .header-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 0.8rem;
  min-width: 100px;
}

.app-header p {
  margin: 0;
  color: #9ca3af;
  font-size: 0.9rem;
}

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr);
  gap: 16px;
  align-items: stretch;
}

.canvas-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.canvas-panel section {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.15);
}

.canvas-panel section h2 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: #e5e7eb;
}

.frames-playback-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 600px) {
  .frames-playback-row {
    grid-template-columns: 1fr;
  }
}

.canvas-wrapper {
  background: #1e293b;
  border-radius: 12px;
  padding: 10px;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
}

.canvas-cursor-wrap {
  position: relative;
  display: block;
  touch-action: none;
}

/* Checkerboard so transparent pixels are visible; canvas starts and stays transparent */
#drawCanvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background-color: #e2e8f0;
  background-image: linear-gradient(45deg, #cbd5e1 25%, transparent 25%),
    linear-gradient(-45deg, #cbd5e1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cbd5e1 75%),
    linear-gradient(-45deg, transparent 75%, #cbd5e1 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

#drawCanvas.custom-cursor-active {
  cursor: none;
}

/* Eyedropper: tip at hotspot (16,30) in 32x32 viewBox */
#drawCanvas.cursor-eyedropper {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cellipse cx='16' cy='7' rx='6' ry='5' fill='%231e293b' stroke='%23f8fafc' stroke-width='1.2'/%3E%3Crect x='14' y='11' width='4' height='12' fill='%231e293b' stroke='%23f8fafc' stroke-width='1.2'/%3E%3Cpath d='M16 23 l-3 7 l2 0 l1-3 l1 3 l2 0 z' fill='%231e293b' stroke='%23f8fafc' stroke-width='1.2'/%3E%3C/svg%3E") 16 30, crosshair;
}

.cursor-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: 8px;
}

.cursor-shape {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.cursor-brush-circle {
  border: 2px solid rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.cursor-eraser-circle {
  border: 2px solid rgba(220, 38, 38, 0.8);
  border-radius: 50%;
  background: rgba(248, 113, 113, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.cursor-eraser-circle::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2'%3E%3Cpath d='M12 2 L2 12 L7 22 L12 18 L22 8 L12 2 Z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Bucket tilting; paint stream ends at center = cursor/fill point */
.cursor-bucket {
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 20 L26 6 L36 10 L36 24 L26 28 Z' fill='%231e293b' stroke='%23f8fafc' stroke-width='1.2'/%3E%3Cpath d='M26 10 L26 12 L20 20' fill='none' stroke='%2322c55e' stroke-width='3' stroke-linecap='round'/%3E%3Ccircle cx='20' cy='20' r='2' fill='%2322c55e' stroke='%23f8fafc'/%3E%3C/svg%3E") center/contain no-repeat;
}

.canvas-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.9);
}

.canvas-tools label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #d1d5db;
}

.canvas-tools input[type="range"] {
  width: 140px;
}

/* Brush size + swatches + shuffle/reset on one line */
.tools-top-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tools-top-row label {
  flex-shrink: 0;
}

.palette-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(10, 18px);
  gap: 4px;
  flex-shrink: 0;
}

.palette-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.palette-action-btn {
  font-size: 0.65rem;
  padding: 2px 6px;
  line-height: 1.2;
  white-space: nowrap;
}

.color-hidden-input {
  position: fixed;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  opacity: 0;
  z-index: 9999;
  pointer-events: none;
}
.color-hidden-input.color-picker-open {
  pointer-events: auto;
}
/* Tool mode toggle */
.tool-toggle {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
}

.tool-button {
  font-size: 0.8rem;
  padding-inline: 14px;
  border-radius: 999px;
}

.tool-button.active {
  background: #22c55e;
  color: #022c22;
}

/* Simple custom color picker */
.color-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  min-width: 34px;
}

.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid #e5e7eb;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.6);
}

.color-option {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 2px solid #020617;
  box-shadow: 0 0 0 1px rgba(209, 213, 219, 0.6);
  padding: 0;
  position: relative;
}

.color-option::before {
  content: attr(data-swatch-index);
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: #9ca3af;
}

.color-option.selected {
  box-shadow: 0 0 0 2px #e5e7eb, 0 0 0 4px #22c55e;
  z-index: 1;
}

.color-option.swatch-transparent {
  background-color: #e5e7eb;
  background-image: linear-gradient(45deg, #94a3b8 25%, transparent 25%),
    linear-gradient(-45deg, #94a3b8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #94a3b8 75%),
    linear-gradient(-45deg, transparent 75%, #94a3b8 75%);
  background-size: 4px 4px;
  background-position: 0 0, 0 2px, 2px -2px, -2px 0;
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.controls-panel .output-preview {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.controls-panel .output-preview .gif-output {
  flex: 0 0 auto; /* size to the GIF content instead of stretching */
  min-height: 0;
  align-self: center; /* keep the GIF box as wide as the GIF, centered */
}

.controls-panel .output-preview h2 {
  margin-bottom: 4px;
}

.controls-panel .export-controls {
  padding-top: 6px;
  padding-bottom: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.controls-panel .export-controls .status-text {
  text-align: center;
}

.controls-panel section {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.15);
}

.controls-panel h2 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: #e5e7eb;
  text-align: center;
}

.frames-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.frames-controls h2 {
  align-self: stretch;
}

.frame-info {
  font-size: 0.85rem;
  color: #9ca3af;
  margin-bottom: 6px;
}

.timeline-strip {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
}

.timeline-strip-inner {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

/* Fixed left column: one row per layer (controls + name + visibility) */
.timeline-labels-column {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 168px;
  min-width: 168px;
}

.timeline-layer-label-row {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  height: 64px;
  min-height: 64px;
  padding: 6px 6px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  transition: background 0.15s, border-color 0.15s;
}

.timeline-layer-label-row:hover {
  background: rgba(51, 65, 85, 0.5);
  border-color: rgba(148, 163, 184, 0.4);
}

.timeline-layer-label-row.selected {
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.12);
}

/* Top row: layer name only, full width */
.timeline-layer-name-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-height: 0;
}

.timeline-layer-name {
  width: 100%;
  font-size: 0.9rem;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  padding: 0 2px;
}

.timeline-layer-label-row:hover .timeline-layer-name,
.timeline-layer-label-row.selected .timeline-layer-name {
  color: #e2e8f0;
}

.timeline-layer-name-input {
  width: 100%;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(34, 197, 94, 0.5);
  border-radius: 4px;
  padding: 2px 6px;
  outline: none;
}

.timeline-layer-name-input:focus {
  border-color: rgba(34, 197, 94, 0.8);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

/* Bottom row: tools + eye */
.timeline-layer-tools-row {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
}

.timeline-layer-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  line-height: 1;
  color: #94a3b8;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.timeline-layer-btn:hover:not(:disabled) {
  color: #e2e8f0;
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(148, 163, 184, 0.5);
}

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

.timeline-layer-tools-row .timeline-row-label {
  flex-shrink: 0;
  width: 28px;
  height: 22px;
  min-width: 28px;
  min-height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 4px;
}

.timeline-layer-tools-row .timeline-row-label:hover {
  background: rgba(51, 65, 85, 0.6);
}

.timeline-layer-label-row .layer-eye-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.timeline-frames-scroll {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.timeline-frames-scroll::-webkit-scrollbar {
  height: 10px;
}

.timeline-frames-scroll::-webkit-scrollbar-track {
  background: #0f172a;
  border-radius: 6px;
}

.timeline-frames-scroll::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 6px;
}

.timeline-frames-scroll::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.frame-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: max-content;
  min-height: 0;
}

.timeline-layer-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: stretch;
  /* 64px so cell content box fits 54px canvas + 6px padding + 4px border with no clipping */
  height: 64px;
  min-height: 64px;
}

/* Match label button height to one frame row so Top/Bottom align with their rows */
.timeline-row-label {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 88px;
  height: 64px;
  min-height: 64px;
  padding: 0 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.timeline-row-label:hover {
  color: #e2e8f0;
  background: rgba(51, 65, 85, 0.5);
  border-color: rgba(148, 163, 184, 0.4);
}
.layer-eye-wrap {
  display: inline-flex;
  align-items: center;
  color: #94a3b8;
}
.timeline-row-label:hover .layer-eye-wrap {
  color: #e2e8f0;
}
.eye-icon {
  display: block;
  vertical-align: middle;
}

.timeline-cell {
  position: relative;
  flex-shrink: 0;
  padding: 3px;
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  background: #020617;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.timeline-cell-num {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 0.6rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 2px #000, 0 1px 2px #000;
  z-index: 1;
  pointer-events: none;
}

.timeline-cell-layer {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 0.55rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 0 2px #000;
  z-index: 1;
  pointer-events: none;
}

.timeline-cell:hover {
  border-color: rgba(148, 163, 184, 0.7);
}

.timeline-cell.selected {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px #22c55e;
}

.timeline-cell canvas {
  display: block;
  border-radius: 6px;
  width: 72px;
  height: 54px;
}

.layer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.5);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
}

.layer-toggle .tool-button.active {
  background: rgba(34, 197, 94, 0.25);
  border-color: rgba(34, 197, 94, 0.5);
}

.layer-list-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.layer-select-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #cbd5e1;
}

.layer-select {
  padding: 4px 8px;
  font-size: 0.8rem;
  color: #e5e7eb;
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 6px;
  cursor: pointer;
  min-width: 6em;
}

.layer-select:focus {
  outline: none;
  border-color: rgba(34, 197, 94, 0.5);
}

.layer-list-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.layer-list-actions .tool-button {
  font-size: 0.75rem;
  padding: 4px 8px;
}

.frame-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  justify-content: center;
}

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

.playback-row label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #d1d5db;
}

.playback-row input[type="number"] {
  width: 64px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: #020617;
  color: #e5e7eb;
}

.playback-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.gif-output {
  position: relative;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #1e293b;
  background-image: linear-gradient(45deg, #334155 25%, transparent 25%),
    linear-gradient(-45deg, #334155 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #334155 75%),
    linear-gradient(-45deg, transparent 75%, #334155 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  border-radius: 10px;
  overflow: hidden;
}

.gif-output::after {
  content: "Clear GIF (G)";
  position: absolute;
  top: 6px;
  left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 500;
  color: rgba(226, 232, 240, 0.9);
  background: rgba(15, 23, 42, 0.75);
  pointer-events: none;
}

.gif-output img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Hide the Clear GIF button visually so it doesn't add height,
   but keep it in the DOM for the G hotkey to trigger. */
#clearGifBtn {
  display: none;
}

.shortcuts {
  text-align: center;
}

.shortcuts h2 {
  margin-bottom: 8px;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  font-size: 0.7rem;
  color: #9ca3af;
  line-height: 1.35;
}

.shortcut-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.shortcut-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}

.shortcut-group-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin-bottom: 2px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 4px;
}

.shortcut-item kbd {
  margin-right: 0;
}

.shortcut-item kbd + kbd {
  margin-left: 0;
}

.shortcuts kbd {
  font-size: 0.65rem;
  padding: 1px 4px;
}

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 2px 6px;
  margin-right: 4px;
  border-radius: 4px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: #020617;
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.75rem;
}

.status-text {
  min-height: 18px;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #9ca3af;
}

.controls-panel .output-preview {
  align-items: center;
}

.controls-panel .output-preview h2 {
  margin-bottom: 4px;
  text-align: center;
}

button {
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  background: #1f2937;
  color: #e5e7eb;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04),
    0 9px 16px rgba(15, 23, 42, 0.8);
  transition: background 0.12s ease, transform 0.08s ease,
    box-shadow 0.12s ease, opacity 0.12s ease;
}

button.primary {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #022c22;
}

button.secondary {
  background: #0f172a;
}

button.new-project-btn {
  background: linear-gradient(135deg, #475569, #334155);
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.5);
}

button.new-project-btn:hover {
  background: linear-gradient(135deg, #64748b, #475569);
  border-color: rgba(148, 163, 184, 0.7);
}

button.danger {
  background: linear-gradient(135deg, #f97373, #dc2626);
  color: #fee2e2;
}

button.accent {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #082f49;
}

.project-save-load {
  margin-top: 16px;
}
.project-save-load h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #e2e8f0;
}
.project-save-hint {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.35;
}
.project-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.project-buttons .primary,
.project-buttons .secondary {
  font-size: 0.85rem;
}

button.wide {
  width: 100%;
  justify-content: center;
}

button:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.9);
}

button:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.8);
}

@media (max-width: 840px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

