/* ---------- fonts ---------- */
@font-face {
  font-family: "SF Technodelight";
  src: url("../fonts/SF-Technodelight-NS-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "OpenDyslexic";
  src: url("../fonts/OpenDyslexic-Regular.woff2") format("woff2"),
       url("../fonts/OpenDyslexic-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- palette ---------- */
:root {
  --blue-deep:   #3f6fa8;
  --blue:        #6fa3d8;
  --blue-light:  #b7d4ee;
  --blue-pale:   #e4eef8;

  --green-deep:  #6f8f2a;
  --green:       #9cbf46;
  --green-light: #cbe07f;
  --green-pale:  #eef6d8;

  --grey-ink:    #37424d;
  --grey-slate:  #6a7580;
  --grey-mist:   #b9c3cc;
  --grey-fog:    #e6ebef;
  --white:       #ffffff;

  --surface-rgb: 255, 255, 255;
  --surface-solid: #ffffff;
  --sheen-alpha: 0.9;

  --glass: rgba(var(--surface-rgb), 0.62);
  --glass-strong: rgba(var(--surface-rgb), 0.82);
  --shadow: 0 8px 24px rgba(63, 111, 168, 0.18);
  --shadow-soft: 0 2px 8px rgba(55, 66, 77, 0.12);

  --radius: 18px;
  --radius-sm: 10px;

  --font-title: "SF Technodelight", "Segoe UI", sans-serif;
  --font-body: "OpenDyslexic", "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
}

/* ---------- dark theme ---------- */
/* explicit toggle (data-theme) always wins; with no explicit choice, follow system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --blue-deep:   #8fc0f0;
    --blue:        #6fa3d8;
    --blue-light:  #3a5478;
    --blue-pale:   #1b2636;

    --green-deep:  #b6d873;
    --green:       #8fb23e;
    --green-light: #3f5424;
    --green-pale:  #1c2417;

    --grey-ink:    #e7ebef;
    --grey-slate:  #9aa5b1;
    --grey-mist:   #5b6570;
    --grey-fog:    #2a323b;

    --surface-rgb: 30, 38, 48;
    --surface-solid: #1b232c;
    --sheen-alpha: 0.12;

    --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --blue-deep:   #8fc0f0;
  --blue:        #6fa3d8;
  --blue-light:  #3a5478;
  --blue-pale:   #1b2636;

  --green-deep:  #b6d873;
  --green:       #8fb23e;
  --green-light: #3f5424;
  --green-pale:  #1c2417;

  --grey-ink:    #e7ebef;
  --grey-slate:  #9aa5b1;
  --grey-mist:   #5b6570;
  --grey-fog:    #2a323b;

  --surface-rgb: 30, 38, 48;
  --surface-solid: #1b232c;
  --sheen-alpha: 0.12;

  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--grey-ink);
  background:
    radial-gradient(circle at 8px 8px, rgba(255,255,255,0.55) 1.6px, transparent 1.6px),
    linear-gradient(160deg, var(--blue-pale) 0%, var(--green-pale) 45%, var(--blue-light) 100%);
  background-size: 22px 22px, cover;
  background-attachment: fixed;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background 0.2s ease, color 0.2s ease;
}

input, textarea, button, select {
  font-family: inherit;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 700px 400px at 90% -5%, rgba(159, 205, 255, 0.55), transparent 60%),
    radial-gradient(ellipse 600px 500px at -5% 100%, rgba(196, 224, 140, 0.45), transparent 60%);
}

:root[data-theme="dark"] .bg-glow {
  background:
    radial-gradient(ellipse 700px 400px at 90% -5%, rgba(90, 130, 180, 0.28), transparent 60%),
    radial-gradient(ellipse 600px 500px at -5% 100%, rgba(110, 150, 80, 0.22), transparent 60%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bg-glow {
    background:
      radial-gradient(ellipse 700px 400px at 90% -5%, rgba(90, 130, 180, 0.28), transparent 60%),
      radial-gradient(ellipse 600px 500px at -5% 100%, rgba(110, 150, 80, 0.22), transparent 60%);
  }
}

h1, h2, h3, .brand-name {
  font-family: var(--font-title);
  font-weight: 400;
  letter-spacing: 0.5px;
}

/* ---------- topbar ---------- */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 26px;
  background: linear-gradient(180deg, rgba(var(--surface-rgb),0.85), rgba(var(--surface-rgb),0.35));
  border-bottom: 1px solid rgba(var(--surface-rgb),0.6);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(6px);
}

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

.brand-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--blue) 45%, var(--blue-deep) 100%);
  box-shadow: 0 0 0 3px rgba(111, 163, 216, 0.25);
}

