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

:root {
  --white: #ffffff;
  --bg: #ecfdf5;
  --bg-soft: #f0fdf4;
  --green: #10b981;
  --green-deep: #047857;
  --green-neon: #34d399;
  --text: #064e3b;
  --text-soft: #047857;
  --text-muted: #6b7280;
  --glass-bg: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(16, 185, 129, 0.35);
  --shadow: 0 8px 30px rgba(4, 120, 87, 0.1);
  --radius: 14px;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --side-w: clamp(96px, 10vw, 140px);
  --timer-w: 210px;
  --content-pad: 1.5rem;
}

html {
  font-size: 17px;
}

body {
  font-family: var(--font);
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

.grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(rgba(16, 185, 129, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 185, 129, 0.06) 1px, transparent 1px),
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(52, 211, 153, 0.2), transparent 55%),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
  background-size: 36px 36px, 36px 36px, auto, auto;
}

.hidden {
  display: none !important;
}

.futbol-img {
  display: block;
  border-radius: 50%;
  object-fit: cover;
  filter: drop-shadow(0 10px 22px rgba(4, 120, 87, 0.25));
  user-select: none;
  pointer-events: none;
}

.welcome-balls {
  position: fixed;
  top: 0;
  bottom: 0;
  width: var(--side-w);
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  padding: 2rem 0;
  pointer-events: none;
}

.welcome-balls--left { left: 0; }
.welcome-balls--right { right: 0; }
.main-side { z-index: 2; }

.ball-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.spin-slow {
  animation: spin-ball 52s linear infinite;
}

.spin-slow-rev {
  animation: spin-ball 64s linear infinite reverse;
}

.float-slow {
  animation: float-y 8s ease-in-out infinite;
}

.float-mid {
  animation: float-y 6s ease-in-out infinite reverse;
}

@keyframes spin-ball {
  to { transform: rotate(360deg); }
}

@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem calc(var(--side-w) + 1rem);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.welcome-screen.leave {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.welcome-card {
  z-index: 4;
  width: min(480px, calc(100vw - 2 * var(--side-w) - 2rem));
  padding: 2rem 1.75rem;
  text-align: center;
}

.welcome-center-wrap {
  margin: 0 auto 1rem;
}

.welcome-kicker {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 0.35rem;
}

.welcome-greeting {
  font-size: clamp(1.25rem, 4vw, 1.65rem);
  font-weight: 800;
  color: var(--green-deep);
  margin-bottom: 1.25rem;
}

.glow-pulse {
  animation: glow-pulse 2s ease-in-out infinite;
}

.glow-pulse-btn {
  animation: glow-pulse-btn 2.2s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% {
    opacity: 1;
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
  }
  50% {
    opacity: 0.75;
    text-shadow: 0 0 22px rgba(16, 185, 129, 0.75);
  }
}

@keyframes glow-pulse-btn {
  0%, 100% {
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.35);
  }
  50% {
    box-shadow: 0 4px 28px rgba(16, 185, 129, 0.65);
  }
}

.main-app.hidden { display: none; }

.app-shell {
  position: relative;
  z-index: 1;
  width: calc(100vw - 2 * var(--side-w) - var(--timer-w) - 0.75rem);
  margin-left: var(--side-w);
  margin-right: calc(var(--side-w) + var(--timer-w) + 0.5rem);
  padding: 1.25rem var(--content-pad) 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.timer-side {
  position: fixed;
  top: 4.5rem;
  right: calc(var(--side-w) + 0.35rem);
  width: var(--timer-w);
  z-index: 40;
  padding: 1rem;
}

.timer-side-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--green-deep);
  margin-bottom: 0.75rem;
}

.timer-side-title i {
  color: var(--green);
  margin-right: 0.35rem;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-soft);
  margin-bottom: 0.35rem;
  display: block;
}

.menu-hamburger {
  position: fixed;
  top: 1rem;
  left: calc(var(--side-w) + 0.35rem);
  z-index: 45;
  width: 44px;
  height: 44px;
  border: 2px solid var(--glass-border);
  border-radius: 10px;
  background: var(--white);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: var(--shadow);
}

.menu-hamburger span {
  width: 20px;
  height: 2px;
  background: var(--green-deep);
  border-radius: 2px;
}

