/* ===== 색상 토큰 (라이트 / 다크) ===== */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --subtle: #f3f5f8;
  --seg: #eceef1;
  --ink: #111827;
  --ink-2: #4b5563;
  --muted: #9ca3af;
  --line: #e5e7eb;
  --accent: #2563eb;
  --up: #e11d48;      /* 상승: 빨강 (국내 표기 관례) */
  --down: #2563eb;    /* 하락: 파랑 */
  --tip-bg: #111827;
  --tip-ink: #ffffff;
  --tip-dim: #cbd5e1;
  --umb-off: #b6bdc8;
  --holiday: #e11d48;
  --saturday: #2563eb;
  --google: #4285f4;
  --naver: #03c75a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #171a21; --subtle: #1f232c; --seg: #232833;
    --ink: #e8eaee; --ink-2: #a3aab8; --muted: #6b7280; --line: #2a2f3a;
    --accent: #60a5fa; --up: #fb7185; --down: #60a5fa;
    --tip-bg: #e8eaee; --tip-ink: #111827; --tip-dim: #4b5563; --umb-off: #4b5563;
    --holiday: #fb7185; --saturday: #60a5fa;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a21; --subtle: #1f232c; --seg: #232833;
  --ink: #e8eaee; --ink-2: #a3aab8; --muted: #6b7280; --line: #2a2f3a;
  --accent: #60a5fa; --up: #fb7185; --down: #60a5fa;
  --tip-bg: #e8eaee; --tip-ink: #111827; --tip-dim: #4b5563; --umb-off: #4b5563;
  --holiday: #fb7185; --saturday: #60a5fa;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
  color-scheme: dark;
}

/* ===== 기본 ===== */
* { box-sizing: border-box; }
html, body { margin: 0; }
/* 아이폰이 글자를 키우거나, 튀어나온 요소 때문에 화면 폭을 넓히지 않도록 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.wrap { position: relative; max-width: 1400px; margin: 0 auto; padding: 56px 16px 48px; overflow-x: clip; }
.sec { margin-bottom: 40px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.sec-head h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.sec-head .sub { color: var(--muted); font-size: 13px; margin-left: 8px; font-weight: 400; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; min-width: 0;
}
.skeleton { color: var(--muted); font-size: 14px; padding: 8px 0; }
.err { color: var(--up); font-size: 13px; }
.note { font-size: 12px; color: var(--muted); margin-top: 10px; }
.note a { color: var(--accent); text-decoration: none; font-weight: 600; white-space: nowrap; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.btn-text {
  border: 0; background: transparent; color: var(--ink-2); font-size: 13px; cursor: pointer;
  padding: 6px 10px; border-radius: 8px;
}
.btn-text:hover { background: var(--subtle); color: var(--ink); }
.btn-text[aria-pressed="true"] { color: var(--accent); font-weight: 600; }
.field {
  width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  padding: 9px 12px; font-size: 15px; outline: none;
}
.field:focus { border-color: var(--accent); }
/* 아이폰은 16px보다 작은 입력 상자를 누르면 화면을 확대하므로, 터치 기기에서는 16px로 */
@media (hover: none) and (pointer: coarse) { .field { font-size: 16px; } }

