:root {
  --fondo: #AFEEEE;
  --card: #ffffff;
  --texto: #333;
  --principal: #6c9cff;
  --borde-puzzle: #333;
}

/* Variables para el Modo Oscuro */
body.dark {
  --fondo: #191970;
  --card: #2d2d44; 
  --texto: #f1f1f1;
  --principal: #4a76d1;
  --borde-puzzle: #f1f1f1;
}

body {
  margin: 0;
  font-family: 'Comic Sans MS', 'Segoe UI', sans-serif;
  background: var(--fondo);
  color: var(--texto);
  text-align: center;
  transition: background 0.3s, color 0.3s;

  /* --- CORRECCIÓN DEL BORDE --- */
  border: 30px solid transparent; /* Bajamos de 200px a 30px para que sea razonable */
  border-image-source: url(http://googleusercontent.com/image_generation_content/0);
  border-image-slice: 20% 10%; /* Cortamos 20% de arriba/abajo y 10% de los lados */
  border-image-repeat: round; /* Repite las piezas para llenar el borde */
  
  box-sizing: border-box; /* Evita que el borde cree scroll horizontal */
  min-height: 100vh;
}
.app {
  max-width: 500px;
  margin: auto;
  padding: 20px;
}

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

.card, .info {
  background: var(--card);
  padding: 15px;
  margin: 15px 0;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: background 0.3s;
}

.botones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button {
  font-size: 16px;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: var(--principal);
  color: white;
  cursor: pointer;
  transition: 0.2s;
}

button:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

/* Rompecabezas */
#puzzle {
  width: 220px;
  height: 220px;
  margin: 20px auto;
  display: grid;
  grid-template-columns: repeat(2, 100px);
  grid-template-rows: repeat(2, 100px);
  gap: 10px;
  border: 3px solid var(--borde-puzzle);
  background-color: #7FFFD4;
  padding: 5px;
}

body.dark #puzzle {
  background-color: #444;
}

.piece {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  border: 1px dashed black;
  cursor: pointer;
  background-image: url("https://images.vexels.com/media/users/3/300496/isolated/preview/c3ab1a63508dfebaef7effafe2d90e9f-perro-pug-de-dibujos-animados-acostado.png");
  background-size: 200px 200px;
}

/* Sección de Calma Corregida */
#relax {
  margin: 40px auto;
  max-width: 440px;
  padding: 30px;
  background-color: var(--card); /* Antes era fijo, ahora es dinámico */
  border-radius: 20px;
  border: 5px solid;
  border-image: linear-gradient(45deg, blue, purple, pink) 1;
  transition: background 0.3s;
}

.circle {
  width: 120px;
  height: 120px;
  margin: 20px auto;
  background-color: #90EE90;
  border-radius: 50%;
  transition: transform 4s ease-in-out;
}
h1{
  color:#333;
}

.container{
  display:flex;
  justify-content:center;
  gap:40px;
  margin-top:20px;
}

.left{
  display:flex;
  flex-direction:column;
  align-items:center;
}

.tools{
  margin-bottom:10px;
}

.colors{
  margin-bottom:10px;
}

.color{
  width:35px;
  height:35px;
  border:none;
  border-radius:50%;
  margin:3px;
  cursor:pointer;
}

canvas{
  border:3px solid #333;
  background:white;
}

#clear{
  margin-left:10px;
  padding:8px;
  cursor:pointer;
}

.reference{
  width:200px;
  opacity:0.8;
}

.reference img{
  width:180px;
}
canvas {
  touch-action: none; /* evita que la pantalla se desplace mientras dibujas */
}
