/* 학생 화면. 디자인 원본: Claude Design 캔버스 "CCTV 동의서 학생 화면" */
:root {
	--bg: #f5f5f4;
	--surface: #ffffff;
	--surface-muted: #fafaf9;
	--text: #1c1917;
	/* #78716c는 --bg 위에서 4.5:1에 못 미쳐 조금 진하게 */
	--muted: #6f6863;
	--border: #e7e5e4;
	--accent: #b4002f;
	--accent-hover: #8f0025;
	--on-accent-muted: #f3d3db;
	--ok-bg: #ecfdf3;
	--ok-text: #05603a;
	--error-bg: #fef3f2;
	--error-text: #b42318;
	--shadow: 0 1px 2px rgba(28, 25, 23, 0.06);
	--radius-card: 12px;
	--radius-control: 8px;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--text);
	font: 15px/1.6 Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
	-webkit-text-size-adjust: 100%;
}

a {
	color: var(--accent);
}

a:hover {
	color: var(--accent-hover);
}

h1, h2, h3, p {
	margin: 0;
}

.icon {
	flex-shrink: 0;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* 상단 바 */
.topbar {
	background: var(--accent);
	border-bottom: 1px solid var(--accent-hover);
	color: #fff;
}

.topbar-inner {
	max-width: 640px;
	margin: 0 auto;
	padding: 12px 16px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 4px 12px;
}

.topbar .brand {
	color: #fff;
	font-size: 18px;
	font-weight: 700;
	text-decoration: none;
}

.topbar nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
	font-size: 14px;
}

.topbar nav span {
	color: var(--on-accent-muted);
}

.topbar nav a,
.topbar nav button {
	min-height: 36px;
	padding: 6px 10px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--on-accent-muted);
	font: inherit;
	text-decoration: none;
	cursor: pointer;
}

.topbar nav a:hover,
.topbar nav button:hover {
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
}

.topbar :focus-visible {
	outline-color: #fff;
}

.topbar form {
	margin: 0;
}

/* 본문 */
.page {
	flex: 1;
	width: 100%;
	max-width: 640px;
	margin: 0 auto;
	padding: 20px 16px 32px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.page.narrow {
	max-width: 440px;
}

.page.centered {
	justify-content: center;
	gap: 32px;
	padding-top: 40px;
	padding-bottom: 40px;
}

.page-head {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.page-head h1 {
	font-size: 22px;
	font-weight: 700;
	line-height: 1.3;
}

.muted {
	color: var(--muted);
}

.small {
	font-size: 13px;
}

.back-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	align-self: flex-start;
	min-height: 32px;
	color: var(--muted);
	font-size: 14px;
	text-decoration: none;
}

.back-link:hover {
	color: var(--text);
}

.card {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 20px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow);
}

.card h2 {
	font-size: 18px;
	font-weight: 700;
}

.card-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

/* 알림 */
.alert {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 14px;
	border-radius: var(--radius-control);
	font-size: 14px;
	font-weight: 600;
}

.alert .icon {
	width: 18px;
	height: 18px;
	margin-top: 2px;
}

.alert.ok {
	background: var(--ok-bg);
	color: var(--ok-text);
}

.alert.error {
	background: var(--error-bg);
	color: var(--error-text);
	font-weight: 500;
}

/* 버튼 */
.button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 52px;
	padding: 0 16px;
	border: 0;
	border-radius: var(--radius-control);
	background: var(--accent);
	color: #fff;
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(28, 25, 23, 0.08);
	transition: background-color 150ms ease-out;
}

.button:hover {
	background: var(--accent-hover);
	color: #fff;
}

.button .sub {
	color: var(--on-accent-muted);
	font-weight: 600;
}

.text-button {
	min-height: 44px;
	padding: 0 4px;
	border: 0;
	background: transparent;
	color: var(--accent);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

/* 언어 선택 */
.band {
	background: var(--accent);
	border-bottom: 1px solid var(--accent-hover);
}

.band p {
	max-width: 440px;
	margin: 0 auto;
	padding: 12px 16px;
	color: #fff;
	font-size: 18px;
	font-weight: 700;
}

.hero {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	text-align: center;
}

.hero-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 16px;
	background: var(--surface);
	border: 1px solid var(--border);
	color: var(--accent);
	box-shadow: var(--shadow);
}

.hero h1 {
	font-size: 24px;
	font-weight: 700;
	line-height: 1.3;
}

.choice {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 56px;
	padding: 0 20px;
	border-radius: var(--radius-control);
	background: var(--accent);
	color: #fff;
	font-size: 17px;
	font-weight: 700;
	text-decoration: none;
	transition: background-color 150ms ease-out;
}

.choice:hover {
	background: var(--accent-hover);
	color: #fff;
}

.choice.secondary {
	background: var(--surface);
	border: 1px solid var(--border);
	color: var(--text);
}

