/* DESK 화면 스타일: 밝은·어두운 화면 모두
   색: 청록(어두운 화면이 책상 위 바 모니터의 기본 모습). 숫자(시각·기온)는 고정폭 숫자
   카드 안의 크기는 모두 --u의 배수다: app.js fit()이 화면 높이(가로)·폭(세로)에 맞춰 --u를 정한다 → 515px 바 모니터와 휴대폰 가로가 같은 비율로 보인다
   화면 틀·터치·가로 조건은 모든 서비스 공통 규칙 /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(.clock):not(.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, .todo-main:active, .todo-del:active, .nw-row:active, .ag-past:active, .top-chip:active, .pages button:active { opacity: .55; }
.main-page .card .btn[aria-pressed="true"] { border-width: 2px; }

.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; }

/* ---- 카드 (크기는 --u의 배수. 기본값은 app.js가 맞추기 전 잠깐 쓰인다) ---- */
.view { --u: 9px; --n: 1; --gap: 12px; }
.board { display: grid; gap: var(--gap); grid-auto-rows: max-content; }
.card {
  display: flex; flex-direction: column; min-width: 0; padding: calc(var(--u) * 2.2) calc(var(--u) * 2.4);
  border-radius: calc(var(--u) * 2.2); background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--line);
  font-size: max(13px, calc(var(--u) * 1.7)); font-variant-numeric: tabular-nums;
}
.card h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: max(13px, calc(var(--u) * 1.6)); font-weight: 600; color: var(--dim); margin-bottom: calc(var(--u) * 1); }
.card h2 small { font-size: max(12px, calc(var(--u) * 1.4)); font-weight: 500; color: var(--faint); white-space: nowrap; }
.card h2 small.warn { color: var(--warn); }
.h2-right { display: flex; gap: 8px; align-items: baseline; }
.h2-right small:empty { display: none; }
.card-msg { font-size: max(15px, calc(var(--u) * 2)); font-weight: 600; margin-top: calc(var(--u) * 2); }
.card-sub { font-size: max(12px, calc(var(--u) * 1.4)); color: var(--faint); }
.card .ic { width: calc(var(--u) * 2.6); height: calc(var(--u) * 2.6); }
.main-page .card .btn { flex: 1; min-width: 0; padding: 0 4px; font-size: max(14px, calc(var(--u) * 1.7)); min-height: max(44px, calc(var(--u) * 5.2)); border-radius: calc(var(--u) * 1.4); }
.main-page .card .round-btn { width: max(44px, calc(var(--u) * 5)); height: max(44px, calc(var(--u) * 5)); }

