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

:root {
  --primary: #4A90D9;
  --primary-hover: #357ABD;
  --bg: #f0f2f5;
  --card-bg: #fff;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --today-bg: #e8f0fe;
  --today-border: #4A90D9;
  --danger: #ef4444;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Home ===== */
.home-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 60px 20px;
}

.home-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 40px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform .2s, box-shadow .2s;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-icon { font-size: 3rem; margin-bottom: 12px; }
.card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 6px; }
.card-desc { font-size: .85rem; color: var(--text-secondary); text-align: center; }

/* ===== Shared components ===== */
.back-btn {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: .9rem;
  padding: 8px 14px;
  border-radius: var(--radius);
  transition: background .2s;
}
.back-btn:hover { background: var(--border); }

.nav-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text);
  transition: background .2s;
}
.nav-btn:hover { background: var(--border); }

.btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}
.modal.active { display: flex; }
.modal-content {
  background: var(--card-bg);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-lg { max-width: 600px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: .95rem; font-weight: 600; }
.close-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0 4px;
}
.close-btn:hover { color: var(--text); }
.modal-body { padding: 16px 18px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: .85rem;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
  z-index: 3000;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 4px;
}
