:root {
  --bg: #0b1620; --text: #f3f5f4; --muted: rgba(255, 255, 255, .56); --line: rgba(255, 255, 255, .1);
  --glass: rgba(255, 255, 255, .06); --glass-2: rgba(255, 255, 255, .1); --glass-line: rgba(255, 255, 255, .12);
  --ink: #0f1f3a; --cream: #fffaf0; --paper-line: #e3d8bf; --ink-mute: #6b7a95;
  --yellow: #f5c451; --teal: #7fd1c7; --teal-bar: rgba(127, 209, 199, .28); --teal-ink: #bff0ea; --sun: #ff9b85;
  --bad: #ff8a80; --warn: #f0b060;
  --radius: 18px; --tabbar: 88px;
  --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans); }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--yellow); }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.meta { color: var(--muted); font-size: 12.5px; }
.error { color: var(--bad); }
.icon { width: 18px; height: 18px; flex: none; }

button, .btn {
  cursor: pointer; border: 1px solid var(--glass-line); background: var(--glass); border-radius: 999px;
  padding: 8px 15px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; color: var(--text); transition: transform .08s ease, background .15s ease;
}
button:active, .btn:active { transform: scale(.97); }
button.primary { background: var(--yellow); color: var(--ink); border-color: var(--yellow); font-weight: 700; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=date], input[type=time], textarea, select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--glass-line); border-radius: 14px; background: var(--glass); color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--yellow); outline-offset: -1px; }
select option { background: #13222e; }
input[type=checkbox] { accent-color: var(--yellow); }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 0 calc(var(--tabbar) + 24px); }
section { padding: 0 16px; }
.dday { font-family: var(--mono); background: var(--yellow); color: var(--ink); font-weight: 600; font-size: 13px; padding: 5px 10px; border-radius: 8px; box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.dday:empty { display: none; }

/* ---- 상단 (자료 · 질문 탭) */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(22px + env(safe-area-inset-top)) 20px 12px; }
.topbar h2 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.topbar.on-cal { display: none; }

/* ---- 사진 커버 */
.hero {
  position: relative; height: 340px; margin: 0 -16px 4px; background: url("/static/img/sydney.jpg") center/cover;
}
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 18, 28, .45) 0%, rgba(8, 18, 28, .05) 38%, rgba(11, 22, 32, 1) 100%); }
.hero .bar { position: absolute; z-index: 2; top: calc(18px + env(safe-area-inset-top)); left: 20px; right: 20px; display: flex; justify-content: space-between; align-items: center; }
.hero .brand { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; font-weight: 600; opacity: .92; }
.hero .in { position: absolute; z-index: 2; left: 20px; right: 20px; bottom: 18px; }
.hero h1 { margin: 0 0 8px; font-size: 36px; line-height: 1.04; letter-spacing: -.035em; font-weight: 800; text-shadow: 0 2px 18px rgba(0, 0, 0, .25); }
.hero .sub { font-size: 14px; opacity: .88; }
.route { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; }
.route span { padding: 4px 9px; border-radius: 999px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.route i { opacity: .6; font-style: normal; }

/* ---- 유리 카드 공통 */
.detail { background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--radius); }
.detail { padding: 16px; margin-top: 14px; display: grid; gap: 10px; }
.detail > p { margin: 0; }

