/* 댕그램 데모 (Mobile-first) */
:root{
  --app-max: 430px;
  --bg: #f6f7fb;
  --card: #ffffff;
  --card2:#f8fafc;
  --text: #0f172a;
  --muted:#64748b;
  --line:#e2e8f0;
  --accent:#6d5efc;
  --accent2:#0ea5e9;
  --danger:#ef4444;

  --topbar-h: 56px;
  --tabbar-h: 66px;
  --radius: 16px;

  --shadow: 0 14px 40px rgba(15,23,42,.12);
  --vh: 1vh;
}

*{ box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Apple SD Gothic Neo, Noto Sans KR, sans-serif;
  letter-spacing: -0.2px;
}


a{ color: inherit; text-decoration: none; }
button{ font: inherit; color: inherit; }
input{ font: inherit; color: inherit; background: transparent; border: none; outline: none; }

.app{
  width: min(100%, var(--app-max));
  margin: 0 auto;
  min-height: calc(var(--vh) * 100);
  position: relative;
}

.topbar{
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--app-max));
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 30;
  backdrop-filter: blur(14px);
  background: linear-gradient(to bottom, rgba(246,247,251,.72), rgba(246,247,251,.35));
  border-bottom: 1px solid rgba(226,232,240,.55);
}

.topbarTitle{
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.title{
  font-weight: 750;
  font-size: 15px;
  line-height: 1.1;
}
.subtitle{
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbarActions{
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.iconbtn{
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(226,232,240,.7);
  background: rgba(255,255,255,.55);
  border-radius: 12px;
  cursor: pointer;
}
.iconbtn svg{ width: 18px; height: 18px; }

.view{
  padding: calc(var(--topbar-h) + env(safe-area-inset-top) + 12px) 14px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}

.sectionTitle{
  font-weight: 760;
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 10px;
}

.row{
  display:flex;
  align-items:center;
}
.gap8{ gap:8px; }
.gap10{ gap:10px; }
.gap12{ gap:12px; }
.spaceBetween{ justify-content: space-between; }

.chipsRow{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 14px;
}
.chip{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  border: 1px solid rgba(226,232,240,.8);
}
.chip .k{
  font-size:12px;
  color: var(--muted);
}
.chip .v{
  font-size:12px;
  font-weight: 720;
}
.chip .miniBtn{
  width: 26px; height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(226,232,240,.9);
  background: rgba(248,250,252,.8);
  display:grid;
  place-items:center;
  cursor:pointer;
}
.miniBtn svg{ width: 14px; height: 14px; }

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(255,255,255,.72));
  border: 1px solid rgba(226,232,240,.85);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(15,23,42,.10);
}

.post{
  overflow: hidden;
  margin: 10px 0 14px;
}
.postHeader{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 12px 12px 10px;
}
.avatar{
  width: 34px; height: 34px;
  border-radius: 12px;
  display:grid;
  place-items:center;
  background: rgba(124,92,255,.18);
  border: 1px solid rgba(124,92,255,.35);
  flex: 0 0 auto;
}
.userMeta{ min-width: 0; }
.userLine{
  display:flex;
  align-items:center;
  gap: 8px;
  font-size: 13px;
  font-weight: 760;
}
.userLine .username{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.metaLine{
  font-size: 12px;
  color: var(--muted);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.badge{
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,77,90,.14);
  border: 1px solid rgba(255,77,90,.25);
  color: #ffd6d9;
  flex: 0 0 auto;
}
.flag{
  font-size: 14px;
  opacity: .95;
}

.postImage{
  /*
    .postImage is an <a> in the feed and a <div> in the detail view.
    <a> is inline by default, so height doesn't apply and absolute children may overlap
    the following content. Force block to prevent image/text overlap.
  */
  display: block;
  height: 320px;
  position: relative;
  background: linear-gradient(135deg, rgba(124,92,255,.18), rgba(53,208,255,.12));
  border-top: 1px solid rgba(226,232,240,.7);
  border-bottom: 1px solid rgba(226,232,240,.7);
  overflow:hidden;
}

.postImage .postPhoto{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.postImage.hasPhoto .ph{ display:none; }

.gridItem.hasPhoto{
  background-size: cover;
  background-position: center;
}
.postImage .ph{
  position:absolute;
  inset: 0;
  display:grid;
  place-items:center;
  font-size: 42px;
  opacity: .95;
}
.postImage .ph small{
  display:block;
  font-size: 12px;
  color: rgba(15,23,42,.78);
  margin-top: 10px;
  letter-spacing: .2px;
}
.postActions{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 10px 12px 12px;
  gap: 10px;
}
.actionsLeft{
  display:flex;
  gap: 8px;
}
.actionBtn{
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.66);
  display:flex;
  align-items:center;
  gap: 8px;
  cursor:pointer;
}
.actionBtn svg{ width: 16px; height: 16px; }
.actionBtn .t{ font-size: 12px; font-weight: 650; }
.actionBtn.likeOn{
  border-color: rgba(124,92,255,.6);
  background: rgba(124,92,255,.18);
}
.postCounts{
  font-size: 12px;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.postBody{
  padding: 0 12px 12px;
}
.postBody .caption{
  font-size: 13px;
  line-height: 1.45;
  color: rgba(15,23,42,.92);
}
.postBody .previewLink{
  margin-top: 8px;
  font-size: 12px;
  color: rgba(100,116,139,.95);
  text-decoration: underline;
  cursor: pointer;
  display:inline-block;
}

.tabbar{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(100%, var(--app-max));
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 10px 10px calc(env(safe-area-inset-bottom) + 10px);
  display:flex;
  justify-content: space-between;
  gap: 8px;
  z-index: 30;
  backdrop-filter: blur(16px);
  background: linear-gradient(to top, rgba(246,247,251,.76), rgba(246,247,251,.30));
  border-top: 1px solid rgba(226,232,240,.55);
}

.tab{
  flex: 1 1 0;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(226,232,240,.75);
  background: rgba(255,255,255,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  cursor:pointer;
  color: rgba(15,23,42,.78);
}
.tab svg{ width: 18px; height: 18px; }
.tab span{ font-size: 12px; font-weight: 650; }
.tab.active{
  color: rgba(15,23,42,.98);
  border-color: rgba(124,92,255,.55);
  background: rgba(124,92,255,.14);
}
.tabPrimary{
  border-color: rgba(53,208,255,.45);
  background: rgba(53,208,255,.12);
}
.tabPrimary .plus{
  width: 28px; height: 28px;
  border-radius: 12px;
  display:grid;
  place-items:center;
  font-weight: 900;
  background: rgba(53,208,255,.18);
  border: 1px solid rgba(53,208,255,.30);
}

.backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 40;
}
.hidden{ display:none !important; }

.sheet{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(100%, var(--app-max));
  max-height: calc(var(--vh) * 92);
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(226,232,240,.85);
  border-bottom: none;
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  z-index: 50;
  box-shadow: var(--shadow);
  overflow: hidden;
  display:flex;
  flex-direction: column;
}
.sheetHandle{
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(100,116,139,.35);
  margin: 10px auto 8px;
}
.sheetHeader{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 0 14px 10px;
  border-bottom: 1px solid rgba(226,232,240,.7);
}
.sheetTitle{
  font-weight: 780;
}
.sheetBody{
  padding: 12px 14px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
}
.sheetComposer{
  padding: 10px 12px calc(env(safe-area-inset-bottom) + 12px);
  border-top: 1px solid rgba(226,232,240,.7);
  display:flex;
  align-items:center;
  gap: 10px;
}
.composerAvatar{
  width: 30px; height: 30px;
  border-radius: 12px;
  display:grid;
  place-items:center;
  background: rgba(124,92,255,.16);
  border: 1px solid rgba(124,92,255,.28);
  flex: 0 0 auto;
}
.composerInput{
  flex: 1 1 auto;
  height: 40px;
  border-radius: 999px;
  padding: 0 14px;
  border: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.55);
  font-size: 13px;
}
.composerInput:disabled{
  opacity: .55;
}
.composerSend{
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.55);
  color: rgba(15,23,42,.78);
}
.composerSend:disabled{ opacity: .55; }
.composerSend:not(:disabled){
  border-color: rgba(124,92,255,.55);
  background: rgba(124,92,255,.18);
  color: rgba(15,23,42,.98);
  cursor: pointer;
}

.commentItem{
  display:flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(226,232,240,.55);
}
.commentBody{
  flex: 1 1 auto;
  min-width: 0;
}
.commentTop{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
}
.commentUser{
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.commentTime{
  font-size: 11px;
  color: var(--muted);
  flex: 0 0 auto;
}
.commentText{
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(15,23,42,.92);
  word-break: break-word;
}

.searchBox input{
  width: 100%;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.55);
  padding: 0 12px;
  font-size: 13px;
}
.searchResults{
  margin-top: 12px;
}
.resultRow{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,.65);
  background: rgba(248,250,252,.30);
  cursor:pointer;
  margin-bottom: 8px;
}
.resultRow:hover{
  background: rgba(248,250,252,.45);
}
.resultMeta{ min-width: 0; }
.resultName{ font-size: 13px; font-weight: 760; }
.resultSub{ font-size: 12px; color: var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.modal{
  position: fixed;
  inset: 0;
  display:grid;
  place-items:center;
  z-index: 60;
  background: rgba(0,0,0,.6);
}
.modalCard{
  width: min(92%, 380px);
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(226,232,240,.85);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px;
}
.modalTitle{
  font-weight: 820;
  margin-bottom: 10px;
}
.modalBody{
  display:flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 0 12px;
}
.adTimer{
  font-size: 42px;
  font-weight: 900;
  text-align: center;
  padding: 10px 0;
  border-radius: 16px;
  border: 1px solid rgba(226,232,240,.75);
  background: rgba(248,250,252,.55);
}
.modalActions{
  display:flex;
  gap: 10px;
}
.btnGhost, .btnPrimary{
  flex: 1 1 0;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.55);
  cursor:pointer;
}
.btnPrimary{
  border-color: rgba(124,92,255,.55);
  background: rgba(124,92,255,.18);
}
.btnPrimary:disabled{
  opacity: .55;
  cursor: not-allowed;
}

