:root {
  --bg: #0b1220;
  --card: rgba(255, 255, 255, 0.08);
  --card2: rgba(255, 255, 255, 0.06);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.70);
  --muted2: rgba(255, 255, 255, 0.55);
  --border: rgba(255, 255, 255, 0.12);

  --primary: #7c5cff;
  --day: #34d399;
  --night: #a78bfa;
  --rest: #fbbf24;

  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* { box-sizing: border-box; }

button {
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

html, body { height: 100%; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 700px at 15% 20%, rgba(124, 92, 255, 0.28), transparent 55%),
    radial-gradient(900px 650px at 85% 0%, rgba(34, 197, 94, 0.18), transparent 50%),
    radial-gradient(900px 650px at 70% 85%, rgba(45, 212, 191, 0.12), transparent 52%),
    var(--bg);
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 18px 22px;
}

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

h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.2px;
}

.sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.badge {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

.grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
}

.card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--card), var(--card2));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.month {
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.icon-btn:hover { transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0px); }

.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
  user-select: none;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0px); }

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  padding: 0 0 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.weekdays > div {
  text-align: center;
  padding: 6px 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  user-select: none;
  -webkit-user-seleft: none;
  touch-action: pan-y;
}

.card[aria-label="日历"] {
  user-select: none;
  -webkit-user-select: none;
}

.daycell {
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.14);
  border-radius: 14px;
  padding: 10px 10px 9px;
  min-height: 62px;
  width: 100%;
  display: grid;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.daycell:hover { transform: translateY(-1px); }

.daycell:active { transform: translateY(0px); }

.daycell.out {
  opacity: 0.55;
}

.daycell.today {
  border-color: rgba(124, 92, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.12);
}

.daycell.selected {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
}

.daynum {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.daynum .num {
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(100% + 8px);
  margin: 0 -4px;
  padding: 6px 0;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.10);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill.day { background: rgba(52, 211, 153, 0.22); color: rgba(235, 255, 247, 0.95); border-color: rgba(52, 211, 153, 0.34); }
.pill.night { background: rgba(167, 139, 250, 0.22); color: rgba(246, 241, 255, 0.96); border-color: rgba(167, 139, 250, 0.34); }
.pill.rest { background: rgba(251, 191, 36, 0.22); color: rgba(255, 248, 232, 0.96); border-color: rgba(251, 191, 36, 0.34); }


.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.detail-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--muted);
}

.detail-date {
  font-size: 13px;
  color: var(--muted2);
  font-weight: 700;
}

.detail-main {
  margin-top: 14px;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0.6px;
}

.detail-meta {
  margin-top: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 12px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.footer {
  margin-top: 14px;
  color: var(--muted2);
  font-size: 12px;
}

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

@media (max-width: 420px) {
  .app { padding: 18px 12px 18px; }
  .card { padding: 14px; }

  .toolbar { gap: 8px; }
  .icon-btn { width: 34px; height: 34px; border-radius: 11px; }
  .btn { padding: 9px 10px; }

  .weekdays { gap: 6px; padding-bottom: 8px; }
  .calendar { gap: 6px; }

  .daycell { padding: 8px 8px 7px; min-height: 56px; border-radius: 13px; gap: 7px; }
  .daynum .num { font-size: 18px; }
  .pill { width: calc(100% + 6px); margin: 0 -3px; font-size: 11px; padding: 5px 0; border-radius: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .icon-btn, .daycell { transition: none; }
}
