@font-face {
  font-family: "Terminus";
  src: url("./TerminusTTF-4.49.3.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0f1115;
  --dot: rgba(255, 255, 255, 0.08);
  --cell: rgba(255, 255, 255, 0.10);
  --cell-border: rgba(255, 255, 255, 0.18);
  --text: #e6e6e6;
  --muted: rgba(255, 255, 255, 0.45);
  --bar-bg: rgba(20, 22, 28, 0.95);
  --pro: #ffd700;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: "Terminus", system-ui, sans-serif; }
html, body { width: 100%; height: 100%; }
body { background-color: var(--bg); background-image: radial-gradient(var(--dot) 1px, transparent 1px); background-size: 14px 14px; color: var(--text); padding-top: 50px; }
.hidden { display: none !important; }

/* ---------- TOP BAR ---------- */
.top-bar {
  position: fixed; top: 0; left: 0; width: 100%; height: 50px; background: var(--bar-bg);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem; z-index: 50; border-bottom: 1px solid var(--cell-border);
}
.top-left { display: flex; align-items: center; gap: 0.5rem; }
.title { font-weight: bold; cursor: pointer; letter-spacing: 0.1em; margin-right: 1rem; }
.top-btn { background: transparent; border: 1px solid var(--cell-border); color: var(--text); padding: 0.4rem 0.8rem; cursor: pointer; letter-spacing: 0.1em; font-size: 0.9rem; }
.top-btn:hover { background: rgba(255, 255, 255, 0.12); }
.top-right { display: flex; align-items: center; gap: 0.6rem; }
.pro-btn { background: rgba(255, 215, 0, 0.15); border: 1px solid rgba(255, 215, 0, 0.6); color: var(--pro); padding: 0.4rem 0.8rem; cursor: pointer; letter-spacing: 0.1em; font-size: 0.9rem; }
.pro-btn:hover { background: rgba(255, 215, 0, 0.3); }
.profile-circle { width: 28px; height: 28px; border-radius: 50%; background: white; opacity: 0.85; cursor: pointer; }

/* ---------- CALENDAR ---------- */
.calendar-wrapper { width: min(92vw, 92vh); margin: 70px auto 0 auto; display: flex; flex-direction: column; gap: 1.2rem; }
.month-title { text-align: center; font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: 0.15em; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.15em; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.8rem; }
.day { background: var(--cell); border: 1px solid var(--cell-border); border-radius: 4px; aspect-ratio: 1 / 1; padding: 0.4rem; cursor: pointer; transition: background 0.2s ease; position: relative; }
.day.inactive { color: var(--muted); opacity: 0.6; cursor: default; }
.day:not(.inactive):hover { background: rgba(255, 255, 255, 0.18); }

/* Highlight today */
.day.today {
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid #ffffff;
  font-weight: bold;
}

/* ---------- OVERLAY WINDOWS ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 17, 21, 0.85); display: flex; align-items: center; justify-content: center; z-index: 40; opacity: 0; transition: opacity 0.25s ease; }
.overlay.active { opacity: 1; }
.overlay-window { width: min(90vw, 600px); min-height: 280px; background: #26282C; border: 1px solid var(--cell-border); padding: 1.5rem; display: flex; flex-direction: column; gap: 1.2rem; transform: translateY(40px); opacity: 0; transition: transform 0.3s ease, opacity 0.3s ease; }
.overlay.active .overlay-window { transform: translateY(0); opacity: 1; }
.overlay-header { display: flex; justify-content: space-between; align-items: center; letter-spacing: 0.15em; }
.back-btn { background: transparent; border: 1px solid var(--cell-border); color: var(--text); padding: 0.5rem 1rem; cursor: pointer; letter-spacing: 0.15em; }
.back-btn:hover { background: rgba(255, 255, 255, 0.12); }
.overlay-content { opacity: 0.7; font-size: 0.9rem; letter-spacing: 0.1em; }
.overlay-content a { color: var(--text); text-decoration: none; }
.overlay-content a:hover { text-decoration: underline; }

/* ---------- FOOTER ---------- */
.footer-text { position: fixed; bottom: 10px; width: 100%; text-align: center; color: var(--muted); font-size: 0.9rem; opacity: 0.5; }
.bottom-right { position: fixed; bottom: 10px; right: 10px; display: flex; gap: 0.5rem; }
.bottom-btn { background: transparent; border: 1px solid var(--cell-border); color: var(--text); padding: 0.3rem 0.6rem; font-size: 0.85rem; cursor: pointer; opacity: 0.6; }
.bottom-btn:hover { background: rgba(255,255,255,0.12); opacity: 1; }

/* ---------- BIG DAY WINDOW ---------- */
/* The overlay window should have a fixed usable height */
.overlay-window.large {
  width: min(98vw, 1200px);
  height: 75vh;        /* fixed height */
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
}

/* Make day-sections take remaining height */
.day-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1.5rem;
  flex: 1;           /* fills overlay-window */
  min-height: 0;     /* important for internal scrolling */
}



.section {
  border: 1px solid var(--cell-border);
  padding: 1rem;
  background: rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-title {
  letter-spacing: 0.15em;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ---------- STOPWATCH ---------- */
.stopwatch {
  flex: 1; /* takes remaining space in section */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
}


.time-display {
  font-size: 2rem;
  letter-spacing: 0.2em;
}

.record-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #b22222;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(178,34,34,0.4);
}

.record-btn.active {
  background: #ff4444;
}

/* ---------- TODO LIST ---------- */
.todo-input input {
  width: 100%;
  background: transparent;
  border: 1px solid var(--cell-border);
  padding: 0.5rem;
  color: var(--text);
}

.todo-list {
  flex: 1;
  overflow-y: auto;
}


.todo-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--cell-border);
  padding: 0.4rem;
}