.gate{
  position: fixed;
  inset: 0;
  display:grid;
  place-items:center;
  z-index: 80;
  background: rgba(0,0,0,.70);
}
.gateCard{
  width: min(92%, 420px);
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(226,232,240,.85);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.gateTitle{ font-weight: 860; font-size: 16px; margin-bottom: 10px; }
.gateBody{ display:flex; flex-direction: column; gap: 12px; }
.field{ display:flex; flex-direction: column; gap: 8px; }
.field span{ font-size: 12px; color: var(--muted); }
.field input{
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.55);
  padding: 0 12px;
  font-size: 13px;
}
.hint{ font-size: 12px; color: rgba(100,116,139,.92); }

.muted{ color: var(--muted); font-size: 13px; line-height: 1.45; }

.toast{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px);
  width: min(92%, var(--app-max));
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(226,232,240,.85);
  background: rgba(255,255,255,.92);
  z-index: 90;
  box-shadow: var(--shadow);
  font-size: 13px;
}

/* Post detail */
.detailHero{
  overflow:hidden;
}
.detailMeta{
  padding: 12px 12px 10px;
  border-top: 1px solid rgba(226,232,240,.7);
}
.detailMeta .caption{
  font-size: 13px;
  line-height: 1.45;
}
.kv{
  display:flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.kv .pill{
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(226,232,240,.8);
  background: rgba(248,250,252,.40);
  color: rgba(15,23,42,.90);
}

/* Profile */
.profileHeader{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 14px;
}
.profileName{
  font-size: 14px;
  font-weight: 850;
}
.profileSub{
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.profileActions{
  margin-left: auto;
}
.followBtn{
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.55);
  cursor:pointer;
  font-size: 12px;
  font-weight: 760;
}
.followBtn.on{
  border-color: rgba(124,92,255,.55);
  background: rgba(124,92,255,.18);
}
.dogChips{
  display:flex;
  gap: 8px;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px 12px;
}
.dogChip{
  white-space: nowrap;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(226,232,240,.8);
  background: rgba(248,250,252,.40);
  cursor:pointer;
  font-size: 12px;
  color: rgba(15,23,42,.88);
}
.dogChip.active{
  border-color: rgba(53,208,255,.55);
  background: rgba(53,208,255,.12);
}
.dogInfo{
  margin: 0 14px 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.30);
}
.grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 0 14px 16px;
}
.gridItem{
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,.75);
  background: linear-gradient(135deg, rgba(124,92,255,.16), rgba(53,208,255,.10));
  display:grid;
  place-items:center;
  cursor:pointer;
}
.gridItem span{ font-size: 20px; }

