/* 세 화면이 함께 쓰는 바탕. 색 · 글자 · 간격의 정본은 DESIGN.md.
   판은 기기 설정을 따른다(어두운 모드 → 어두운 판). 신호색은 녹색 하나. */
@font-face {
  font-family: 'Barlow Digits';
  src: url('/assets/fonts/barlow-condensed-600-digits.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
  unicode-range: U+20, U+2F-3A;
}

:root {
  color-scheme: dark light;
  --bg: #131416;
  --surface: #1b1c1f;
  --surface-2: #232428;
  --text: #e8e6e1;
  --text-2: #9b988f;
  --line: #26272b;
  --ctl: #6e6c66;
  --live: #4cc38a;
  --live-ink: #6fd3a0;
  --live-fill: #1f7a52;
  --live-on: #ffffff;
  --live-tint: #1d3a2c;
  --live-edge: #2e7d57;
  --warn-ink: #e0b072;
  --warn-tint: #3a2f1d;
  --scrim: rgba(0, 0, 0, 0.66);
  --font: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --digits: 'Barlow Digits', var(--font);
  --gutter: 16px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f3ef;
    --surface: #ffffff;
    --surface-2: #ebe9e4;
    --text: #1d1d1f;
    --text-2: #5f5d58;
    --line: #dddad3;
    --ctl: #8a877f;
    --live: #17874f;
    --live-ink: #17734a;
    --live-tint: #dcefe4;
    --live-edge: #2f8f63;
    --warn-ink: #8a5a12;
    --warn-tint: #f6ead6;
    --scrim: rgba(0, 0, 0, 0.4);
  }
}

@media (min-width: 375px) {
  :root {
    --gutter: 20px;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.digits {
  font-family: var(--digits);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* 상태 표시 점 — 채운 점 = 지금 그런 상태, 빈 점 = 사실 한 줄. 색만으로 말하지 않고 글자가 늘 함께 있다. */
.dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--ctl);
}

.dot.is-on {
  background: var(--live);
  box-shadow: none;
}

.dot.is-warn {
  background: var(--warn-ink);
  box-shadow: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 단추 — 채움(가장 중요한 하나) · 테두리(그 밖). 높이 48px 이상. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--ctl);
}

a.btn {
  text-decoration: none;
}

.btn.is-primary {
  background: var(--text);
  color: var(--bg);
  box-shadow: none;
}

.btn.is-live {
  background: var(--live-fill);
  color: var(--live-on);
  box-shadow: none;
}

.btn:disabled {
  background: transparent;
  color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.btn.is-quiet {
  background: none;
  box-shadow: none;
  color: var(--text-2);
  padding: 0 12px;
}

@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover {
    filter: brightness(1.12);
  }
}

/* 확인 창 — 되돌릴 수 없는 동작은 한 번 더 묻는다. 열리면 초점은 「취소」. */
dialog.confirm {
  width: min(420px, calc(100vw - 32px));
  padding: 24px;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
}

dialog.confirm::backdrop {
  background: var(--scrim);
}

dialog.confirm h2 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
}

dialog.confirm p {
  margin-top: 8px;
  color: var(--text-2);
}

dialog.confirm blockquote {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  font-weight: 600;
}

dialog.confirm .actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

/* 로그인(관리자 · 게스트) */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px var(--gutter);
}

.login form {
  width: min(380px, 100%);
}

.login h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.login .lede {
  margin-top: 6px;
  color: var(--text-2);
}

.field {
  display: block;
  margin-top: 20px;
}

.field > span {
  display: block;
  font-size: 15px;
  color: var(--text-2);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.login .btn {
  width: 100%;
  margin-top: 24px;
}

.form-error {
  min-height: 24px;
  margin-top: 12px;
  font-size: 15px;
  color: var(--warn-ink);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
