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

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --me: #10b981;
  --me-bg: rgba(16, 185, 129, 0.15);
  --other: #ef4444;
  --other-bg: rgba(239, 68, 68, 0.15);
  --border: #334155;
  --radius: 10px;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--me), #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.controls button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
}

.controls button:hover {
  background: var(--surface-hover);
  transform: scale(1.05);
}

.controls button:active {
  transform: scale(0.95);
}

.today-btn {
  background: var(--surface) !important;
  border: 1px solid #3b82f6 !important;
  color: #3b82f6 !important;
  width: auto !important;
  padding: 0 1rem !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
}

.today-btn:hover {
  background: #3b82f6 !important;
  color: #fff !important;
}

.year-label {
  font-size: 1.5rem;
  font-weight: 600;
  min-width: 80px;
  text-align: center;
}

.legend {
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.legend span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.me {
  background: var(--me);
}

.dot.other {
  background: var(--other);
}

.dot.holiday {
  background: #f59e0b;
}

.dot.fun {
  background: #a855f7;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.holiday-list {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.holiday-list h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.holiday-section {
  margin-bottom: 1.5rem;
}

.holiday-section:last-child {
  margin-bottom: 0;
}

.holiday-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.holiday-section ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.holiday-section li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.holiday-section li .dot {
  flex-shrink: 0;
}

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 800px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
  .grid { grid-template-columns: 1fr; }
  .app { padding: 1rem; }
  h1 { font-size: 1.5rem; }
}

.month {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  transition: box-shadow 0.2s;
}

.month.current {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}

.month:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.month.current:hover {
  box-shadow: 0 0 0 1px #3b82f6, 0 4px 20px rgba(0, 0, 0, 0.3);
}

.month-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  margin-bottom: 0.5rem;
}

.dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.dow span {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 2px 0;
}

.dow span:nth-child(6),
.dow span:nth-child(7) {
  color: var(--other);
}

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

.day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  border-radius: 6px;
  transition: background 0.15s, transform 0.1s;
  position: relative;
}

.day.empty {
  visibility: hidden;
}

.day.weekday {
  color: var(--text-muted);
}

.day.weekday:hover {
  background: var(--surface-hover);
}

.day.weekend {
  font-weight: 600;
}

.day.weekend.me {
  color: var(--me);
  background: var(--me-bg);
}

.day.weekend.other {
  color: var(--other);
  background: var(--other-bg);
}

.day.today {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

.day.weekend:hover {
  transform: scale(1.1);
  z-index: 1;
}

.day.has-holiday::after,
.day.has-school-holiday::after,
.day.has-fun-holiday::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.day.has-holiday::after {
  background: #f59e0b;
}

.day.has-school-holiday::after {
  background: #3b82f6;
}

.day.has-fun-holiday::after {
  background: #a855f7;
}

.day.has-holiday.has-school-holiday::after,
.day.has-holiday.has-fun-holiday::after,
.day.has-school-holiday.has-fun-holiday::after {
  left: calc(50% + 4px);
}

.day.has-holiday.has-school-holiday::before,
.day.has-holiday.has-fun-holiday::before,
.day.has-school-holiday.has-fun-holiday::before {
  content: '';
  position: absolute;
  bottom: 2px;
  right: calc(50% + 4px);
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.day.has-holiday.has-school-holiday::before,
.day.has-holiday.has-fun-holiday::before {
  background: #f59e0b;
}

.day.has-school-holiday.has-fun-holiday::before {
  background: #3b82f6;
}

.dot.school {
  background: #3b82f6;
}

.locale-switcher {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.locale-switcher button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.locale-switcher button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.locale-switcher button.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}
