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

:root {
  --bg: #f5f0e8;
  --bg2: #ede8df;
  --surface: #faf7f2;
  --border: #e2d9cc;
  --text: #2c2416;
  --muted: #9b8e7e;
  --accent: #c17f3a;
  --accent2: #5a7a52;
  --accent3: #7a5c8a;
  --red: #c0392b;
  /* Season-themed (set by JS) */
  --tc-border: rgba(220,170,190,0.5);
  --tc-shadow: rgba(180,100,130,0.18);
  --tc-color: #7a3050;
  --tc-divider: rgba(220,170,190,0.4);
  --tc-btn-color: #a05070;
  --tc-btn-hover-bg: rgba(244,160,181,0.18);
  --tc-btn-hover-border: rgba(212,116,142,0.35);
  --tc-btn-hover-color: #7a3050;
  --tc-btn-active-bg: rgba(212,116,142,0.20);
  --tc-btn-active-border: rgba(212,116,142,0.5);
  --clock-shadow: rgba(220,120,150,0.22);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SKY SCENE ── */
#sky-scene {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

.layout { position: relative; z-index: 1; }



.layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  min-height: 100vh;
}

/* ── CLOCK ── */
.clock-section {
  grid-column: 1;
  grid-row: 1;
  padding: 22px;
  background: rgba(250,247,242,0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226,217,204,0.55);
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.05);
}

.sakura-clock-wrap {
  display: flex;
  align-items: center;
  gap: 28px;
}

#sakura-clock {
  border-radius: 50%;
  box-shadow:
    0 8px 32px var(--clock-shadow),
    0 2px 8px rgba(0,0,0,0.08),
    inset 0 0 0 3px rgba(255,255,255,0.6);
  flex-shrink: 0;
}

.clock-info { display: flex; flex-direction: column; gap: 6px; }