/* ---- 자료 질문 · 일정별 목록 */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 10px var(--yellow); margin-right: 6px; }
.notice { margin: 12px 0 4px; width: 100%; justify-content: flex-start; border-color: rgba(245, 196, 81, .35); color: var(--yellow); }
.q { display: grid; gap: 6px; padding: 12px 14px; margin-top: 10px; border-radius: var(--radius); background: rgba(245, 196, 81, .08); border: 1px solid rgba(245, 196, 81, .4); }
.q b { font-size: 14.5px; overflow-wrap: anywhere; }
.q button { padding: 6px 12px; font-size: 13px; }
.q .error { margin: 0; } .q .error:empty { display: none; }
.q-pick select { flex: 1 1 160px; min-width: 0; }
.q-wait { margin-top: 10px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--glass-line); color: var(--muted); font-size: 13px; }
.grp { border-bottom: 1px solid var(--line); }
.grp summary { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 4px; cursor: pointer; list-style: none; }
.grp summary::-webkit-details-marker { display: none; }
.grp summary b { font-size: 14.5px; overflow-wrap: anywhere; }
.grp summary .meta { flex: none; }
.grp[open] summary .meta::after { content: " ⌃"; } .grp:not([open]) summary .meta::after { content: " ⌄"; }
.frow { display: flex; width: 100%; align-items: center; gap: 8px; padding: 6px 4px 6px 10px; margin: 0 0 4px 4px; border: 0; border-left: 2px solid var(--glass-line); border-radius: 0; background: transparent; font-size: 13px; text-align: left; white-space: normal; }
.frow i { flex: none; font: 600 9px var(--mono); font-style: normal; background: var(--cream); color: var(--ink); border-radius: 5px; padding: 2px 5px; }
.frow i.pdf { background: var(--yellow); } .frow i.img { background: #9cc4ff; } .frow i.txt, .frow i.memo { background: var(--teal); }
.frow .fn { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.frow .meta { flex: none; }

/* ---- 달력 */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 4px 10px; }
.cal-head strong { font-size: 18px; letter-spacing: -.01em; }
.cal-head .nav { display: flex; gap: 6px; }
.cal-head button { width: 34px; height: 34px; padding: 0; justify-content: center; font-size: 16px; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 3px; background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08); border-radius: 22px; padding: 10px 0 12px; overflow: hidden;
}
.cal-wd { text-align: center; font-size: 10.5px; color: var(--muted); padding: 0 0 4px; }
.cal-wd:first-child { color: var(--sun); }
.cal-cell {
  min-height: 34px; padding: 1px 0 2px; border: 0; border-radius: 0; background: transparent; display: flex; min-width: 0;
  flex-direction: column; align-items: stretch; gap: 2px; white-space: normal; justify-content: flex-start;
}
.cal-cell:active { transform: none; }
.cal-cell.empty { pointer-events: none; }
.cal-num { display: block; align-self: center; width: 25px; height: 25px; line-height: 25px; text-align: center; border-radius: 50%; font-size: 12.5px; }
.cal-cell.sun .cal-num { color: var(--sun); }
.cal-cell.dim .cal-num { opacity: .35; }
.cal-cell.today .cal-num { box-shadow: 0 0 0 1.5px var(--yellow) inset; }
.cal-cell.sel .cal-num { background: var(--cream); color: var(--ink); font-weight: 700; opacity: 1; }
.cal-lane { display: block; height: 15px; }
.cal-ev {
  display: block; height: 15px; font-size: 9.5px; line-height: 15px; padding: 0 4px; white-space: nowrap; overflow: visible;
  position: relative; text-align: left; background: rgba(255, 255, 255, .14); color: var(--text); font-weight: 600;
}
.cal-ev.start { margin-left: 3px; border-top-left-radius: 5px; border-bottom-left-radius: 5px; }
.cal-ev.end { margin-right: 3px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; }
.cal-ev .t { position: relative; z-index: 1; display: block; overflow: hidden; text-overflow: ellipsis; width: calc(var(--span, 1) * 100%); }
.cal-ev.flight { background: var(--yellow); color: var(--ink); }
.cal-ev.stay { background: var(--teal-bar); color: var(--teal-ink); }
.cal-more { display: block; font-size: 9.5px; color: var(--muted); text-align: center; }

