/* DESK 화면 스타일: 모든 화면이 함께 쓰는 것(색·머리줄·단추)과 로그인 화면. 밝은·어두운 화면 모두
   카드가 놓이는 메인 화면의 틀과 카드 바탕은 board.css, 카드마다의 모양은 cards/<카드>.css (메인 화면은 늘 어둡다)
   화면 틀·터치·가로 조건은 모든 서비스 공통 규칙 /srv/infra/shared/UX.md */
:root {
  --bg: #eef3f5;
  --card: #ffffff;
  --line: #d6e0e4;
  --text: #10212a;
  --dim: #4b6170;
  --faint: #617684;
  --accent: #0f6e7f;
  --accent-text: #ffffff;
  --accent-soft: #dcedf0;
  --glow: #8a5200;
  --good: #1d7a4c;
  --good-soft: #e2f3e9;
  --warn: #8a5300;
  --warn-soft: #fff1dc;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --shadow: 0 1px 2px rgba(10, 30, 40, .05), 0 2px 8px rgba(10, 30, 40, .06);
  --radius: 16px;
  --rail: 64px;
  /* 왼쪽·오른쪽 안전 여백: 아이폰은 가로일 때 아일랜드가 한쪽에만 있어도 양쪽에 같은 폭을 알려 준다.
     common.js가 돌린 방향을 보고 html.island-left/right를 붙이면 반대쪽은 0 */
  --sa-l: env(safe-area-inset-left, 0px);
  --sa-r: env(safe-area-inset-right, 0px);
  color-scheme: light dark;
}
html.island-left { --sa-r: 0px; }
html.island-right { --sa-l: 0px; }
/* 어두운 색: 기기 설정이 어둡고 '밝게'를 고르지 않았을 때, 또는 '어둡게'를 골랐을 때 (화면 모드는 theme.js가 <html data-theme>로 붙인다). 두 벌을 같이 고친다 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1a22;
    --card: #142a35;
    --line: #23404d;
    --text: #e8f1f4;
    --dim: #9fb6c1;
    --faint: #8aa2ad;
    --accent: #7fd3e0;
    --accent-text: #082028;
    --accent-soft: #173a47;
    --glow: #f3e6a1;
    --good: #67d29c;
    --good-soft: #13281e;
    --warn: #f0b660;
    --warn-soft: #2d2414;
    --bad: #ff8a80;
    --bad-soft: #321a19;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1a22;
  --card: #142a35;
  --line: #23404d;
  --text: #e8f1f4;
  --dim: #9fb6c1;
  --faint: #8aa2ad;
  --accent: #7fd3e0;
  --accent-text: #082028;
  --accent-soft: #173a47;
  --glow: #f3e6a1;
  --good: #67d29c;
  --good-soft: #13281e;
  --warn: #f0b660;
  --warn-soft: #2d2414;
  --bad: #ff8a80;
  --bad-soft: #321a19;
  --shadow: none;
}
/* 고른 쪽에 맞춰 입력칸·스크롤 막대 같은 브라우저 부품 색도 */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
/* touch-action: 두 손가락 확대를 막는다 (하루 종일 켜 두는 화면이 실수로 확대된 채 남지 않게). 밀기는 그대로 */
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; touch-action: pan-x pan-y; }
/* 문서는 튕기지도 스크롤되지도 않는다. 가운데 내용 칸만 움직인다 (UX.md '1. 화면 틀') */
html, body { overscroll-behavior: none; }
/* 누르는 것은 두 번 눌러도 확대되지 않게 (UX.md '7. 터치') */
a, button, summary, label, input, select { touch-action: manipulation; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  word-break: keep-all; overflow-wrap: anywhere; letter-spacing: -.005em; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2 { line-height: 1.3; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
small, .small { font-size: 13px; }
.muted { color: var(--dim); }
.ic { flex: none; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.top-spacer { flex: 1; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* 아이폰 홈 화면 앱(iOS 26~): 화면 맨 위에 고정된 띠가 없으면 아이폰이 머리줄 위에 뿌연 흐림을 덮는다.
   보이지 않는 고정 띠(.ios-edge, 각 HTML의 body 첫 줄)를 두면 흐림 대신 이 배경색으로 상태 표시줄 자리를 칠한다 (CHECKLIST F10) */
.ios-edge {
  position: fixed; top: 0; left: 0; right: 0; height: 11px; z-index: 2147483647; pointer-events: none;
  background-color: var(--bg); -webkit-background-clip: text; background-clip: text;
}
body.ak .ios-edge { background-color: var(--ak-card); }

/* ---- 화면 틀: 머리줄 · 내용 칸(이 칸만 스크롤) ---- */
body.main-page, body.login-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.top {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) max(16px, var(--sa-r)) 10px max(16px, var(--sa-l));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.view, .login-page main {
  flex: 1; min-height: 0; min-width: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; outline: none;
  padding: 16px max(16px, var(--sa-r)) calc(32px + env(safe-area-inset-bottom, 0px)) max(16px, var(--sa-l));
}
/* 카드 안 글자는 고르지 않는다 (끌어 넘기다 글자가 잡히지 않게). 입력칸은 그대로 */
.main-page .view { -webkit-user-select: none; user-select: none; }
.main-page input { -webkit-user-select: text; user-select: text; }
#app, #pending { max-width: 520px; margin: 0 auto; }
#app > .ak-install { margin-bottom: 16px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-height: 44px; }
.brand-mark { display: block; border-radius: 9px; flex: none; }
.brand-text { display: grid; line-height: 1.15; font-weight: 800; font-size: 18px; letter-spacing: .06em; }
.brand-text small { font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--dim); }
.count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--bad); color: var(--card); font-size: 11px; font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
@media (any-pointer: coarse) { .btn.small { min-height: 44px; } }
@media (hover: hover) { .btn.ghost:hover { background: var(--accent-soft); color: var(--text); } }
.top-btn { position: relative; white-space: nowrap; }
.top-btn.net { color: var(--warn); }
.top-label b { font-variant-numeric: tabular-nums; }
.top-chip { min-height: 44px; padding: 0 10px; border: 1px solid var(--glow); border-radius: 12px; background: none; color: var(--glow); font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; cursor: pointer; }
.pages { display: flex; gap: 2px; }
.pages button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; }
.pages i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.pages .on i { width: 10px; height: 22px; border-radius: 5px; background: var(--accent); }
/* 자료를 새로 받지 못하고 있으면 카드의 내용을 옅게 (시계는 그대로: 시계는 기기의 것이라 맞다) */
body.stale .card:not(.c-clock):not(.c-timer) { opacity: .55; }
/* 위 띠: 놓치면 안 되는 것. 누를 때까지 남는다. 천천히 밝아졌다 어두워진다 (움직임 줄이기를 켜면 가만히) */
.alert { position: fixed; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 900; display: flex; align-items: center; gap: 12px; max-width: min(92vw, 720px); padding: 6px 6px 6px 18px; border-radius: 999px; background: var(--glow); color: #1a1205; font-weight: 700; font-size: 16px; box-shadow: 0 4px 24px rgba(0, 0, 0, .45); animation: alert-breathe 2s ease-in-out infinite; }
:root[data-theme="light"] .alert { color: #fff; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .alert { color: #fff; } }
.alert-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: none; color: inherit; font: inherit; padding: 0; cursor: pointer; }
.alert .btn { flex: none; min-height: 44px; border-radius: 999px; }
@keyframes alert-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .78; } }
@media (prefers-reduced-motion: reduce) { .alert { animation: none; } }
/* 아주 좁은 화면(320px): 로고 아래 덧글을 숨겨 단추 자리를 남긴다 */
@media (max-width: 359px) { .brand-text small { display: none; } .top { gap: 2px; } }
/* 휴대폰 세로: 머리줄 단추는 그림만 (단추가 셋이라 글자까지 넣으면 넘친다) */
@media (orientation: portrait) and (max-width: 479px) { .top-label { display: none; } .top-btn.net .top-label { display: inline; } .top-btn { min-width: 44px; padding: 0 8px; } }
.round-btn {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer;
}
.round-btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
/* 눌림 표시: 터치 화면이라 누른 순간 옅어진다 (크기·바탕은 바꾸지 않는다. UX.md '7. 터치') */
.btn:active, .round-btn:active, .top-chip:active, .pages button:active { opacity: .55; }

