:root {
  --bg: #0b1220;
  --bg-soft: #111a2b;
  --surface: rgba(20, 28, 45, 0.92);
  --surface-2: rgba(28, 37, 58, 0.95);
  --surface-3: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f8fafc;
  --text-soft: #cbd5e1;
  --text-dim: #94a3b8;
  --primary: #22c55e;
  --primary-strong: #16a34a;
  --accent: #38bdf8;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  --radius: 20px;
  --radius-sm: 14px;
  --calendar-cell: 48px;
}

body.light-mode {
  --bg: #eef3f8;
  --bg-soft: #dde7f2;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-2: rgba(248, 250, 252, 0.98);
  --surface-3: rgba(15, 23, 42, 0.04);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a;
  --text-soft: #334155;
  --text-dim: #64748b;
  --primary: #16a34a;
  --primary-strong: #15803d;
  --accent: #0284c7;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 12px 26px rgba(15, 23, 42, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.10), transparent 28%),
    linear-gradient(180deg, var(--bg), var(--bg-soft));
  min-height: 100vh;
  transition: background 0.25s ease, color 0.25s ease;
}

img {
  max-width: 100%;
  display: block;
}


.logo {
  width: 55px;
  height: 55px;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: var(--shadow);
  background: #771ac6;
  padding: 4px;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(14px);
  background: rgba(8, 18, 32, 0.72);
  border-bottom: 1px solid var(--border);
}

body.light-mode .topbar {
  background: rgba(255, 255, 255, 0.72);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.nav {
  font-size: 0.77rem;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.nav a,
.icon-button,
.mode-toggle {
  border: 1px solid transparent;
  background: var(--surface-3);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  transition: 0.2s ease;
  cursor: pointer;
}

.nav a:hover,
.nav a.active,
.icon-button:hover,
.mode-toggle:hover {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 90px;
}

.hero,
.card,
.modal-content,
.calendar-shell,
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
}

.hero {
  padding: 24px;
  margin-bottom: 24px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 2rem;
}

.hero p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.section-title {
  margin: 0 0 14px;
  font-size: 1.25rem;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card,
.stat-card {
  padding: 18px;
}

.stat-label {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
}

.button,
.button-secondary,
.button-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: 0.2s ease;
}

.button {
  background: var(--primary);
  color: #052e16;
  font-weight: 700;
}

.button:hover {
  background: var(--primary-strong);
  color: #fff;
}

.button-secondary {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border);
}

.button-secondary:hover {
  border-color: var(--border-strong);
}

.button-danger {
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.24);
}

.input,
select {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

.input:focus,
select:focus {
  border-color: rgba(56, 189, 248, 0.45);
}

.label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.stack {
  display: grid;
  gap: 16px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.calendar-shell {
  padding: 18px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.calendar-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.calendar-nav {
  display: flex;
  gap: 10px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.calendar-weekdays {
  margin-bottom: 10px;
}

.calendar-weekday {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 6px 0;
}

.calendar-day {
  min-height: var(--calendar-cell);
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--text);
}

.calendar-day.empty {
  background: transparent;
  border-color: transparent;
}

.calendar-day.today {
  outline: 2px solid rgba(56, 189, 248, 0.5);
}

.calendar-day.marked {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
  font-weight: 700;
}

.calendar-day.relapse {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.30);
  color: #fecaca;
}

.calendar-dot {
  position: absolute;
  bottom: 6px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.9;
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.legend .ok {
  background: rgba(34, 197, 94, 0.85);
}

.legend .bad {
  background: rgba(239, 68, 68, 0.85);
}

.legend .now {
  background: rgba(56, 189, 248, 0.85);
}

@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.6rem;
  }

  .nav {
    width: 100%;
  }

  .nav a,
  .mode-toggle {
    flex: 1 1 auto;
    text-align: center;
  }

  :root {
    --calendar-cell: 42px;
  }
}

.time-greeting {
  padding: 24px;
  margin-bottom: 24px;
  display:block;margin: auto;
  max-width: 650px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;

  border-radius: 18px;
}

.greeting-morning {
  background: linear-gradient(
    135deg,
    #fff4cf,
    #ffd77a
  );

  color: #704000;
  box-shadow: 0 5px 18px rgba(255, 180, 40, 0.22);
  animation: greetingSunrise 25.0s ease;
}

.greeting-night {
  background: linear-gradient(
    135deg,
    #17213f,
    #34235c
  );

  color: #ffffff;

  box-shadow: 0 5px 20px rgba(25, 20, 70, 0.3);
  animation: greetingNight 25.0s ease;
}

@keyframes greetingSunrise {
  from {
    opacity: 0;
    transform: translateY(55px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes greetingNight {
  from {
    opacity: 0;
    transform: translateY(-55px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.copyright {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-soft);
  align-items: center;
  padding: 24px;
  margin-bottom:20px;
}

.visitor-counter {
  color: var(--text-soft);
  text-align: center;
  align-items: center;
}

.darklightbutton {margin-bottom:20px;}

.saved-note-info,
.info-text,
.install-help {
  margin-top: 12px;
  color: var(--subtext);
  font-size: 0.95rem;
}