.archive-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(300px, 88vw);
  height: 100%;
  z-index: 70;
  background: var(--white);
  border-right: 2px solid var(--glass-border);
  box-shadow: 8px 0 30px rgba(4, 120, 87, 0.12);
  padding: 1rem;
  transform: translateX(-100%);
  transition: transform 0.35s ease;
  display: flex;
  flex-direction: column;
}

.archive-drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.drawer-head h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--green-deep);
}

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

.archive-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.archive-item {
  width: 100%;
  text-align: left;
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.75rem;
  border: 2px solid rgba(16, 185, 129, 0.2);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
}

.archive-item.active {
  border-color: var(--green);
  background: rgba(16, 185, 129, 0.12);
}

.archive-item .archive-live {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 0.2rem;
}

.overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(6, 78, 59, 0.25);
}

.app-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-left: 4px solid var(--green);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-ball {
  width: 44px;
  height: 44px;
}

.app-header h1 {
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 800;
  color: var(--green-deep);
}

.tagline {
  font-size: 0.88rem;
  color: var(--text-soft);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.live-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.live-dot.archive-mode {
  background: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.archive-banner {
  font-size: 0.9rem;
  color: #92400e;
  padding: 0.65rem 1rem;
  border: 2px dashed #fcd34d;
  border-radius: 10px;
  background: #fffbeb;
}

.panel {
  padding: 1.25rem 1.35rem;
}

.panel-hero {
  border: 2px solid var(--green);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.panel-head i {
  color: var(--green);
  font-size: 1.15rem;
  margin-top: 0.15rem;
}

.panel-head h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--green-deep);
}

.panel-sub {
  font-size: 0.88rem;
  color: var(--text-soft);
  margin-top: 0.15rem;
}

.panel-hint {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.pill {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: var(--green);
  color: var(--white);
}

.subject-select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.65rem;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  border: 2px solid rgba(16, 185, 129, 0.35);
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
}

.mode-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.mode-tab {
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.45rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}

.mode-tab.active {
  background: var(--white);
  color: var(--green-deep);
  box-shadow: 0 2px 6px rgba(4, 120, 87, 0.1);
}

.timer-display {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--green-deep);
  letter-spacing: 0.05em;
  text-align: center;
  margin-bottom: 0.35rem;
}

.timer-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 0.65rem;
}

.timer-controls {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.timer-controls .btn {
  width: 100%;
  justify-content: center;
}

.today-plan-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.today-plan-list li {
  display: flex;
  gap: 0.55rem;
  padding: 0.85rem;
  background: rgba(16, 185, 129, 0.08);
  border-radius: 10px;
  border-left: 4px solid var(--green);
  font-size: 0.95rem;
}

.today-empty {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
}

.today-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  font-size: 0.9rem;
  color: var(--text-soft);
  padding-top: 0.65rem;
  border-top: 1px dashed rgba(16, 185, 129, 0.3);
}

.today-meta strong {
  color: var(--green-deep);
}

.planner-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
}

.planner-day:nth-child(-n + 4) {
  grid-column: span 3;
}

.planner-day:nth-child(n + 5) {
  grid-column: span 4;
}

.planner-day {
  display: flex;
  flex-direction: column;
  min-height: 240px;
  border: 2px solid rgba(16, 185, 129, 0.25);
  border-radius: 14px;
  overflow: hidden;
  background: var(--white);
}

.planner-day.today {
  border-color: var(--green);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
}

.planner-day-head {
  position: relative;
  padding: 0.55rem 2.5rem 0.55rem 0.55rem;
  text-align: center;
  background: rgba(16, 185, 129, 0.1);
}

.planner-day-info {
  width: 100%;
}

.day-add-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: var(--green);
  color: var(--white);
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.day-add-btn:hover {
  background: var(--green-deep);
}

.day-add-form {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(16, 185, 129, 0.25);
}

.day-add-form.hidden {
  display: none !important;
}

.day-add-input {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.5rem;
  font-family: var(--font);
  font-size: 0.8rem;
  border: 2px solid rgba(16, 185, 129, 0.35);
  border-radius: 8px;
}

.btn-xs {
  font-size: 0.72rem;
  padding: 0.45rem 0.55rem;
}

.planner-day-name {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--green-deep);
}

.planner-day-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.planner-badge {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: var(--green);
  color: white;
}

.day-task-list {
  list-style: none;
  flex: 1;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.day-task-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem 0.5rem;
}

