/* Escritorio privado: fondo de pantalla frutiger aero y paneles de cristal */
:root {
  --ink: #0d3b57;
  --ink-soft: #2f6583;
  --aqua: #0d7fc4;
  --error: #b3261e;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-line: rgba(255, 255, 255, 0.8);
  --well: rgba(255, 255, 255, 0.7);
  --radius: 28px;
  --mx: 0; /* posicion del raton de -1 a 1, la actualiza escritorio-fondo.js */
  --my: 0;
  --cursor: url('/img/cursor-aero.svg') 4 2, auto;
  --cursor-link: url('/img/cursor-aero-link.svg') 4 2, pointer;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { min-height: 100%; }
html { cursor: var(--cursor); }

body {
  margin: 0;
  background: #7cc8f5;
  color: var(--ink);
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ── Fondo ── */

.wallpaper {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(180deg, #1f86dc 0%, #55b4ef 42%, #bfeafa 72%, #e6f9f4 100%);
}

.wallpaper svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.sun {
  position: absolute;
  top: -22vmax;
  right: -14vmax;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.4) 28%, rgba(255, 255, 255, 0) 68%);
}

/* Capas del fondo: las mas cercanas se mueven mas con el raton */
.sun { transform: translate(calc(var(--mx) * 18px), calc(var(--my) * 10px)); }
.layer-clouds { transform: translate(calc(var(--mx) * -12px), calc(var(--my) * -5px)); }
.layer-ribbons { transform: translate(calc(var(--mx) * -22px), calc(var(--my) * -9px)); }
.layer-hill-back { transform: translate(calc(var(--mx) * -36px), calc(var(--my) * -12px)); }
.layer-hill-front { transform: translate(calc(var(--mx) * -64px), calc(var(--my) * -20px)); }

/* ── Burbujas ── */

.bubble {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  will-change: transform;
  background:
    radial-gradient(circle at 31% 27%, rgba(255, 255, 255, 0.98) 0 3%, rgba(255, 255, 255, 0) 11%),
    radial-gradient(circle at 70% 74%, rgba(255, 255, 255, 0.6) 0 2%, rgba(255, 255, 255, 0) 9%),
    radial-gradient(circle at 42% 38%, rgba(255, 255, 255, 0.05) 0 52%, rgba(190, 235, 255, 0.2) 78%, rgba(255, 255, 255, 0.75) 100%);
  box-shadow:
    inset 0 0 calc(var(--size) * 0.1) rgba(255, 255, 255, 0.55),
    0 2px 8px rgba(10, 80, 130, 0.12);
}

/* Pelicula de jabon: reflejos de colores en el borde */
.bubble::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 20deg, #ff9fdc, #ffe48a, #a4f5c0, #8fe6ff, #b6a8ff, #ff9fdc);
  opacity: 1;
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 84%, #000 96%, transparent 100%);
  mask: radial-gradient(circle, transparent 60%, #000 84%, #000 96%, transparent 100%);
  animation: film 16s linear infinite;
}

/* Brillo curvo de la ventana */
.bubble::after {
  content: '';
  position: absolute;
  inset: 11%;
  border: calc(var(--size) * 0.035 + 0.5px) solid transparent;
  border-top-color: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  transform: rotate(-42deg);
  filter: blur(calc(var(--size) * 0.012));
}

.bubble.popping {
  opacity: 0;
  scale: 1.25;
  transition: opacity 0.12s ease-out, scale 0.12s ease-out;
}

@keyframes film { to { rotate: 360deg; } }

.pop-ring,
.droplet {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.pop-ring {
  width: var(--size);
  height: var(--size);
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  border: 2px solid rgba(255, 255, 255, 0.9);
  animation: pop-ring 0.3s ease-out forwards;
}

.droplet {
  width: var(--drop);
  height: var(--drop);
  background: radial-gradient(circle at 35% 30%, #fff 0 25%, rgba(190, 235, 255, 0.75) 100%);
  animation: droplet 0.5s cubic-bezier(0.15, 0.7, 0.4, 1) forwards;
}

@keyframes pop-ring {
  from { transform: scale(0.95); opacity: 0.9; }
  to   { transform: scale(1.5); opacity: 0; }
}

@keyframes droplet {
  to { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bubble::before { animation: none; }
}

/* ── Piezas comunes ── */

.glass {
  position: relative;
  padding: 24px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 38%), var(--glass);
  box-shadow: 0 18px 40px rgba(10, 80, 130, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.25s ease-out;
}

/* Reflejo que sigue al raton por encima del cristal */
.glass::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(240px circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 72%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.glass:hover::after { opacity: 1; }

.field {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  outline: none;
  background: var(--well);
  color: var(--ink);
  font: inherit;
  box-shadow: inset 0 1px 3px rgba(10, 80, 130, 0.14);
}

.field::placeholder { color: var(--ink-soft); }
.field:focus { border-color: #5ec3f5; box-shadow: 0 0 0 3px rgba(94, 195, 245, 0.35); }

.primary {
  padding: 11px 22px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  background: linear-gradient(180deg, #4cb8ee 0%, #1487cf 50%, #0a70b4 51%, #0c7cc2 100%);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: var(--cursor-link);
  box-shadow: 0 4px 10px rgba(10, 100, 170, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.15s ease-out, filter 0.15s;
}

.primary:hover { filter: brightness(1.08); transform: scale(1.04); }
.primary:active { transform: scale(0.97); }
.primary:disabled { opacity: 0.6; cursor: var(--cursor); }

.primary.round {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}

.pill {
  padding: 6px 16px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: var(--cursor-link);
  transition: transform 0.15s ease-out, background 0.15s;
}

.pill:hover { background: rgba(255, 255, 255, 0.85); transform: scale(1.06); }

.msg { margin: 0; color: var(--error); font-size: 14px; font-weight: 600; }
.msg:empty { display: none; }

/* ── Contraseña ── */

.login {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(360px, calc(100% - 32px));
  margin: 18vh auto 0;
}

.login h1 { margin: 0 0 4px; font-size: 26px; font-weight: 800; }
.lbl { font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* ── Escritorio ── */

.desktop {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.top { display: flex; justify-content: flex-end; gap: 8px; }

.greeting {
  margin: 4vh 0 5vh;
  color: #fff;
  font-size: clamp(34px, 6vw, 60px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-align: center;
  text-shadow: 0 2px 14px rgba(8, 70, 130, 0.5);
  transform: translate(calc(var(--mx) * -10px), calc(var(--my) * -6px));
}

.widgets {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 20px;
  align-items: start;
  transform: translate(calc(var(--mx) * -6px), calc(var(--my) * -4px));
}

/* ── Tiempo ── */

.place {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  text-align: left;
  cursor: var(--cursor-link);
}

.place::after { content: ' ▾'; color: var(--ink-soft); font-size: 13px; }

.place-results { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }

.place-results button {
  padding: 8px 12px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: var(--cursor-link);
}

.place-results button:hover,
.place-results button:focus-visible { background: var(--well); outline: none; }

.place-results p { margin: 6px 12px; font-size: 14px; color: var(--ink-soft); }

.weather-now { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.weather-icon { font-size: 48px; line-height: 1; }
.weather-temp { font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.weather-desc { margin: 8px 0 16px; min-height: 1.4em; font-weight: 600; color: var(--ink-soft); }

.weather-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 12px;
  padding: 12px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.45);
  text-align: center;
}

.weather-facts dt { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.weather-facts dd { margin: 2px 0 0; font-size: 14px; font-weight: 800; }

.weather-days { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.weather-day { font-size: 14px; font-weight: 700; }
.weather-day span { display: block; }
.weather-day .day-name { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.weather-day .day-icon { font-size: 22px; line-height: 1.4; }

/* ── Reloj ── */

.clock { text-align: center; }
.dial { display: block; width: min(200px, 100%); margin: 0 auto 12px; filter: drop-shadow(0 6px 10px rgba(10, 80, 130, 0.25)); }

.tick { stroke: #7fb6d3; stroke-width: 2; stroke-linecap: round; }
.tick.major { stroke: var(--ink); stroke-width: 3.5; }

.hand { stroke-linecap: round; }
.hand-hour { stroke: var(--ink); stroke-width: 6; }
.hand-minute { stroke: var(--ink); stroke-width: 4; }
.hand-second { stroke: var(--aqua); stroke-width: 2; }

.clock-time { margin: 0; font-size: 34px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.clock-date { margin: 2px 0 0; font-weight: 600; color: var(--ink-soft); }
.clock-date::first-letter { text-transform: uppercase; }

/* ── Notas ── */

.notes h2 { margin: 0 0 12px; font-size: 18px; font-weight: 800; }

.note-form { display: flex; gap: 8px; margin-bottom: 12px; }

.note-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 46vh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.note-list:empty::before {
  content: 'Todavía no hay notas';
  padding: 8px 4px;
  color: var(--ink-soft);
  font-size: 14px;
}

.note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 8px 8px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  transition: background 0.15s;
}

.note:hover { background: rgba(255, 255, 255, 0.72); }

.note input[type='checkbox'] {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--aqua);
  cursor: var(--cursor-link);
}

.note textarea {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  line-height: 1.5;
  resize: none;
  overflow: hidden;
}

.note.done textarea { color: var(--ink-soft); text-decoration: line-through; }

.note button {
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1;
  cursor: var(--cursor-link);
}

.note button:hover { background: rgba(255, 255, 255, 0.8); color: var(--error); }

.notes .msg { margin-top: 8px; }

/* ── Pantallas estrechas ── */

@media (max-width: 960px) {
  .widgets { grid-template-columns: 1fr 1fr; }
  .notes { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .widgets { grid-template-columns: 1fr; }
  .note-list { max-height: none; }
}