/* ---- 날짜 상세 (작은 티켓) */
.day-title { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 4px 10px; }
.day-title b { font-size: 17px; letter-spacing: -.01em; }
.day-title span { font-size: 12px; color: var(--muted); }
.ev-card {
  position: relative; margin-bottom: 8px; background: var(--cream); color: var(--ink); border-radius: 14px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .3); cursor: pointer;
}
.ev-card .tk { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; align-items: center; position: relative; }
/* 절취 구멍은 카드 전체의 위아래 끝에 단다 (펼쳐도 카드 가장자리에 남도록) */
.ev-card::before, .ev-card::after { content: ""; position: absolute; z-index: 1; left: 53px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); }
.ev-card::before { top: -7px; } .ev-card::after { bottom: -7px; }
.ev-card .tm { padding: 11px 0 11px 12px; font-family: var(--mono); font-size: 14px; font-weight: 600; border-right: 2px dashed var(--paper-line); align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.ev-card .tm small { font-size: 9px; letter-spacing: .1em; color: var(--ink-mute); font-weight: 400; }
.ev-card .bd { padding: 9px 12px 9px 14px; min-width: 0; }
.ev-card .bd b { display: block; font-size: 14.5px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-card .bd b.code { font-family: var(--mono); letter-spacing: .02em; }
.ev-card .bd span { display: block; font-size: 11px; color: var(--ink-mute); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-card .tg { margin-right: 12px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; font-weight: 600; padding: 3px 7px; border-radius: 5px; background: var(--yellow); color: var(--ink); }
.ev-card.stay .tg { background: var(--teal); }
.ev-card.out { opacity: .72; }
.ev-card.out .tg { background: #e7e1d2; color: var(--ink-mute); }
.ev-card.plain { background: var(--glass); color: var(--text); border: 1px solid var(--glass-line); box-shadow: none; }
.ev-card.plain::before, .ev-card.plain::after { display: none; }
.ev-card.plain .tm { border-right-color: rgba(255, 255, 255, .15); }
.ev-card.plain .tm small, .ev-card.plain .bd span, .ev-card.plain .more .memo { color: var(--muted); }
.ev-card.plain .tg { background: rgba(255, 255, 255, .14); color: var(--text); }
.ev-card .more { display: none; position: relative; padding: 2px 14px 12px 74px; font-size: 12.5px; }
.ev-card .more::before { content: ""; position: absolute; left: 58px; top: 0; bottom: 0; border-left: 2px dashed var(--paper-line); }
.ev-card.plain .more::before { border-left-color: rgba(255, 255, 255, .15); }
.ev-card.open .more { display: grid; gap: 6px; }
.ev-card .more .memo { color: var(--ink-mute); white-space: pre-wrap; }
.ev-card .more button { padding: 5px 12px; font-size: 12.5px; background: transparent; border-color: var(--paper-line); color: var(--ink); }
.ev-card .more button.danger { color: #b3261e; }
.ev-card.plain .more button { border-color: var(--glass-line); color: var(--text); }
.ev-card.plain .more button.danger { color: var(--bad); }
.ev-wiki { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--paper-line); display: grid; gap: 8px; }
.ev-card.plain .ev-wiki { border-top-color: var(--glass-line); }
.ev-wiki .md h1 { font-size: 15px; } .ev-wiki .md h2 { font-size: 13.5px; } .ev-wiki .md strong { color: inherit; }
.ev-wiki .meta, .ev-wiki .city-h { color: var(--ink-mute); margin: 0; }
.ev-card.plain .ev-wiki .meta, .ev-card.plain .ev-wiki .city-h { color: var(--muted); }
.src { display: flex; align-items: center; gap: 8px; }
.ev-card .more .src .lnk { border: 0; padding: 0; text-decoration: underline; flex: 1 1 auto; min-width: 0; justify-content: flex-start; white-space: normal; text-align: left; overflow-wrap: anywhere; }
.src .meta, .src [data-w="detach"] { flex: none; }
.empty-note { text-align: center; color: var(--muted); padding: 18px 0; }
.fab-row { display: flex; justify-content: flex-end; margin-top: 12px; }

/* ---- 폼 */
.form-row > label { flex: 1 1 140px; display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.form-row > input, .form-row > select { flex: 1 1 140px; }

/* ---- 자료 */
.drop {
  border: 1.5px dashed rgba(255, 255, 255, .22); border-radius: 20px; padding: 20px 16px; text-align: center; color: var(--muted);
  margin: 4px 0 12px; display: grid; gap: 6px; justify-items: center; font-size: 13px;
}
.drop .icon { width: 26px; height: 26px; color: var(--yellow); }
.drop.over { border-color: var(--yellow); background: rgba(245, 196, 81, .08); color: var(--text); }
.drop label { cursor: pointer; color: var(--yellow); font-weight: 700; font-size: 14px; }
.banner { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--warn); color: var(--warn); margin: 8px 0; }
.cards { margin-top: 14px; }
.badge { font-size: 11px; padding: 1px 8px; border-radius: 99px; border: 1px solid currentColor; margin-left: 6px; font-weight: 500; vertical-align: 1px; }
.badge.pending { color: var(--warn); } .badge.failed { color: var(--bad); }
.md { overflow-wrap: anywhere; line-height: 1.65; }
.md h1 { font-size: 19px; margin: 4px 0 10px; letter-spacing: -.02em; } .md h2 { font-size: 15px; margin: 18px 0 6px; }
.md ul { padding-left: 20px; } .md strong { color: #fff; }
.md table { border-collapse: collapse; } .md td, .md th { border: 1px solid var(--line); padding: 4px 8px; }

/* ---- 채팅 */
.chat { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; padding-bottom: 150px; }
.msg { padding: 11px 14px; border-radius: 18px; max-width: 86%; overflow-wrap: anywhere; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--yellow); color: var(--ink); white-space: pre-wrap; border-bottom-right-radius: 6px; font-weight: 500; }
.msg.assistant { align-self: flex-start; background: var(--glass-2); border: 1px solid var(--glass-line); border-bottom-left-radius: 6px; }
.msg .md > :first-child { margin-top: 0; } .msg .md > :last-child { margin-bottom: 0; }
.msg .status { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.chat-empty { text-align: center; padding: 40px 12px; color: var(--muted); }
.chat-empty b { display: block; font-size: 20px; color: var(--text); margin-bottom: 6px; letter-spacing: -.02em; }
.composer {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) - 8px); z-index: 15;
  padding: 8px 16px 6px; background: linear-gradient(180deg, rgba(11, 22, 32, 0), var(--bg) 22%);
}
.composer .inner { max-width: 760px; margin: 0 auto; display: grid; gap: 8px; }
.composer .field { display: flex; gap: 8px; align-items: flex-end; background: #16252f; border: 1px solid var(--glass-line); border-radius: 24px; padding: 5px 5px 5px 16px; }
.composer textarea { border: 0; padding: 8px 0; min-height: 38px; max-height: 140px; resize: none; background: transparent; border-radius: 0; }
.composer textarea:focus { outline: none; }
.composer #send { width: 40px; height: 40px; padding: 0; justify-content: center; }
.composer .opts { font-size: 12.5px; color: var(--muted); justify-content: space-between; }
.composer .opts button { padding: 4px 12px; font-size: 12.5px; }

/* ---- 하단 탭바 (떠 있는 유리) */
.tabbar { position: fixed; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 20; display: flex; justify-content: center; padding: 0 14px; pointer-events: none; }
.tabbar .inner {
  pointer-events: auto; width: 100%; max-width: 440px; height: 60px; border-radius: 24px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: center;
  background: rgba(18, 32, 44, .8); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.tabbar button { border: 0; background: transparent; justify-self: center; font-size: 13px; color: var(--muted); padding: 8px 18px; }
.tabbar button .icon { width: 17px; height: 17px; }
.tabbar button[aria-selected=true] { background: var(--cream); color: var(--ink); font-weight: 700; }

/* ---- 로그인 */
.login-wrap { min-height: 100vh; display: grid; align-items: end; padding: 24px 16px calc(32px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(8, 18, 28, .2), rgba(11, 22, 32, .95) 70%), url("/static/img/sydney-tall.jpg") center/cover; }
.login { width: 100%; max-width: 400px; margin: 0 auto; display: grid; gap: 12px; }
.login h1 { margin: 0; font-size: 36px; line-height: 1.05; letter-spacing: -.035em; font-weight: 800; }
.login p.sub { margin: 0 0 10px; color: rgba(255, 255, 255, .8); }
.login .brand { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; opacity: .85; }

@media (min-width: 720px) {
  .hero { height: 380px; margin: 0 0 4px; border-radius: 0 0 28px 28px; overflow: hidden; }
  .cal-cell { min-height: 46px; }
  .cal-ev { font-size: 11px; height: 18px; line-height: 18px; }
  .cal-lane { height: 18px; }
}
.maps-row { gap: 6px; }
.btn.map { padding: 6px 11px; font-size: 12.5px; gap: 4px; background: var(--ink); color: var(--cream); border-color: var(--ink); }
.btn.map .icon { width: 14px; height: 14px; }
.btn.map em { font-style: normal; font-size: 10.5px; color: var(--yellow); margin-left: 4px; }
.ev-card.plain .btn.map, .place-card .btn.map { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.ev-card.plain .btn.map em, .place-card .btn.map em { color: #a15c00; }
.map-wait { font-size: 12px; }
.link-form { display: flex; gap: 8px; margin: 4px 0 10px; }
.link-form input { flex: 1; }
.place-bar { margin-bottom: 6px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; }
.chip { padding: 6px 12px; font-size: 12.5px; flex: none; }
.chip.on { background: var(--cream); color: var(--ink); border-color: var(--cream); font-weight: 700; }
.city-h { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--muted); margin: 18px 4px 8px; text-transform: uppercase; }
.place-card { background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; display: grid; gap: 6px; }
.pc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pc-top b { font-size: 16px; letter-spacing: -.01em; }
.pc-note { font-size: 13px; color: rgba(255, 255, 255, .8); white-space: pre-wrap; }
.cat { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; padding: 3px 8px; border-radius: 6px; background: rgba(255, 255, 255, .14); flex: none; }
.cat.food { background: var(--yellow); color: var(--ink); } .cat.cafe { background: #e8c39e; color: var(--ink); }
.cat.sight { background: var(--teal); color: var(--ink); } .cat.shopping { background: #c9b6ff; color: var(--ink); }
.place-card button { padding: 6px 12px; font-size: 12.5px; }
.tabbar .inner { grid-template-columns: repeat(4, 1fr); }
.tabbar button { padding: 8px 14px; }

.hero { transition: background-image .25s ease; }
.route span.on { background: var(--yellow); color: var(--ink); border-color: var(--yellow); font-weight: 600; }
.credits { margin: 28px 4px 0; font-size: 10.5px; line-height: 1.6; color: rgba(255, 255, 255, .38); }
.credits a { color: inherit; }

.offline-bar { display: none; position: sticky; top: 0; z-index: 30; background: var(--yellow); color: var(--ink); font-size: 12.5px; font-weight: 700; text-align: center; padding: calc(6px + env(safe-area-inset-top)) 12px 6px; }
body.offline .offline-bar { display: block; }
.sync-status { margin: 0 4px 8px; }
.offline-note { display: none; margin: 0; text-align: center; color: var(--muted); font-size: 13px; padding: 10px 0; }
body.offline .offline-note { display: block; }
body.offline .needs-net, body.offline #drop, body.offline #memo-btn, body.offline #memo-form, body.offline #link-form,
body.offline #place-add, body.offline #place-form, body.offline #ev-add, body.offline #ev-form,
body.offline [data-act="edit"], body.offline [data-act="del"], body.offline [data-act="remap"], body.offline [data-act="save"],
body.offline [data-act="no"], body.offline [data-act="plan"],
body.offline #d-edit, body.offline #d-regen, body.offline #d-del, body.offline #d-extract,
body.offline .composer .field, body.offline .composer .opts { display: none !important; }
