
:root{
  --bg:#fafafa; --card:#fff; --line:#dbdbdb; --text:#111;
  --muted:#737373; --blue:#0095f6; --accent:#777; --max:470px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;background:#ececec;color:var(--text)}
body{font-family:-apple-system,BlinkMacSystemFont,"Pretendard","Apple SD Gothic Neo","Malgun Gothic",Arial,sans-serif;-webkit-font-smoothing:antialiased}
button,input{font:inherit}button{border:0;background:none;color:inherit;cursor:pointer;padding:0}
img{display:block;width:100%}
a{color:inherit;text-decoration:none}
.shell{max-width:var(--max);min-height:100dvh;margin:0 auto;background:var(--bg);position:relative;padding-bottom:66px;box-shadow:0 0 24px rgba(0,0,0,.08)}
.topbar{height:54px;position:sticky;top:0;z-index:30;background:rgba(255,255,255,.97);backdrop-filter:blur(12px);border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 14px}
.top-title{font-size:16px;font-weight:800;display:flex;align-items:center;gap:5px}
.top-actions{display:flex;gap:18px;font-size:23px;align-items:center}
.icon-btn{font-size:23px;line-height:1}
.profile{background:#fff;padding:18px 14px 10px}
.profile-top{display:grid;grid-template-columns:88px 1fr;gap:17px;align-items:center}
.avatar{width:86px;height:86px;border-radius:50%;padding:3px;background:linear-gradient(135deg,var(--accent),#ddd 72%);overflow:hidden}
.avatar-inner{width:80px;height:80px;border:3px solid #fff;border-radius:50%;background:linear-gradient(135deg,#222,#777);overflow:hidden;display:grid;place-items:center;color:white;font-weight:900;font-size:25px}
.avatar-inner img{height:100%;object-fit:cover}
.avatar-inner img.failed{display:none}
.stats{display:grid;grid-template-columns:repeat(3,1fr);text-align:center}
.stat strong{display:block;font-size:16px}.stat span{font-size:12px;color:#333}
.bio{margin-top:13px;font-size:13.5px;line-height:1.45;white-space:pre-line}
.bio .name{font-weight:800}.category{color:var(--muted);font-size:12px;margin:2px 0 3px}
.actions{display:grid;grid-template-columns:1fr 1fr 40px;gap:7px;margin-top:12px}
.actions button{height:34px;border-radius:8px;background:#efefef;font-size:13px;font-weight:800}
.actions .follow{background:var(--blue);color:#fff}.actions .follow.following{background:#efefef;color:#111}
.highlights{display:flex;gap:15px;overflow-x:auto;padding:14px 14px 11px;background:#fff;scrollbar-width:none}
.highlights::-webkit-scrollbar{display:none}
.highlight{width:68px;flex:0 0 auto;text-align:center}
.h-ring{width:62px;height:62px;border-radius:50%;border:1px solid #ccc;padding:3px;margin:auto;background:#fff}
.h-img{height:54px;border-radius:50%;overflow:hidden;background:linear-gradient(135deg,#222,var(--accent));display:grid;place-items:center;color:#fff;font-size:10px;font-weight:900}
.h-img img{height:100%;object-fit:cover}.h-img img.failed{display:none}
.h-name{font-size:11px;margin-top:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tabs{height:46px;background:#fff;border-top:1px solid var(--line);border-bottom:1px solid var(--line);display:grid;grid-template-columns:repeat(3,1fr)}
.tab{display:grid;place-items:center;color:#999;font-size:21px}.tab.active{color:#111;border-bottom:1px solid #111}
.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:2px;background:#fff}
.tile{aspect-ratio:1/1;position:relative;overflow:hidden;background:linear-gradient(135deg,#242424,var(--accent))}
.tile img{height:100%;object-fit:cover;position:relative;z-index:2}
.tile img.failed{display:none}
.tile-label{position:absolute;inset:0;display:grid;place-items:center;text-align:center;color:#fff;font-size:12px;font-weight:900;letter-spacing:.05em;padding:10px;z-index:1;background:linear-gradient(145deg,rgba(255,255,255,.05),rgba(0,0,0,.45))}
.bottom-nav{position:fixed;bottom:0;left:50%;transform:translateX(-50%);max-width:var(--max);width:100%;height:58px;background:rgba(255,255,255,.98);backdrop-filter:blur(10px);border-top:1px solid var(--line);display:flex;align-items:center;justify-content:space-around;z-index:31;font-size:24px}
.bottom-avatar{width:26px;height:26px;border-radius:50%;background:linear-gradient(135deg,#222,var(--accent))}
.modal{position:fixed;inset:0;background:rgba(0,0,0,.72);z-index:60;display:none;align-items:flex-end;justify-content:center}
.modal.open{display:flex}
.modal-card{width:100%;max-width:var(--max);max-height:92dvh;background:#fff;border-radius:15px 15px 0 0;overflow:auto}
.modal-head{height:54px;display:flex;align-items:center;justify-content:space-between;padding:0 14px;border-bottom:1px solid var(--line);position:sticky;top:0;background:#fff;z-index:2}
.modal-user{display:flex;align-items:center;gap:9px;font-size:13px;font-weight:800}
.modal-avatar{width:32px;height:32px;border-radius:50%;background:linear-gradient(135deg,#222,var(--accent))}
.modal-media{width:100%;aspect-ratio:1/1;position:relative;background:linear-gradient(135deg,#222,var(--accent));overflow:hidden}
.modal-media img{height:100%;object-fit:cover;position:relative;z-index:2}
.modal-media img.failed{display:none}
.modal-fallback{position:absolute;inset:0;display:grid;place-items:center;color:#fff;font-size:25px;font-weight:900;text-align:center;padding:25px;z-index:1}
.modal-actions{display:flex;justify-content:space-between;padding:11px 14px 5px;font-size:25px}
.modal-left{display:flex;gap:17px}.like.on{color:#ed4956}
.modal-body{padding:0 14px 14px;font-size:14px;line-height:1.45}
.modal-likes{font-weight:800;margin:3px 0 8px}.modal-caption b{font-weight:850}
.comments{display:flex;flex-direction:column;gap:6px;margin-top:8px}.comment b{font-weight:850}
.date{font-size:11px;color:var(--muted);margin-top:9px}
.comment-form{display:flex;align-items:center;gap:8px;border-top:1px solid #eee;padding:10px 14px;position:sticky;bottom:0;background:#fff}
.comment-form input{flex:1;border:0;outline:0;font-size:14px}.comment-form button{color:var(--blue);font-weight:800;font-size:13px}
.notice{padding:8px 12px;background:#111;color:#ddd;font-size:10.5px;line-height:1.4}
.toast{position:fixed;bottom:74px;left:50%;transform:translateX(-50%) translateY(15px);background:rgba(0,0,0,.83);color:#fff;border-radius:999px;padding:10px 15px;font-size:12px;opacity:0;transition:.2s;z-index:90;pointer-events:none}.toast.show{opacity:1;transform:translateX(-50%)}
.hub{max-width:720px;margin:30px auto;padding:20px;font-family:inherit}.hub h1{margin-bottom:5px}.hub p{color:#666}.hub-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:12px}.hub-card{display:block;background:#fff;border:1px solid #ddd;border-radius:14px;padding:18px}.hub-card strong{display:block;font-size:18px}.hub-card span{font-size:13px;color:#777}
@media(max-width:500px){html,body{background:var(--bg)}.shell{box-shadow:none}}

/* 이미지가 로딩되면 대체 이니셜/문구가 겹치지 않도록 분리 */
.avatar-inner,.h-img{position:relative}
.avatar-photo,.h-photo{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:2}
.avatar-fallback,.h-fallback{position:absolute;inset:0;display:grid;place-items:center;z-index:1}


/* ===== Black theme override ===== */
:root{
  --bg:#000;
  --card:#000;
  --line:#26262a;
  --text:#f5f5f5;
  --muted:#9b9ba1;
}
html,body{background:#090909!important;color:var(--text)!important}
.shell{background:#000!important;box-shadow:0 0 28px rgba(0,0,0,.55)!important}
.topbar{background:rgba(0,0,0,.97)!important;border-bottom-color:var(--line)!important}
.profile{background:#000!important}
.avatar-inner{border-color:#000!important}
.stat span{color:#d8d8dc!important}
.actions button{background:#27272a!important;color:#fff!important}
.actions .follow{background:var(--blue)!important;color:#fff!important}
.actions .follow.following{background:#27272a!important;color:#fff!important}
.highlights{background:#000!important}
.h-ring{background:#000!important;border-color:#444!important}
.tabs{background:#000!important;border-top-color:var(--line)!important;border-bottom-color:var(--line)!important}
.tab{color:#777!important}
.tab.active{color:#fff!important;border-bottom-color:#fff!important}
.grid{background:#000!important}
.bottom-nav{background:rgba(0,0,0,.97)!important;border-top-color:var(--line)!important}
.modal-card{background:#000!important;border:1px solid #29292d!important;border-bottom:0!important}
.modal-head{background:#000!important;border-bottom-color:var(--line)!important}
.comment-form{background:#000!important;border-top-color:#242424!important}
.comment-form input{background:#000!important;color:#fff!important}
.comment-form input::placeholder{color:#777!important}
.notice{background:#101010!important;color:#aaa!important;border-bottom:1px solid #252525!important}
.toast{background:#f5f5f5!important;color:#111!important}
.hub-card{background:#111!important;border-color:#2a2a2a!important;color:#fff!important}
.hub p,.hub-card span{color:#999!important}


/* 댓글 입력창 모바일/자동완성 블랙 테마 보정 */
.comment-form,
.comment-form input{
  background:#000!important;
}
.comment-form input{
  color:#fff!important;
  caret-color:#fff!important;
  box-shadow:none!important;
  -webkit-appearance:none;
  appearance:none;
}
.comment-form input::placeholder{
  color:#777!important;
  opacity:1;
}
.comment-form input:-webkit-autofill,
.comment-form input:-webkit-autofill:hover,
.comment-form input:-webkit-autofill:focus{
  -webkit-text-fill-color:#fff!important;
  -webkit-box-shadow:0 0 0 1000px #000 inset!important;
  box-shadow:0 0 0 1000px #000 inset!important;
  caret-color:#fff!important;
}


/* 좌우 여백·스크롤 영역·브라우저 스크롤바 블랙 테마 보정 */
:root{
  background:#000!important;
  color-scheme:dark;
}
html{
  min-height:100%;
  background:#000!important;
  overscroll-behavior:none;
  scrollbar-color:#4a4a4a #000;
  scrollbar-width:thin;
}
body{
  width:100%;
  min-height:100vh;
  background:#000!important;
  overflow-x:hidden;
  overscroll-behavior:none;
}
.shell{
  width:100%!important;
  background:#000!important;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.shell::-webkit-scrollbar,
.highlights::-webkit-scrollbar,
.modal-card::-webkit-scrollbar{
  background:#000!important;
}
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.shell::-webkit-scrollbar-track,
.highlights::-webkit-scrollbar-track,
.modal-card::-webkit-scrollbar-track{
  background:#000!important;
}
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.shell::-webkit-scrollbar-thumb,
.highlights::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb{
  background:#4a4a4a!important;
  border-radius:999px;
  border:2px solid #000;
}
.highlights,
.modal-card{
  scrollbar-color:#4a4a4a #000;
}


/* ===== 비밀 계정 발견 및 잠금 UI ===== */
.modal-caption{white-space:pre-line}
.secret-hidden{display:none!important}
.secret-recommendation{
  margin:10px 12px 2px;
  padding:11px;
  border:1px solid #5f1e24;
  border-radius:13px;
  background:linear-gradient(135deg,#171012,#090909);
  box-shadow:0 0 24px rgba(170,20,32,.12);
}
.secret-reco-label{
  display:flex;
  align-items:center;
  gap:7px;
  margin:0 2px 8px;
  color:#b7b7bc;
  font-size:11px;
}
.secret-reco-label span{
  padding:2px 6px;
  border-radius:999px;
  background:#aa1d28;
  color:#fff;
  font-size:9px;
  font-weight:900;
}
.secret-reco-link{
  display:flex;
  align-items:center;
  gap:11px;
}
.secret-reco-avatar{
  position:relative;
  flex:0 0 auto;
  width:46px;
  height:46px;
  overflow:hidden;
  border-radius:50%;
  border:1px solid #7d2a31;
  background:#19191c;
}
.secret-reco-photo,
.secret-reco-fallback{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
}
.secret-reco-photo{
  z-index:2;
  object-fit:cover;
}
.secret-reco-fallback{
  z-index:1;
  display:grid;
  place-items:center;
  color:#fff;
  font-weight:900;
}
.secret-reco-copy{
  min-width:0;
  flex:1;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.secret-reco-copy strong{
  overflow:hidden;
  color:#fff;
  font-size:13px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.secret-reco-copy small{
  overflow:hidden;
  color:#929298;
  font-size:11px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.secret-reco-action{
  color:#ff4655;
  font-size:12px;
}
.private-lock{
  min-height:270px;
  padding:45px 30px;
  border-top:1px solid #242428;
  border-bottom:1px solid #242428;
  background:#000;
  text-align:center;
}
.private-lock-icon{
  margin-bottom:15px;
  color:#eee;
  font-size:48px;
}
.private-lock h2{
  margin:0 0 9px;
  color:#f5f5f5;
  font-size:17px;
}
.private-lock p{
  max-width:320px;
  margin:0 auto;
  color:#929298;
  font-size:13px;
  line-height:1.55;
}
.hidden-account{
  min-height:520px;
  padding:110px 28px 80px;
  background:#000;
  text-align:center;
}
.hidden-account-icon{
  margin-bottom:18px;
  color:#7f7f85;
  font-size:58px;
}
.hidden-account h2{
  margin:0 0 10px;
  color:#f5f5f5;
  font-size:19px;
}
.hidden-account p{
  margin:0 auto 24px;
  color:#929298;
  font-size:13px;
}
.hidden-account button{
  padding:10px 15px;
  border-radius:9px;
  background:#29292d;
  color:#fff;
  font-size:13px;
  font-weight:800;
}


/* ===== 확장 이머시브 루트 UI ===== */
.profile-recommendations{display:none;padding:0 0 4px;background:#000}
.profile-recommendations.show{display:block}
.profile-recommendations .secret-recommendation{margin-top:10px}
.post-discovery-action{
  margin:12px 0 4px;
  padding:9px 11px;
  border:1px solid #39393f!important;
  border-radius:8px;
  background:#171719!important;
  color:#f2f2f4!important;
  font-size:12px!important;
  font-weight:800!important;
}
.date-unlock{
  color:#9d9da3!important;
  text-decoration:underline dotted;
  text-underline-offset:4px;
}
.profile-empty{
  min-height:260px;
  padding:54px 28px;
  border-top:1px solid #252529;
  text-align:center;
}
.profile-empty-icon{font-size:48px;color:#6f6f75}
.profile-empty h2{font-size:17px;margin:13px 0 8px}
.profile-empty p{font-size:13px;color:#929298;line-height:1.55}


/* ===== 게시물 상세 UI·인앱 브라우저 편의성 개선 ===== */
body.post-modal-open{overflow:hidden!important;touch-action:none}
.profile-back-btn{
  width:44px;height:44px;margin-left:-10px;display:grid;place-items:center;
  font-size:34px!important;font-weight:300;line-height:1;border-radius:50%;
  -webkit-tap-highlight-color:transparent;
}
.profile-back-btn:active,.modal-back-btn:active,.modal-close-btn:active{background:#202024!important;transform:scale(.96)}
.modal{padding-top:max(10px,env(safe-area-inset-top));cursor:pointer}
.modal-card{position:relative;cursor:default;transition:transform .18s ease,opacity .18s ease;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.modal-drag-handle{display:none;width:42px;height:5px;margin:8px auto 1px;border-radius:999px;background:#54545a}
.modal-head{
  display:grid!important;grid-template-columns:48px minmax(0,1fr) 48px!important;
  padding:0 4px!important;height:56px!important;
}
.modal-user{justify-self:center;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.modal-back-btn,.modal-close-btn{
  width:44px;height:44px;display:grid;place-items:center;border-radius:50%;
  color:#fff;background:transparent;-webkit-tap-highlight-color:transparent;
}
.modal-back-btn{justify-self:start;font-size:36px;font-weight:300;line-height:1}
.modal-close-btn{justify-self:end;font-size:27px;font-weight:300;line-height:1}
@media(max-width:500px){
  .modal{align-items:flex-end;background:rgba(0,0,0,.60)}
  .modal-card{max-height:94dvh;border-radius:18px 18px 0 0!important}
  .modal-drag-handle{display:block}
  .modal-head{top:0}
}
@media(min-width:501px){
  .modal{align-items:center;padding:24px}
  .modal-card{border-radius:16px!important;max-height:92dvh}
}

/* 2026-08 웹 이머시브 탐색 강화 */
.phase-profile-badge{
  display:inline-flex;align-items:center;justify-content:center;
  margin-left:6px;padding:2px 6px;border-radius:999px;
  background:#b7ff00;color:#0b0b0b;font-size:9px;font-weight:900;
  line-height:1.35;vertical-align:2px;letter-spacing:.04em;
}
.secret-recommendation{position:relative;overflow:hidden}
.secret-recommendation::after{
  content:"";position:absolute;right:-28px;top:-32px;width:72px;height:72px;
  border-radius:50%;background:radial-gradient(circle,rgba(183,255,0,.12),transparent 68%);pointer-events:none;
}
.hidden-account-icon .iniesta-icon,.private-lock-icon .iniesta-icon,.profile-empty-icon .iniesta-icon{width:34px;height:34px}
