:root {
  --bg-color: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text-main: #334155;
  --text-heading: #0f172a;
  --text-muted: #64748b;
  --primary-pink: #ff1e89;
  --primary-pink-hover: #e6006f;
  --pink-light: #fde8f3;
  --accent-cyan: #06b6d4;
  --cyan-light: #cffafe;
  --success: #059669;
  --success-light: #d1fae5;
  --danger: #e11d48;
  --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08);
  --shadow-xl: 0 28px 80px rgba(15,23,42,0.16);
  --radius-lg: 24px;
  --radius-xl: 32px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 15%, rgba(6,182,212,0.09), transparent 26%), radial-gradient(circle at 82% 45%, rgba(255,30,137,0.09), transparent 28%), var(--bg-color);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}
button, input { font-family: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
body.modal-open { overflow: hidden; }

.login-gate-wrapper {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card {
  background: var(--surface);
  padding: clamp(28px, 5vw, 44px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  text-align: center;
  width: min(520px, 100%);
  border: 1px solid var(--border);
  animation: popIn 0.28s ease-out both;
}
.gate-card.wide { width: min(820px, 100%); }
.choice-card { width: min(760px, 100%); text-align: left; }
.gate-logo { width: 82px; height: 82px; object-fit: contain; border-radius: 22px; margin: 0 auto 20px; display: block; box-shadow: var(--shadow-sm); }
.choice-card .gate-logo { margin-left: 0; }
.eyebrow { color: var(--primary-pink); font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 8px; }
.gate-card h1, .gate-card h2 { color: var(--text-heading); letter-spacing: -0.055em; line-height: 0.98; margin: 0 0 10px; font-size: clamp(2rem, 5vw, 3rem); font-weight: 900; }
.gate-card h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.form-instruction { color: var(--text-muted); font-size: 1.05rem; line-height: 1.45; margin: 0 0 24px; font-weight: 650; }

.student-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 26px 0 18px; }
.student-choice-btn { border: 1px solid var(--border); background: #f8fafc; border-radius: 24px; padding: 20px; text-align: left; display: grid; gap: 9px; transition: 0.18s ease; color: var(--text-heading); min-height: 170px; }
.student-choice-btn:hover { border-color: #38bdf8; background: #ecfeff; transform: translateY(-2px); box-shadow: 0 16px 42px rgba(6,182,212,0.14); }
.choice-icon { font-size: 2.2rem; }
.student-choice-btn strong { font-size: 1.15rem; font-weight: 900; }
.student-choice-btn small { color: var(--text-muted); line-height: 1.4; font-weight: 750; }

.gate-form { display: flex; flex-direction: column; gap: 16px; }
.gate-form input { height: 62px; border-radius: 20px; border: 2px solid var(--border); padding: 0 18px; font-size: 1.1rem; font-weight: 750; text-align: center; background: #fff; color: var(--text-heading); transition: 0.18s ease; }
.gate-form input:focus { border-color: var(--primary-pink); outline: none; box-shadow: 0 0 0 4px var(--pink-light); }
.two-col-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gate-btn, .ghost-btn, .text-link-btn, .small-clear-btn { border: none; font-weight: 900; transition: 0.18s ease; }
.gate-btn { min-height: 62px; border-radius: 20px; background: var(--primary-pink); color: #fff; font-size: 1.1rem; }
.gate-btn.bg-cyan { background: var(--accent-cyan); }
.gate-btn:hover { background: var(--primary-pink-hover); transform: translateY(-2px); box-shadow: 0 16px 36px rgba(255,30,137,0.18); }
.gate-btn.bg-cyan:hover { background: #0891b2; box-shadow: 0 16px 36px rgba(6,182,212,0.18); }
.ghost-btn { border-radius: 16px; background: #f8fafc; color: var(--text-muted); border: 1px solid var(--border); padding: 11px 18px; }
.ghost-btn.full { width: 100%; min-height: 52px; }
.ghost-btn:hover { background: #e2e8f0; color: var(--text-heading); }
.text-link-btn { background: none; color: #7c3aed; text-decoration: underline; font-size: 1rem; }
.text-link-btn:hover { color: var(--primary-pink); }
.text-link-btn.mini { margin: 0; padding: 5px 9px; background: var(--pink-light); color: var(--primary-pink); border-radius: 10px; text-decoration: none; font-size: 0.85rem; }
.create-own-link { width: 100%; text-align: center; margin-top: 8px; }
.message-text { min-height: 24px; margin: 14px 0 0; font-weight: 800; line-height: 1.4; }

.picture-password-box { border: 1px solid var(--border); border-radius: 24px; padding: 18px; background: #f8fafc; }
.picture-password-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; text-align: left; margin-bottom: 12px; }
.picture-password-head h3 { color: var(--text-heading); font-size: 1.1rem; margin: 0 0 5px; }
.picture-password-head p { color: var(--text-muted); margin: 0; font-weight: 650; }
.small-clear-btn { background: #fff; border: 1px solid var(--border); color: var(--text-muted); border-radius: 12px; padding: 8px 13px; }
.small-clear-btn:hover { background: var(--pink-light); color: var(--primary-pink); }

.password-slots { display: flex; justify-content: center; gap: 14px; margin: 20px 0 28px; }
.password-slots span { width: 64px; height: 64px; display: grid; place-items: center; background: var(--surface); border: 2px dashed var(--border); border-radius: 18px; font-size: 2rem; font-weight: 900; color: var(--text-muted); }
.password-slots span:not(.empty-icon-slot) { border-style: solid; border-color: var(--primary-pink); background: var(--pink-light); }
.password-icon-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; max-width: 650px; margin: 0 auto 22px; }
.password-icon-grid.compact { gap: 8px; max-width: 560px; }
.password-icon-btn, .create-password-icon-btn { width: 72px; height: 72px; border-radius: 20px; background: var(--surface); border: 2px solid var(--border); font-size: 2.15rem; box-shadow: var(--shadow-sm); transition: 0.18s ease; }
.password-icon-grid.compact .create-password-icon-btn { width: 52px; height: 52px; border-radius: 14px; font-size: 1.55rem; }
.password-icon-btn:hover, .create-password-icon-btn:hover { transform: translateY(-3px) scale(1.04); border-color: var(--accent-cyan); background: var(--cyan-light); }
.password-icon-btn.selected, .create-password-icon-btn.selected { border-color: var(--primary-pink); background: var(--pink-light); opacity: 0.72; }
.selected-student-login-card { display: inline-flex; align-items: center; gap: 16px; background: #fff; padding: 12px 24px; border-radius: 999px; box-shadow: var(--shadow-sm); margin: 5px auto 22px; border: 1px solid var(--border); }
.student-avatar-small { width: 48px; height: 48px; border-radius: 50%; background: var(--pink-light); display: grid; place-items: center; font-size: 1.5rem; overflow: hidden; }
.student-avatar-small img { width: 100%; height: 100%; object-fit: cover; }
.selected-student-login-card strong { font-size: 1.15rem; color: var(--text-heading); }

.student-dashboard { min-height: 100vh; display: flex; flex-direction: column; }
.dash-top-nav { display: flex; justify-content: space-between; align-items: center; padding: 20px 40px; background: var(--surface); border-bottom: 1px solid var(--border); }
.nav-brand { display: flex; align-items: center; gap: 12px; font-weight: 900; font-size: 1.15rem; color: var(--text-heading); }
.nav-brand img { width: 42px; height: 42px; border-radius: 12px; }
.dash-main-content { max-width: 1120px; width: 100%; margin: 0 auto; padding: 40px 20px; }
.hero-banner { display: flex; justify-content: space-between; align-items: center; gap: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: clamp(24px, 5vw, 44px); margin-bottom: 40px; box-shadow: var(--shadow-sm); }
.hero-text h1 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 900; margin: 0 0 8px; color: var(--text-heading); letter-spacing: -0.06em; line-height: 0.95; }
.tag-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.tag-row p { font-size: 1.05rem; color: var(--text-muted); margin: 0; font-weight: 700; }
.hero-avatar-wrapper { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hero-avatar { width: 140px; height: 140px; border-radius: 40px; background: var(--cyan-light); display: grid; place-items: center; font-size: 4rem; overflow: hidden; box-shadow: var(--shadow-md); }
.hero-avatar img { width: 100%; height: 100%; object-fit: cover; }
.change-avatar-btn { background: var(--pink-light); color: var(--primary-pink); border: none; padding: 9px 16px; border-radius: 999px; font-size: 0.9rem; font-weight: 900; }
.assignment-panel { margin-top: 34px; }
.secondary-panel { margin-top: 60px; }
.section-heading { margin-bottom: 22px; }
.section-heading h2 { font-size: 1.8rem; font-weight: 900; margin: 0 0 4px; color: var(--text-heading); letter-spacing: -0.035em; }
.section-heading p { color: var(--text-muted); margin: 0; font-weight: 650; }
.activity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.activity-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: 0.18s ease; display: flex; flex-direction: column; }
.activity-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--accent-cyan); }
.activity-cover { height: 160px; background: var(--cyan-light); display: grid; place-items: center; font-size: 3rem; border-bottom: 1px solid var(--border); overflow: hidden; }
.activity-cover img { width: 100%; height: 100%; object-fit: cover; }
.activity-content { padding: 20px 24px 24px; flex-grow: 1; display: flex; flex-direction: column; }
.activity-content h3 { font-size: 1.35rem; font-weight: 900; margin: 0 0 6px; color: var(--text-heading); }
.activity-content p { color: var(--text-muted); margin: 0 0 16px; font-weight: 650; font-size: 0.95rem; }
.activity-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.activity-pill { background: var(--bg-color); padding: 6px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 800; color: var(--text-muted); border: 1px solid var(--border); }
.activity-pill.done { background: var(--success-light); color: #065f46; border-color: #a7f3d0; }
.play-link { margin-top: auto; background: var(--primary-pink); color: white; text-decoration: none; text-align: center; padding: 14px; border-radius: 16px; font-weight: 900; font-size: 1.05rem; }
.play-link:hover { background: var(--primary-pink-hover); }
.success-card-text { margin-top: auto; color: var(--success) !important; background: var(--success-light); padding: 12px; border-radius: 12px; text-align: center; border: 1px solid #a7f3d0; font-weight: 800 !important; }
.completed-list { display: flex; flex-direction: column; gap: 12px; }
.completed-list .activity-card { flex-direction: row; align-items: center; min-height: 100px; border-radius: 18px; }
.completed-list .activity-card:hover { transform: none; border-color: var(--border); box-shadow: var(--shadow-sm); }
.completed-list .activity-cover { width: 110px; height: 100%; min-height: 100px; flex: 0 0 auto; border-bottom: none; border-right: 1px solid var(--border); }
.completed-list .activity-content { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; width: 100%; }
.completed-list h3 { font-size: 1.1rem; margin: 0; }
.completed-list p, .completed-list .activity-meta { margin: 0; }
.empty-state { grid-column: 1 / -1; background: transparent; border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 36px; text-align: center; }
.empty-state strong { display: block; font-size: 1.15rem; color: var(--text-heading); margin-bottom: 8px; }
.empty-state span { color: var(--text-muted); font-weight: 650; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100000; background: rgba(15, 23, 42, 0.62); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-card { background: var(--surface); width: min(600px, 100%); padding: 32px; border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); animation: popIn 0.22s ease both; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h2 { margin: 0; color: var(--text-heading); font-size: 1.5rem; font-weight: 900; }
.modal-close-btn { background: var(--bg-color); border: none; width: 42px; height: 42px; border-radius: 14px; font-size: 1.5rem; font-weight: 900; color: var(--text-muted); }
.modal-close-btn:hover { background: var(--pink-light); color: var(--primary-pink); }
.avatar-gif-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.avatar-gif-btn { background: var(--cyan-light); border: 2px solid transparent; border-radius: 20px; aspect-ratio: 1; padding: 0; overflow: hidden; transition: 0.18s ease; }
.avatar-gif-btn:hover { border-color: var(--primary-pink); transform: translateY(-2px); }
.avatar-gif-btn img { width: 100%; height: 100%; object-fit: cover; }

@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 760px) {
  .student-choice-grid, .two-col-fields { grid-template-columns: 1fr; }
  .choice-card { text-align: center; }
  .choice-card .gate-logo { margin-left: auto; }
  .hero-banner { flex-direction: column; text-align: center; }
  .tag-row { justify-content: center; }
  .dash-top-nav { padding: 16px 18px; }
  .completed-list .activity-card { flex-direction: column; align-items: stretch; }
  .completed-list .activity-cover { width: 100%; height: 140px; }
}

@media (max-width: 520px) {
  .login-gate-wrapper { padding: 14px; }
  .password-icon-btn { width: 58px; height: 58px; font-size: 1.7rem; border-radius: 16px; }
  .password-slots span { width: 54px; height: 54px; }
  .avatar-gif-grid { grid-template-columns: repeat(2, 1fr); }
}