.empty { padding: 14px 16px; border-radius: 12px; border: 1px dashed var(--line); color: var(--dim); font-size: 14px; }
.load-err { display: grid; justify-items: center; gap: 8px; margin: 48px auto; max-width: 360px; padding: 24px 20px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); text-align: center; }
.load-err .ic { color: var(--warn); }
.load-err .btn { margin-top: 8px; }

/* 창 안의 덧글과 뉴스 창(QR + 기사 열기) */
.sheet-note { font-size: 13px; color: var(--faint); }
.nw-open { display: grid; justify-items: center; gap: 12px; padding: 8px 0 4px; text-align: center; }
.nw-open svg { width: min(200px, 60vw); height: auto; background: #fff; padding: 10px; border-radius: 12px; }
/* 카드 설정 창의 카드 줄: 이름 · 앞으로 · 뒤로 · 크기 · 보임/숨김 */
.set-rows { display: grid; gap: 6px; margin-bottom: 16px; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.set-row b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-row.off b { color: var(--faint); }
.set-row .round-btn:disabled { opacity: .35; cursor: default; }
.set-row .show, .set-row .size { min-width: 60px; min-height: 44px; padding: 0 8px; }
.set-row .size[hidden] + .show { grid-column: 5; }
.set-row .up .ic, .set-row .down .ic { width: 20px; height: 20px; transform: rotate(90deg); }
.set-row .show[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* 서버 상태 점 (왼쪽 줄)과 그 창 */
.pulse-dot { display: grid; place-items: center; width: 12px; height: 12px; border-radius: 50%; background: var(--faint); color: #1a1205; font: 800 13px/1 system-ui, sans-serif; font-style: normal; }
#pulse-btn[data-level="ok"] .pulse-dot { background: var(--good); }
/* 색만으로 알리지 않는다: 주의는 세모, 위험은 네모 (안에 느낌표) */
#pulse-btn[data-level="warn"] .pulse-dot { width: 22px; height: 20px; border-radius: 0; background: #e0913a; clip-path: polygon(50% 0, 100% 100%, 0 100%); padding-top: 6px; font-size: 11px; }
#pulse-btn[data-level="crit"] .pulse-dot { width: 20px; height: 20px; border-radius: 4px; background: var(--bad); }
.ps { display: grid; gap: 12px; padding-bottom: 8px; }
.ps-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.ps-list li { padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.ps-list li.crit { background: var(--bad-soft); color: var(--bad); }
.ps-nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ps-nums div { display: grid; gap: 2px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 12px; text-align: center; }
.ps-nums small { color: var(--dim); } .ps-nums b { font-size: 18px; font-variant-numeric: tabular-nums; }
.ps .btn { justify-self: start; }

/* ---- 로그인·가입 신청 ---- */
.login-page main { padding-top: 8vh; }
.login-page main > * { max-width: 420px; margin-left: auto; margin-right: auto; }
.login-head { text-align: center; margin-bottom: 20px; display: grid; justify-items: center; gap: 6px; }
.login-head .brand-mark { border-radius: 14px; }
.login-head h1 { font-size: 26px; letter-spacing: .08em; }
.login-page .card { display: block; padding: 16px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); font-size: 16px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); margin-bottom: 16px; }
.tabs button { min-height: 44px; border: 0; border-radius: 9px; background: none; color: var(--dim); font: inherit; font-weight: 600; cursor: pointer; }
.tabs button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.form { display: grid; gap: 14px; }
.form label, .pw-field { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.form label small { font-weight: 400; color: var(--dim); }
.form input {
  width: 100%; min-width: 0; min-height: 48px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font: inherit; font-size: 16px; font-weight: 400;
}
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 72px; }
.pw-eye { position: absolute; right: 2px; top: 50%; margin-top: -22px; min-width: 60px; min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--accent); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.msg { margin: 12px 0 0; font-size: 14px; color: var(--bad); }
.msg:empty { display: none; }
/* 터치가 되는 기기에서는(윈도우 PC에 붙인 터치 모니터는 주 입력이 마우스라 any-pointer로 본다) 폭과 상관없이 입력칸 글자 16px 이상 (아이폰이 화면을 확대하지 않게. UX.md '6. 입력칸') */
@media (any-pointer: coarse) { input, select, textarea { font-size: 16px; } }

/* ==== 가로 화면 (바 모니터·휴대폰 가로·PC): 머리줄은 왼쪽 세로 줄로, 카드는 화면 높이를 다 쓰고 옆으로 넘긴다 ====
   내용 칸(.view) 하나만 스크롤되는 것은 같다: 세로 화면은 위아래, 가로 화면은 옆으로 */
@media (orientation: landscape) {
  body.main-page { flex-direction: row; --ak-rail-l: var(--rail); }
  .main-page .top {
    flex-direction: column; gap: 4px; width: calc(var(--rail) + var(--sa-l)); border-bottom: 0; border-right: 1px solid var(--line);
    padding: max(8px, env(safe-area-inset-top)) 6px max(8px, env(safe-area-inset-bottom)) calc(6px + var(--sa-l));
  }
  .main-page .brand-text { display: none; }
  /* 왼쪽 줄 단추: 그림 아래에 작은 글자 (그림만으로는 무엇인지 알기 어렵다) */
  .main-page .top-btn { flex-direction: column; gap: 2px; width: 56px; min-height: 52px; padding: 4px 0; font-size: 11px; font-weight: 600; }
  .main-page .pages { flex-direction: column; }
  .main-page .top-chip { width: 56px; padding: 0; font-size: 13px; }
  .main-page .brand { min-width: 44px; justify-content: center; }
  .main-page .top-btn .count { position: absolute; top: 0; right: 2px; margin: 0; }
}

/* ==== 휴대폰 가로 화면 (모든 서비스가 같은 조건. UX.md '5. 가로 모드 조건'): 로그인은 로고 왼쪽·카드 오른쪽 ==== */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 560px) {
  /* 낮은 가로 화면(휴대폰): 왼쪽 줄에 쪽 점까지 넣으면 넘친다 → 점은 숨긴다 (손가락으로 넘기면 된다) */
  .main-page .pages { display: none; }
  .login-page main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; align-items: start; padding-top: 16px; }
  .login-page main > * { max-width: 420px; margin: 0; width: 100%; }
  .login-head { margin-bottom: 0; justify-self: end; align-self: center; }
  .login-page .card { padding: 12px; }
  .login-page .tabs { margin-bottom: 10px; }
  .login-page .form { gap: 8px; }
  .login-page .form input { min-height: 44px; }
}