.clock-digital {
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.date-line {
  font-family: 'Playfair Display', serif;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.greeting {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-style: italic;
  color: var(--muted);
  margin-top: 2px;
}

/* ── CARDS ── */
.card {
  background: rgba(250,247,242,0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226,217,204,0.55);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.05);
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: 0 4px 24px rgba(0,0,0,0.08); }

.card-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ── CALENDAR ── */
.calendar-wrap {
  grid-column: 1;
  grid-row: 2;
}

.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.cal-month {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
}

.cal-nav {
  display: flex; gap: 4px;
}
.cal-nav button {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 30px; height: 30px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.cal-nav button:hover { background: var(--border); color: var(--text); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 0 8px;
  letter-spacing: 0.06em;
}

.cal-day {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  border-radius: 10px;
  font-size: 13px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
}

.cal-day:hover { background: var(--bg2); }
.cal-day.other-month { color: var(--border); cursor: default; }
.cal-day.other-month:hover { background: transparent; }
.cal-day.today {
  background: var(--accent);
  color: white;
  font-weight: 500;
}
.cal-day.today:hover { background: #a86c2f; }
.cal-day.sunday { color: var(--red); }
.cal-day.sunday.today { color: white; }
.cal-day.saturday { color: #2980b9; }
.cal-day.saturday.today { color: white; }
.cal-day.holiday { background: rgba(193,57,43,0.09); }
.cal-day.holiday:not(.today) { color: var(--red); }
.cal-day.holiday.today { background: var(--red); }

.cal-lunar {
  font-size: 8px;
  line-height: 1;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  opacity: 0.7;
}
.cal-lunar.lunar-first { color: var(--accent); opacity: 1; font-weight: 500; }
.cal-day.today .cal-lunar { color: rgba(255,255,255,0.75); }
.cal-day.holiday:not(.today) .cal-lunar { color: var(--red); opacity: 0.6; }
.cal-day.other-month .cal-lunar { opacity: 0.4; }

.cal-dow.sun { color: var(--red); }
.cal-dow.sat { color: #2980b9; }

/* ── RIGHT COLUMN ── */
.right-col {
  grid-column: 2;
  grid-row: 1 / 4;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── WEATHER ── */
.weather-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.weather-temp {
  font-family: 'Playfair Display', serif;
  font-size: 48px;
  font-weight: 400;
  line-height: 1;
}
.weather-icon { font-size: 48px; }
.weather-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }
.weather-meta { display: flex; gap: 12px; margin-top: 12px; }
.weather-meta span { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }

/* ── WEATHER BG ── */
#weather-card { position: relative; overflow: hidden; transition: background 0.6s, border-color 0.4s; }
#weather-card.w-active {
  border-color: rgba(255,255,255,0.15);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
#weather-card.w-active > *:not(#w-bg) { position: relative; z-index: 2; }
#weather-card.w-active .card-title { color: rgba(255,255,255,0.75); }
#weather-card.w-active .weather-temp { color: #fff; }
#weather-card.w-active .weather-desc { color: rgba(255,255,255,0.85); }
#weather-card.w-active .weather-meta span { color: rgba(255,255,255,0.75); }
#weather-card.w-active #w-forecast > div { background: rgba(255,255,255,0.12) !important; }
#weather-card.w-active #w-forecast > div > div { color: rgba(255,255,255,0.85) !important; }
#w-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1; border-radius: 18px;
  pointer-events: none;
}

/* ── TODO ── */
.todo-input-row {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.todo-input-row input {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.todo-input-row input:focus { border-color: var(--accent); }
.todo-input-row input::placeholder { color: var(--muted); }
.todo-input-row button {
  background: var(--accent);
  border: none;
  border-radius: 10px;
  width: 34px; height: 34px;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.todo-input-row button:hover { background: #a86c2f; }

.todo-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.todo-list::-webkit-scrollbar { width: 4px; }
.todo-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.todo-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background 0.15s;
  cursor: pointer;
}
.todo-item:hover { background: var(--bg2); }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--muted); }

.todo-check {
  width: 18px; height: 18px; border-radius: 6px;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; font-size: 10px;
}
.todo-item.done .todo-check {
  background: var(--accent2);
  border-color: var(--accent2);
  color: white;
}
.todo-text { font-size: 13px; flex: 1; }
.todo-del {
  opacity: 0; font-size: 14px; color: var(--muted);
  cursor: pointer; transition: opacity 0.15s;
}
.todo-item:hover .todo-del { opacity: 1; }

/* ── QUOTE ── */
.quote-text {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}
.quote-author {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.quote-refresh {
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--muted);
  float: right; padding: 2px;
  transition: transform 0.3s;
}
.quote-refresh:hover { transform: rotate(180deg); color: var(--accent); }

/* ── QUICK LINKS ── */
.links-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.link-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.link-item:hover { background: var(--bg2); }
.link-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.link-label { font-size: 11px; color: var(--muted); text-align: center; font-weight: 500; }

/* ── QUICK LINK MODAL ── */
.ql-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.ql-overlay.open { opacity: 1; pointer-events: auto; }
.ql-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  width: 320px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  transform: translateY(10px) scale(0.97);
  transition: transform 0.2s;
}
.ql-overlay.open .ql-modal { transform: translateY(0) scale(1); }
.ql-modal h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 700; margin-bottom: 16px;
}
.ql-field { margin-bottom: 12px; }
.ql-field label {
  display: block; font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 4px;
}
.ql-field input {
  width: 100%; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: 13px;
  font-family: 'DM Sans', sans-serif; color: var(--text);
  outline: none; transition: border-color 0.15s;
}
.ql-field input:focus { border-color: var(--accent); }
.ql-emoji-grid {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.ql-emoji-btn {
  width: 34px; height: 34px; border-radius: 8px;
  border: 2px solid transparent; background: var(--bg2);
  font-size: 16px; cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.ql-emoji-btn:hover { border-color: var(--border); }
.ql-emoji-btn.selected { border-color: var(--accent); background: rgba(193,127,58,0.1); }
.ql-actions { display: flex; gap: 8px; margin-top: 16px; }
.ql-actions button {
  flex: 1; padding: 8px 0; border-radius: 10px;
  font-size: 13px; font-family: 'DM Sans', sans-serif;
  cursor: pointer; transition: all 0.15s; border: none;
}
.ql-btn-cancel { background: var(--bg2); color: var(--muted); }
.ql-btn-cancel:hover { background: var(--border); color: var(--text); }
.ql-btn-save { background: var(--accent); color: white; font-weight: 500; }
.ql-btn-save:hover { background: #a86c2f; }

.link-item .link-del {
  display: none; position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--red); color: white; font-size: 10px;
  border: none; cursor: pointer;
  align-items: center; justify-content: center; line-height: 1;
}
.link-item:hover .link-del { display: flex; }
.link-item { position: relative; }

/* ── BOTTOM BAR ── */
.bottom-bar {
  grid-column: 1;
  grid-row: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  background: rgba(250,247,242,0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226,217,204,0.55);
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.05);
}
.focus-input {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 15px;
  background: none;
  border: none;
  outline: none;
  color: var(--muted);
  width: 300px;
}
.focus-input::placeholder { color: var(--border); }
.pomodoro { display: flex; align-items: center; gap: 10px; }
.pomo-time { font-family: 'DM Mono', monospace; font-size: 18px; font-weight: 500; color: var(--text); }
.pomo-btn {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
  cursor: pointer; font-size: 12px; color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}
.pomo-btn:hover { background: var(--border); color: var(--text); }
.pomo-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.anim { opacity: 0; animation: fadeUp 0.5s ease forwards; }
.d1 { animation-delay: 0s; }
.d2 { animation-delay: 0.08s; }
.d3 { animation-delay: 0.14s; }
.d4 { animation-delay: 0.20s; }
.d5 { animation-delay: 0.26s; }
.d6 { animation-delay: 0.32s; }

/* ── HIDE WIDGETS MODE ── */
.layout.hidden-widgets {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.layout {
  transition: opacity 0.4s ease;
}

/* ── TC TOGGLE BUTTON (mobile only) ── */
#tc-toggle {
  display: none;
  position: fixed;
  bottom: 14px; right: 14px;
  z-index: 1001;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  background: rgba(255,252,250,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--tc-border);
  border-radius: 50%;
  box-shadow: 0 4px 16px var(--tc-shadow), 0 1px 4px rgba(0,0,0,0.08);
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.2s;
  padding: 0;
}
#tc-toggle:active { transform: scale(0.9); }
#tc-toggle.active { transform: rotate(90deg); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 16px;
    padding: 20px 16px 100px;
    max-width: 100%;
  }

  .clock-section {
    grid-column: 1;
    grid-row: auto;
    padding: 8px 0 16px;
  }

  .sakura-clock-wrap {
    gap: 18px;
  }

  .date-line {
    font-size: clamp(18px, 5vw, 26px);
  }

  .greeting { font-size: 14px; }

  .calendar-wrap {
    grid-column: 1;
    grid-row: auto;
  }

  .right-col {
    grid-column: 1;
    grid-row: auto;
  }

  .bottom-bar {
    grid-column: 1;
    grid-row: auto;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .focus-input {
    width: 100%;
  }

  .pomodoro {
    justify-content: center;
  }

  .links-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .link-icon {
    width: 32px; height: 32px;
    font-size: 16px;
  }

  .link-label { font-size: 10px; }

  .card { padding: 18px; }

  .weather-temp { font-size: 38px; }
  .weather-icon { font-size: 38px; }

  /* Time control toggle button (mobile only) */
  #tc-toggle {
    display: flex;
  }

  /* Time control bar - hidden by default on mobile */
  #time-ctrl {
    bottom: 56px;
    left: 8px; right: 8px;
    transform: none;
    max-width: none;
    padding: 10px 12px;
    gap: 6px;
    border-radius: 14px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.25s, transform 0.25s, border-color 0.4s, box-shadow 0.4s, color 0.4s;
  }
  #time-ctrl.tc-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .tc-btn { padding: 4px 7px; font-size: 11px; }
  .tc-season-btn { padding: 3px 6px !important; font-size: 10px !important; }
  .tc-season-auto { padding: 3px 6px; font-size: 10px; }
  .tc-season-label { font-size: 10px; }
  .tc-divider { display: none; }

  #tc-slider { width: 60px; }
}

@media (max-width: 420px) {
  .layout {
    padding: 14px 12px 100px;
    gap: 12px;
  }

  .sakura-clock-wrap {
    gap: 14px;
  }

  .clock-digital { font-size: 13px; }
  .date-line { font-size: clamp(16px, 5vw, 22px); }
  .greeting { font-size: 13px; }

  .card { padding: 14px; border-radius: 14px; }
  .card-title { font-size: 10px; margin-bottom: 12px; }

  .cal-day { font-size: 12px; }
  .cal-dow { font-size: 10px; }
  .cal-month { font-size: 17px; }

  .weather-temp { font-size: 32px; }
  .weather-icon { font-size: 32px; }
  .weather-desc { font-size: 12px; }

  .todo-text { font-size: 12px; }
  .quote-text { font-size: 14px; }

  .pomo-time { font-size: 16px; }

  .links-grid { gap: 4px; }
  .link-item { padding: 10px 4px; gap: 4px; }
  .link-icon { width: 30px; height: 30px; border-radius: 8px; font-size: 14px; }
  .link-label { font-size: 9px; }
}

/* ── TIME CONTROL ── */
.tc-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: var(--tc-btn-color);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-weight: 500;
}
.tc-btn:hover {
  background: var(--tc-btn-hover-bg);
  border-color: var(--tc-btn-hover-border);
  color: var(--tc-btn-hover-color);
}
.tc-btn.active {
  background: var(--tc-btn-active-bg);
  border-color: var(--tc-btn-active-border);
  color: var(--tc-btn-hover-color);
  font-weight: 600;
}
.tc-live {
  background: rgba(220,240,220,0.5);
  border-color: rgba(90,122,82,0.4) !important;
  color: #3a6a32 !important;
  font-weight: 600;
}
.tc-live.active {
  background: rgba(90,122,82,0.18);
  border-color: rgba(90,122,82,0.6) !important;
}
.tc-btn.tc-fw:hover {
  background: rgba(255,80,40,0.18) !important;
  border-color: rgba(255,100,60,0.65) !important;
}
.tc-btn.tc-fw.active {
  background: rgba(255,60,20,0.22) !important;
  border-color: rgba(255,80,40,0.8) !important;
  color: #ff4020 !important;
  font-weight: 700;
  animation: fw-pulse 0.8s ease-in-out infinite alternate;
}
@keyframes fw-pulse {
  from { box-shadow: 0 0 0 0 rgba(255,80,40,0); }
  to   { box-shadow: 0 0 8px 3px rgba(255,100,40,0.35); }
}

/* ── SEASON TOGGLE ── */
.tc-divider {
  width: 1px; height: 20px;
  background: var(--tc-divider);
  margin: 0 4px; flex-shrink: 0;
}
.tc-season-label {
  font-size: 11px; opacity: 0.7; white-space: nowrap;
}
.tc-season-btn { font-size: 11px !important; padding: 3px 8px !important; }
.tc-season-btn.active { font-weight: 700 !important; }
.tc-season-auto { font-size: 11px; padding: 3px 8px; }
.tc-season-auto.active {
  background: rgba(120,120,120,0.15);
  border-color: rgba(120,120,120,0.4) !important;
  font-weight: 600;
}
