:root { --bg: #1b1b1a; --fg: #eee; --muted: #9a9a96; --accent: #fc8; --card: #262624; --line: #333; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.45 system-ui, -apple-system, sans-serif; -webkit-tap-highlight-color: transparent; }
body { padding: env(safe-area-inset-top) 0 calc(env(safe-area-inset-bottom) + 84px); }
main { max-width: 42rem; margin: 0 auto; padding: 0 12px; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.5rem; margin: 14px 0 6px; } h2 { font-size: 1.05rem; margin: 18px 0 8px; color: var(--muted); font-weight: 600; }
p { margin: .6rem 0; } .muted { color: var(--muted); } .center { text-align: center; } .small { font-size: .9rem; }
button, .btn { font: inherit; border: 0; border-radius: 12px; padding: 12px 18px; background: var(--accent); color: #221; font-weight: 600; cursor: pointer; display: inline-block; }
button.quiet, .btn.quiet { background: var(--card); color: var(--fg); border: 1px solid var(--line); }
button:disabled { opacity: .5; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card { background: var(--card); border-radius: 14px; padding: 14px; margin: 10px 0; }
.ol { padding-left: 1.3rem; } .ol li { margin: .4rem 0; }
header.room { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0 4px; }
header.room h1 { margin: 0; }
.flame { font-weight: 700; } .flame b { font-size: 1.4rem; color: var(--accent); }
.members { display: flex; gap: 10px; overflow-x: auto; padding: 6px 0 4px; }
.member { display: flex; flex-direction: column; align-items: center; min-width: 58px; font-size: .75rem; color: var(--muted); }
.member.me .avatar { outline: 2px solid var(--accent); }
.avatar { height: 36px; min-width: 36px; max-width: 120px; padding: 0 12px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: #111; font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar.sm { height: 22px; min-width: 22px; padding: 0 8px; font-size: .7rem; }
.member { min-width: 0; max-width: 130px; } .member .streak { font-weight: 700; color: var(--fg); }
.member .status { font-size: .7rem; color: var(--muted); text-align: center; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member .dot { width: 8px; height: 8px; border-radius: 50%; background: #444; margin-top: 3px; } .member .dot.on { background: #8d6; }
.day { margin: 14px 0; } .day h2 { display: flex; justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid a { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: #111; }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .who { position: absolute; left: 5px; bottom: 5px; } .grid .late { position: absolute; right: 5px; top: 5px; font-size: .65rem; background: #0008; padding: 1px 5px; border-radius: 6px; }
.fab { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 16px); width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: #221; font-size: 1.6rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 20px #0008; }
.topnav { position: fixed; right: 14px; top: calc(env(safe-area-inset-top) + 10px); }
.topnav a { background: var(--card); border: 1px solid var(--line); border-radius: 50%; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; color: var(--fg); }
form label.block { display: block; margin: 12px 0; }
form input[type=text], form select { font: inherit; width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: #111; color: var(--fg); }
.pick { display: block; text-align: center; padding: 28px 14px; border: 2px dashed var(--line); border-radius: 14px; color: var(--muted); cursor: pointer; }
.pick input { display: none; }
#prev { width: 100%; border-radius: 14px; display: block; margin: 10px 0; max-height: 60vh; object-fit: contain; background: #111; }
progress { width: 100%; height: 8px; accent-color: var(--accent); }
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }
.overlay { position: fixed; inset: 0; background: #000e; z-index: 10; display: flex; flex-direction: column; }
.overlay .pic { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.overlay .pic .frame { position: relative; max-width: 100%; max-height: 100%; display: inline-block; }
.overlay .pic img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.overlay .pic.zoom { overflow: auto; display: block; touch-action: pan-x pan-y pinch-zoom; -webkit-overflow-scrolling: touch; }
.overlay .pic.zoom .frame { max-width: none; max-height: none; }
.overlay .pic.zoom img { max-width: none; max-height: none; width: auto; height: auto; min-width: 100%; }
/* the caption band: Snapchat's translucent strip across the picture, at the height the sender chose */
.band { position: absolute; left: 0; right: 0; transform: translateY(-50%); background: #0009; color: #fff; text-align: center; padding: 8px 14px; font-size: 1.1rem; line-height: 1.3; word-wrap: break-word; pointer-events: none; }
#stage { position: relative; margin: 10px 0; } #stage img { width: 100%; max-height: 60vh; object-fit: contain; display: block; border-radius: 14px; background: #111; }
form input[type=range] { width: 100%; accent-color: var(--accent); }
/* the camera */
.cam { position: fixed; inset: 0; background: #000; z-index: 20; display: flex; flex-direction: column; }
.cam video { flex: 1; min-height: 0; width: 100%; object-fit: cover; } .cam video.mirror { transform: scaleX(-1); }
.cam-top { position: absolute; top: calc(env(safe-area-inset-top) + 10px); left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 0 14px; }
.cam-top button { background: #0008; color: #fff; border: 0; border-radius: 999px; padding: 8px 12px; font-size: 1rem; }
.cam-x { width: 40px; height: 40px; padding: 0 !important; }
.cam-count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 6rem; font-weight: 700; color: #fff; text-shadow: 0 2px 12px #000; pointer-events: none; }
.cam-bottom { background: #000; padding: 8px 10px calc(env(safe-area-inset-bottom) + 14px); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.shutter { width: 72px; height: 72px; border-radius: 50%; background: #fff; border: 5px solid #888; padding: 0; }
.shutter:active { transform: scale(.93); }
.cam-err { position: absolute; bottom: 140px; left: 14px; right: 14px; text-align: center; }
.place { width: 100%; margin-top: 8px; } .place .map { width: 100%; height: 120px; border-radius: 10px; overflow: hidden; background: #222; cursor: pointer; }
.place a { display: inline-block; margin-top: 4px; font-size: .9rem; }
.leaflet-container { background: #222; font-size: 10px; }
/* the details sheet: peeks at the bottom, swipes up over the picture */
.overlay { --peek: 64px; }
.overlay .pic { padding-bottom: var(--peek); }
.overlay .sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; max-height: 78%; display: flex; flex-direction: column; background: #141413; border-radius: 18px 18px 0 0; box-shadow: 0 -6px 24px #0008; transform: translateY(calc(100% - var(--peek))); transition: transform .22s ease-out; touch-action: none; }
.overlay .sheet.open { transform: none; }
.overlay .handle { flex: 0 0 auto; padding: 8px 14px 10px; cursor: pointer; }
.overlay .grip { display: block; width: 38px; height: 4px; border-radius: 2px; background: #555; margin: 0 auto 8px; }
.overlay .peek { display: flex; align-items: center; gap: 10px; min-height: 26px; white-space: nowrap; overflow: hidden; }
.overlay .peek .ell { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; } .overlay .peek .peek-rx { margin-left: auto; flex: 0 0 auto; font-size: .95rem; }
.overlay .sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 14px calc(env(safe-area-inset-bottom) + 16px); touch-action: pan-y; }
.overlay .sheet-body .cap { font-size: 1.05rem; margin: 2px 0 6px; } .overlay .acts { gap: 18px; margin-top: 12px; }
.overlay .close { position: absolute; z-index: 3; top: calc(env(safe-area-inset-top) + 10px); right: 14px; background: #0008; color: #fff; border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.overlay .pic { touch-action: none; transition: transform .15s ease-out; }
.overlay .pic.zoom { touch-action: pan-x pan-y pinch-zoom; }
.overlay .strip { flex: 0 0 auto; display: flex; gap: 4px; overflow-x: auto; padding: calc(env(safe-area-inset-top) + 8px) 60px 8px 10px; background: #000; scrollbar-width: none; scroll-snap-type: x proximity; }
.overlay .strip::-webkit-scrollbar { display: none; }
.overlay .strip img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; opacity: .45; flex: 0 0 auto; border: 2px solid transparent; scroll-snap-align: center; }
.overlay .strip img.on { opacity: 1; border-color: var(--accent); }
.overlay .strip img.unseen { box-shadow: 0 0 0 2px var(--accent) inset; }
.grid .new { position: absolute; left: 50%; top: 5px; transform: translateX(-50%); width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px #0008; }
.err { color: #f99; }
.grid .rx { position: absolute; right: 5px; bottom: 5px; font-size: .75rem; background: #0009; padding: 2px 6px; border-radius: 10px; }
.rx-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; width: 100%; margin-top: 8px; }
.rxb { background: #222; color: var(--fg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font-size: 1rem; }
.rxb.mine { border-color: var(--accent); background: #3a2f1f; } .rxb.quick { opacity: .75; }
.rxany { font: inherit; width: 7.5rem; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: #111; color: var(--fg); }
/* rooms: the title is a switcher when you have more than one; the list in settings; "send to" in the composer */
.roomsel { font: inherit; font-size: 1.5rem; font-weight: 700; background: transparent; color: var(--fg); border: 0; padding: 0; max-width: 70vw; appearance: none; -webkit-appearance: none; cursor: pointer; }
.roomsel::after { content: ' ▾'; }
header.room .roomsel { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239a9a96' stroke-width='2'/%3E%3C/svg%3E") no-repeat right center; padding-right: 18px; }
.roomlist { list-style: none; padding: 0; margin: 0; } .roomlist li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.roomlist li .inv { flex-basis: 100%; }
button.sm { padding: 6px 12px; font-size: .9rem; margin-left: auto; }
.rooms { margin: 8px 0; } .rooms > span { display: block; margin-bottom: 2px; }
