html { zoom: 1.25; }
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: #FBFBFD; color: #1D1D1F; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.container { max-width: 720px; margin: 0 auto; padding: 20px 16px; }

/* Hero */
.hero { text-align: center; padding: 48px 16px 24px; }
.hero h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; background: linear-gradient(135deg,#0A84FF,#5E5CE6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p { color: #8E8E93; font-size: 16px; margin-top: 6px; }

/* Grade selector */
.grade-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 20px 0; }
.grade-btn { padding: 12px 24px; border-radius: 14px; border: 1.5px solid #E5E5EA; background: white; font-size: 15px; font-weight: 600; cursor: pointer; transition: all .2s; color: #1D1D1F; }
.grade-btn:hover { border-color: #0A84FF; background: #F0F7FF; }
.grade-btn.active { border-color: #0A84FF; background: #0A84FF; color: white; }
.grade-btn.small { padding: 8px 14px; font-size: 13px; }

/* Card list */
.card { background: white; border-radius: 16px; padding: 16px 18px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); cursor: pointer; transition: all .2s; }
.card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.1); transform: translateY(-1px); }
.card .date { font-size: 12px; color: #8E8E93; margin-bottom: 2px; }
.card .title { font-size: 16px; font-weight: 600; }
.card .meta { font-size: 13px; color: #8E8E93; margin-top: 4px; }
.card .status { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; margin-top: 6px; }
.status.done { background: #34C759; color: white; }
.status.pending { background: #FF9F0A; color: white; }
.card .sub-count { font-size: 12px; color: #8E8E93; float: right; }

/* Homework detail */
.back-btn { display: inline-block; border: none; background: none; color: #0A84FF; font-size: 15px; cursor: pointer; padding: 8px 0; font-weight: 500; margin-bottom: 12px; }
.back-btn:hover { text-decoration: underline; }
.student-chip { display: inline-block; background: #F2F2F7; border-radius: 20px; padding: 6px 14px; color: #1C1C1E; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.detail-card { background: white; border-radius: 16px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.detail-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.detail-card .date { font-size: 13px; color: #8E8E93; margin-bottom: 12px; }
.detail-card .problem { font-size: 15px; line-height: 1.7; margin-bottom: 16px; }
.detail-card .problem img { max-width: 100%; border-radius: 12px; margin-top: 10px; }
.detail-card label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 4px; }
.detail-card input[type="text"],
.detail-card input[type="number"],
.detail-card textarea { width: 100%; padding: 12px 14px; border: 1.5px solid #E5E5EA; border-radius: 12px; font-size: 15px; font-family: inherit; outline: none; transition: border-color .2s; }
.detail-card input:focus,
.detail-card textarea:focus { border-color: #0A84FF; }
.name-row { display: flex; gap: 10px; }
.name-row input { flex: 1; }
.submit-btn { display: block; width: 100%; padding: 14px; border: none; border-radius: 14px; background: #0A84FF; color: white; font-size: 17px; font-weight: 600; cursor: pointer; margin-top: 16px; transition: background .2s; }
.submit-btn:hover { background: #0071E3; }
.submit-btn:disabled { opacity: .5; cursor: not-allowed; }
.submit-ok { text-align: center; padding: 20px; font-size: 16px; font-weight: 600; color: #34C759; }

/* Code editor */
.code-wrap { border: 1.5px solid #E5E5EA; border-radius: 12px; overflow: hidden; }
.code-wrap textarea { width: 100%; min-height: 140px; padding: 12px; font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace; font-size: 14px; border: none; resize: vertical; outline: none; background: #F5F5F7; tab-size: 2; }
.run-btn { padding: 8px 20px; border: none; border-radius: 10px; background: #34C759; color: white; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 8px; transition: background .2s; }
.run-btn:hover { background: #28A745; }
.run-btn:disabled { opacity: .5; }
.code-output { background: #1D1D1F; color: #fff; padding: 12px 14px; border-radius: 10px; font-family: 'SF Mono', monospace; font-size: 13px; margin-top: 8px; min-height: 28px; white-space: pre-wrap; display: none; }

/* Admin */
.admin-bar { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 12px; }
.admin-bar .btn { padding: 6px 14px; border-radius: 10px; border: none; font-size: 13px; font-weight: 600; cursor: pointer; }
.admin-bar .btn-login { background: #0A84FF; color: white; }
.admin-bar .btn-logout { background: #FF3B30; color: white; }
.admin-form { background: white; border-radius: 16px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 16px; }
.admin-form h3 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.admin-form select,
.admin-form input[type="text"],
.admin-form textarea { width: 100%; padding: 10px 12px; border: 1.5px solid #E5E5EA; border-radius: 10px; font-size: 14px; font-family: inherit; outline: none; margin-bottom: 10px; }
.admin-form select:focus,
.admin-form input:focus,
.admin-form textarea:focus { border-color: #0A84FF; }
.admin-form .file-upload { border: 1.5px dashed #E5E5EA; border-radius: 12px; padding: 20px; text-align: center; cursor: pointer; color: #8E8E93; margin-bottom: 10px; }
.admin-form .file-upload:hover { border-color: #0A84FF; color: #0A84FF; }
.admin-form .file-name { font-size: 13px; color: #34C759; margin-bottom: 10px; }
.submissions-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.submissions-table th { text-align: left; padding: 8px 10px; border-bottom: 1.5px solid #E5E5EA; font-weight: 600; color: #8E8E93; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.submissions-table td { padding: 8px 10px; border-bottom: 1px solid #F2F2F7; }
.submissions-table .correct { color: #34C759; font-weight: 600; }
.submissions-table .wrong { color: #FF3B30; font-weight: 600; }
.submissions-table .muted { color: #8E8E93; }

/* Toast */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); padding: 12px 24px; border-radius: 14px; background: #1D1D1F; color: white; font-size: 14px; font-weight: 500; box-shadow: 0 4px 24px rgba(0,0,0,0.2); z-index: 1000; opacity: 0; transition: opacity .3s; pointer-events: none; }
.toast.show { opacity: 1; }

/* Top row (user chip + logout) */
.top-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.top-row .student-chip { margin-bottom: 0; }
.link-btn { border: none; background: none; color: #8E8E93; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: #FF3B30; }

/* Login screen */
.login-hint { font-size: 13px; color: #8E8E93; text-align: center; margin-top: 12px; }
.detail-card input[type="password"] { width: 100%; padding: 12px 14px; border: 1.5px solid #E5E5EA; border-radius: 12px; font-size: 15px; font-family: inherit; outline: none; transition: border-color .2s; }
.detail-card input[type="password"]:focus { border-color: #0A84FF; }
.inline-login { margin-top: 14px; padding-top: 14px; border-top: 1px solid #F2F2F7; }

/* Student list badges */
.done-badge { display: inline-block; margin-top: 8px; background: #34C759; color: white; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 8px; }
.overdue { color: #FF3B30 !important; font-weight: 600; }

/* Submitted (read-only) answers */
.submitted-note { text-align: center; padding: 16px; margin-top: 14px; border-radius: 12px; background: #F0F9F0; color: #1F7A33; font-size: 15px; font-weight: 700; }
.answer-readonly { margin-top: 10px; }
.answer-label { font-size: 13px; font-weight: 600; color: #8E8E93; margin: 8px 0 2px; }
.answer-value { font-size: 15px; padding: 10px 12px; background: #F5F5F7; border-radius: 10px; white-space: pre-wrap; word-break: break-word; }
.answ-info { margin-top: 8px; font-size: 13px; line-height: 1.5; }
.answ-expected { color: #8E8E93; }
.res-ok { color: #28A745; }
.res-bad { color: #DC3545; }

/* Admin sections */
.section-title { font-size: 18px; font-weight: 700; margin: 24px 0 10px; }
.students-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.students-table th { text-align: left; padding: 8px 10px; border-bottom: 1.5px solid #E5E5EA; font-weight: 600; color: #8E8E93; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.students-table td { padding: 6px 10px; border-bottom: 1px solid #F2F2F7; }
.students-table select,
.students-table input[type="text"] { padding: 6px 8px; border: 1.5px solid #E5E5EA; border-radius: 8px; font-size: 13px; font-family: inherit; outline: none; }
.students-table select:focus,
.students-table input[type="text"]:focus { border-color: #0A84FF; }
.admin-form label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 4px; }
.admin-form input[type="date"] { width: 100%; padding: 10px 12px; border: 1.5px solid #E5E5EA; border-radius: 10px; font-size: 14px; font-family: inherit; outline: none; margin-bottom: 10px; }

/* Loading */
.spinner { text-align: center; padding: 40px; color: #8E8E93; }

/* Hidden */
.hidden { display: none !important; }

/* Stats */
.stat-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.stat-pill { background: #F2F2F7; padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 500; color: #1D1D1F; }

/* Task card in admin */
.task-card { background: #F9F9FB; border-radius: 12px; padding: 14px; margin-bottom: 8px; font-size: 14px; line-height: 1.6; }

/* Responsive */
@media (max-width: 500px) {
  .hero h1 { font-size: 26px; }
  .name-row { flex-direction: column; gap: 4px; }
}
