:root {
  --bg: #0e1117;
  --card: #161b24;
  --card-2: #1d2430;
  --line: #262e3b;
  --text: #e6e9ef;
  --muted: #8b95a7;
  --accent: #6aa7ff;
  --accent-2: #ffb454;
  --good: #5ccf8f;
  --radius: 14px;
  --cal-0: #6aa7ff;
  --cal-1: #ffb454;
  --cal-2: #5ccf8f;
  --cal-3: #e38cff;
  --cal-4: #ff7a7a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding: 28px clamp(16px, 3vw, 40px) 20px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.pill {
  font-size: 0.75rem; padding: 2px 9px; border-radius: 999px;
  background: var(--card-2); color: var(--muted);
}

/* header */
.top { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; gap: 16px; }
.top h1 { font-size: clamp(1.5rem, 2.6vw, 2.2rem); }
.top p { margin: 4px 0 0; }
.clock { white-space: nowrap; font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* grid */
.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr) minmax(280px, 1fr);
  grid-template-areas:
    "todo weather quote"
    "todo cal cal"
    "news news daily";
}
.todo { grid-area: todo; }
.weather { grid-area: weather; }
.quote { grid-area: quote; }
.calendar { grid-area: cal; }
.news { grid-area: news; }
.daily { grid-area: daily; }

