/* 소음맵 웹 도구 공통 스타일 — /check/ /notice/ /diary/ /guide/ /app/ */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-soft: #eef2ff;
  --text: #1a1a2e;
  --text-sub: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f6fb;
  --card: #ffffff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #15803d;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

a {
  color: var(--primary-dark);
}

/* 전화번호가 줄 끝에서 '031-738-'과 '3300'처럼 갈라지지 않게 한다. */
a[href^='tel:'] {
  white-space: nowrap;
}

/* 머리글·바닥글 */

.site-header {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
}

.brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 15px;
}

.site-nav a {
  color: var(--text-sub);
  text-decoration: none;
  padding: 4px 0;
}

.site-nav a[aria-current='page'] {
  color: var(--primary-dark);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--primary);
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 16px 40px;
}

h1 {
  font-size: 26px;
  line-height: 1.35;
  margin: 12px 0 10px;
}

h2 {
  font-size: 20px;
  line-height: 1.4;
  margin: 0 0 12px;
}

h3 {
  font-size: 17px;
  line-height: 1.45;
  margin: 18px 0 8px;
}

p {
  margin: 0 0 12px;
}

.lead {
  color: var(--text-sub);
  margin-bottom: 20px;
}

.meta {
  color: var(--muted);
  font-size: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 16px;
  margin: 0 0 16px;
}

.card > :last-child {
  margin-bottom: 0;
}

.site-footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.site-footer p {
  margin-bottom: 8px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.footer-links a {
  color: var(--text-sub);
}

/* 폼 */

fieldset {
  border: 0;
  margin: 0 0 18px;
  padding: 0;
  min-width: 0;
}

legend {
  font-weight: 700;
  padding: 0;
  margin-bottom: 8px;
}

.choices {
  display: grid;
  gap: 8px;
}

.choices.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

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

.choice-text {
  display: flex;
  flex-direction: column;
}

.choice-text small {
  color: var(--muted);
  font-size: 14px;
}

input[type='text'],
input[type='time'],
input[type='date'] {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.45);
  outline-offset: 2px;
}

input[aria-invalid='true'] {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.field {
  margin-bottom: 18px;
}

/* 체크박스 선택지(.choice)는 자체 배치를 쓰므로 뺀다. */
.field > label:not(.choice) {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

.hint {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 0;
}

.inline-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-row input {
  flex: 1;
}

.badge {
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 700;
}

.optional {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.lmax-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.lmax-grid input {
  padding: 8px 4px;
  text-align: center;
}

.form-error {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--danger-soft);
  color: #b91c1c;
  font-size: 15px;
  margin-bottom: 16px;
}

.form-error ul {
  margin: 4px 0 0;
  padding-left: 20px;
}

/* 버튼 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 10px 20px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-store {
  background: var(--text);
  color: #fff;
}

.store-links {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

/* 표 */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  padding-bottom: 8px;
}

/* 표 칸에서는 anywhere 대신 break-word: anywhere는 칸 최소 너비까지 줄여 '22:40~23:15' 같은 값을 쪼갠다. */
th,
td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: middle;
  overflow-wrap: break-word;
}

thead th {
  background: var(--primary-soft);
}

th small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.std-table td[data-std] {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
}

/* 판정 결과 */

.result-summary {
  padding: 14px 16px;
  border-radius: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.result-summary.over {
  background: #fee2e2;
  color: #991b1b;
}

.result-summary.ok {
  background: #dcfce7;
  color: #166534;
}

.result-items {
  display: grid;
  gap: 10px;
  margin: 12px 0 16px;
}

.result-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

.result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-weight: 700;
}

.status {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 14px;
}

.status.over {
  background: #fee2e2;
  color: #b91c1c;
}

.status.ok {
  background: #dcfce7;
  color: #166534;
}

.result-numbers {
  margin: 6px 0 0;
}

.result-note {
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 0;
}

.notice-box {
  background: #f8fafc;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text-sub);
  margin-bottom: 16px;
}

/* 앱 안내 */

.cta {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
  border-radius: 16px;
  padding: 20px 16px;
  margin: 0 0 16px;
}

.cta h2 {
  color: #fff;
}

.cta .btn {
  background: #fff;
  color: var(--primary-dark);
}

/* 글 */

.notes {
  padding-left: 20px;
  color: var(--text-sub);
  font-size: 15px;
}

.notes li + li {
  margin-top: 4px;
}

.toc ol {
  margin: 0;
  padding-left: 22px;
}

.step {
  scroll-margin-top: 12px;
}

.step-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  vertical-align: 2px;
}

.source {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}

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

dl.terms dt {
  font-weight: 700;
  margin-top: 10px;
}

dl.terms dd {
  margin: 2px 0 0;
  color: var(--text-sub);
}

/* A4 시트(안내문·기록표) */

.sheet {
  background: #fff;
  max-width: 210mm;
  margin: 0 auto 16px;
  padding: 28px 20px;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.sheet-title {
  font-size: 24px;
  text-align: center;
  margin: 0 0 20px;
}

.sheet-lines p {
  line-height: 1.85;
}

.sheet-tips {
  background: #f8fafc;
  border-radius: 8px;
  margin: 16px 0;
  padding: 14px 14px 14px 34px;
}

.sheet-tips li + li {
  margin-top: 4px;
}

.sheet-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-top: 24px;
}

.sheet-signature {
  margin: 0 0 0 auto;
  font-weight: 700;
}

.sheet-qr {
  width: 100px;
  margin: 0;
}

.sheet-qr figcaption {
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted);
  margin-top: 4px;
}

#qr-box svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

.qr-large {
  max-width: 220px;
  margin: 8px auto 0;
}

.diary-table {
  table-layout: fixed;
  font-size: 12px;
}

.diary-table th:nth-child(1) { width: 14%; }
.diary-table th:nth-child(2) { width: 15%; }
.diary-table th:nth-child(3) { width: 15%; }
.diary-table th:nth-child(4) { width: 11%; }
.diary-table th:nth-child(5) { width: 15%; }
.diary-table th:nth-child(6) { width: 15%; }
.diary-table th:nth-child(7) { width: 15%; }

.diary-table td {
  height: 13mm;
}

.diary-period {
  text-align: center;
  margin-bottom: 14px;
}

.sheet-credit {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  margin: 8px 0 0;
}

.example-table {
  min-width: 640px;
  font-size: 14px;
}

@media (min-width: 600px) {
  h1 {
    font-size: 30px;
  }

  .card,
  .cta {
    padding: 28px;
  }
}

@media (min-width: 700px) {
  .sheet {
    padding: 18mm 16mm;
  }
}

/* 인쇄 */

@page {
  size: A4;
  margin: 15mm;
}

@media print {
  body {
    background: #fff;
    font-size: 12pt;
  }

  .no-print,
  .site-header,
  .site-footer {
    display: none !important;
  }

  /* 표가 인쇄 영역 폭에 꼭 맞으면 바깥 테두리 절반이 영역 밖으로 나가 잘린다. 양옆에 1px을 남긴다. */
  .table-wrap {
    padding: 0 1px;
  }

  main {
    max-width: none;
    padding: 0;
  }

  .sheet {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .sheet-title {
    font-size: 20pt;
  }

  .sheet-qr {
    width: 30mm;
  }

  .sheet-qr figcaption {
    font-size: 8pt;
  }

  .diary-table {
    font-size: 9pt;
  }

  .sheet-credit {
    font-size: 8pt;
  }
}