.chart-wrap {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--white);
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  height: 170px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  height: 100%;
}

.bar {
  width: 100%;
  max-width: 44px;
  min-height: 6px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--green-neon), var(--green));
}

.bar-label,
.bar-value {
  font-size: 0.68rem;
  color: var(--text-soft);
  font-weight: 700;
}

.analysis-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.analysis-table th,
.analysis-table td {
  padding: 0.65rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(16, 185, 129, 0.15);
}

.analysis-table th {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.analysis-table tr.today-row {
  background: rgba(16, 185, 129, 0.08);
}

.plan-snippet {
  max-width: min(400px, 40vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-total {
  text-align: center;
  margin-top: 0.65rem;
  color: var(--text-soft);
}

.tasks-intro {
  font-size: 0.92rem;
  color: var(--text-soft);
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 10px;
}

.task-form--hero {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
  padding: 0.85rem;
  background: var(--white);
  border: 2px dashed var(--green);
  border-radius: 12px;
}

.task-input {
  flex: 1 1 220px;
  padding: 0.85rem 1rem;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid rgba(16, 185, 129, 0.35);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text);
}

.task-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.btn-task-add {
  font-size: 0.95rem;
  padding: 0.85rem 1.15rem;
}

.task-list--hero {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--white);
  border: 2px solid rgba(16, 185, 129, 0.25);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(4, 120, 87, 0.06);
}

.task-check-label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

.task-check-label span.check-caption {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--green-deep);
  text-transform: uppercase;
}

.task-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.task-check-box {
  width: 2.35rem;
  height: 2.35rem;
  border: 3px solid var(--green);
  border-radius: 10px;
  background: var(--white);
  display: grid;
  place-items: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.task-check-box i {
  font-size: 1.1rem;
  color: var(--white);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s, transform 0.2s;
}

.task-check-label:active .task-check-box {
  transform: scale(0.96);
}

.task-checkbox:focus-visible + .task-check-box {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.35);
}

.task-checkbox:checked + .task-check-box {
  background: var(--green);
  border-color: var(--green-deep);
}

.task-checkbox:checked + .task-check-box i {
  opacity: 1;
  transform: scale(1);
}

.task-text {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.task-item--compact {
  padding: 0.55rem 0.6rem;
  gap: 0.5rem;
}

.task-item--compact .task-check-box {
  width: 1.85rem;
  height: 1.85rem;
}

.task-item--compact .check-caption {
  font-size: 0.55rem;
}

.task-item--compact .task-text {
  font-size: 0.88rem;
}

.task-item.done .task-text {
  text-decoration: line-through;
  text-decoration-color: var(--green);
  color: var(--text-muted);
  opacity: 0.85;
}

.task-delete {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  cursor: pointer;
  font-size: 1rem;
}

.tasks-empty {
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.btn {
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-sm {
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--green), var(--green-deep));
  color: var(--white);
}

.btn-secondary {
  background: var(--white);
  color: var(--green-deep);
  border: 2px solid rgba(16, 185, 129, 0.4);
}

.btn-accent {
  background: var(--green-deep);
  color: var(--white);
}

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

.btn-enter {
  width: 100%;
  justify-content: center;
  font-size: 1rem;
  padding: 0.85rem;
}

.btn-icon {
  width: 42px;
  height: 42px;
  border: 2px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  background: var(--white);
  color: var(--green-deep);
  cursor: pointer;
}

@media (max-width: 960px) {
  :root {
    --timer-w: 0px;
  }
  .timer-side {
    top: auto;
    bottom: 1rem;
    width: min(280px, calc(100vw - 2 * var(--side-w) - 1rem));
  }
  .app-shell {
    width: calc(100vw - 2 * var(--side-w));
    margin-right: var(--side-w);
    padding-bottom: 6rem;
  }
  .timer-controls {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .timer-controls .btn {
    width: auto;
    flex: 1;
  }
  .mode-tabs {
    flex-direction: row;
  }
  .planner-grid {
    grid-template-columns: 1fr 1fr;
  }
  .planner-day:nth-child(-n + 4),
  .planner-day:nth-child(n + 5) {
    grid-column: span 1;
  }
}

@media (max-width: 720px) {
  :root {
    --side-w: 68px;
    --content-pad: 0.85rem;
  }
  .planner-grid {
    grid-template-columns: 1fr;
  }
}
