:root {
  color-scheme: light;
  --ink: #14201c;
  --muted: #56655f;
  --bg: #f3f4f1;
  --surface: #fff;
  --line: #e1e5e2;
  --deep: #0f2a24;
  --green: #1f6f55;
  --green-soft: #e6f1ec;
  --mint: #9fe0c0;
  --blue: #1d3b8c;
  --red: #b4372a;
  --red-soft: #fde9e5;
  --warm: #fff3d1;
  --radius: 16px;
  --gut: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); line-height: 1.4; }
body.locked { overflow: hidden; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #3b8f72; outline-offset: 2px; }
h1, h2, h3, p, ul, ol { margin: 0; overflow-wrap: anywhere; }
ul, ol { padding: 0; list-style: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 1.25em; height: 1.25em; flex: 0 0 auto; }
.chev { width: 1.1em; height: 1.1em; color: #9aa7a1; margin-left: auto; }

.shell { min-height: 100vh; max-width: 640px; margin: 0 auto; background: var(--bg); }
main { outline: none; padding-bottom: 8px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) var(--gut) 8px;
  background: var(--deep); color: #fff;
}
.brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; color: inherit; text-decoration: none; font-weight: 750; }
.brand-icon { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 9px; background: var(--mint); position: relative; }
.brand-icon::after { content: ""; position: absolute; left: 8px; top: 6px; width: 8px; height: 8px; border: 2.5px solid var(--deep); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
#open-leader { min-height: 40px; padding: 6px 12px; border: 1px solid #ffffff40; border-radius: 10px; background: transparent; color: #fff; font-size: .85rem; font-weight: 650; }

/* Hero */
.hero { padding: 6px var(--gut) 14px; background: var(--deep); color: #fff; }
.hero-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: .8rem; color: #c3d8cf; }
.hero h1 { margin-top: 4px; font-size: 1.6rem; line-height: 1.15; letter-spacing: -.02em; }
.pills { display: flex; gap: 8px; margin: 12px calc(var(--gut) * -1) 0; padding: 0 var(--gut) 2px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.pills::-webkit-scrollbar { display: none; }
.pills button { flex: 0 0 auto; scroll-snap-align: start; min-height: 44px; padding: 5px 13px; border: 0; border-radius: 12px; background: #ffffff1a; color: #fff; font-size: .82rem; font-weight: 700; text-align: left; line-height: 1.2; }
.pills button small { display: block; font-weight: 500; opacity: .8; font-size: .72rem; }
.pills button.on { background: var(--mint); color: var(--deep); }

/* Notice and install */
.notice, .install { margin: 12px var(--gut) 0; padding: 12px 14px; border-radius: 14px; background: var(--warm); border: 1px solid #f0dca0; }
.notice-head { display: flex; align-items: center; gap: 8px; font-size: .8rem; }
.new { padding: 2px 6px; border-radius: 6px; background: #d64b28; color: #fff; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.notice-text { margin-top: 4px; white-space: pre-line; }
.notice.long:not(.open) .notice-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.install { background: var(--green-soft); border-color: #cfe3d9; }
.install-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* Buttons */
.linkish { min-height: 44px; padding: 0; border: 0; background: none; color: var(--green); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.btn-solid, .btn-outline, .btn-light, .btn-ghost, .pill-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 8px 14px; border-radius: 12px; font-weight: 700; font-size: .92rem; text-decoration: none; text-align: center;
}
.btn-solid { border: 0; background: var(--green); color: #fff; }
.btn-outline { border: 1px solid #c6d3cd; background: var(--surface); color: var(--green); }
.btn-light { border: 0; background: #fff; color: var(--blue); }
.btn-ghost { border: 0; background: #ffffff26; color: #fff; }
.pill-btn { min-height: 40px; padding: 6px 12px; border-radius: 10px; background: var(--green-soft); color: var(--green); font-size: .85rem; }
.pill-btn.red { background: var(--red-soft); color: var(--red); }

/* Now card */
.now { margin: 12px var(--gut) 0; padding: 16px; border-radius: 20px; background: var(--blue); color: #fff; box-shadow: 0 6px 18px #1d3b8c33; }
.now.done, .now.soon { background: var(--deep); box-shadow: none; }
.tag { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.now-title { margin-top: 4px; font-size: 1.35rem; line-height: 1.2; }
.now-sub { margin-top: 3px; font-size: .9rem; opacity: .88; }
.now-note { margin-top: 8px; font-size: .9rem; opacity: .92; }
.then { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; width: 100%; margin-top: 12px; padding: 10px 12px; border: 0; border-radius: 12px; background: #ffffff1f; color: #fff; text-align: left; font-size: .85rem; }
.now-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.now-actions > * { flex: 1 1 auto; }

/* Timeline */
.sect { margin: 20px var(--gut) 6px; font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.timeline { margin: 0 var(--gut); }
.stop { position: relative; display: grid; grid-template-columns: 3.1em 14px 1fr; gap: 0 8px; align-items: start; }
.stop .t { padding-top: 13px; text-align: right; font-weight: 800; font-size: .92rem; font-variant-numeric: tabular-nums; }
.stop .dot { position: relative; align-self: stretch; }
.stop .dot::before { content: ""; position: absolute; left: 2px; top: 17px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); z-index: 1; }
.stop .dot::after { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: #d3dcd8; }
.stop:first-child .dot::after { top: 20px; }
.stop:last-child .dot::after { bottom: calc(100% - 20px); }
.stop:only-child .dot::after { display: none; }
.stop-btn { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; width: 100%; min-height: 48px; margin: 3px 0; padding: 9px 10px 9px 12px; border: 1px solid transparent; border-radius: 12px; background: none; text-align: left; }
.stop-btn:hover { background: #fff; border-color: var(--line); }
.stop-btn .chev { order: 2; }
.stop-title { flex: 1 1 0; min-width: 0; font-weight: 700; font-size: 1rem; }
.stop-sub { order: 3; flex: 1 0 100%; font-size: .84rem; color: var(--muted); margin-top: 1px; }
.stop.past { opacity: .5; }
.stop.is-now .dot::before { background: #e0522c; box-shadow: 0 0 0 5px #e0522c33; }
.stop.is-now .stop-btn { background: #fff; border-color: #f1c6b9; }
.stop.other .stop-title::after { content: " (other groups)"; font-weight: 500; color: var(--muted); font-size: .85rem; }

/* Pages */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 16px var(--gut) 8px; }
.page-head h1 { font-size: 1.6rem; letter-spacing: -.02em; }
.day { margin: 10px var(--gut) 0; padding: 12px 6px 6px 0; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.day .timeline { margin: 4px 0 0; }
.day-head { padding: 0 8px 0 16px; }
.day-head h2 { font-size: 1.05rem; }
.day-head p { color: var(--muted); font-size: .85rem; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--mint); color: var(--deep); font-size: .72rem; font-weight: 800; }
.hotel-row { display: flex; align-items: center; gap: 8px; width: calc(100% - 10px); min-height: 44px; margin: 4px 0 4px 10px; padding: 8px 10px; border: 0; border-top: 1px dashed var(--line); background: none; color: var(--muted); font-size: .88rem; text-align: left; }
.place-list { margin: 4px var(--gut) 0; display: grid; gap: 8px; }
.place-card { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; }
.place-card img, .thumb { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 10px; object-fit: cover; }
.thumb { display: grid; place-items: center; background: var(--green-soft); color: var(--green); }
.pc-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.pc-text .stop-sub { flex: none; }
.songs { margin: 4px var(--gut) 0; display: grid; gap: 8px; }
.song, .grp { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.song summary, .grp summary { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 10px 14px; list-style: none; font-weight: 700; cursor: pointer; }
.song summary::-webkit-details-marker, .grp summary::-webkit-details-marker { display: none; }
.song[open] .chev, .grp[open] .chev { transform: rotate(90deg); }
.song pre { margin: 0; padding: 0 14px 16px; white-space: pre-wrap; font: inherit; font-size: 1.05rem; line-height: 1.6; }
.grp { margin-top: 8px; }
.grp p { padding: 0 14px 10px; }
.card { margin: 10px var(--gut) 0; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.card .k { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.card .v { font-weight: 750; font-size: 1.08rem; margin-top: 6px; }
.card .ko, .sheet .ko { color: var(--muted); }
.card > .btn-solid { margin-top: 10px; width: 100%; }
.line { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 6px 0; border-top: 1px solid #eef1ef; }
.card .k + .line { border-top: 0; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.row-btns > * { flex: 1 1 auto; }
.field { display: block; font-size: .85rem; color: var(--muted); font-weight: 650; }
.field select { display: block; width: 100%; min-height: 46px; margin-top: 4px; padding: 8px 10px; border: 1px solid #b9c7c0; border-radius: 10px; background: #fff; font-size: 16px; color: var(--ink); }
.hint { font-size: .85rem; color: var(--muted); }
.phrases { margin-top: 6px; }
.phrases button { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; width: 100%; min-height: 48px; padding: 10px 0; border: 0; border-top: 1px solid #eef1ef; background: none; text-align: left; }
.phrases li:first-child button { border-top: 0; }
.phrases .ko { font-weight: 700; color: var(--ink); }
.empty { margin: 16px var(--gut); padding: 28px 18px; border: 1px dashed #c8d2cd; border-radius: var(--radius); text-align: center; color: var(--muted); }
.empty-title { font-weight: 700; color: var(--ink); }

#trip-footer { padding: 14px var(--gut) calc(84px + env(safe-area-inset-bottom, 0px)); }
#updated { color: var(--muted); font-size: .8rem; text-align: center; }

/* Bottom nav */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; max-width: 640px; margin: 0 auto;
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
  background: #fffffff2; border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
#nav button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; padding: 5px 2px; border: 0; border-radius: 12px; background: none; color: #7a8681; font-size: .7rem; font-weight: 600; }
#nav button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
#nav .nav-ico { width: 23px; height: 23px; }
#nav button.on { color: var(--deep); }
#nav button.on .nav-ico { color: var(--green); }
#nav button.on::before { content: ""; position: absolute; }

/* Bottom sheet */
.sheet-layer { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-dim { position: absolute; inset: 0; background: #0a14117a; }
.sheet {
  position: relative; width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 6px var(--gut) calc(20px + env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px 0 0; background: var(--surface);
  box-shadow: 0 -10px 30px #0003; animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet-bar { position: sticky; top: -6px; z-index: 2; display: flex; align-items: center; justify-content: flex-end; margin: 0 calc(var(--gut) * -1) 4px; padding: 6px var(--gut) 4px; background: var(--surface); }
.grab { position: absolute; left: 50%; top: 8px; width: 38px; height: 4px; margin-left: -19px; border-radius: 9px; background: #cfd6d3; }
.sheet-close { min-height: 40px; padding: 6px 12px; border: 0; border-radius: 10px; background: #eef2f0; font-weight: 700; font-size: .85rem; }
.sheet h2 { font-size: 1.35rem; line-height: 1.2; outline: none; }
.sheet .ko { margin-top: 3px; }
.photo { display: block; width: 100%; max-height: 210px; object-fit: cover; border-radius: 14px; margin-bottom: 12px; background: var(--green-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chips li { padding: 4px 9px; border-radius: 8px; background: #eef3f0; font-size: .82rem; font-weight: 650; }
.note { margin: 0 0 12px; }
.go { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 52px; padding: 10px 14px; border: 0; border-radius: 14px; background: var(--blue); color: #fff; font-weight: 750; font-size: 1rem; }
.alt-apps { margin-top: 2px; font-size: .88rem; color: var(--muted); text-align: center; }
.alt-apps .linkish { min-height: 40px; font-size: .88rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; margin-top: 10px; }
.grid button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 64px; padding: 8px 4px; border: 0; border-radius: 12px; background: #f0f3f1; font-size: .78rem; font-weight: 650; }
.grid .ico { width: 22px; height: 22px; color: var(--green); }
.place-note { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.place-note h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 4px; }
.addr { margin-top: 12px; color: var(--muted); font-size: .9rem; }
.when .linkish { text-align: left; }
.edit { width: 100%; margin-top: 16px; }

/* Full-screen show card */
.show-layer { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; overflow-y: auto; padding: calc(16px + env(safe-area-inset-top, 0px)) 20px calc(20px + env(safe-area-inset-bottom, 0px)); background: #fff; color: #000; }
.show-close { align-self: flex-start; min-height: 44px; padding: 6px 14px; border: 0; border-radius: 10px; background: #eef2f0; font-weight: 700; }
.say { margin-top: 22px; color: #555; font-size: 1rem; }
.big { margin-top: 8px; font-size: 2.4rem; font-weight: 900; line-height: 1.2; }
.addr-big { margin-top: 16px; font-size: 1.5rem; font-weight: 700; line-height: 1.4; }
.en { margin-top: 18px; padding-top: 12px; border-top: 1px solid #eee; color: #555; }
.show-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 24px; }
.show-actions > * { flex: 1 1 auto; }

.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 70; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: #14201c; color: #fff; font-size: .9rem; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Leader tools */
#leader { padding: 16px var(--gut) 0; }
#leader > h1 { font-size: 1.6rem; margin: 4px 0 14px; }
.drill > summary { position: relative; display: block; list-style: none; padding-right: 28px; min-height: 28px; cursor: pointer; }
.drill > summary::-webkit-details-marker { display: none; }
.drill > summary::after { content: ""; position: absolute; right: 6px; top: 6px; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.drill[open] > summary::after { transform: translateY(4px) rotate(225deg); }
.unlock-panel { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.unlock-panel label { flex: 1 1 180px; margin: 0; }
.editor-panel, .editor-entry { margin: 10px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.editor-panel > summary, .editor-entry > summary { padding: 14px 34px 14px 14px; }
.editor-panel > summary::after, .editor-entry > summary::after { top: 18px; right: 16px; }
.editor-entry { background: #f7f8f6; }
.editor-entry .editor-entry { background: var(--surface); }
.panel-body { padding: 0 12px 12px; }
form label .help-text { display: block; }
[data-panel] { scroll-margin-top: 72px; }
.help-text { margin: 2px 0 8px; font-size: .82rem; color: var(--muted); font-weight: 500; }
#leader-status { margin: 12px 0; color: var(--green); min-height: 1.3em; font-weight: 650; }
form label { display: block; margin: 10px 0; color: var(--muted); font-size: .875rem; font-weight: 650; }
form input, form select, form textarea { display: block; width: 100%; min-height: 46px; margin-top: 4px; padding: 8px 10px; border: 1px solid #b4c3bc; border-radius: 10px; background: #fff; color: var(--ink); font-size: 16px; }
form textarea { min-height: 88px; }
form button { min-height: 44px; padding: 8px 13px; border: 1px solid #c6d3cd; border-radius: 12px; background: var(--surface); color: var(--green); font-size: .9rem; font-weight: 700; }
form button[data-action] { margin: 4px 5px 4px 0; }
form button[data-action^="delete"], form button[data-action^="event-delete"] { color: var(--red); }
#unlock, form .save { color: #fff; background: var(--green); border-color: var(--green); }
.editor-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--bg); }
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 4px #e0522c88; } to { box-shadow: 0 0 0 4px transparent; } }

@media (min-width: 641px) {
  .shell { border-inline: 1px solid var(--line); }
}
@media (max-width: 340px) {
  :root { --gut: 12px; }
  .stop { grid-template-columns: 2.8em 12px 1fr; }
}