.choice.secondary:hover {
	background: var(--bg);
	color: var(--text);
}

.choice.secondary .icon {
	color: var(--muted);
}

.choice-label {
	text-align: center;
	font-size: 14px;
	font-weight: 600;
}

/* 로그인 */
.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.field span {
	font-size: 14px;
	font-weight: 600;
}

.field input {
	width: 100%;
	height: 48px;
	padding: 0 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	background: var(--surface);
	color: var(--text);
	font: inherit;
	font-size: 16px;
}

.field input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 2px rgba(180, 0, 47, 0.25);
}

.field input[aria-invalid="true"] {
	border-color: var(--error-text);
}

.notes {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	font-size: 14px;
}

.notes p {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	color: var(--muted);
}

.notes .icon {
	width: 18px;
	height: 18px;
	margin-top: 2px;
	color: var(--text);
}

.notes .icon.caution {
	color: var(--accent);
}

/* 내 수업 */
.progress-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}

.progress-head strong {
	font-size: 15px;
}

.progress {
	height: 8px;
	border-radius: 999px;
	background: var(--bg);
	overflow: hidden;
}

.progress span {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--accent);
}

.course-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.course {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow);
}

.course.pending {
	border: 1px dashed var(--accent);
}

.course-info {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.course-name {
	font-size: 16px;
	font-weight: 700;
}

.course-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.course-meta .muted {
	font-size: 13px;
}

.pill {
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--bg);
	color: var(--text);
	font-size: 12px;
	font-weight: 700;
}

.pill.done {
	background: var(--ok-bg);
	color: var(--ok-text);
}

.pill.todo {
	color: var(--muted);
}

.course-status {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.course-status a {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 44px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

.empty {
	padding: 16px;
	border: 1px dashed var(--border);
	border-radius: var(--radius-control);
}

.empty p + p {
	margin-top: 4px;
}

/* 동의서 작성 */
.steps {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 13px;
	font-weight: 600;
	color: var(--muted);
}

.steps li + li::before {
	content: "·";
	margin-right: 8px;
	color: #d6d3d1;
}

.steps li[aria-current="step"],
.steps li.done {
	color: var(--accent);
}

.summary {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px;
	background: var(--surface-muted);
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
}

.summary h3 {
	text-align: center;
	font-size: 15px;
	font-weight: 700;
}

.summary dl {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0;
	font-size: 14px;
}

.summary dl div {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.summary dt {
	color: var(--muted);
	font-size: 13px;
	font-weight: 600;
}

.summary dd {
	margin: 0;
	font-weight: 500;
}

.summary dd.highlight {
	color: var(--accent);
	font-weight: 600;
}

.summary details {
	padding-top: 12px;
	border-top: 1px solid var(--border);
}

.summary summary {
	min-height: 32px;
	color: var(--muted);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.summary details > div {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 8px;
	color: var(--muted);
	font-size: 13px;
	line-height: 1.7;
}

.agree {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	cursor: pointer;
}

.agree input {
	width: 20px;
	height: 20px;
	margin: 2px 0 0;
	flex-shrink: 0;
	accent-color: var(--accent);
}

.agree span {
	font-weight: 700;
}

.select-all {
	display: flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	color: var(--muted);
	font-size: 14px;
	cursor: pointer;
}

.select-all input {
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: var(--accent);
}

.course-options {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0;
	padding: 0;
	border: 0;
}

.course-option {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 16px 48px 16px 16px;
	border: 2px solid var(--border);
	border-radius: var(--radius-card);
	background: var(--surface);
	cursor: pointer;
	transition: border-color 150ms ease-out;
}

.course-option:has(input:checked) {
	border-color: var(--accent);
}

.course-option:has(input:focus-visible) {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.course-option .check {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 22px;
	height: 22px;
	color: var(--border);
}

.course-option input:checked ~ .check {
	color: var(--accent);
}

.course-option .check .tick {
	visibility: hidden;
}

.course-option input:checked ~ .check .tick {
	visibility: visible;
}

.signature-pad {
	display: block;
	width: 100%;
	height: 200px;
	border: 2px solid var(--border);
	border-radius: var(--radius-control);
	background: #fff;
	touch-action: none;
	cursor: crosshair;
}

.field-error {
	color: var(--error-text);
	font-size: 14px;
}

.signer {
	text-align: right;
	color: var(--muted);
	font-size: 14px;
	font-weight: 500;
}

.signer strong {
	color: var(--text);
}

.submit-bar {
	position: sticky;
	bottom: 0;
	z-index: 10;
	background: var(--surface);
	border-top: 1px solid var(--border);
}

.submit-bar > div {
	max-width: 640px;
	margin: 0 auto;
	padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
	display: flex;
	flex-direction: column;
	gap: 8px;
	text-align: center;
}

.button:disabled {
	background: #d6d3d1;
	color: #57534e;
	cursor: not-allowed;
	box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important;
	}
}