/* 시계 */
.clock-time { text-align: center; font-size: calc(var(--u) * 9.5); font-weight: 600; line-height: 1.05; color: var(--glow); letter-spacing: -.02em; white-space: nowrap; }
.clock-time small { font-size: calc(var(--u) * 2.6); font-weight: 500; margin-left: calc(var(--u) * .6); opacity: .75; letter-spacing: 0; }
.clock-date { text-align: center; font-size: max(14px, calc(var(--u) * 2.1)); color: var(--dim); margin: calc(var(--u) * .6) 0 calc(var(--u) * 1.2); }
.clock-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-height: 0; }
.clock-chips:not(:empty) { margin-bottom: calc(var(--u) * 1.2); }
.chip { padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: max(12px, calc(var(--u) * 1.45)); font-weight: 600; white-space: nowrap; }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.glow { color: var(--glow); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; padding: calc(var(--u) * 1) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: calc(var(--u) * .6); }
.week-day { display: grid; justify-items: center; gap: 2px; line-height: 1.2; }
.week-day small { font-size: max(11px, calc(var(--u) * 1.3)); color: var(--faint); }
.week-day b { display: grid; place-items: center; width: calc(var(--u) * 3.4); height: calc(var(--u) * 3.4); min-width: 26px; min-height: 26px; border-radius: 50%; font-size: max(13px, calc(var(--u) * 1.8)); font-weight: 600; }
.week-day.sun b, .week-day.sun small { color: var(--up); } .week-day.sat b, .week-day.sat small { color: var(--down); }
.week-day.today b { background: var(--accent); color: var(--accent-text); }
.week-day i { width: 5px; height: 5px; border-radius: 50%; }
.week-day i.on { background: var(--glow); }
.world { flex: 1; display: flex; flex-direction: column; }
.world-row { flex: 1; max-height: calc(var(--u) * 7); display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding: calc(var(--u) * .6) 0; }
.world-row:first-child { border-top: 0; }
.world-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; line-height: 1.25; }
.world-name b { font-size: max(14px, calc(var(--u) * 2)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.world-name small { font-size: max(12px, calc(var(--u) * 1.35)); color: var(--faint); }
.world-time { flex: none; font-size: calc(var(--u) * 3.2); font-weight: 600; line-height: 1.1; }

/* 날씨 */
.wx { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.wx-now { display: flex; align-items: center; gap: calc(var(--u) * 1.6); }
.wx-temp { font-size: calc(var(--u) * 8); font-weight: 600; line-height: 1.05; letter-spacing: -.03em; }
.wx-now > .ic { width: calc(var(--u) * 6); height: calc(var(--u) * 6); color: var(--glow); stroke-width: 1.6; }
.wx-text { display: grid; min-width: 0; line-height: 1.3; }
.wx-text b { font-size: max(15px, calc(var(--u) * 2.2)); }
.wx-text span { font-size: max(12px, calc(var(--u) * 1.45)); color: var(--dim); }
.wx-days { flex: 1; display: flex; flex-direction: column; margin-top: calc(var(--u) * 1); }
.wx-day { flex: 1; max-height: calc(var(--u) * 8); display: grid; grid-template-columns: 3em auto minmax(0, 1fr) 2.6em 2.6em; align-items: center; gap: calc(var(--u) * 1); border-top: 1px solid var(--line); padding: calc(var(--u) * .7) 0; font-size: max(13px, calc(var(--u) * 1.8)); }
.wx-pop { font-size: max(12px, calc(var(--u) * 1.35)); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-hi, .wx-lo { text-align: right; }
.wx-lo { color: var(--faint); }

/* 달력 */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: calc(var(--u) * .8); }
.cal-mid { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; min-width: 0; }
.cal-title { font-size: max(15px, calc(var(--u) * 2.1)); font-weight: 600; white-space: nowrap; }
.main-page .card .cal-home { flex: none; min-height: 44px; padding: 0 12px; }
.cal-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(calc(var(--u) * 4.4), 1fr); text-align: center; font-size: max(13px, calc(var(--u) * 1.9)); }
.cal-grid > div { display: grid; place-items: center; position: relative; }
/* 일정이 있는 날: 숫자 아래 점 */
.cal-day.has::after { content: ""; position: absolute; bottom: 12%; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--glow); }
.cal-dow { font-size: max(12px, calc(var(--u) * 1.4)); color: var(--faint); }
.cal-grid .sun { color: var(--up); }
.cal-grid .sat { color: var(--down); }
.cal-day.today span { display: grid; place-items: center; width: calc(var(--u) * 4); height: calc(var(--u) * 4); border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 700; }

/* 할 일 */
.todo-add { display: flex; gap: 8px; margin-bottom: calc(var(--u) * .8); }
.todo-add input {
  flex: 1; min-width: 0; min-height: max(44px, calc(var(--u) * 5)); padding: 0 12px; border-radius: max(12px, calc(var(--u) * 1.4)); border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font: inherit; font-size: max(16px, calc(var(--u) * 1.8)); font-weight: 400;
}
.todo-list { list-style: none; margin: 0; padding: 0; outline: none; }
.todo-list li { display: flex; align-items: stretch; border-top: 1px solid var(--line); min-width: 0; }
.todo-list li:first-child { border-top: 0; }
.todo-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: calc(var(--u) * 1.2); min-height: max(44px, calc(var(--u) * 5)); padding: 4px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.todo-box { flex: none; display: grid; place-items: center; width: calc(var(--u) * 2.8); height: calc(var(--u) * 2.8); min-width: 22px; min-height: 22px; border: 2px solid var(--faint); border-radius: 7px; }
.todo-box .ic { width: 80%; height: 80%; stroke-width: 3; }
.todo-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-list .done .todo-text { text-decoration: line-through; color: var(--faint); }
.todo-list .done .todo-box { background: var(--good); border-color: var(--good); color: var(--card); }
.todo-del { flex: none; display: grid; place-items: center; width: 44px; min-height: 44px; border: 0; background: none; color: var(--faint); cursor: pointer; }
.todo-del .ic { width: 20px; height: 20px; }
.todo-empty { padding: calc(var(--u) * 1.6) 0; color: var(--faint); border-top: 0; }
@media (hover: hover) { .todo-del:hover { color: var(--bad); } }

/* TickTick 할 일: 기한·중요 표시 */
.todo-main .todo-due { flex: none; margin-left: auto; padding-left: 6px; font-size: max(12px, calc(var(--u) * 1.35)); color: var(--faint); white-space: nowrap; }
.todo-due.today { color: var(--accent); font-weight: 600; }
.todo-due.late { color: var(--bad); font-weight: 600; }
.todo-list .high .todo-box { border-color: var(--bad); }
.card-sub.warn { color: var(--warn); margin-bottom: calc(var(--u) * .6); }
.card-acts { display: flex; margin-top: calc(var(--u) * 1.6); }
.card-acts .btn { flex: none; padding: 0 16px; }

/* 일정: 날짜 머리 + 줄(시각 · 캘린더 색 점 · 제목과 덧글) */
.ag, .nw { outline: none; }
.ag h3 { margin: calc(var(--u) * 1.4) 0 calc(var(--u) * .4); font-size: max(12px, calc(var(--u) * 1.45)); font-weight: 600; color: var(--faint); }
.ag h3:first-child { margin-top: 0; }
.ag-none { color: var(--faint); padding: calc(var(--u) * .6) 0; }
/* 다음 일정(또는 지금 하고 있는 일정): 남은 시간이 가장 크다. 10분 안이면 왼쪽에 띠 */
.ag-hero { display: grid; gap: 2px; padding: calc(var(--u) * 1.4) calc(var(--u) * 1.6); margin-bottom: calc(var(--u) * 1.4); border-radius: calc(var(--u) * 1.4); background: var(--accent-soft); border-left: 6px solid transparent; line-height: 1.25; min-width: 0; }
.ag-hero small { font-size: max(12px, calc(var(--u) * 1.4)); color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-hero small:empty { display: none; }
.ag-hero-when { font-size: calc(var(--u) * 4); font-weight: 600; color: var(--glow); letter-spacing: -.01em; }
.ag-hero-title { font-size: max(15px, calc(var(--u) * 2.1)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-hero.soon, .ag-hero.going { border-left-color: var(--glow); }
.ag-then { margin: calc(var(--u) * -.6) 0 calc(var(--u) * 1.2); font-size: max(12px, calc(var(--u) * 1.45)); color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-past { display: block; width: 100%; min-height: 44px; padding: 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--faint); font: inherit; font-size: max(12px, calc(var(--u) * 1.45)); text-align: left; cursor: pointer; }
.ag-row { display: grid; grid-template-columns: 3.2em calc(var(--u) * 1) minmax(0, 1fr); align-items: baseline; gap: calc(var(--u) * 1); padding: calc(var(--u) * .75) 0; border-top: 1px solid var(--line); }
.ag h3 + .ag-row { border-top: 0; }
.ag-time { color: var(--dim); white-space: nowrap; }
.ag-dot { align-self: center; width: calc(var(--u) * 1); height: calc(var(--u) * 1); min-width: 7px; min-height: 7px; border-radius: 50%; background: var(--accent); }
.ag-dot.s1 { background: #b86a12; } .ag-dot.s2 { background: #8a55d6; } .ag-dot.s3 { background: #2f8f52; } .ag-dot.s4 { background: #c9446a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ag-dot.s1 { background: #e0913a; } :root:not([data-theme="light"]) .ag-dot.s2 { background: #b07cf0; } :root:not([data-theme="light"]) .ag-dot.s3 { background: #5fbf7a; } :root:not([data-theme="light"]) .ag-dot.s4 { background: #e56b8a; } }
:root[data-theme="dark"] .ag-dot.s1 { background: #e0913a; } :root[data-theme="dark"] .ag-dot.s2 { background: #b07cf0; } :root[data-theme="dark"] .ag-dot.s3 { background: #5fbf7a; } :root[data-theme="dark"] .ag-dot.s4 { background: #e56b8a; }
.ag-text { display: grid; min-width: 0; line-height: 1.3; }
.ag-text b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-text small { font-size: max(12px, calc(var(--u) * 1.35)); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-row.past b, .ag-row.past .ag-time { color: var(--faint); font-weight: 400; }
.ag-row.past .ag-dot { opacity: .5; }
.ag-row.next .ag-time, .ag-row.next .ag-text small { color: var(--glow); font-weight: 600; }

/* 뉴스: 제목 두 줄까지 + 매체·나온 때 */
.nw-row { display: grid; gap: 2px; width: 100%; min-height: 44px; padding: calc(var(--u) * .9) 0; border: 0; border-top: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.nw-row:first-child { border-top: 0; }
.nw-row b { font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.nw-row small { font-size: max(12px, calc(var(--u) * 1.3)); color: var(--faint); }
@media (hover: hover) { .nw-row:hover b { color: var(--accent); } }
.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; 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 { min-width: 64px; min-height: 44px; }
.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); }

/* 사진 슬라이드쇼: 카드를 가득 채운다. 흐린 같은 사진을 깔고(가로·세로 사진 모두 빈 띠 없이) 그 위에 사진을 잘리지 않게 얹는다 */
.card.photos { position: relative; padding: 0; overflow: hidden; min-height: calc(var(--u) * 46); background: #0b1318; color: #fff; }
.ph-layer { position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s ease; }
.ph-layer.on { opacity: 1; }
.ph-layer img { position: absolute; inset: 0; width: 100%; height: 100%; }
.ph-layer img:first-child { object-fit: cover; filter: blur(24px) brightness(.4) saturate(1.2); transform: scale(1.15); }
.ph-layer img:last-child { object-fit: contain; }
.ph-layer img:not([src]) { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .ph-layer { transition: none; } }
.card.photos .card-msg { position: relative; margin: auto; padding: 0 calc(var(--u) * 3); text-align: center; color: #c9d6dc; }
.ph-hit { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; border: 0; background: none; padding: 0; color: #fff; cursor: pointer; }
.ph-hit .ic { width: 28px; height: 28px; opacity: 0; transition: opacity .2s; filter: drop-shadow(0 0 4px rgba(0, 0, 0, .7)); }
.card.photos.hint .ph-hit .ic { opacity: .9; }
.ph-hit.prev { left: 0; width: 25%; } .ph-hit.mid { left: 25%; width: 50%; } .ph-hit.next { right: 0; width: 25%; }
.ph-hit:focus-visible { outline-offset: -4px; }
.ph-foot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; gap: 8px; padding: calc(var(--u) * 3) calc(var(--u) * 2) calc(var(--u) * 1.4); background: linear-gradient(transparent, rgba(0, 0, 0, .55)); font-size: max(12px, calc(var(--u) * 1.5)); pointer-events: none; }
.ph-foot:has(.ph-cap:empty):has(.ph-state[hidden]) { display: none; }
.ph-state { font-weight: 700; }

/* 시세: 이름 · 값 · 등락률 (오르면 빨강, 내리면 파랑) */
:root { --up: #c9342c; --down: #1f5fd0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --up: #ff8177; --down: #74aaff; } }
:root[data-theme="dark"] { --up: #ff8177; --down: #74aaff; }
.mk { outline: none; }
.mk h3 { margin: calc(var(--u) * 1.4) 0 calc(var(--u) * .2); font-size: max(12px, calc(var(--u) * 1.45)); font-weight: 600; color: var(--faint); }
.mk-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 5.2em; align-items: baseline; gap: calc(var(--u) * 1); padding: calc(var(--u) * .8) 0; border-top: 1px solid var(--line); }
.mk-row:first-child, .mk h3 + .mk-row, .mk .card-sub + .mk-row { border-top: 0; }
.mk-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-name small { margin-left: 6px; font-size: max(11px, calc(var(--u) * 1.2)); color: var(--faint); }
.mk-price { font-weight: 600; }
.mk-chg { text-align: right; font-weight: 600; color: var(--faint); }
.mk-row.up .mk-chg { color: var(--up); } .mk-row.down .mk-chg { color: var(--down); }
.mk-row.closed .mk-price { color: var(--dim); font-weight: 400; }

/* 서버 상태 점 (왼쪽 줄)과 그 창 */
.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; }

/* 타이머 */
/* 쉴 때는 옅고 작게, 돌 때는 강조색, 끝나면 빨강 (멈춰 있는 타이머가 시계보다 눈에 띄지 않게) */
.timer-time { flex: 1; display: grid; place-items: center; padding: calc(var(--u) * 2) 0; font-size: calc(var(--u) * 8); font-weight: 600; line-height: 1; letter-spacing: -.02em; color: var(--dim); }
.timer-time.run { color: var(--glow); font-size: calc(var(--u) * 9.5); }
.timer-time.end { color: var(--bad); }
.timer-row { display: flex; gap: 8px; margin-top: 8px; }

/* ---- 로그인·가입 신청 ---- */
.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); border: 0; 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; }
  .main-page .view {
    overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gap); scrollbar-width: none;
    /* 오른쪽 여백은 여기 두지 않는다: 옆으로 미는 칸은 끝 여백이 스크롤 끝에 붙지 않는다 → 카드 줄 끝의 빈 칸(.board::after)으로 준다 */
    --pr: max(var(--gap), var(--sa-r));
    padding: max(var(--gap), env(safe-area-inset-top)) 0 max(var(--gap), env(safe-area-inset-bottom)) var(--gap);
  }
  .main-page .view::-webkit-scrollbar { display: none; }
  .main-page .view.dragging { scroll-snap-type: none; cursor: grabbing; }
  .main-page #app { max-width: none; height: 100%; }
  /* 설치 안내는 가로 화면에서 카드 높이를 깎으므로 숨긴다 ('내 계정' 창에 설치 단추가 있다) */
  .main-page #app > .ak-install { display: none; }
  .main-page .board { display: flex; height: 100%; }
  .main-page .board::after { content: ""; flex: 0 0 var(--pr); margin-left: calc(var(--gap) * -1); }
  /* 한 화면(카드 n장)씩 멈춘다: app.js drawPages가 쪽의 첫 카드에 .snap, 마지막 카드에 .snap-end를 붙인다 */
  .main-page .card { flex: 0 0 calc((100% - var(--pr) - (var(--n) - 1) * var(--gap)) / var(--n)); overflow: hidden; }
  .main-page .card.snap { scroll-snap-align: start; scroll-snap-stop: always; }
  .main-page .card.snap-end:not(.snap) { scroll-snap-align: end; }
  .main-page .load-err, .main-page .board > .empty { margin: auto; }
  /* 할 일·일정·뉴스가 카드보다 길면 목록만 그 안에서 밀린다 */
  .main-page .todo-list, .main-page .ag, .main-page .nw, .main-page .mk { -webkit-mask-image: linear-gradient(#000 calc(100% - var(--u) * 3), transparent); mask-image: linear-gradient(#000 calc(100% - var(--u) * 3), transparent); padding-bottom: calc(var(--u) * 3); flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: none; }
  .main-page .todo-list::-webkit-scrollbar, .main-page .ag::-webkit-scrollbar, .main-page .nw::-webkit-scrollbar, .main-page .mk::-webkit-scrollbar { display: none; }
  .main-page .timer-time { padding: 0; }
  .main-page .card.photos { min-height: 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; }
}