@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr 1fr; grid-template-areas: "todo weather" "todo quote" "cal cal" "news news" "daily daily"; }
}
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; grid-template-areas: "todo" "weather" "quote" "cal" "news" "daily"; }
  .cal-wrap { grid-template-columns: 1fr !important; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-width: 0;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.error { color: #ff8f8f; font-size: 0.9rem; }

/* to-do */
.todo { display: flex; flex-direction: column; }
.todo-list { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; max-height: 560px; }
.todo-list li.item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 4px; border-bottom: 1px solid var(--line);
}
.todo-list li.item:last-child { border-bottom: none; }
.check {
  flex: none; width: 20px; height: 20px; margin-top: 2px; border-radius: 6px;
  border: 2px solid var(--muted); background: transparent; cursor: pointer; padding: 0;
  display: grid; place-items: center; color: #0e1117; font-size: 13px; font-weight: 700;
}
.check:hover { border-color: var(--accent); }
.item.done .check { background: var(--good); border-color: var(--good); }
.item .main { flex: 1; min-width: 0; }
.item .text { word-wrap: break-word; }
.item.done .text { text-decoration: line-through; color: var(--muted); }
.item .meta { font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.item .time { color: var(--accent); font-variant-numeric: tabular-nums; }
.tag { font-size: 0.7rem; padding: 1px 6px; border-radius: 5px; background: var(--card-2); color: var(--muted); margin-left: 4px; }
.del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; opacity: 0; padding: 0 4px; }
.item:hover .del { opacity: 1; }
.del:hover { color: #ff8f8f; }
.todo-form { display: flex; gap: 8px; margin-top: 12px; }
.todo-form input {
  flex: 1; background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 12px; font: inherit;
}
.todo-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.todo-form button, .icon-btn {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; cursor: pointer; font-size: 1.1rem; min-width: 38px;
}
.todo-form button:hover, .icon-btn:hover { border-color: var(--accent); }
.empty { padding: 18px 0; text-align: center; }

/* weather */
.w-now { display: flex; align-items: center; gap: 14px; }
.w-icon { font-size: 3.2rem; line-height: 1; }
.w-temp { font-size: 3rem; font-weight: 300; line-height: 1; }
.w-desc { font-size: 1.05rem; }
.w-details { display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0 14px; font-size: 0.85rem; color: var(--muted); }
.w-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.w-day { background: var(--card-2); border-radius: 10px; padding: 8px 2px; font-size: 0.82rem; }
.w-day .ic { font-size: 1.3rem; margin: 3px 0; }
.w-day .hi { font-weight: 600; }
.w-day .lo, .w-day .pp { color: var(--muted); }

/* quote */
.quote { display: flex; flex-direction: column; }
.quote-text { margin: 0; font-size: 1.25rem; line-height: 1.5; font-family: Georgia, "Times New Roman", serif; flex: 1; }
.quote-text:not(.muted)::before { content: "“"; color: var(--accent-2); font-size: 2.2rem; line-height: 0; vertical-align: -0.45em; margin-right: 2px; }
.quote-author { margin: 12px 0 0; color: var(--accent-2); }
.credit { margin: 8px 0 0; font-size: 0.72rem; color: var(--muted); }
.credit a { color: var(--muted); text-decoration: underline; }

/* calendar */
.cal-nav { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.cal-nav .icon-btn { min-width: 30px; height: 28px; font-size: 1rem; }
.cal-wrap { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(220px, 1fr); gap: 22px; }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.cal-dow { font-size: 0.72rem; color: var(--muted); margin-bottom: 6px; }
.cal-grid { gap: 3px; }
.cal-day {
  aspect-ratio: 1 / 0.9; border-radius: 8px; border: none; background: transparent; color: var(--text);
  font: inherit; font-size: 0.85rem; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; padding: 0;
}
.cal-day:hover { background: var(--card-2); }
.cal-day.other { color: #4b5466; }
.cal-day.today { background: var(--accent); color: #0b1220; font-weight: 700; }
.cal-day.selected:not(.today) { outline: 2px solid var(--accent); outline-offset: -2px; }
.dots { display: flex; gap: 2px; height: 5px; }
.dot { width: 5px; height: 5px; border-radius: 50%; }
.cal-day.today .dot { background: #0b1220 !important; }
.agenda h3 { font-size: 0.95rem; margin-bottom: 10px; }
.agenda-list { max-height: 330px; overflow-y: auto; }
.ag-day { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 12px 0 6px; }
.ag-day:first-child { margin-top: 0; }
.ag-ev { display: flex; gap: 10px; padding: 6px 0; border-left: 3px solid var(--accent); padding-left: 9px; margin-bottom: 6px; }
.ag-ev .t { font-size: 0.8rem; color: var(--muted); min-width: 62px; font-variant-numeric: tabular-nums; }
.ag-ev .loc { font-size: 0.78rem; color: var(--muted); }

/* news */
.news-list { display: grid; gap: 4px; }
.story { display: flex; gap: 14px; padding: 10px 6px; border-radius: 10px; color: var(--text); }
.story:hover { background: var(--card-2); text-decoration: none; }
.story img { width: 112px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; background: var(--card-2); }
.story .title { font-weight: 600; font-family: Georgia, "Times New Roman", serif; font-size: 1.02rem; line-height: 1.3; }
.story .sum { color: var(--muted); font-size: 0.86rem; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.story .when { color: var(--muted); font-size: 0.75rem; margin-top: 4px; }

/* word + games */
.wotd-word { font-size: 1.9rem; font-family: Georgia, "Times New Roman", serif; font-weight: 600; color: var(--text); }
.wotd-word:hover { text-decoration: none; color: var(--accent); }
.wotd-meta { color: var(--muted); font-size: 0.88rem; margin: 2px 0 8px; }
.wotd-def { margin: 0 0 6px; }
.wotd-ex { margin: 0; color: var(--muted); font-style: italic; font-size: 0.9rem; }
.games-h { margin: 20px 0 10px; }
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.game {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px;
  border-radius: 11px; background: var(--card-2); border: 1px solid var(--line); color: var(--text); font-weight: 600;
}
.game:hover { border-color: var(--accent); text-decoration: none; }
.game .gi { font-size: 1.5rem; }
.game.played { opacity: 0.55; }
.game .sub { font-size: 0.7rem; color: var(--muted); font-weight: 400; }

.foot { margin-top: 22px; text-align: center; }
.foot a { color: var(--muted); text-decoration: underline; }

.read-only .check { cursor: default; }
.read-only .check:hover { border-color: var(--muted); }
.read-only .item.done .check:hover { border-color: var(--good); }
