:root {
  --width: min(100vw, 430px);
  font-size: calc(var(--width) / 25.125);
  --ink: #292929;
  --red: #ff2142;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* The standalone layout keeps the proportions of the 402 × 874 reference. */
  --top-inset: max(3.75rem, var(--safe-top));
  --bottom: calc(2.75rem + max(2.125rem, var(--safe-bottom)));
  color-scheme: light;
}
* { box-sizing: border-box; }
html,body { margin: 0; height: 100%; overflow: hidden; }
/* Keep one-finger scrolling in nested panels while disabling page zoom. */
:where(html, body, #shell, #shell *) { touch-action: pan-x pan-y; }
body { color: var(--ink); background: #f4f4f5; font: 1rem/1.45 -apple-system,BlinkMacSystemFont,"PingFang TC","Helvetica Neue",Arial,"Noto Sans TC","Microsoft JhengHei",sans-serif; -webkit-text-size-adjust: 100%; -webkit-font-smoothing:antialiased; -webkit-tap-highlight-color: transparent; }
button,input,textarea,select { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
button:focus-visible,a:focus-visible { outline: 2px solid #5073be; outline-offset: -2px; }
button { transition: transform 130ms ease, color 140ms, background-color 140ms; }
button:active { transform: scale(.965); }
img { max-width: 100%; }
[hidden] { display:none !important; }
#shell { position:relative; width:var(--width); height:100vh; height:100dvh; margin:auto; background:white; overflow:hidden; isolation:isolate; }
#shell[data-view="me"][data-identity="member"][data-depth="base"]::before,
#shell[data-view="me"][data-identity="member"][data-depth="drawer"]::before {
  content:""; position:absolute; inset:0 0 auto; height:var(--top-inset);
  background:linear-gradient(#2a424c,#344851); pointer-events:none;
}
@media (min-width: 601px) { #shell { box-shadow:0 0 0 1px #00000008, 0 0 3rem #00000005; } }
#stage { position:absolute; inset:var(--top-inset) 0 var(--bottom); overflow:auto; overscroll-behavior-y:contain; scrollbar-width:none; }
#stage::-webkit-scrollbar,.page-content::-webkit-scrollbar {display:none}
#nav { z-index:3; position:absolute; bottom:0; height:var(--bottom); width:100%; display:grid; grid-template-columns:repeat(5,1fr); align-items:start; background:#fff; }
#nav>button { height:2.75rem; color:#909090; font-size:1rem; font-weight:500; display:grid; place-items:center; white-space:nowrap; }
#nav>button:not([data-tab="create"]) {padding-top:.125rem;}
#nav>button[aria-current="page"] {color:#242424;font-size:1.0625rem;font-weight:550;}
.plus-box {display:block;width:3rem;height:2.25rem;}
.msg-label {position:relative;}
#unread { position:absolute;top:-.42rem;left:85%;height:1rem;min-width:1rem; padding:0 .17rem; border-radius:1rem; background:#ff2442;color:white;font:500 .76rem/1rem Arial,sans-serif; }
#shell[data-view="me"][data-identity="member"] #unread {top:0;left:100%;width:.5rem;height:.5rem;min-width:0;padding:0;font-size:0;}
#layers {position:absolute;inset:var(--top-inset) 0 0; z-index:5;pointer-events:none;}
.layer {height:100%;position:absolute;inset:0;display:flex; flex-flow:column; background:white;pointer-events:auto; }
.page-bar { position:relative; flex:0 0 2.95rem; display:flex; align-items:center; justify-content:center; background:#fff; border-bottom:1px solid #f3f3f3; }
.page-bar h1 { margin:0; font-size:1.02rem;line-height:1.4;font-weight:600;max-width:75%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.go-back { position:absolute;left:.3rem; width:2.8rem;height:100%;display:grid;place-items:center;}
.page-content { position:relative; flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:none; }
.layer.enter {animation:push .28s cubic-bezier(.2,.7,.25,1);}
.layer.exit {animation:pop .21s cubic-bezier(.3,0,.8,.5) forwards;pointer-events:none;}
@keyframes push {from {transform:translateX(100%);opacity:.85}to {transform:none;opacity:1}}
@keyframes pop {to {transform:translateX(100%);opacity:.8}}
#toast {pointer-events:none;position:absolute;z-index:20;bottom:calc(var(--bottom) + .85rem); left:50%;width:max-content;max-width:88%;padding:.55rem .95rem;border-radius:.6rem; color:white; background:#242424ee; font-size:.85rem;opacity:0; transform:translate(-50%,.4rem);transition:transform .18s,opacity .18s;}
#toast.show {opacity:1;transform:translate(-50%,0);}
html.telegram {
  --safe-top:max(env(safe-area-inset-top,0px),calc(var(--tg-safe-area-inset-top,0px) + var(--tg-content-safe-area-inset-top,0px)));
  --safe-bottom:max(env(safe-area-inset-bottom,0px),calc(var(--tg-safe-area-inset-bottom,0px) + var(--tg-content-safe-area-inset-bottom,0px)));
  /* Telegram already places the regular WebView below its own header. */
  --top-inset:var(--safe-top);
}
.telegram #shell {height:min(100dvh,var(--tg-viewport-stable-height,100dvh));}
.telegram #stage,.telegram #layers,.telegram #nav { left:calc(var(--tg-safe-area-inset-left,0px) + var(--tg-content-safe-area-inset-left,0px)); right:calc(var(--tg-safe-area-inset-right,0px) + var(--tg-content-safe-area-inset-right,0px)); width:auto; }
@media (min-width: 601px) and (min-height: 500px) { :root {--width:min(430px,calc(100dvh * 402 / 874));} }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after {animation-duration:.01ms !important;transition-duration:.01ms !important;scroll-behavior:auto !important;} }
