/* BI4OAE HAM 工具站 —— 全站样式
   设计基调：深色仪表盘风格，等宽字体点缀，电报/仪表感 */

:root {
	--bg: #0d1117;
	--bg-soft: #161b22;
	--bg-card: #1a2029;
	--bg-input: #0b0f15;
	--line: #2b3441;
	--line-soft: #222a35;
	--fg: #e6edf3;
	--fg-dim: #9aa7b4;
	--fg-mute: #6b7885;
	--accent: #f0a500;
	--accent-2: #35c3e8;
	--ok: #3fb950;
	--warn: #d29922;
	--err: #f85149;
	--mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
	--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
		"Hiragino Sans GB", "Microsoft YaHei", sans-serif;
	--radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--sans);
	font-size: 15px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶栏 ---------- */
.topbar {
	position: sticky;
	top: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 20px;
	background: rgba(13, 17, 23, .92);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--line);
	flex-wrap: wrap;
}

.topbar .callsign {
	font-family: var(--mono);
	font-size: 19px;
	font-weight: 700;
	color: var(--accent);
	letter-spacing: .06em;
}

.topbar .tagline {
	font-size: 12.5px;
	color: var(--fg-mute);
	font-family: var(--mono);
}

.topbar nav {
	margin-left: auto;
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
}

.topbar nav a {
	padding: 5px 11px;
	border-radius: 6px;
	font-size: 13.5px;
	color: var(--fg-dim);
	border: 1px solid transparent;
	white-space: nowrap;
}

.topbar nav a:hover {
	background: var(--bg-card);
	color: var(--fg);
	text-decoration: none;
}

.topbar nav a.active {
	background: var(--bg-card);
	border-color: var(--line);
	color: var(--accent);
}

/* ---------- 布局 ---------- */
.wrap { max-width: 1060px; margin: 0 auto; padding: 26px 20px 70px; }
.wrap.narrow { max-width: 780px; }

.page-head { margin-bottom: 22px; }
.page-head h1 {
	margin: 0 0 6px;
	font-size: 25px;
	letter-spacing: .01em;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.badge {
	display: inline-block;
	font-family: var(--mono);
	font-size: 11px;
	font-weight: 500;
	padding: 2px 8px;
	border-radius: 20px;
	background: var(--bg-card);
	border: 1px solid var(--line);
	color: var(--fg-dim);
	vertical-align: middle;
}

.badge.hot { color: var(--accent); border-color: #4a3a12; background: #241c08; }
.badge.off { color: var(--fg-mute); }

.page-head p.desc { margin: 0; color: var(--fg-dim); font-size: 14px; }

/* ---------- 卡片 ---------- */
.card {
	background: var(--bg-card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 18px;
	margin-bottom: 18px;
}

.card > h2 {
	margin: 0 0 14px;
	font-size: 15.5px;
	color: var(--accent);
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 8px;
}

.card > h2::before {
	content: "";
	width: 3px;
	height: 15px;
	background: var(--accent);
	border-radius: 2px;
}

.card p.note {
	margin: 12px 0 0;
	font-size: 12.5px;
	color: var(--fg-mute);
	line-height: 1.6;
}

/* ---------- 表单 ---------- */
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }

label.fld { display: block; margin-bottom: 2px; }
label.fld > span {
	display: block;
	font-size: 12.5px;
	color: var(--fg-dim);
	margin-bottom: 5px;
}

input[type="text"], input[type="number"], select, textarea {
	width: 100%;
	background: var(--bg-input);
	border: 1px solid var(--line);
	border-radius: 7px;
	color: var(--fg);
	padding: 9px 11px;
	font-size: 15px;
	font-family: var(--mono);
	outline: none;
	transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(240, 165, 0, .12);
}

select { font-family: var(--sans); cursor: pointer; }

input[type="range"] { width: 100%; accent-color: var(--accent); }

.btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--accent);
	color: #201500;
	border: none;
	border-radius: 7px;
	padding: 9px 18px;
	font-size: 14.5px;
	font-weight: 600;
	font-family: var(--sans);
	cursor: pointer;
	transition: filter .15s, transform .05s;
}

.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }

.btn.ghost {
	background: transparent;
	color: var(--fg-dim);
	border: 1px solid var(--line);
}
.btn.ghost:hover { color: var(--fg); border-color: var(--fg-mute); background: var(--bg-soft); }

.btn.sm { padding: 5px 11px; font-size: 13px; }

/* ---------- 输出区 ---------- */
.out {
	background: var(--bg-input);
	border: 1px solid var(--line-soft);
	border-radius: 7px;
	padding: 13px 15px;
	font-family: var(--mono);
	font-size: 15px;
	line-height: 1.8;
	word-break: break-all;
}