/* Ranking */
.rankNote{
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.35);
  color: rgba(15,23,42,.90);
  font-size: 12px;
  line-height: 1.45;
}
.rankList{
  margin-top: 12px;
}
.rankRow{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 16px;
  border: 1px solid rgba(226,232,240,.65);
  background: rgba(248,250,252,.25);
  cursor:pointer;
  margin-bottom: 10px;
}
.rankIdx{
  width: 26px;
  text-align:center;
  font-weight: 900;
  color: rgba(15,23,42,.92);
}
.rankMeta{ min-width: 0; flex: 1 1 auto; }
.rankName{ font-weight: 860; font-size: 13px; }
.rankSub{ font-size: 12px; color: var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rankScore{ font-weight: 900; }

/* Upload */
.form{
  padding: 14px;
}
.form .field{ margin-bottom: 12px; }
.select{
  width: 100%;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.55);
  padding: 0 12px;
  font-size: 13px;
  color: rgba(15,23,42,.92);
}
.textarea{
  width: 100%;
  min-height: 88px;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.55);
  padding: 10px 12px;
  font-size: 13px;
  color: rgba(15,23,42,.92);
  resize: vertical;
}
.checkRow{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,.75);
  background: rgba(248,250,252,.30);
}
.checkRow .label{
  display:flex;
  flex-direction: column;
  gap: 2px;
}
.checkRow .label .t{ font-weight: 780; font-size: 13px; }
.checkRow .label .d{ font-size: 12px; color: var(--muted); }
.switch{
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.55);
  position: relative;
  cursor:pointer;
  flex: 0 0 auto;
}
.switch::after{
  content:"";
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255,255,255,.95);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: all .18s ease;
}
.switch.on{
  border-color: rgba(124,92,255,.55);
  background: rgba(124,92,255,.18);
}
.switch.on::after{
  left: 22px;
  background: rgba(255,255,255,.98);
}


/* When a sheet/modal is open, keep focus on it */
body.sheetOpen .tabbar{
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}
