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

:root {
  --primary: #3b6fdb;
  --primary-light: #eef4ff;
  --green: #2d8a4e;
  --green-light: #eefbf3;
  --orange: #d97706;
  --orange-light: #fef3c7;
  --red: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100dvh;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
  padding-bottom: 40px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 20px;
}

.header h1 {
  font-size: 17px;
  font-weight: 700;
}

.header-action {
  font-size: 13px;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  margin-bottom: 12px;
  overflow: hidden;
}

.card-body { padding: 16px; }

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.badge-done { background: var(--green-light); color: var(--green); }
.badge-current { background: var(--primary-light); color: var(--primary); }
.badge-locked { background: var(--gray-100); color: var(--gray-400); }
.badge-active { background: var(--green-light); color: var(--green); }
.badge-expired { background: var(--gray-100); color: var(--gray-500); }

.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s;
}

.btn:active { opacity: 0.8; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-sm {
  display: inline-block;
  width: auto;
  padding: 8px 18px;
  font-size: 13px;
}

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

select.form-input {
  appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 12px center;
  padding-right: 36px;
}

.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.chapter-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.15s;
}

.chapter-item:last-child { border-bottom: none; }
.chapter-item:active { background: var(--gray-50); }

.ch-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.ch-done { background: var(--green-light); color: var(--green); }
.ch-current { background: var(--primary-light); color: var(--primary); }
.ch-locked { background: var(--gray-100); color: var(--gray-400); }

.ch-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
}

.ch-desc {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  margin-bottom: 16px;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 14px;
  text-align: center;
}

.stat-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

.log-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100);
}

.log-item:last-child { border-bottom: none; }

.log-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
}

.log-action {
  font-weight: 400;
  color: var(--gray-500);
}

.log-time {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 2px;
}

.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
}

.admin-row:last-child { border-bottom: none; }

.code-text {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 12px;
  color: var(--gray-400);
  margin-left: 8px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  padding: 12px 16px 8px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  padding: 8px 0;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: #fff;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  overflow-y: auto;
  padding: 24px 20px;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.month-tabs {
  display: flex;
  gap: 6px;
}

.month-tab {
  flex: 1;
  padding: 10px 0;
  text-align: center;
  border-radius: var(--radius);
  background: var(--gray-100);
  color: var(--gray-500);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.month-tab.active {
  background: var(--primary);
  color: #fff;
}

.section-header {
  padding: 14px 16px 6px;
  border-bottom: 1px solid var(--gray-100);
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-400);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.item-icon-video {
  background: #eee8ff;
  color: #6d5ccd;
}

.item-icon-work {
  background: #e8f5ee;
  color: #2d8a4e;
}

.item-meta {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 4px;
}

.item-chevron {
  display: flex;
  align-items: center;
  color: var(--gray-300);
  flex-shrink: 0;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--gray-400);
  font-size: 14px;
}

.home-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.home-card:active { background: var(--gray-50); }

.home-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.home-icon-blue { background: var(--primary-light); color: var(--primary); }
.home-icon-purple { background: #eee8ff; color: #6d5ccd; }
.home-icon-green { background: var(--green-light); color: var(--green); }

.home-card-body { flex: 1; min-width: 0; }

.home-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
}

.home-card-desc {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

.home-card-note {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 4px;
  line-height: 1.5;
}

.home-chevron {
  color: var(--gray-300);
  flex-shrink: 0;
}

.schedule-item {
  display: flex;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  align-items: flex-start;
}

.schedule-item:last-child { border-bottom: none; }

.schedule-past { opacity: 0.45; }

.schedule-today {
  background: var(--primary-light);
}

.schedule-date {
  text-align: center;
  flex-shrink: 0;
  min-width: 44px;
}

.schedule-month {
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 600;
}

.schedule-day {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.schedule-weekday {
  font-size: 11px;
  color: var(--gray-400);
}

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

.schedule-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
}

.schedule-desc {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

.zoom-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #2d8fef;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  background: #eef6ff;
}

.toggle-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
}

.toggle-row:last-child { border-bottom: none; }

.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--gray-500); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
