:root {
  --bg: #f7f8fa;
  --white: #ffffff;
  --border: #e8eaed;
  --border-hover: #d0d3d9;
  --teal: #0d9488;
  --teal-light: #f0fdfa;
  --text: #111827;
  --text-soft: #6b7280;
  --text-muted: #9ca3af;
  --red: #ef4444;
  --green: #16a34a;
  --yellow: #d97706;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top, rgba(13, 148, 136, 0.16), transparent 38%),
    linear-gradient(180deg, rgba(247, 248, 250, 0.98), rgba(239, 253, 250, 0.98));
  backdrop-filter: blur(10px);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 26px 24px 22px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(13, 148, 136, 0.14);
  box-shadow: 0 20px 60px rgba(13, 148, 136, 0.12);
}

.loading-orbit {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(from 180deg, var(--teal), #38bdf8, #22c55e, var(--teal));
  animation: loadingSpin 1.1s linear infinite;
}

.loading-orbit::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: white;
}

.loading-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

.loading-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.loading-text {
  color: var(--text-soft);
  font-size: 0.85rem;
}

.loading-bar {
  width: min(240px, 70vw);
  height: 6px;
  border-radius: 999px;
  background: rgba(13, 148, 136, 0.12);
  overflow: hidden;
}

.loading-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #38bdf8, #22c55e);
  animation: loadingSlide 1.15s ease-in-out infinite;
}

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

@keyframes loadingSlide {
  0% { transform: translateX(-115%); }
  50% { transform: translateX(30%); }
  100% { transform: translateX(115%); }
}

.wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* HEADER HERO */
.header {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #0f2027 0%, #0d9488 60%, #134e4a 100%);
  padding: 22px 20px 18px;
  box-shadow: 0 8px 28px rgba(13,148,136,0.22);
}
.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 18px 18px;
  pointer-events: none;
}
.header::after {
  content: '';
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  top: -60px; right: -60px;
  pointer-events: none;
}
.header-inner { position: relative; z-index: 1; }
.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.22);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.brand-logo-img { width: 38px; height: 38px; object-fit: contain; display: block; }

.brand-name {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 1.05rem;
  color: white; line-height: 1.1;
}
.brand-sub { font-size: 0.72rem; color: rgba(255,255,255,0.55); margin-top: 2px; }
.help-btn {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.75);
  font-size: 0.82rem; font-weight: 700;
  cursor: pointer; transition: all 0.15s; flex-shrink: 0;
}
.help-btn:hover { background: rgba(255,255,255,0.2); color: white; }
.header-tagline {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem; font-weight: 800;
  color: white; line-height: 1.2;
  margin-bottom: 12px; letter-spacing: -0.3px;
}
.header-tagline span { color: #5eead4; }
.header-verse {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 11px;
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
  border-left: 3px solid rgba(94,234,212,0.6);
}
.verse-text {
  font-size: 0.74rem; color: rgba(255,255,255,0.72);
  line-height: 1.5; font-style: italic; flex: 1;
}
.verse-ref {
  font-size: 0.68rem; color: #5eead4;
  font-weight: 600; font-style: normal;
  white-space: nowrap; margin-top: 1px;
}

/* ADD COURSE ROW */
.add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

input[type="text"], input[type="number"] {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--text);
  transition: border-color 0.15s;
  width: 100%;
}
input::placeholder { color: var(--text-muted); }
input:focus { outline: none; border-color: var(--teal); }

.btn-add {
  border: none;
  border-radius: var(--radius);
  background: var(--teal);
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.btn-add:hover { opacity: 0.88; }

/* SECTION LABEL */
.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* COURSE CARD */
.course-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.15s;
}
.course-card.is-open { border-color: var(--teal); }

.course-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  gap: 10px;
  user-select: none;
}
.course-top:hover { background: #fafafa; }

.course-name-text {
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1;
}

.course-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.score-text {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
}

.grade-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
}

.chevron {
  color: var(--text-muted);
  font-size: 0.7rem;
  transition: transform 0.2s;
}
.is-open .chevron { transform: rotate(180deg); }

