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

:root {
  --primary-color: #4285f4;
  --primary-dark: #3367d6;
  --success-color: #34a853;
  --danger-color: #ea4335;
  --warning-color: #fbbc04;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --border-color: #dadce0;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-hover: #f1f3f4;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app {
  max-width: 800px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-primary);
  box-shadow: var(--shadow);
}

/* ヘッダー */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary-color);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.header-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.btn-refresh {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  color: white;
}

.btn-refresh:hover {
  background: rgba(255, 255, 255, 0.3);
}

.btn-refresh:active {
  transform: rotate(180deg);
  transition: transform 0.3s;
}

/* タブ */
.tabs {
  display: flex;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 60px;
  z-index: 99;
}

.tab {
  flex: 1;
  padding: 14px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab:hover {
  background: var(--bg-hover);
}

.tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.badge {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.tab.active .badge {
  background: var(--primary-color);
  color: white;
}

/* タスクリスト */
.task-list {
  padding: 8px 0;
  min-height: calc(100vh - 140px);
}

.task-item {
  background: var(--bg-primary);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: background 0.2s;
}

.task-item:hover {
  background: var(--bg-hover);
}

.task-item.done {
  opacity: 0.6;
}

.task-checkbox {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  margin-top: 2px;
}

.task-checkbox:hover {
  border-color: var(--primary-color);
}

.task-checkbox.checked {
  background: var(--success-color);
  border-color: var(--success-color);
}

.task-checkbox.checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.task-content {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
  word-wrap: break-word;
}

.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.task-source {
  background: #e3f2fd;
  color: #1565c0;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
}

.task-time {
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-due {
  color: var(--warning-color);
  font-weight: 500;
}

.task-due.overdue {
  color: var(--danger-color);
}

.task-url {
  color: var(--primary-color);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-url:hover {
  text-decoration: underline;
}

.task-description {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.task-actions {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.btn-icon {
  background: none;
  border: none;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-delete:hover {
  color: var(--danger-color);
  background: #fce8e6;
}

/* ローディング */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 空の状態 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--text-secondary);
  text-align: center;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-text {
  font-size: 16px;
  margin-bottom: 8px;
}

.empty-subtext {
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* トースト通知 */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 1000;
  max-width: calc(100% - 40px);
}

.toast.show {
  opacity: 1;
  visibility: visible;
}

.toast.success {
  background: var(--success-color);
}

.toast.error {
  background: var(--danger-color);
}

/* レスポンシブ */
@media (max-width: 768px) {
  .app {
    box-shadow: none;
  }

  .header {
    padding: 14px 16px;
  }

  .header-title {
    font-size: 18px;
  }

  .task-item {
    padding: 14px 16px;
  }

  .task-url {
    max-width: 150px;
  }
}

@media (max-width: 480px) {
  .tab {
    font-size: 13px;
    padding: 12px 8px;
  }

  .task-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* プルトゥリフレッシュ対応 */
@media (pointer: coarse) {
  body {
    overscroll-behavior-y: contain;
  }
}
