:root {
  --bg: #0f1115;
  --panel: #161a22;
  --muted: #7c8193;
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --text: #e5e7eb;
  --workarea-bg: #ffffff;
  --workarea-border: #2a2f3a;
  --handle: #8b5cf6;
  --handle-rot: #22d3ee;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(1200px 600px at 20% -10%, #121726 0%, #0b0d12 60%, #080a0f 100%);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, Apple Color Emoji, Segoe UI Emoji;
}

body {
  padding-bottom: 40px;
  position: relative;
}

/* Header avec titre + version badge */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.0));
  border-bottom: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.version-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

select, .btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
}

.btn {
  cursor: pointer;
  transition: transform .08s ease, background .2s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.status { color: var(--muted); font-size: 13px; }

/* Canvas wrapper avec z-index pour bordures */
.canvas-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding: 16px;
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid var(--workarea-border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  margin: 16px;
  z-index: 1;
}

#main-canvas {
  display: block;
  background: var(--workarea-bg);
  border-radius: 8px;
  cursor: grab;
  position: relative;
  z-index: 2;
}

#main-canvas:active {
  cursor: grabbing;
}

/* Overlay handles */
.overlay {
  pointer-events: none;
  position: absolute;
  inset: 16px;
  z-index: 10;
}

.handle {
  pointer-events: auto;
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--handle);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  transform: translate(-50%, -50%);
  cursor: nwse-resize;
  display: none;
  z-index: 20;
}

.handle-tl { cursor: nwse-resize; }
.handle-tr { cursor: nesw-resize; }
.handle-br { cursor: nwse-resize; }
.handle-bl { cursor: nesw-resize; }
.handle-rot {
  background: var(--accent-2);
  cursor: grab;
}

.handle-rot:active { cursor: grabbing; }

.canvas-wrapper.drag-over #main-canvas {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}

/* Help text */
.drop-help {
  color: var(--muted);
  padding: 6px 18px 24px;
  font-size: 14px;
  text-align: center;
}

/* Badges stylés */
.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 0 24px 32px;
}

.badge {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* with love qui fait battre le cœur */
.heart {
  color: #ef4444;
  font-size: 14px;
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  10% { transform: scale(1.2); }
  20% { transform: scale(1); }
}


/* Changelog section */
.changelog {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px;
}

.changelog-intro {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(34, 211, 238, 0.06));
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 32px;
  line-height: 1.7;
}

.changelog-intro p {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.changelog h2 {
  font-size: 20px;
  margin-bottom: 24px;
  color: var(--text);
  letter-spacing: 0.3px;
}

.version-item {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  transition: transform .15s ease, box-shadow .15s ease;
}

.version-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.version-current {
  border: 1px solid rgba(139, 92, 246, 0.4);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(34, 211, 238, 0.08));
}

.version-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.version-number {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  letter-spacing: 0.3px;
}

.version-status {
  font-size: 18px;
}

.version-desc {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

.version-tech {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

.version-problem {
  display: inline-block;
  margin-top: 4px;
  color: #fbbf24;
  font-size: 13px;
}

/* Section "Idées futures" */
.ideas-title {
  margin-top: 48px;
}

.ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.idea-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 16px;
  transition: transform .15s ease, border-color .15s ease;
}

.idea-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 92, 246, 0.3);
}

.idea-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.idea-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-2);
  letter-spacing: 0.2px;
  flex: 1;
}

.idea-like-btn {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(34, 211, 238, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 20px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform .1s ease, background .2s ease;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.idea-like-btn:hover {
  transform: scale(1.05);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(34, 211, 238, 0.15));
}

.idea-like-btn:active {
  transform: scale(0.95);
}

.like-icon {
  font-size: 16px;
}

.like-count {
  min-width: 20px;
  text-align: center;
}

.idea-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.tagline {
  text-align: center;
  font-size: 16px;
  font-style: italic;
  color: var(--accent);
  margin-top: 40px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(34, 211, 238, 0.04));
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.15);
}

/* Conteneur pour emojis like animés */
#like-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.like-emoji {
  position: absolute;
  font-size: 32px;
  pointer-events: none;
  animation: float-up 3s ease-out forwards;
}

@keyframes float-up {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-300px) scale(1.5);
  }
}

/* Responsive */
@media (max-width: 640px) {
  .controls { flex-wrap: wrap; }
  .header-title { flex-direction: column; align-items: flex-start; gap: 6px; }
  .changelog { padding: 24px 16px; }
  .badges { padding: 0 16px 24px; }
  .ideas-grid { grid-template-columns: 1fr; }
}
