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

:root {
  --color-high: #ff6b6b;
  --color-high-bg: #ffe0e0;
  --color-medium: #ffd93d;
  --color-medium-bg: #fff8dc;
  --color-low: #6bcb77;
  --color-low-bg: #e0f5e0;
  --color-default: #4ecdc4;
  --color-default-bg: #e0f7f5;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.time {
  font-size: 16px;
  font-weight: 500;
  color: #666;
  min-width: 60px;
}

.status {
  font-size: 12px;
  color: #888;
  min-width: 60px;
  text-align: right;
}

.status.updating {
  color: #667eea;
}

.status.error {
  color: #ff6b6b;
}

main {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: white;
  font-size: 18px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: white;
}

.empty-state h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

.empty-state p {
  font-size: 16px;
  opacity: 0.8;
}

.task-card {
  background: white;
  border-radius: 4px;
  padding: 16px;
  min-height: 120px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.task-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 4px 4px 0 0;
}

.task-card.priority-1::before {
  background: var(--color-high);
}

.task-card.priority-2::before {
  background: var(--color-medium);
}

.task-card.priority-3::before {
  background: var(--color-low);
}

.task-card.priority-1 {
  background: var(--color-high-bg);
}

.task-card.priority-2 {
  background: var(--color-medium-bg);
}

.task-card.priority-3 {
  background: var(--color-low-bg);
}

.task-card.custom-color {
  background: var(--custom-bg);
}

.task-card.custom-color::before {
  background: var(--custom-color);
}

.task-priority {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.priority-1 .task-priority {
  color: var(--color-high);
}

.priority-2 .task-priority {
  color: #cc9900;
}

.priority-3 .task-priority {
  color: var(--color-low);
}

.task-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  flex-grow: 1;
  word-break: break-word;
}

.task-memo {
  font-size: 13px;
  color: #666;
  margin-top: 8px;
  line-height: 1.4;
  word-break: break-word;
}

.task-due {
  font-size: 12px;
  margin-top: auto;
  padding-top: 10px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-due.overdue {
  color: var(--color-high);
  font-weight: 600;
}

.task-due.today {
  color: #e67e22;
  font-weight: 600;
}

@media (max-width: 768px) {
  main {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    padding: 16px;
  }

  .task-card {
    min-height: 100px;
    padding: 14px;
  }

  .task-title {
    font-size: 14px;
  }
}

@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  }

  header {
    background: rgba(30, 30, 50, 0.95);
  }

  header h1 {
    color: #fff;
  }

  .time {
    color: #aaa;
  }

  .task-card {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  }
}
