/* V-006 考古題分享站：手機優先，淺色、深色都可以 */
:root {
	--bg: #f6f4ef;
	--card: #ffffff;
	--text: #1f2421;
	--muted: #6b736e;
	--line: #e2ded4;
	--accent: #2f6f5e;
	--accent-soft: #e3efe9;
	--good: #2e7d32;
	--good-soft: #e5f3e6;
	--bad: #c0392b;
	--bad-soft: #fbe9e7;
	--warn: #b7791f;
	--radius: 12px;
	color-scheme: light;
}
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #161a18;
		--card: #1f2522;
		--text: #e7ece9;
		--muted: #9aa49f;
		--line: #2f3733;
		--accent: #6cc3a6;
		--accent-soft: #24352e;
		--good: #7bd389;
		--good-soft: #1f3324;
		--bad: #ff8a7a;
		--bad-soft: #3a2420;
		color-scheme: dark;
	}
	#watermark { filter: invert(1); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
	padding-bottom: env(safe-area-inset-bottom);
}
#watermark {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 50;
	background-repeat: repeat;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

header.top {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 8px 12px;
	padding-top: calc(8px + env(safe-area-inset-top));
	background: var(--card);
	border-bottom: 1px solid var(--line);
}
header.top .brand { font-weight: 700; margin-right: auto; color: var(--text); }
header.top a.nav { padding: 6px 10px; border-radius: 8px; color: var(--muted); font-size: 15px; }
header.top a.nav.on { background: var(--accent-soft); color: var(--accent); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 12px; line-height: 18px; text-align: center; margin-left: 2px; }

main { max-width: 760px; margin: 0 auto; padding: 14px 14px 80px; }
h1 { font-size: 22px; margin: 6px 0 12px; }
h2 { font-size: 18px; margin: 18px 0 8px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
.list { display: flex; flex-direction: column; gap: 8px; }
a.row, div.row {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 12px 14px;
	color: var(--text);
}
a.row:active { background: var(--accent-soft); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow-wrap: anywhere; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.cherry { font-size: 20px; }

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 9px 16px;
	border-radius: 10px;
	border: 1px solid var(--line);
	background: var(--card);
	cursor: pointer;
	min-height: 40px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: 14px; }
.btn:disabled { opacity: 0.5; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

input[type="text"], input[type="password"], input:not([type]), select, textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--card);
}
textarea { min-height: 90px; resize: vertical; }
label.check { display: inline-flex; align-items: center; gap: 6px; margin: 4px 12px 4px 0; }
.field { margin: 10px 0; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 6px 0 12px; -webkit-overflow-scrolling: touch; }
.tabs button { flex: none; border: none; background: transparent; padding: 8px 12px; border-radius: 8px; color: var(--muted); }
.tabs button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; white-space: nowrap; }
tr.bad td { background: var(--bad-soft); }
tr.locked td { background: #fff3cd; color: #6b4e00; }
.tag { display: inline-block; padding: 0 8px; border-radius: 10px; font-size: 12px; background: var(--accent-soft); color: var(--accent); margin: 1px 2px; }
.tag.bad { background: var(--bad-soft); color: var(--bad); }

/* 題目 */
.q-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.q-stem { font-size: 17px; margin: 8px 0 12px; overflow-wrap: anywhere; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	text-align: left;
	padding: 12px;
	border: 1.5px solid var(--line);
	border-radius: 10px;
	background: var(--card);
	cursor: pointer;
	width: 100%;
}
.choice .k { font-weight: 700; min-width: 1.4em; }
.choice .t { flex: 1; overflow-wrap: anywhere; }
.choice .t p { margin: 0; }
.choice.picked { border-color: var(--accent); background: var(--accent-soft); }
.choice.right { border-color: var(--good); background: var(--good-soft); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); }
.verdict { font-weight: 700; font-size: 18px; margin: 12px 0 4px; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }
.explain { border-left: 3px solid var(--accent); padding: 4px 12px; margin: 10px 0; }
.explain h4 { margin: 4px 0; font-size: 14px; color: var(--muted); }
.md p { margin: 4px 0; }
.md pre { overflow-x: auto; background: var(--bg); padding: 8px; border-radius: 8px; }
.md blockquote { margin: 4px 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.md ul, .md ol { margin: 4px 0; padding-left: 22px; }
.wikilink { color: var(--accent); }
.pager { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.pager .btn { flex: 1; }

/* 留言 */
.post { padding: 10px 0; border-top: 1px solid var(--line); }
.post:first-child { border-top: none; }
.post .who { font-weight: 600; font-size: 14px; }
.post .when { color: var(--muted); font-size: 12px; margin-left: 6px; }
.post .quote { font-size: 13px; color: var(--muted); border-left: 3px solid var(--line); padding-left: 8px; margin: 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post .acts { display: flex; gap: 12px; font-size: 13px; margin-top: 2px; }
.post .acts a { color: var(--muted); cursor: pointer; }
.post.hidden-post .md { opacity: 0.5; }
.notice { background: var(--accent-soft); color: var(--accent); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0; }

.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: #333; color: #fff; padding: 10px 18px; border-radius: 20px; z-index: 100; font-size: 15px; max-width: 90vw; }
.toast.bad { background: var(--bad); }
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--card); border-radius: var(--radius); padding: 18px; max-width: 420px; width: 100%; }
.password { font: 600 22px/1.4 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; background: var(--bg); padding: 8px 12px; border-radius: 8px; user-select: all; }
.login { max-width: 360px; margin: 12vh auto 0; }
.vis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.vis-col { border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.vis-col h4 { margin: 0 0 6px; }
.vis-col .opts { max-height: 180px; overflow-y: auto; }
.targets { max-height: 340px; overflow-y: auto; }
.targets button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.targets button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.targets .lv1 { padding-left: 22px; }
.targets .lv2 { padding-left: 40px; font-size: 14px; }
.math-block { overflow-x: auto; margin: 6px 0; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }

.q-img { max-width: 100%; height: auto; display: block; margin: 8px 0; background: #fff; border-radius: 6px; }