/* SUPPO METER */
.suppo {
  margin: 0 14px 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.suppo-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.suppo-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.suppo-verdict {
  font-size: 0.75rem;
  font-weight: 700;
}

.suppo-track {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}

.suppo-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}

.suppo-quote {
  font-size: 0.73rem;
  color: var(--text-muted);
  font-style: italic;
}

/* COMPONENTS */
.comp-list { padding: 0 14px; }

.comp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.comp-name-label { font-weight: 500; font-size: 0.85rem; flex: 1; }
.comp-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }
.comp-earned { font-weight: 700; font-size: 0.82rem; color: var(--teal); white-space: nowrap; }
.comp-del {
  border: none; background: none; color: var(--text-muted);
  cursor: pointer; font-size: 0.85rem; padding: 3px 5px;
  border-radius: 5px; transition: all 0.15s;
}
.comp-del:hover { color: var(--red); background: #fee2e2; }

/* FORM */
.comp-form {
  margin: 10px 14px 14px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.form-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.comp-grid {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr 0.8fr 0.8fr;
  gap: 6px;
  margin-bottom: 8px;
}

.field-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 3px;
  display: block;
}

.form-actions {
  display: flex;
  gap: 6px;
}

.btn-save {
  border: none; border-radius: 8px;
  background: var(--teal); color: white;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600; font-size: 0.8rem;
  padding: 7px 14px; cursor: pointer;
}
.btn-save:hover { opacity: 0.88; }

.btn-ghost {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--white); color: var(--text-soft);
  font-family: 'DM Sans', sans-serif;
  font-weight: 500; font-size: 0.8rem;
  padding: 7px 12px; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--border-hover); }

.btn-del {
  border: 1px solid #fecaca; border-radius: 8px;
  background: #fff5f5; color: var(--red);
  font-family: 'DM Sans', sans-serif;
  font-weight: 500; font-size: 0.8rem;
  padding: 7px 12px; cursor: pointer; margin-left: auto;
}
.btn-del:hover { background: #fee2e2; }

.weight-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* EMPTY */
.empty {
  text-align: center;
  padding: 36px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
}
.empty-icon { font-size: 2rem; margin-bottom: 8px; }
.empty strong { display: block; color: var(--text-soft); margin-bottom: 3px; font-size: 0.875rem; }
.empty p { font-size: 0.8rem; }

/* MODAL */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center;
  z-index: 999; padding: 16px;
}
.backdrop.active { display: flex; }

.modal {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 460px;
  padding: 20px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.95rem; font-weight: 800;
}

.modal-close {
  border: none; background: var(--bg);
  color: var(--text-muted); width: 28px; height: 28px;
  border-radius: 7px; cursor: pointer; font-size: 0.85rem;
}
.modal-close:hover { color: var(--red); }

.step {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.step:first-of-type { border-top: none; padding-top: 0; }
.step-num {
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--teal-light); color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem; flex-shrink: 0;
}
.step-title { font-weight: 600; font-size: 0.85rem; margin-bottom: 2px; }
.step-text { font-size: 0.8rem; color: var(--text-soft); line-height: 1.5; }

.grade-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.8rem; }
.grade-table th {
  text-align: left; padding: 5px 8px;
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.grade-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); color: var(--text-soft); }
.grade-table td:first-child { font-weight: 700; color: var(--text); }

/* FOOTER */
.footer { margin-top: 40px; }

.footer-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin-bottom: 24px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding-bottom: 32px;
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

.footer-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: block; flex-shrink: 0;
}
.footer-logo-img {
  width: 36px; height: 36px; border-radius: 8px; object-fit: contain; display: block;
  margin-right: 2px;
  margin-top: 1px;
}

.footer-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
}

.footer-tag {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-links a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
}
.footer-links a:hover { text-decoration: underline; }

.footer-copy {
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 340px;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .comp-grid { grid-template-columns: 1fr 1fr; }
  .btn-del { margin-left: 0; width: 100%; }
}

/* Floating WhatsApp button */
.wa-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: white;
  padding: 12px 14px;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(18, 140, 126, 0.22);
  font-weight: 700;
  text-decoration: none;
  z-index: 99999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wa-btn img { width: 18px; height: 18px; display: block; }
.wa-btn:active { transform: translateY(1px); }
