:root {
  --bg: #f4f4f5;
  --surface: #fff;
  --text: #18181b;
  --border: #e4e4e7;
  --border-btn: #d4d4d8;
  --muted: #71717a;
  --subtle: #52525b;
  --faint: #a1a1aa;
  --btn-bg: #fff;
  --btn-hover: #e4e4e7;
  --apt-bg: #eff6ff;
  --apt-accent: #3b82f6;
  --now: #ef4444;
}

[data-theme="dark"] {
  --bg: #18181b;
  --surface: #27272a;
  --text: #f4f4f5;
  --border: #3f3f46;
  --border-btn: #52525b;
  --muted: #a1a1aa;
  --subtle: #a1a1aa;
  --faint: #71717a;
  --btn-bg: #3f3f46;
  --btn-hover: #52525b;
  --apt-bg: #1e3a5f;
  --apt-accent: #60a5fa;
  --now: #f87171;
}

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

body {
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}

header {
  width: 100%;
  max-width: 640px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

#day-label {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  flex: 1;
}

button {
  background: var(--btn-bg);
  border: 1px solid var(--border-btn);
  border-radius: 8px;
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  color: var(--text);
}

button:hover {
  background: var(--btn-hover);
}

#theme-toggle {
  margin-left: 0.75rem;
}

#allday {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.allday-item {
  background: var(--apt-bg);
  border-left: 3px solid var(--apt-accent);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.allday-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.allday-desc {
  font-size: 0.78rem;
  color: var(--subtle);
}

#calendar {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 1rem 1rem 1rem 4rem;
  position: relative;
  min-height: 600px;
}

#timeline {
  position: absolute;
  inset: 1rem;
  pointer-events: none;
}

.hour-label {
  position: absolute;
  left: -3.2rem;
  font-size: 0.72rem;
  color: var(--muted);
  transform: translateY(-50%);
  white-space: nowrap;
}

.hour-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--border);
}

#appointments {
  position: relative;
  height: 600px;
}

.appointment {
  position: absolute;
  left: 0;
  width: 100%;
  background: var(--apt-bg);
  border-left: 3px solid var(--apt-accent);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-height: 2rem;
  overflow: hidden;
}

.apt-time {
  font-size: 0.72rem;
  color: var(--apt-accent);
  font-weight: 600;
}

.apt-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.apt-desc {
  font-size: 0.78rem;
  color: var(--subtle);
}

.no-appointments {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--faint);
  font-size: 0.9rem;
}

#now-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px solid var(--now);
  z-index: 1;
  pointer-events: none;
}

#now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  background: var(--now);
  border-radius: 50%;
}
