:root {
  --ink: #09070f;
  --ink-2: #14111c;
  --gold: #e6c57a;
  --gold-2: #f3dd9e;
  --gold-dim: rgba(230, 197, 122, 0.16);
  --rose: #e7a4b3;
  --lavender: #bba6dc;
  --mint: #9ed4c4;
  --cream: #f7f1e6;
  --muted: #9b9186;
  --line: rgba(230, 197, 122, 0.2);
  --glass: rgba(18, 14, 26, 0.62);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --serif: "Noto Serif SC", "Songti SC", serif;
  --sans: "Noto Sans SC", "PingFang SC", sans-serif;
  --en: "Cormorant Garamond", "Times New Roman", serif;
  --radius: 22px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--cream);
  background: var(--ink);
  overflow-x: hidden;
}
button, input, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(183, 120, 70, 0.22), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(128, 72, 150, 0.18), transparent 50%),
    radial-gradient(800px 700px at 50% 110%, rgba(70, 90, 140, 0.16), transparent 50%),
    #09070f;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
  animation: drift 18s ease-in-out infinite;
}
.orb-a { width: 420px; height: 420px; left: -80px; top: 80px; background: #7a4a2c; }
.orb-b { width: 360px; height: 360px; right: -40px; top: 40px; background: #5a3a78; animation-delay: -6s; }
.orb-c { width: 520px; height: 320px; left: 30%; bottom: -80px; background: #2a3a68; animation-delay: -11s; }
@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(40px, -30px, 0) scale(1.08); }
}
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.topbar, .layout, .drawer, .toast, .modal { position: relative; z-index: 2; }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 28px 8px;
}
.brand-en {
  font-family: var(--en);
  font-style: italic;
  letter-spacing: 0.28em;
  font-size: 11px;
  color: var(--gold);
  text-transform: uppercase;
}
.brand h1 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  background: linear-gradient(120deg, var(--gold-2), var(--gold), var(--rose));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.15;
}
.clock {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
  min-width: 168px;
}
.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  backdrop-filter: blur(16px);
}
.search svg { width: 16px; height: 16px; stroke: var(--gold); fill: none; stroke-width: 1.6; }
.search input {
  flex: 1;
  background: none;
  border: 0;
  outline: none;
  font-size: 14px;
}
.search kbd {
  font-size: 11px;
  color: var(--gold);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
}
.new-wrap { position: relative; }
.gold-btn, .ghost-btn, .danger-btn, .text-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
}
.gold-btn {
  background: linear-gradient(180deg, #f0d78c, #c9a24e);
  color: #2a1c08;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(201, 162, 78, 0.28);
}
.gold-btn:hover { filter: brightness(1.06); }
.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--cream);
}
.danger-btn { background: rgba(180, 70, 80, 0.2); color: #f0b8be; }
.text-btn { background: none; color: var(--gold); padding: 0; }
.new-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: rgba(16, 12, 22, 0.94);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
  min-width: 140px;
  box-shadow: var(--shadow);
  z-index: 5;
}
.new-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 10px 12px;
  border-radius: 10px;
}
.new-menu button:hover { background: var(--gold-dim); color: var(--gold-2); }

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--cream);
  border-radius: 12px;
  font-size: 22px;
  line-height: 1;
}
.menu-btn { display: none; flex-direction: column; justify-content: center; gap: 5px; padding: 10px; }
.menu-btn span { display: block; height: 1.5px; background: var(--gold); }

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 8px;
  padding: 8px 22px 32px;
  min-height: calc(100vh - 88px);
}
.sidebar {
  padding: 12px 8px 0;
}
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 11px 12px;
  border-radius: 14px;
  text-align: left;
  font-size: 15px;
}
.nav-item.is-active, .nav-item:hover {
  color: var(--cream);
  background: var(--gold-dim);
}
.nav-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  opacity: 0.35;
}
.nav-item.is-active .nav-mark { opacity: 1; }
.count {
  margin-left: auto;
  font-size: 12px;
  color: var(--gold);
}
.due-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 10px var(--rose);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.6; }
}
.stats {
  margin-top: 28px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(18px);
}
.stats h2 {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}
.stat { display: flex; justify-content: space-between; padding: 6px 0; color: var(--muted); font-size: 13px; }
.stat b { color: var(--gold-2); font-size: 18px; font-family: var(--en); font-weight: 600; }
.aside-foot {
  margin-top: 22px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  align-content: start;
}
.card {
  position: relative;
  padding: 20px 18px 16px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  cursor: pointer;
  overflow: hidden;
  animation: rise 0.55s ease both;
  min-height: 170px;
  display: flex;
  flex-direction: column;
}
.card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent, var(--gold));
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(230, 197, 122, 0.45);
  box-shadow: 0 18px 40px rgba(230, 197, 122, 0.08), var(--shadow);
}
.card.is-due { box-shadow: 0 0 0 1px rgba(231, 164, 179, 0.45), var(--shadow); }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pin { color: var(--gold); font-size: 12px; }
.card h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 8px;
}
.card p {
  color: #d5cdc2;
  font-size: 13px;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.tag {
  font-size: 11px;
  color: var(--gold-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}
.meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.check-mini { color: var(--gold); }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.empty-en {
  font-family: var(--en);
  font-style: italic;
  color: var(--gold);
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}
.empty p:last-child { font-family: var(--serif); font-size: 20px; color: var(--cream); }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 4, 8, 0.45);
  z-index: 8;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(440px, 100%);
  height: 100%;
  z-index: 9;
  background: rgba(12, 10, 18, 0.92);
  border-left: 1px solid var(--line);
  backdrop-filter: blur(22px);
  padding: 22px 24px 32px;
  overflow: auto;
  box-shadow: -24px 0 60px rgba(0,0,0,0.35);
  transform: translateX(0);
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-kicker {
  font-family: var(--en);
  font-style: italic;
  color: var(--gold);
  letter-spacing: 0.16em;
}
.drawer-title {
  width: 100%;
  margin: 18px 0 12px;
  background: none;
  border: 0;
  outline: none;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
}
.drawer-body {
  width: 100%;
  min-height: 160px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  outline: none;
  resize: vertical;
  line-height: 1.8;
  font-size: 14px;
}
.field {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}
.field input[type="text"], .field input[type="datetime-local"] {
  flex: 1;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  outline: none;
}
.swatches { display: flex; gap: 8px; }
.swatches button {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid transparent;
}
.swatches .is-on { box-shadow: 0 0 0 2px #fff3; }
.swatches [data-color="gold"] { background: var(--gold); }
.swatches [data-color="rose"] { background: var(--rose); }
.swatches [data-color="lavender"] { background: var(--lavender); }
.swatches [data-color="mint"] { background: var(--mint); }
.todos-block { margin-top: 20px; }
.todos-head, .drawer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.todo-edit { list-style: none; margin-top: 10px; }
.todo-edit li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.todo-edit input[type="text"] {
  flex: 1;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: none;
  padding: 6px 0;
}
.todo-edit input[type="checkbox"] { accent-color: #c9a24e; }
.todo-edit .done { text-decoration: line-through; color: var(--muted); }
.drawer-actions { margin-top: 28px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  background: rgba(5,4,8,0.55);
}
.modal-card {
  width: min(360px, 90vw);
  background: #16121d;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.modal-card p { font-family: var(--serif); font-size: 18px; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  background: rgba(16,12,22,0.94);
  border: 1px solid var(--line);
  color: var(--gold-2);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
}

.color-gold { --accent: var(--gold); }
.color-rose { --accent: var(--rose); }
.color-lavender { --accent: var(--lavender); }
.color-mint { --accent: var(--mint); }

[hidden] { display: none !important; }

@media (max-width: 840px) {
  .menu-btn { display: flex; }
  .clock { display: none; }
  .layout { grid-template-columns: 1fr; padding: 8px 14px 24px; }
  .sidebar {
    position: fixed;
    z-index: 7;
    inset: 72px auto 0 0;
    width: 230px;
    background: rgba(10,8,16,0.96);
    transform: translateX(-110%);
    transition: transform 0.25s ease;
    padding: 16px;
  }
  .sidebar.is-open { transform: none; }
  .topbar { padding: 14px 12px 6px; gap: 10px; }
  .brand h1 { font-size: 20px; }
  .search kbd { display: none; }
  .gold-btn { padding: 10px 12px; font-size: 13px; }
}