.out .hl { color: var(--accent); font-weight: 700; }
.out .hl2 { color: var(--accent-2); }
.out .mute { color: var(--fg-mute); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-family: var(--mono); font-size: 14.5px; }
.kv dt { color: var(--fg-mute); }
.kv dd { margin: 0; color: var(--fg); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
	padding: 8px 10px;
	border-bottom: 1px solid var(--line-soft);
	text-align: left;
}
.table th { color: var(--fg-mute); font-weight: 500; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
.table td.mono, .table th.mono { font-family: var(--mono); }
.table tr:hover td { background: var(--bg-soft); }

/* ---------- 首页工具网格 ---------- */
.tools {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 14px;
}

.tool-card {
	background: var(--bg-card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 16px 17px;
	display: block;
	color: inherit;
	transition: border-color .15s, transform .12s, background .15s;
	position: relative;
	overflow: hidden;
}

.tool-card:hover {
	border-color: var(--accent);
	background: #1e2530;
	text-decoration: none;
	transform: translateY(-2px);
}

.tool-card .ico {
	font-size: 22px;
	line-height: 1;
	margin-bottom: 9px;
	display: block;
}

.tool-card h3 { margin: 0 0 5px; font-size: 15.5px; color: var(--fg); }
.tool-card p { margin: 0; font-size: 12.8px; color: var(--fg-mute); line-height: 1.55; }

.tool-card .no {
	position: absolute;
	top: 12px;
	right: 13px;
	font-family: var(--mono);
	font-size: 11px;
	color: var(--fg-mute);
	opacity: .55;
}

/* ---------- 页脚 ---------- */
.foot {
	border-top: 1px solid var(--line);
	margin-top: 40px;
	padding: 20px 20px 34px;
	text-align: center;
	font-size: 12.5px;
	color: var(--fg-mute);
	line-height: 1.9;
}

.foot .call { font-family: var(--mono); color: var(--accent); font-size: 14px; letter-spacing: .05em; }
.foot a { color: var(--fg-dim); }

/* ---------- Toast ---------- */
#toast {
	position: fixed;
	left: 50%;
	bottom: 34px;
	transform: translateX(-50%) translateY(20px);
	background: var(--accent);
	color: #201500;
	padding: 10px 22px;
	border-radius: 24px;
	font-size: 14px;
	font-weight: 600;
	opacity: 0;
	pointer-events: none;
	transition: opacity .22s, transform .22s;
	z-index: 999;
	box-shadow: 0 8px 26px rgba(0, 0, 0, .5);
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 大数字显示 ---------- */
.bigval {
	font-family: var(--mono);
	font-size: 32px;
	font-weight: 700;
	color: var(--accent);
	line-height: 1.2;
	letter-spacing: -.01em;
}

.subval { font-family: var(--mono); font-size: 13.5px; color: var(--fg-dim); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat {
	background: var(--bg-input);
	border: 1px solid var(--line-soft);
	border-radius: 8px;
	padding: 12px 14px;
}
.stat .k { font-size: 12px; color: var(--fg-mute); margin-bottom: 5px; }
.stat .v { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--fg); }
.stat .v small { font-size: 12px; color: var(--fg-dim); font-weight: 400; }

.bar { height: 6px; border-radius: 3px; background: var(--bg-soft); overflow: hidden; margin-top: 7px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }

/* ---------- CW 专用 ---------- */
.cw-key {
	width: 100%;
	height: 92px;
	border-radius: var(--radius);
	border: 2px solid var(--line);
	background: #0a0e13;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--mono);
	font-size: 32px;
	font-weight: 700;
	color: var(--line);
	user-select: none;
	transition: background .04s, color .04s, border-color .04s;
	cursor: pointer;
}
.cw-key.on {
	background: var(--accent);
	border-color: var(--accent);
	color: #201500;
}
/* CW 电码显示：字符保持原始 "." 与 "-"，只上色不改字面 */
.cw-dot { color: var(--accent); font-weight: 700; }
.cw-dash { color: var(--accent-2); font-weight: 700; }

.cw-dots { display: flex; flex-wrap: wrap; gap: 5px; min-height: 34px; align-items: center; }
.cw-dots span {
	font-family: var(--mono);
	font-size: 21px;
	font-weight: 700;
	color: var(--fg);
	line-height: 1;
}
.cw-dots span.d { color: var(--accent); }
.cw-dots span.w { color: transparent; }
.cw-dots span.ws { color: var(--fg-mute); }

/* 灯泡闪烁 */
.lamp {
	width: 62px; height: 62px;
	border-radius: 50%;
	background: #1a2029;
	border: 3px solid var(--line);
	transition: background .05s, box-shadow .05s;
	margin: 0 auto;
}
.lamp.on {
	background: var(--accent);
	box-shadow: 0 0 26px rgba(240, 165, 0, .85);
	border-color: var(--accent);
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
	.topbar { padding: 9px 14px; gap: 8px; }
	.topbar nav { margin-left: 0; width: 100%; overflow-x: auto; }
	.wrap { padding: 18px 14px 60px; }
	.page-head h1 { font-size: 21px; }
	.bigval { font-size: 26px; }
	.tools { grid-template-columns: 1fr; }
}

pre {
	font-family: var(--mono);
	font-size: 13px;
	background: var(--bg-input);
	border: 1px solid var(--line-soft);
	border-radius: 7px;
	padding: 13px;
	overflow-x: auto;
	color: var(--fg-dim);
	line-height: 1.7;
}

/* ---------- 移动端 ---------- */
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 14px; }
.mt0 { margin-top: 0; }

.hidden { display: none !important; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 14px; }
.mt0 { margin-top: 0; }