/* 세그먼트 탭 */
.seg { display: inline-flex; flex-wrap: wrap; background: var(--seg); border-radius: 10px; padding: 3px; }
.seg button {
  border: 0; background: transparent; font-size: 13px; color: var(--ink-2);
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ===== 다크 모드 토글 ===== */
.theme-btn {
  position: fixed; z-index: 5; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.theme-btn svg { width: 20px; height: 20px; }
.theme-btn:hover { color: var(--ink); }

/* ===== 화면 항목 설정 (왼쪽 위 ☰) ===== */
.menu-btn {
  position: fixed; z-index: 5; top: 16px; left: 16px; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.menu-btn svg { width: 20px; height: 20px; }
.menu-btn:hover { color: var(--ink); }
.parts {
  width: min(340px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 20px 20px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  box-shadow: 0 12px 40px rgba(0,0,0,.18); overflow-y: auto;
}
/* 다크 모드에서는 팝업을 바탕보다 조금 밝게 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .parts { --surface: #323846; --line: #434a59; --subtle: #3c4352; --muted: #959cab; }
}
:root[data-theme="dark"] .parts { --surface: #323846; --line: #434a59; --subtle: #3c4352; --muted: #959cab; }
.parts::backdrop { background: rgba(15,17,21,.45); }
.parts-head { display: flex; align-items: center; justify-content: space-between; }
.parts-head h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.parts-x { border: 0; background: transparent; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.parts-x:hover { color: var(--ink); }
.parts-note { text-align: center; margin: 6px 0 10px; font-size: min(12.5px, 3.1vw); letter-spacing: -.02em; white-space: nowrap; color: var(--muted); }
/* 안내문 속 손잡이 모양: 글자(⋮⋮)는 아이폰에서 점 사이가 벌어지므로 실제 손잡이와 같은 그림을 씀 */
.note-grip { width: 1.25em; height: 1.25em; vertical-align: -.3em; margin: 0 -.1em; }
/* 팝업을 열 때 닫기(×) 버튼이 아니라 팝업 자체에 초점을 두므로, 팝업 테두리에 초점 표시를 그리지 않음 */
.parts:focus { outline: none; }
.parts-list { list-style: none; margin: 0; padding: 0; }
.parts-list li { display: flex; align-items: center; gap: 10px; }
.parts-list li + li { border-top: 1px solid var(--line); }
.parts-list { position: relative; }
.parts-list li { background: var(--surface); }
.part-grip {
  flex: none; width: 28px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none;
}
.part-grip svg { width: 18px; height: 18px; }
.part-grip:hover, .part-grip:focus-visible { color: var(--ink-2); background: var(--subtle); }
.parts-list.sorting, .parts-list.sorting * { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.parts-list li.dragging {
  position: relative; z-index: 1; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.18);
  border-top-color: transparent;
}
.parts-list li.dragging + li { border-top-color: transparent; }
.switch-row { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 2px; font-size: 15px; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { position: relative; flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--umb-off); transition: background-color .15s; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s;
}
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(18px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.parts-foot { display: flex; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }

/* 화면 항목 순서: 각 항목의 order와 숨기기는 index.html의 applyParts()가 정함 */
.wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 16px; }
.wrap > * { grid-column: 1 / -1; min-width: 0; }
.wrap > footer { order: 99; }
/* 맨 위 환영 배너: 바탕이 투명한 이미지라 라이트·다크 모드 모두 화면 바탕색이 그대로 비침 */
.wrap > .banner { display: block; width: 100%; max-width: 860px; height: auto; margin: 0 auto 20px; }
/* 할 일과 달력이 붙어 있으면 한 줄에 나란히 */
[data-pair] .wrap > [data-part="todo"], [data-pair] .wrap > [data-part="calendar"] { grid-column: auto; }
[data-pair] [data-part="todo"] > .card, [data-pair] [data-part="calendar"] > .card { height: calc(100% - 46px); }
/* 시세 바로 아래 환율 계산기는 간격을 좁게 */

/* ===== 날짜 · 시간 · 세계 시각 ===== */
/* 시계: 위로 스크롤하다가 위쪽 버튼 높이에 닿으면 멈춰서 날짜·시간이 항상 보이게 */
.clock {
  position: sticky; top: 0; z-index: 4; text-align: center; padding: 14px 0 7px; margin-bottom: 18px;
  background: var(--bg); box-shadow: 0 0 0 100vmax var(--bg); clip-path: inset(0 -100vmax -12px);
}
/* 시계 아래로 지나가는 내용이 뚝 잘려 보이지 않도록 살짝 흐리게. 높이(12px)는 시계 아래 여백(18px)보다 작게 해야 검색창 위쪽(초점 테두리 4px 포함)을 덮지 않음 */
.clock::after { content: ""; position: absolute; left: -100vmax; right: -100vmax; top: 100%; height: 12px; background: linear-gradient(var(--bg), transparent); pointer-events: none; }
.date { font-size: 17px; color: var(--ink-2); letter-spacing: -.01em; }
.time {
  font-size: clamp(52px, 9vw, 88px); font-weight: 700; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 6px;
}
.time .ampm { font-size: .5em; letter-spacing: -.02em; margin-right: .25em; vertical-align: .72em; } /* 글자 윗선을 숫자 윗선에 맞춤 */
.time .sec-s { color: var(--muted); font-weight: 500; font-size: .45em; letter-spacing: -.01em; margin-left: 6px; }
/* 현재 시간 오른쪽의 국제도시 시간보기 버튼: 시간은 가운데 그대로 두고 버튼만 오른쪽에 붙임 */
.time-row { position: relative; display: inline-block; }
.world-btn {
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 10px;
  width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.world-btn svg { width: 18px; height: 18px; }
.world-btn:hover { color: var(--ink-2); }
.world-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
/* 끈 상태에서는 국제도시 시간 줄과 그 위 여백까지 없앰 */
:root:not([data-world]) .world { display: none; }
/* 국제도시 시각: 오른쪽에서 왼쪽으로 계속 흐르는 한 줄. 누르고 있는 동안 멈추고 좌우로 끌어 넘겨 볼 수 있음 (움직임은 js/clock.js) */
.world {
  max-width: 720px; margin: 12px auto 0; overflow: hidden; font-size: 13px; color: var(--ink-2);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-y; cursor: grab;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}
.world-track { display: flex; width: max-content; will-change: transform; }
.world.dragging { cursor: grabbing; }
.world-track > span { flex: none; margin-right: 22px; white-space: nowrap; }
.world span b { color: var(--ink); font-weight: 600; margin-left: 4px; font-variant-numeric: tabular-nums; }
.world em { font-style: normal; color: var(--muted); font-size: 11px; margin-left: 3px; }
.world em:empty { display: none; }

/* ===== 검색창 ===== */
.searches { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 28px; }
.search {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 6px 6px 6px 18px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent), var(--shadow); border-color: var(--brand); }
.search.google { --brand: var(--google); }
.search.naver  { --brand: var(--naver); }
/* 두 검색창의 로고 칸 폭을 같게 해서 입력 커서가 같은 위치에서 시작하도록 */
.logo { font-weight: 800; font-size: 17px; letter-spacing: -.02em; flex: none; width: 58px; white-space: nowrap; }
.google .logo span:nth-child(1){color:#4285f4}.google .logo span:nth-child(2){color:#ea4335}
.google .logo span:nth-child(3){color:#fbbc05}.google .logo span:nth-child(4){color:#4285f4}
.google .logo span:nth-child(5){color:#34a853}.google .logo span:nth-child(6){color:#ea4335}
.naver .logo { color: var(--naver); font-family: "Montserrat", "Arial Black", sans-serif; font-weight: 900; letter-spacing: -.01em; font-size: 15px; }
.search input {
  flex: 1; width: 0; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 16px; padding: 10px 4px;
}
.search input::placeholder { color: var(--muted); }
.search button {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; display: grid; place-items: center;
}
.search button svg { width: 18px; height: 18px; }

/* ===== 바로가기 ===== */
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.link {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 4px 12px; border-radius: 14px; text-decoration: none; color: var(--ink); min-width: 0;
}
.link:hover { background: var(--surface); box-shadow: var(--shadow); }
.link .ico {
  width: 44px; height: 44px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden; font-weight: 700; font-size: 18px; color: var(--accent);
}
.link .ico img { width: 26px; height: 26px; }
.link .nm { font-size: 12.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link .del {
  position: absolute; top: 4px; right: 8px; width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: var(--up); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; display: none;
}
.links.editing .link .del { display: block; }
.links.editing .link { animation: wiggle .3s ease-in-out infinite alternate; }
@keyframes wiggle { from { transform: rotate(-1deg); } to { transform: rotate(1deg); } }
@media (prefers-reduced-motion: reduce) { .links.editing .link { animation: none; } }
.link.add .ico { border-style: dashed; color: var(--muted); font-weight: 400; font-size: 24px; }
.link-form { display: none; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.link-form.open { display: flex; }
.link-form .field { flex: 1 1 160px; }
.link-form button { flex: none; }
.btn {
  border: 0; border-radius: 10px; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff; flex: none; white-space: nowrap;
}
.btn.ghost { background: var(--seg); color: var(--ink-2); }

/* ===== 오늘의 날씨 ===== */
.wx-now { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.wx-icon { width: 76px; height: 76px; flex: none; }
.wx-main { flex: 1; min-width: 180px; }
.wx-temp { font-size: 44px; font-weight: 700; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.wx-temp small { font-size: 16px; font-weight: 600; color: var(--ink-2); margin-left: 10px; letter-spacing: -.01em; }
.wx-detail { font-size: 13px; color: var(--ink-2); margin-top: 8px; font-variant-numeric: tabular-nums; }
.wx-detail b { color: var(--ink); font-weight: 600; }
.wx-boxes { display: flex; gap: 10px; flex-wrap: wrap; }
.wx-box { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--subtle); }
.wx-box svg { width: 30px; height: 30px; flex: none; }
.wx-box .lbl { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.wx-box .val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wx-box .val small { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.aq { display: inline-flex; align-items: center; gap: 5px; }
.aq i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.aq-1 i { background: #3b82f6; } .aq-2 i { background: #22c55e; } .aq-3 i { background: #f59e0b; } .aq-4 i { background: #ef4444; }
.umb-on { color: var(--accent); } .umb-off { color: var(--umb-off); }
.wx-hours {
  display: flex; gap: 4px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: thin;
}
.wx-h { flex: 1 0 56px; text-align: center; padding: 6px 0; border-radius: 10px; font-variant-numeric: tabular-nums; }
.wx-h.now { background: var(--subtle); }
.wx-h .t { font-size: 12px; color: var(--ink-2); }
.wx-h .now-t { color: var(--ink); font-weight: 600; }
.wx-h svg.ic { width: 34px; height: 34px; display: block; margin: 4px auto 2px; }
.wx-h .deg { font-size: 14px; font-weight: 600; }
.wx-h .p { font-size: 11px; display: flex; align-items: center; justify-content: center; gap: 2px; margin-top: 3px; }
.wx-h .p svg { width: 12px; height: 12px; }
.wx-h .p.umb-off { color: var(--muted); }

/* ===== 할 일 · 달력 ===== */
.todo-add { display: flex; gap: 8px; }
.todo-list { list-style: none; margin: 12px 0 0; padding: 0; max-height: 320px; overflow-y: auto; }
.todo-list li { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.todo-list li:last-child { border-bottom: 0; }
.todo-list input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; cursor: pointer; }
.todo-list .txt { flex: 1; min-width: 0; font-size: 15px; overflow-wrap: anywhere; }
.todo-list .txt.editable { cursor: text; border-radius: 6px; }
.todo-list .txt.editable:hover { background: var(--subtle); }
.todo-edit {
  flex: 1; min-width: 0; font: inherit; font-size: 15px; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--accent); border-radius: 6px; padding: 3px 6px; margin: -5px 0; outline: none;
}
@media (hover: none) and (pointer: coarse) { .todo-edit { font-size: 16px; } } /* 아이폰에서 고칠 때 화면이 확대되지 않게 */
.todo-list li.done .txt { color: var(--muted); text-decoration: line-through; }
.todo-list .x { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1; }
.todo-list .x:hover { color: var(--up); }
.todo-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 10px; }
.todo-empty { color: var(--muted); font-size: 14px; padding: 18px 0 8px; text-align: center; }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head b { font-size: 16px; }
.cal-nav { display: flex; gap: 2px; }
.cal-nav button { border: 0; background: transparent; color: var(--ink-2); cursor: pointer; border-radius: 8px; padding: 4px 10px; font-size: 15px; }
.cal-nav button:hover { background: var(--subtle); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; gap: 2px; }
.cal-grid .dow { font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-grid .d {
  font-size: 14px; padding: 7px 0; border-radius: 10px; font-variant-numeric: tabular-nums; position: relative;
  border: 0; background: transparent; color: inherit; font-family: inherit; cursor: pointer;
}
.cal-grid .d:not(.today):hover { background: var(--subtle); }
/* 클릭해서 고른 날 (오늘이 아닌 날): 파란 테두리 */
.cal-grid .d.sel { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 999px; }
.cal-grid .d:focus { outline: none; }
.cal-grid .d:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-grid .d.other { color: var(--muted); opacity: .5; }
.cal-grid .d.other.sel { opacity: 1; } /* 다른 달 날짜를 골라도 파란 테두리는 또렷하게 */
.cal-grid .sun, .cal-grid .hol { color: var(--holiday); }
.cal-grid .sat { color: var(--saturday); }
.cal-grid .hol::after { content: ''; position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--holiday); }
.cal-grid .today { background: var(--accent); color: #fff !important; font-weight: 700; border-radius: 999px; }
.cal-grid .today::after { background: #fff; }
.cal-info { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.cal-info .lunar { color: var(--ink); margin-bottom: 4px; }
.cal-info .lunar-date { color: var(--accent); font-weight: 600; }
.cal-info .days-away { color: var(--holiday); font-weight: 600; }
.cal-info ul { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* ===== 시세 카드 ===== */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cards .card { padding: 20px 20px 14px; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card a.more { font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.card a.more:hover { color: var(--accent); }
.cards .card { position: relative; }
.card-ico { position: absolute; top: 46px; right: 20px; width: 56px; height: 56px; pointer-events: none; }
.price { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.price .unit { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-left: 4px; letter-spacing: 0; }
.chg { font-size: 14px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.chart { position: relative; height: 164px; margin-top: 14px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .skeleton { padding-top: 60px; text-align: center; font-size: 13px; }
.tip {
  position: absolute; top: 0; pointer-events: none; background: var(--tip-bg); color: var(--tip-ink);
  font-size: 12px; padding: 6px 9px; border-radius: 8px; white-space: nowrap; transform: translateX(-50%);
  opacity: 0; transition: opacity .1s; font-variant-numeric: tabular-nums; z-index: 2;
}
.tip b { font-weight: 600; }
.tip .d { color: var(--tip-dim); margin-right: 6px; }

/* 환율 계산기 (네이버 환율계산 모양, 움직임은 js/fxcalc.js) */
.calcs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.calc h3 { margin: 0 0 14px; font-size: 17px; min-height: 30px; display: flex; align-items: center; } /* 옆 금 계산기 머리줄(순도 버튼)과 높이를 맞춤 */
.fx-row { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.fx-row:focus-within { border-color: var(--accent); }
.fx-cur {
  position: relative; flex: 0 0 min(190px, 46%); display: flex; align-items: center; gap: 8px;
  padding: 10px; background: var(--subtle); border-right: 1px solid var(--line); cursor: pointer; min-width: 0;
}
.fx-flag { width: 26px; height: 18px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); flex: none; align-self: flex-start; margin-top: 3px; }
.fx-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.fx-name b { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-name small { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.fx-chev { width: 16px; height: 16px; margin-left: auto; color: var(--muted); flex: none; }
/* 실제 고르기는 투명한 기본 선택 상자가 맡음 (휴대폰에서는 기기 고유의 선택 화면이 뜸) */
.fx-cur select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.fx-amt { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; padding: 8px 12px; }
.fx-amt input {
  width: 100%; border: 0; outline: none; background: transparent; color: var(--ink); text-align: right;
  font: inherit; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 0;
}
.fx-amt small { font-size: 13px; color: var(--ink-2); margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fx-eq { text-align: center; color: var(--muted); font-size: 22px; font-weight: 700; line-height: 1; padding: 4px 0 6px; }
.fx-meta { margin-top: 10px; font-size: 12px; color: var(--muted); text-align: right; }
/* 금 계산기: 머리줄 오른쪽에 순도 선택 */
.gc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.gc-head h3 { margin: 0; }
.gc-head .seg button { padding: 4px 10px; font-size: 12px; }
.gc-ico { width: 26px; height: 26px; flex: none; align-self: flex-start; }

/* ===== 증시 ===== */
.idx { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.idx a { text-decoration: none; display: block; padding: 14px 16px; }
.idx a:hover { border-color: var(--accent); }
.idx .nm { font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 6px; }
.idx .st { font-size: 11px; color: var(--muted); white-space: nowrap; }
.idx .st.open { color: var(--naver); font-weight: 600; }
.idx .pr { font-size: 19px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.idx .ch { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.watch-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.watch-head h3 { margin: 0; font-size: 15px; }
.watch-search { position: relative; margin: 8px 0 4px; display: none; }
.watch-search.open { display: block; }
.watch-results {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12); overflow: hidden;
}
.watch-results button {
  display: flex; width: 100%; justify-content: space-between; gap: 10px; border: 0; background: transparent;
  padding: 10px 14px; cursor: pointer; text-align: left; font-size: 14px;
}
.watch-results button:hover, .watch-results button:focus { background: var(--subtle); outline: none; }
.watch-results small { color: var(--muted); white-space: nowrap; }
.watch-cols { display: grid; grid-template-columns: 1fr 1fr; margin-top: 6px; }
.watch-col:first-child { padding-right: 24px; }
.watch-col + .watch-col { padding-left: 24px; border-left: 1px solid var(--line); }
.watch-col h4 { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.watch-list { list-style: none; margin: 0; padding: 0; }
.watch-list li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.watch-list li:last-child { border-bottom: 0; }
.watch-list a { flex: 1; min-width: 0; text-decoration: none; }
.watch-list .nm { font-size: 15px; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-list .cd { font-size: 12px; color: var(--muted); }
.watch-list .pr { text-align: right; font-variant-numeric: tabular-nums; }
.watch-list .pr b { font-size: 15px; display: block; }
.watch-list .pr span { font-size: 13px; font-weight: 600; }
.watch-list .x { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; display: none; padding: 0 2px; }
.watch-cols.editing .x { display: block; }
.watch-list .x:hover { color: var(--up); }

/* ===== 뉴스 ===== */
.news-list { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 32px; }
.news-list li { break-inside: avoid; padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.news-list .n { color: var(--accent); font-weight: 700; font-size: 13px; width: 18px; flex: none; font-variant-numeric: tabular-nums; padding-top: 1px; }
.news-list a { text-decoration: none; font-size: 15px; line-height: 1.45; }
.news-list a:hover { color: var(--accent); }
.news-list time { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 28px; line-height: 1.7; }
.foot-links { display: flex; justify-content: center; gap: 16px; margin-bottom: 10px; font-size: 13px; }
.foot-links a { color: var(--ink-2); text-decoration: none; }
.foot-links a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.sec-link { font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.sec-link:hover { color: var(--accent); }

/* ===== 반응형 ===== */
@media (max-width: 1060px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .idx { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
  [data-pair] .wrap > [data-part="todo"], [data-pair] .wrap > [data-part="calendar"] { grid-column: 1 / -1; }
  [data-pair] [data-part="todo"] > .card, [data-pair] [data-part="calendar"] > .card { height: auto; }
  .news-list { columns: 1; }
  .calcs { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .searches { grid-template-columns: 1fr; }
  .watch-cols { grid-template-columns: 1fr; }
  .watch-col:first-child { padding-right: 0; }
  .watch-col + .watch-col { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
}
@media (max-width: 640px) {
  .wrap { padding-top: 64px; }
  .cards { grid-template-columns: 1fr; }
  .idx { grid-template-columns: 1fr 1fr; }
  .links { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  /* 기간 탭: 화면 폭을 나눠 한 줄에 표시 */
  #range-seg { display: flex; flex-wrap: nowrap; width: 100%; padding: 2px; }
  #range-seg button { flex: 1 1 auto; min-width: 0; padding: 6px 2px; font-size: 12px; letter-spacing: -.04em; white-space: nowrap; }
  #news-seg { display: flex; flex-wrap: nowrap; width: 100%; overflow-x: auto; }
  #news-seg button { flex: 1 0 auto; padding: 6px 8px; }
  .wx-icon { width: 64px; height: 64px; }
  .wx-temp { font-size: 38px; }
  .wx-boxes { width: 100%; }
  .wx-box { flex: 1 1 140px; }
}
@media (max-width: 360px) {
  .search { gap: 6px; padding-left: 14px; }
  .logo { font-size: 15px; width: 51px; }
  .naver .logo { font-size: 13px; }
  .search button { width: 38px; height: 38px; }
  .links { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 340px) {
  #range-seg button { font-size: 11px; letter-spacing: -.06em; }
}