.brand-name {
  font-size: 26px;
  color: var(--blue-deep);
}

.brand-name .star {
  color: var(--green-deep);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--grey-slate);
}

.theme-toggle {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(var(--surface-rgb),0.7);
  border-radius: 50%;
  background: var(--glass-strong);
  color: var(--blue-deep);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
  transition: transform 0.15s ease;
}

.theme-toggle:hover {
  transform: scale(1.08);
}

.clock {
  font-variant-numeric: tabular-nums;
  background: var(--glass-strong);
  border: 1px solid rgba(var(--surface-rgb),0.7);
  border-radius: 999px;
  padding: 4px 12px;
  color: var(--blue-deep);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

/* ---------- marquee / pinned strip ---------- */
.marquee-strip {
  position: relative;
  z-index: 1;
  overflow: hidden;
  background: repeating-linear-gradient(
    45deg,
    #37424d, #37424d 6px,
    #2c353e 6px, #2c353e 12px
  );
  color: #cbe07f;
  font-size: 12px;
  letter-spacing: 1px;
  height: 26px;
  display: flex;
  align-items: center;
}

.marquee-track {
  white-space: nowrap;
  padding-left: 100%;
  animation: scroll-left 22s linear infinite;
}

.marquee-track:empty::before {
  content: "no pinned reminders yet — mark a note as a reminder to see it here \00a0\00a0\2022\00a0\00a0";
  opacity: 0.75;
}

@keyframes scroll-left {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* ---------- layout ---------- */
.grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.1fr 1.3fr 1.1fr;
  gap: 20px;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
}

/* ---------- panels (glass tiles) ---------- */
.panel {
  background: var(--glass);
  border: 1px solid rgba(var(--surface-rgb),0.75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 18px 18px 20px;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(180deg, rgba(255,255,255,var(--sheen-alpha)), rgba(255,255,255,0));
  pointer-events: none;
}

.panel-tasks::after,
.panel-notes::after,
.panel-events::after,
.panel-pomodoro::after,
.panel-habits::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -30px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  z-index: -1;
  opacity: 0.5;
}

.panel-tasks::after    { background: radial-gradient(circle, var(--blue-light), transparent 70%); }
.panel-notes::after    { background: radial-gradient(circle, var(--green-light), transparent 70%); }
.panel-events::after   { background: radial-gradient(circle, var(--blue-light), transparent 70%); }
.panel-pomodoro::after { background: radial-gradient(circle, var(--green-light), transparent 70%); }
.panel-habits::after   { background: radial-gradient(circle, var(--blue-light), transparent 70%); }

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 1px dashed rgba(106, 117, 128, 0.3);
  padding-bottom: 8px;
}

.panel-head.sub {
  margin-top: 16px;
  margin-bottom: 8px;
}

.panel-head h2 {
  margin: 0;
  font-size: 21px;
  color: var(--blue-deep);
}

.panel-head h3 {
  margin: 0;
  font-size: 14px;
  color: var(--green-deep);
  font-family: "Segoe UI", sans-serif;
  font-weight: 700;
  text-transform: lowercase;
}

.panel-sub {
  font-size: 11px;
  color: var(--grey-slate);
  background: rgba(var(--surface-rgb),0.6);
  border-radius: 999px;
  padding: 2px 10px;
}

/* ---------- tasks ---------- */
.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 40px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(var(--surface-rgb),0.55);
  border: 1px solid rgba(var(--surface-rgb),0.8);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.task-item:hover {
  background: rgba(var(--surface-rgb),0.8);
}

.task-item input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 6px;
  border: 2px solid var(--blue);
  background: linear-gradient(180deg, rgb(var(--surface-rgb)), var(--blue-pale));
  cursor: pointer;
  position: relative;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.9);
}

.task-item input[type="checkbox"]:checked {
  background: linear-gradient(180deg, var(--green-light), var(--green));
  border-color: var(--green-deep);
}

.task-item input[type="checkbox"]:checked::after {
  content: "\2713";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.task-item span.label {
  flex: 1;
  font-size: 14px;
  word-break: break-word;
}

.task-item.done span.label {
  text-decoration: line-through;
  color: var(--grey-mist);
}

.task-item .remove-btn {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.task-item:hover .remove-btn {
  opacity: 1;
}

.remove-btn {
  border: none;
  background: transparent;
  color: var(--grey-slate);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 50%;
}

.remove-btn:hover {
  background: rgba(200, 80, 80, 0.15);
  color: #b04545;
}

/* ---------- add row / inputs ---------- */
.add-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.add-row input[type="text"],
.add-row input[type="date"] {
  flex: 1;
  min-width: 90px;
  border: 1px solid rgba(var(--surface-rgb),0.9);
  background: rgba(var(--surface-rgb),0.7);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--grey-ink);
  outline: none;
}

.add-row input:focus {
  border-color: var(--blue);
  background: var(--surface-solid);
}

.glossy-btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, var(--blue-light) 0%, var(--blue) 50%, var(--blue-deep) 100%);
  box-shadow: 0 3px 0 rgba(63,111,168,0.4), inset 0 1px 0 rgba(255,255,255,0.6);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.glossy-btn:hover { filter: brightness(1.05); }

