/* 앱 틀: 상단 캡슐, 하단 독, 메뉴 서랍, PC 사이드바, 시트, 알림 토스트, 대화상자 */
#app { min-height: 100%; }
.layout { min-height: 100dvh; display: flex; }
.main { flex: 1; min-width: 0; position: relative; }
.view { padding: 0 0 calc(110px + var(--safe-b)); }

/* 상단 캡슐 (모든 화면 같은 자리, 왼쪽 정렬) */
.topcap { position: sticky; top: 0; z-index: 30; padding: calc(10px + var(--safe-t)) 16px 0; display: flex; pointer-events: none; }
.topcap nav { pointer-events: auto; height: 56px; border-radius: 28px; display: flex; align-items: center; gap: 2px; padding: 0 6px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.topcap .sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; }
.avatar { width: 32px; height: 32px; border-radius: 16px; background: radial-gradient(circle at 35% 30%, #FFD3B0, #E07A5F 60%, #8E4A6B); box-shadow: 0 0 0 2px rgba(255,255,255,.16);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex: none; }
.avatar.l { width: 42px; height: 42px; border-radius: 21px; font-size: 15px; box-shadow: none; }
.badge-dot { position: absolute; top: 11px; right: 12px; width: 7px; height: 7px; border-radius: 4px; background: var(--accent); box-shadow: 0 0 0 2px #1A1820; }

/* 하단 독 */
.dock { position: fixed; left: 16px; right: 16px; bottom: calc(18px + var(--safe-b)); z-index: 30; height: 64px; border-radius: 32px; background: var(--glass-strong);
  display: flex; align-items: center; gap: 22px; padding: 0 6px 0 24px; box-shadow: 0 10px 30px rgba(0,0,0,.35); max-width: 520px; margin: 0 auto; }
.dock .tab { font-size: 15px; font-weight: 600; color: #8F8B96; letter-spacing: -.02em; position: relative; white-space: nowrap; }
.dock .tab.on { color: #fff; font-weight: 700; }
.dock .tab.on::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 4px; height: 4px; margin-left: -2px; border-radius: 2px; background: var(--accent); }
.dock .plus { margin-left: auto; width: 52px; height: 52px; border-radius: 26px; background: var(--text); color: #141317; display: flex; align-items: center; justify-content: center; flex: none; }
@media (max-width: 360px) { .dock { gap: 16px; padding-left: 18px; } .dock .tab { font-size: 14px; } }

/* 메뉴 (모바일 서랍 · PC 사이드바 공용) */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 41; width: min(318px, 86vw); background: var(--menu); border: 1px solid var(--line); border-left: 0; border-radius: 0 30px 30px 0;
  padding: calc(14px + var(--safe-t)) 14px calc(14px + var(--safe-b)); display: flex; flex-direction: column; box-shadow: 12px 0 50px rgba(0,0,0,.45);
  transform: translateX(-104%); transition: transform .26s cubic-bezier(.2,.8,.2,1); }
.drawer.open { transform: none; }
.drawer .head { display: flex; align-items: center; gap: 10px; padding: 0 4px 0 8px; flex: none; }
.logo { width: 30px; height: 30px; border-radius: 10px; background: linear-gradient(140deg, #FFB37A, #E5577A); flex: none; }
.brand { flex: 1; font-size: 16px; font-weight: 700; color: var(--text); }
.profile-card { flex: none; margin: 14px 4px 0; padding: 14px; border-radius: 18px; background: var(--fill); border: 1px solid var(--fill-2); display: flex; flex-direction: column; gap: 12px; text-align: left; }
.profile-card .who { display: flex; align-items: center; gap: 12px; }
.profile-card .nm { font-size: 16px; font-weight: 700; color: var(--text-2); letter-spacing: -.02em; display: block; }
.profile-card .em { font-size: 12.5px; font-weight: 500; color: var(--muted-2); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.trialbar { display: flex; flex-direction: column; gap: 8px; }
.trialbar .tx { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--text-3); }
.trialbar .tx em { font-style: normal; color: var(--accent); }
.trialbar .tx span:last-child { color: #A9A29A; font-weight: 500; }
.trialbar .bar { height: 3px; border-radius: 2px; background: var(--line-2); }
.trialbar .bar i { display: block; height: 3px; border-radius: 2px; background: var(--accent); }
.search { flex: none; margin: 12px 4px 4px; height: 48px; border-radius: 16px; background: var(--fill); border: 1px solid var(--fill-2); display: flex; align-items: center; gap: 10px; padding: 0 16px; color: var(--muted-2); }
.search input { border: 0; background: none; color: var(--text-2); width: 100%; outline: none; }
.search input::placeholder { color: var(--muted-2); }
.nav { display: flex; flex-direction: column; margin-top: 6px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.m { flex: none; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid transparent; color: var(--text-3); font-size: 15px; font-weight: 500; text-align: left; width: 100%; }
.m svg { color: var(--muted-2); }
.m:hover { background: var(--fill); }
.m.on { background: rgba(255,255,255,.07); border-color: var(--fill-2); font-weight: 600; color: #fff; }
.m.on svg { color: #fff; }
.m .c { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.m.dim { color: var(--muted-2); }
.nav .h { font-size: 11px; font-weight: 600; color: var(--faint); letter-spacing: .1em; padding: 14px 12px 4px; display: flex; align-items: center; justify-content: space-between; }
.nav .h button { color: var(--faint); width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }
.drawer .foot { flex: none; margin-top: auto; display: flex; gap: 4px; border-top: 1px solid var(--line); padding: 8px 4px 0; }
.drawer .foot .m { flex: 1; font-size: 14px; }

/* PC: 왼쪽 사이드바, 오른쪽 위 알림만 */
@media (min-width: 900px) {
  .drawer { position: sticky; top: 0; height: 100dvh; transform: none; width: 268px; border-radius: 0; border: 0; border-right: 1px solid rgba(255,255,255,.06);
    background: rgba(12,12,16,.30); box-shadow: none; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); padding-top: 26px; flex: none; }
  .drawer .close, .scrim, .topcap, .dock { display: none !important; }
  .drawer .profile-card { order: 10; margin-top: 10px; }
  .drawer .foot { order: 9; border-top: 0; }
  .pc-top { display: flex !important; position: sticky; top: 0; z-index: 30; justify-content: flex-end; gap: 10px; padding: 26px 32px 0; pointer-events: none; }
  .pc-top > * { pointer-events: auto; }
  .view { padding-bottom: 64px; }
  .pc-new { display: inline-flex !important; }
}
.pc-top, .pc-new { display: none; }

/* 아래에서 올라오는 시트 */
.sheet-scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.5); opacity: 0; transition: opacity .2s; }
.sheet-scrim.open { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 92dvh; background: var(--sheet); border: 1px solid rgba(255,255,255,.08); border-bottom: 0;
  border-radius: 32px 32px 0 0; padding: 10px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; box-shadow: 0 -12px 40px rgba(0,0,0,.4);
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1); max-width: 640px; margin: 0 auto; }
.sheet.open { transform: none; }
.sheet .grip { align-self: center; width: 38px; height: 5px; border-radius: 3px; background: #3A3842; flex: none; }
.sheet .body { overflow-y: auto; margin: 0 -20px; padding: 0 20px; }
.sheet h2 { margin: 14px 0 0; font-size: 24px; font-weight: 800; color: var(--text-2); letter-spacing: -.04em; }
@media (min-width: 900px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 520px; max-height: 84dvh; border-radius: 28px; border-bottom: 1px solid rgba(255,255,255,.08); padding-bottom: 24px;
    transform: translate(-50%, -46%); opacity: 0; transition: transform .22s, opacity .22s; }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; }
  .sheet .grip { display: none; }
}

/* 토스트 */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(96px + var(--safe-b)); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 480px; display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 16px; background: #26252C; border: 1px solid var(--line-2);
  color: var(--text-2); font-size: 15px; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.4); animation: rise .2s ease-out; }
.toast.bad { border-color: rgba(255,107,107,.4); }
.toast button { color: var(--accent); font-weight: 700; white-space: nowrap; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
@media (min-width: 900px) { .toasts { bottom: 28px; } }

/* 대화상자 */
dialog.dlg { border: 1px solid var(--line-2); border-radius: 24px; background: var(--sheet); color: var(--text-3); padding: 24px; width: min(400px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
dialog.dlg::backdrop { background: rgba(0,0,0,.55); }
dialog.dlg h3 { margin: 0 0 8px; font-size: 19px; font-weight: 800; color: var(--text-2); letter-spacing: -.03em; }
dialog.dlg p { margin: 0 0 20px; font-size: 15px; color: var(--muted); }
dialog.dlg .row { display: flex; gap: 8px; justify-content: flex-end; }
dialog.dlg .btn { height: 44px; }

/* 처음 띄울 때 */
#boot { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: #16181C; transition: opacity .3s; }
#boot.gone { opacity: 0; pointer-events: none; }
#boot .logo { width: 44px; height: 44px; border-radius: 14px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; transform: scale(.94); } }
.netbar { position: fixed; top: 0; left: 0; right: 0; z-index: 70; text-align: center; font-size: 12px; font-weight: 700; padding: calc(4px + var(--safe-t)) 0 4px; background: #3A2E20; color: #FFD9A0; }
.pc-top[hidden], .dock[hidden], .topcap[hidden] { display: none !important; }
/* 다른 언어의 긴 탭 이름: 간격을 줄이고, 그래도 넘치면 말줄임 */
.dock { gap: clamp(12px, 4.5vw, 22px); }
.dock .tab { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dock .tab { font-size: clamp(13px, 3.7vw, 15px); }
:root:not(:lang(ko)) .dock { gap: clamp(10px, 3.6vw, 20px); padding-left: 20px; }