.todo-item span {
  flex: 1;
}

.todo-item.done span {
  text-decoration: line-through;
  opacity: 0.5;
}

.remove-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
}

.remove-btn:hover {
  color: #ff6666;
}

/* ---------- TRANSPARENT PRODUCTIVITY HEAT ---------- */
.day.has-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 255, 120, var(--progress));
  pointer-events: none;
}

.day.has-progress {
  border-color: rgba(0, 255, 120, 0.35);
}

.day.has-progress::after {
  background: linear-gradient(
    to bottom,
    rgba(0, 255, 120, calc(var(--progress) * 0.8)),
    rgba(0, 255, 120, calc(var(--progress) * 1.1))
  );
}

.day {
  position: relative;
}

.day::after {
  z-index: 1;
}

.day {
  z-index: 0;
}

.day {
  color: #ffffff;
}

.day > * {
  position: relative;
  z-index: 2;
}

.date-number {
  position: relative;
  z-index: 2;
  color: #ffffff;
}

.day.has-progress::after {
  z-index: 1;
}

/* Limit section height inside day window */
.overlay-window.large {
  width: min(98vw, 1200px);
  height: 75vh;        /* fixed usable height */
  max-height: 75vh;
}



/* Make sections able to scroll internally */
.section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;   /* fills its grid cell */
  overflow: hidden; /* prevents expansion */
}



/* Only the todo list scrolls */
.todo-list {
  flex: 1;          /* takes remaining space in section */
  overflow-y: auto; /* scroll internally */
  max-height: 100%; /* constrain inside section */
  padding-right: 4px; /* optional for scrollbar spacing */
}

.todo-list::-webkit-scrollbar {
  width: 6px;
}
.todo-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.25);
}


/* ---------- OVERVIEW ---------- */
.overview-input {
  flex: 1;           /* fills section height */
  width: 100%;
  resize: none;
  overflow-y: auto;  /* scroll internally */
  background: transparent;
  border: 1px solid var(--cell-border);
  color: var(--text);
  padding: 0.6rem;
  font-size: 0.9rem;
}

.overview-input::-webkit-scrollbar {
  width: 6px;
}
.overview-input::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.25);
}

.section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  overflow: hidden;  /* prevents expanding the section */
}

/* Todo list scrolls internally */
.todo-list {
  flex: 1;
  overflow-y: auto;
}

/* Overview scrolls internally */
.overview-input {
  flex: 1;
  width: 100%;
  resize: none;
  overflow-y: auto;
  background: transparent;
  border: 1px solid var(--cell-border);
  color: var(--text);
  padding: 0.6rem;
  font-size: 0.9rem;
}