.glossy-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(63,111,168,0.4), inset 0 1px 0 rgba(255,255,255,0.6);
}

.glossy-btn.small {
  padding: 8px 14px;
}

.block-controls .glossy-btn {
  background: linear-gradient(180deg, var(--green-light) 0%, var(--green) 50%, var(--green-deep) 100%);
  box-shadow: 0 3px 0 rgba(111,143,42,0.4), inset 0 1px 0 rgba(255,255,255,0.6);
}

/* ---------- notes / blocks ---------- */
.block-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 60px;
}

.block {
  position: relative;
  background: rgba(var(--surface-rgb),0.55);
  border: 1px solid rgba(var(--surface-rgb),0.8);
  border-radius: var(--radius-sm);
  padding: 10px 34px 10px 14px;
}

.block[data-type="bullet"] { border-left: 4px solid var(--green); }
.block[data-type="text"] { border-left: 4px solid var(--blue); }
.block[data-type="reminder"] { border-left: 4px solid #e0a63f; background: rgba(255, 247, 225, 0.65); }

.block .block-content {
  min-height: 20px;
  font-size: 14px;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.block .block-content:empty::before {
  content: attr(data-placeholder);
  color: var(--grey-mist);
}

.block[data-type="bullet"] .block-content::before {
  content: "\2022  ";
  color: var(--green-deep);
  font-weight: 700;
}

.block .remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
}

/* ---------- pomodoro ---------- */
.panel-pomodoro {
  grid-column: 1 / -1;
}

.pomodoro-body {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.timer-display {
  font-family: "SF Technodelight", "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 40px;
  color: var(--blue-deep);
  background: var(--glass-strong);
  border: 1px solid rgba(var(--surface-rgb),0.7);
  border-radius: var(--radius-sm);
  padding: 8px 26px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
  min-width: 160px;
  text-align: center;
}

.panel-pomodoro[data-mode="break"] .timer-display {
  color: var(--green-deep);
}

.timer-controls {
  display: flex;
  gap: 8px;
}

.timer-settings {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--grey-slate);
  margin-left: auto;
}

.timer-settings label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timer-settings input[type="number"] {
  width: 52px;
  border: 1px solid rgba(var(--surface-rgb),0.9);
  background: rgba(var(--surface-rgb),0.7);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  font-size: 12px;
  color: var(--grey-ink);
  outline: none;
}

.timer-settings input:focus {
  border-color: var(--blue);
  background: var(--surface-solid);
}

@media (max-width: 640px) {
  .timer-settings { margin-left: 0; }
}

/* ---------- events ---------- */
.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.event-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(var(--surface-rgb),0.55);
  border: 1px solid rgba(var(--surface-rgb),0.8);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
}

.event-item .event-date {
  font-size: 11px;
  color: #fff;
  background: linear-gradient(180deg, var(--blue-light), var(--blue-deep));
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}

/* ---------- habits ---------- */
.panel-habits {
  grid-column: 1 / -1;
}

.habit-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) repeat(7, 32px) 26px;
  align-items: center;
  gap: 6px 8px;
}

.habit-cell {
  font-size: 11px;
  color: var(--grey-slate);
  text-align: center;
  font-weight: 700;
}

.habit-label {
  font-size: 13px;
  color: var(--grey-ink);
  text-align: left;
  font-weight: 400;
}

.habit-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--blue);
  background: linear-gradient(180deg, rgb(var(--surface-rgb)), var(--blue-pale));
  cursor: pointer;
  justify-self: center;
  padding: 0;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.9);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.habit-dot.today {
  border-color: var(--green-deep);
}

.habit-dot.done {
  background: linear-gradient(180deg, var(--green-light), var(--green));
  border-color: var(--green-deep);
}

.habit-empty {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--grey-slate);
  padding: 6px 0;
}

@media (max-width: 640px) {
  .habit-grid { grid-template-columns: minmax(90px, 1fr) repeat(7, 26px) 22px; }
  .habit-dot { width: 20px; height: 20px; }
}

/* ---------- footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 18px;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--grey-slate);
  text-transform: lowercase;
}
