/* ===================================================================
   현장 도구 — 모바일 최적화 스타일
   현장 작업자(어르신) 기준: 큰 글씨 · 큰 터치영역 · 높은 대비
   =================================================================== */

:root {
	--bg:        #f1f5f9;   /* 배경 */
	--card:      #ffffff;   /* 카드 */
	--ink:       #0f172a;   /* 기본 글자 */
	--ink-soft:  #64748b;   /* 보조 글자 */
	--line:      #e2e8f0;   /* 경계선 */
	--brand:     #2563eb;   /* 포인트(파랑) */
	--brand-dark:#1d4ed8;
	--accent:    #f97316;   /* 강조(주황) */
	--result-bg: #0f172a;   /* 결과 카드 */
	--radius:    14px;
	--header-h:  52px;
	--tabbar-h:  64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

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

body {
	font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
	background: var(--bg);
	color: var(--ink);
	font-size: 16px;
	line-height: 1.45;
	max-width: 520px;
	margin: 0 auto;
	min-height: 100vh;
	position: relative;
}

/* ---------- 헤더 ---------- */
.app-header {
	position: sticky;
	top: 0;
	z-index: 10;
	height: var(--header-h);
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--result-bg);
	color: #fff;
	padding: 0 16px;
	padding-top: env(safe-area-inset-top);
	height: calc(var(--header-h) + env(safe-area-inset-top));
}
.app-header h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }

/* ---------- 본문 ---------- */
.app-main {
	padding: 12px 14px calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
}

.tab-panel { display: none; animation: fade .2s ease; }
.tab-panel.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 입력 카드 ---------- */
.card {
	background: var(--card);
	border-radius: var(--radius);
	padding: 4px 14px 14px;
	box-shadow: 0 1px 3px rgba(15,23,42,.06);
}

.field { margin-top: 11px; }
.field > label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--ink);
	margin-bottom: 5px;
}
.field .unit { font-weight: 500; color: var(--ink-soft); font-size: 12px; }

input, textarea {
	width: 100%;
	font-size: 18px;
	font-weight: 600;
	color: var(--ink);
	background: var(--bg);
	border: 2px solid var(--line);
	border-radius: 11px;
	padding: 11px 14px;
	font-family: inherit;
	transition: border-color .15s;
}
textarea { font-size: 17px; font-weight: 500; resize: none; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #cbd5e1; font-weight: 500; }
input:focus, textarea:focus { outline: none; border-color: var(--brand); }
/* 숫자 화살표 제거 */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* ---------- 재질 선택 버튼 ---------- */
.material-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.material-btn {
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	color: var(--ink-soft);
	background: var(--bg);
	border: 2px solid var(--line);
	border-radius: 11px;
	padding: 9px 4px;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1px;
	transition: all .15s;
}
.material-btn span { font-size: 11px; font-weight: 500; color: #94a3b8; }
.material-btn.is-active {
	color: #fff;
	background: var(--brand);
	border-color: var(--brand);
}
.material-btn.is-active span { color: rgba(255,255,255,.8); }

/* ---------- 결과 카드 ---------- */
.result-card {
	background: var(--result-bg);
	border-radius: var(--radius);
	padding: 2px 18px;
	margin-top: 12px;
	color: #fff;
}
.result-row {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 10px 0;
}
.result-row + .result-row { border-top: 1px solid rgba(255,255,255,.12); }
.result-label { font-size: 13px; color: #cbd5e1; font-weight: 500; }
.result-value {
	display: flex;
	align-items: baseline;
	gap: 4px;
	min-width: 0;
}
.result-value strong {
	font-size: 24px;
	font-weight: 800;
	color: var(--accent);
	letter-spacing: -0.5px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
}
.result-value em { font-size: 13px; font-style: normal; color: #94a3b8; flex-shrink: 0; }

/* ---------- 변환기 화살표 ---------- */
.convert-arrow {
	text-align: center;
	font-size: 22px;
	color: var(--brand);
	margin: 10px 0 0;
	font-weight: 700;
}

/* ---------- 공식 안내 ---------- */
.formula-note {
	margin-top: 12px;
	padding: 10px 14px;
	background: #fff7ed;
	border: 1px solid #fed7aa;
	border-radius: 11px;
	font-size: 13px;
	line-height: 1.6;
	color: #9a3412;
	text-align: center;
}

/* ---------- 소통방 ---------- */
.board-form .board-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.submit-btn {
	width: 100%;
	margin-top: 12px;
	font-family: inherit;
	font-size: 17px;
	font-weight: 700;
	color: #fff;
	background: var(--brand);
	border: none;
	border-radius: 11px;
	padding: 13px;
	cursor: pointer;
	transition: background .15s;
}
.submit-btn:active { background: var(--brand-dark); }

.board-list { list-style: none; margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.board-item {
	background: var(--card);
	border-radius: 14px;
	padding: 14px 16px;
	box-shadow: 0 1px 3px rgba(15,23,42,.06);
}
.board-item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.board-item-nick { font-weight: 700; font-size: 15px; color: var(--brand); }
.board-item-date { font-size: 12px; color: #94a3b8; }
.board-item-body { font-size: 16px; color: var(--ink); line-height: 1.55; word-break: break-word; }
.board-item-del {
	margin-top: 8px;
	font-size: 13px;
	color: #94a3b8;
	background: none;
	border: none;
	cursor: pointer;
	padding: 2px 0;
	text-decoration: underline;
}
.board-empty { text-align: center; color: var(--ink-soft); padding: 30px 0; font-size: 15px; }
.board-stub-note { margin-top: 16px; text-align: center; font-size: 13px; color: #94a3b8; }

/* ---------- 하단 탭바 ---------- */
.tab-bar {
	position: fixed;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 100%;
	max-width: 520px;
	height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
	padding-bottom: env(safe-area-inset-bottom);
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	background: #fff;
	border-top: 1px solid var(--line);
	z-index: 20;
}
.tab-btn {
	font-family: inherit;
	border: none;
	background: none;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	color: var(--ink-soft);
	font-size: 12px;
	font-weight: 600;
	transition: color .15s;
}
.tab-btn svg {
	width: 23px;
	height: 23px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.tab-btn.is-active { color: var(--brand); }
